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.
unsigned char state=0;
unsigned char p=0;
unsigned char c,s;
else if(COM=='2') c=5;
else if(COM=='3') c=6;
else if(COM=='4') c=7;
else if (COM=='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