Friday, April 29, 2011

It's Friday... Gotta have my bowl, gotta have Serial

We decided earlier in the week that we were going to use serial communication to send data from the Beagleboard to the mbed. We finally got that working today.

We transmitted the serial data using the UART_TX (pin 6) on Beagleboard's expansion header. Serial works on the Beagleboard by alternating voltage from 1.8V to 0V with each voltage corresponding to a 1 or a 0, respectively. The mbed's UART_RX pin accepts voltages between 3.3V which represents a 1 and 0V which represents a 0. So, we had to amplify the voltage coming out of the Beagleboard to 3.3V otherwise, the mbed might not recognize 1.8V as a high signal.

We first made a test program in bash on the Beagleboard to see if serial data was even coming out of pin 6.

while true
do
echo t > /dev/ttyO1
done

Generally, computers use /dev/ttyS* for serial communication, but Ubuntu on the Beagleboard uses the device ttyO* for serial communication. We did not know this for a while so we were looking into other options for communication.

When we ran this program, connected the Beagleboard's TX pin to its RX pin (pin 8), and polled the /dev/ttyO1 device we saw that it was, in fact, printing a 't'.

In order to send the signal to the mbed we first had to amplify to voltage. To do this, we used a logic level converter to shift the output voltage from 1.8V to 3.3V so that the mbed could recognize the data.

We then connected the TX signal out of the Beagleboard to the RX of the mbed (pin 10) to see if we could send data. We initially thought that the baud rate for the data was 115200 because that was the data speed for the RS-232 output of the Beagleboard. When we tested this, the mbed did not recognize the serial data sent in. We then switched the baud rate on the mbed to 9600 (the other most common baud rate) and it worked. We received a 't' and were able to print the data sent from the Beagleboard to the mbed on a computer.

We then hooked up our Kinect to the Beagleboard, ran our program that parsed the depth data and converted the data into 3 bytes, sent that data out the TX pin of the Beagleboard, received that data on the RX pin of the mbed, printed it to the terminal, and had all of our buzzers buzzing at different levels.

We-we-we so excited
We so excited