2015년 8월 17일 월요일

[IoT] Bluetooth AC Control Android app with Delphi XE8 and Arduino

Bluetooth 220v AC control Android app with Delphi XE8 and Arduino

> Function
  • Arduino Bluetooth(HC-06) and relay(KY-019) to control the appliances connected to 220V.
  • On/Off and Interval time can be assigned easily.
  • Before run the app, activate the Bluetooth pairing the smart-phone and  HC-06 bluetooth module.
  • Please note that a short circuit or electric shock when connecting the KY-019 relay.



Android app download at Google play


Arduino connected parts


For HC-06 Bluetooth setup, see the below.



LiquidCrystal circuit ref.


Delphi XE8 full source download



Demo MOV


댓글 6개:

  1. hey man this is wonderfull, but can you learn me how recive information fron bluetooth on arduino? thanks

    답글삭제
  2. Super Cool! Delphi is an Assassin Software!

    답글삭제
  3. how receive serial data from bluetooth?

    답글삭제
  4. Thanks for sharing the useful blog about Bluetooth AC Control Android App.

    Android App Development in Coimbatore

    답글삭제
  5. Hey , very nice code , a little upgrade: if you want to recieve any data to android , just , add this to BTConfig.pas

    function TBTMethod.RecieveData( nPair:integer; sData:string ) : string;
    var
    LDevice: TBluetoothDevice;
    begin
    result:='';
    if ManagerConnected then
    try
    if (FSocket = nil) or ( ItemIndex <> nPair ) then
    begin
    if nPair > -1 then
    begin
    LDevice := FPairedDevices[ nPair ] as TBluetoothDevice;
    FSocket := LDevice.CreateClientSocket( StringToGUID( FServiceGUID ), False);
    if FSocket <> nil then
    begin
    ItemIndex := nPair;
    FSocket.Connect;
    sData := TEncoding.UTF8.Getstring(FSocket.ReceiveData);
    result := sData;
    end
    else
    ShowMessage('Out of time -15s-');
    end
    else
    ShowMessage('No paired device selected');
    end

    else
    begin
    sData := TEncoding.UTF8.Getstring(fsocket.ReceiveData);
    result := sData;
    end;

    except
    on E : Exception do
    begin
    ShowMessage(E.Message);
    FreeAndNil(FSocket);
    end;
    end;
    end;

    답글삭제
  6. usage in main form example : label1.Text:=btmethod.RecieveData(TargetPaireNo,'');

    of course do not forget to declare function in BTConfig.pas : function RecieveData( nPair:integer; sData: string) : string; at the begining...

    답글삭제