Pages: [1]   Go Down
Author Topic: arduino- bluetooth - relay  (Read 1094 times)
0 Members and 1 Guest are viewing this topic.
Belgium
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I would like to control my outputs with my android phone. @ this moment im building my own relay shield + an option for bluetooth module. The only big problem I have no knowledge about how to creat a code to get it work. Im new to arduino so i hope there is someone that can help me out.




The way how im going to connect the bluetooth module





Many thank,
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you need to create your own 'protocol'

data will be send as a never ending byte array (stream) so you need to be able to find a beginning of a 'command' and it's end.
for example if you want to send two bytes, you can make third byte 0x00 as a 'stop byte' if you are sure, that data bytes have no 0 value.
more sophisticated protocols could look like this:
two bytes - unique signature
two bytes - length of a datablock
byte[] - data

if you want to steer a relay, so you dont want to send data whole the time, you can make 'commads'
for example
one byte - unique signature
one byte - command
one byte  - data

so the command would look like this: 
0xff 0x01 0x00  - means disable device 1 (your relay)
0xff 0x01 0x01  - means enable device 1 (your relay)
0xff 0x02 0x01  - means enable device 2 (next relay)
« Last Edit: January 21, 2012, 08:58:34 am by razorjack » Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 158
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No needto create special protocol. You can use StandardFirmata sketch (Firmata protocol) and ArduinoCommander android application - https://market.android.com/details?id=name.antonsmirnov.android.arduinocommander
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46029
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@4ntoine - Enough with the spamming. Once or twice is fine. You don't need to post this stuff in EVERY thread that mentions Android!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@4ntoine Too much noise about the app, but i must confess that it's cool  smiley-razz
Logged

Pages: [1]   Go Up
Jump to: