<< back

Networking & Communications

This week we are encouraged to build a network connecting two processors. Since my final project would be building a digital wristband that can talk to android phone, I decided to work with Bluetooth this week. Also I would also try to add Lipo batteries to my board.

Last week I was working with the Fabduino board (w/ Atmega 168). This time I added a voltage regulator to the board so that a 3.7V Lipo Battery can be used.

When milling my first board I used the default setting in the online Fab module. The result is ok but there is a broken trace on the top left corner. I used a wire to connect the two ends. Also around the middle part there are 3 traces sticking together. Since I have a quite a lot of other I/O pins on the board, I decided to fix that later. However, after stuffing the board, the bootloader couldn't be burnt to the board. I spent a whole day debugging the board with a multimeter but it just didn't work.

I then decided to mill another board with a lower speed setting (3mm/s instead of 4mm/s). Unfortunately after milling I saw again the missing trace on the top left and also these fuzzy traces. The 1/64 endmill is probably broken. I used a multimeter to check the board and actually it's ok. Therefore due to time constraints I decided to work with this board. However the board again cannot be programmed. Seth told me that there are probably some hardly-seen little traces that are causing some shorts in my board. I then used the microscope in the electronics shop and a razor to check and clean my board. But it still didn't work after another whole day of debugging...

I milled the third board with a further lower speed setting (2mm/s). It's much better this time but the three traces on the right are still sticking together. I stuffed the board very carefully and it eventually worked!

After that I started to work with Bluetooth. The Bluetooth module that I'm using is the JBtek HC-05 found in the electronics shop of the media lab.

The connection is actually pretty straightforward.

Bluetooth Module (VCC) -> Fabduino (VCC)

Bluetooth Module (GND) -> Fabduino (GND)

Bluetooth Module (TXD) -> Fabduino (RX)

Bluetooth Module (RXD) -> Fabduino (TX)

With the Software Serial library I can set any Pins on my board to serial pins. I set the D7 Pin to be RX and the D6 Pin to be TX. I then uploaded a simple program to the board so that when I press "1" on my PC keyboard, the LED on Pin 13 will light up ; when I press "0" the LED will be off. Also a text will be shown in the terminal to state the status of the LED. For terminal software I use "Tera Term".

-------------------------------------------------------------------------------------------

My Arduino code:

#include <SoftwareSerial.h>

SoftwareSerial alan01(7, 6); // RX = Pin D7, TX = Pin D6
int ledpin=13;
int BluetoothData;

void setup()
{
alan01.begin(9600); // Init Bluetooth communication
alan01.println("Hello Alan!");

pinMode(ledpin,OUTPUT);
}

void loop() {
if (alan01.available()){ // If Bluetooth available
BluetoothData=alan01.read(); // Read data sent from PC to Arduino through BT

if(BluetoothData=='1') // If sent data is 1
{
digitalWrite(ledpin,1); // Led On
alan01.println("LED ON"); // Write me the led is On
}

if (BluetoothData=='0') // If sent data is 0
{
digitalWrite(ledpin,0); // Led Off
alan01.println("LED OFF"); // Write me the led is Off
}
}
delay(100);
}

-------------------------------------------------------------------------------------------

When you open Tera Term, choose "Serial" and the port for your Bluetooth. There will be 2 COMs for your bluetooth, choose the one with the smaller number.

It works!

Now I make another board and try to use my PC to talk to 2 boards via Bluetooth.

I modified the code in each of the board so that they will give different text in the terminal. I name the boards as "Board_01" & "Board_02", and the LEDs as "LED_01" & "LED_02"

 

I then opened 2 terminals and controled the 2 boards. They work!

Sometimes in Tera Term it would say the Port with the Bluebooth cannot be opened. In this case I would just unplug the bluetooth module from the board and plug it again. Then usually it would work.

And then I tried to power the board with the LiPo Battery

And it worked fine without the voltage regulator. The bluetooth module is functioning well.

Finally I tried to connect the board with my Android phone. I use an Android Terminal App called "BlueSPP".

It worked fine!