0

I am trying to build a home automation -thing- system for Arduino via Bluetooth on an android device , and have several devices and sensors that are sending data and other receiving (photo-resistor,temp and humidity from the arduino to the phone , accelerometer from the android phone to the arduino) and other simple stuff like controlling a led strip from the phone,servos,etc

I want to know if its possible to send/receive all this data on the serial communication without causing any issues?

  • I am new to microcontrollers so I am not sure if this can be even done ..? –  Aug 03 '15 at 22:50

1 Answers1

0

Yeah that's entirely possible. I've already created some apps which did the same. However it's a huge process. This is the recipe I used to create e.g an Bluetooth oscilloscope with an XMC4500 µC, but its similar with arduino.

1) Hardware Requirements Connect the serial port (µC) with a bluetooth transceiver (e.g. BTM-222). Configure your serial interface to communicate with that transceiver (baud rate, parity, start/stop bits) and configure your transceiver module accordingly.

2) Configure bluetooth on your app There is a good explaination on how to this on developer.android.com . I suggest you configure your app as a client and µC side as the server.

3) Define a communication protocol Android communicates in Java, µC in C/Assembler. Define byte codes for each interaction e.g. The first byte is the command you want to perform:

GET TEMPERATURE DATA : 0x00

GET HUMIDITY DATA : 0x01

........

µC: program the receive interrupt to send the requested value (using a simple state machine)

Android : send the command and wait for the answer if there is one.

4) Test & Debug, Test & Debug, Test & Debug ......

I had no problems sending data with a baudrate of 115200.

I hope this is a little help

chrizz42
  • 122
  • 1
  • 1
  • 7