Juan Ranera
Fab Academy 2013 Participant
Networking and communications
The assignment for this week was to build a wired &/or wireless network with at least two nodes.
There are a lot of kind of communications but at this moment I am especially interested in the communication wireless by
bluetooth.
Some time ago I wanted to do a simple Android application to move everything.
One of the challenges of my final project is to move a platform driven by motors with the mobile
so this week has been a big oportunity for me to began with this task.
![](images/week14/Barduino-with-bluetooth-module.png)
Another objective that I wanted to do was to define what kind of main board I will use in my final project, to control the motors. So I decided to test the Barduino board, recently improved by Luciano. Is a small board with the same Arduino Uno microcontroller, Atmega328P.
Arduino UNO vs Barduino:
![](images/week14/Arduino-vs-Barduino.png)
This time I have installed a version of iteadstudio application for my mobile. It is a simple application that works very well for testing bluetooth devices.
I started to make my application to control the platform of my final project. I established communication with the board but I still have yet to solve a lot of errors :(
This is the code to test the comunnication with my board. When the board receive data, the data are displayed on the screen. If the data sent is a "1" (symbol) through mobile, the board receive a 49 decimal and the green led turns ON. When you send a "2" (symbol) green led turns OFF.
Code:
//---------------------------------------------------------------------------- //Barduino to Android first test //Control of Barduino board by bluetooth //---------------------------------------------------------------------------- //Juan Ranera, FabLab 2013 //Assignment: Networking and communications //Barcelona, May 2013 //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- #define Led_ON 49 //49 DEC -> 1 Symbol when we sent 1 (Symbol) //corresponds to 49 (Decimal) according to the ASCII table #define Led_OFF 50 //50 DEC -> 2 Symbol ///////////////////////////////////////////////////////////////////////////// ////////////////////// GLOBAL VARIABLE DECLARATION ////////////////////////// ///////////////////////////////////////////////////////////////////////////// int incomingByte = 0; // for serial input data int led = 13; void setup() { Serial.begin(115200); // opens the serial port, set the speed to 115200 bps pinMode(led, OUTPUT); } void loop() { //digitalWrite(led, LOW); //send data only when you receive data: if (Serial.available() > 0) { //read the incoming byte: incomingByte = Serial.read(); //shows value received Serial.print("Barduino received: "); Serial.println(incomingByte, DEC); } if(incomingByte == Led_ON) digitalWrite(led, HIGH); if(incomingByte == Led_OFF) digitalWrite(led, LOW); }
In the next video you can see the communication between Barduino and the mobile.