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.
Arduino connected parts
For HC-06 Bluetooth setup, see the below.
LiquidCrystal circuit ref.
http://c2design5sh.blogspot.kr/2015/08/iot-arduino-with-delphi-xe8.html
Arduino Source code download
Arduino Source code download
Delphi XE8 full source download
hey man this is wonderfull, but can you learn me how recive information fron bluetooth on arduino? thanks
답글삭제Super Cool! Delphi is an Assassin Software!
답글삭제how receive serial data from bluetooth?
답글삭제Thanks for sharing the useful blog about Bluetooth AC Control Android App.
답글삭제Android App Development in Coimbatore
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;
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...