Go Down

Topic: Use the android phone to control the relay shield for appliances switch (Read 4770 times) previous topic - next topic


We release a ITEAD BT Debugging Assistant software on android, and you can use it to build some home automation prototyping.Use the relay you can switch many appliances easily, so here we show you a simple demo that how to use your android cell phone to control the relay by Arduino via Bluetooth.

We have am Arduino multi-channel relay/switch shield with 2 mechanical relays and 2 MOS switch. Using the 12V power for Arduino, the MOS switch channel can drive the fan by this DC 12V power supply. So we will use the cell phone to control the Arduino, turn on and turn of the fan. It's the same as using the mechanical relay channel to control a fan with external 220/110V AC power supply.

We make a simple controlling protocol, every command includes 3 byte, the first byte is command header, if Arduino receive a character 'C' it means channel control. This command will go with 2 more byte parameter - channel number and channel status, channel can be 1-3 (1 and 2 is the relay channel, 3 and 4 is MOS switch channel),  status can be 0 or 1 (0 means turn off, 1 means turn on). So a simple command for Arduino to turn on the channel 4 is "C41" , turn off channel 1 is "C10".

Plug the BTBee on the IS shield, and plug the shield on Arduino board. Connect the 12V DC fan with Channel 4. Down load this simple demo code into the Arduino - just very simple demo so it without verify code in this project.

Code: [Select]
unsigned char state=0;
unsigned char p=0;
char COM[3];
unsigned char c,s;

void setup()

void loop()
 case 0:

 case 1:
   if(p==3) state=2;

 case 2:
   if(COM[1]=='1') c=4;
   else if(COM[1]=='2') c=5;
   else if(COM[1]=='3') c=6;
   else if(COM[1]=='4') c=7;

   if(COM[2]=='0') s=0;
   else if (COM[2]=='1') s=1;

Open the ITEAD BT Debugging Assistant, connect the BTBee and enter the monitor window (more information about how to use this software you can click here) , type the controlling command in input box, if we need to turn on the fan, write "C41" and press the "Send", you can see the "OK" reply from Arduino, and the fan start rotating. If you send the "C40" and get the "OK" reply, you will see the fan slowdown and stop.

More information here: http://iteadstudio.com/application-note/use-android-phone-to-control-arduino-relay-shield


still an interesting combination... wished that  there were more hours in a day  :)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Now we have finished another small demo, using the Android cell phone with ITEAD BT Debugging assistant to control the DC motor by MotoMama shield. MotoMama is base on L298N and with a XBee interface, so plug the BTBee on it, we can use the software to send the command with speed Parameter -255- +255 to control the speed, also the Direction of rotation.

Go Up