Networking

This week, we were tasked with creating and programing devices that talk to eachother. We used the hello serial bus boards. This network has 3 major pieces, one bridge, and two nodes. The bridge is the board that the computer talks to directly, and the bridge then communicates with the nodes.

To create the boards, I downloaded the code from here, and then milled them on the modela. This was straightforward, as I have milled quite a few boards already. Then I stuffed the boards with the necesary components. The boards were small and had only a few components, so it was quick and painless.

Next, I programmed each of the boards.  To do this, I had to flash the code onto each of the boards. I used the code found here, and my fabISP to push the code to the boards using the terminal command:

"sudo make -f hello.bus.45.make program-usbtiny"

To be able to communicate with each node individually, I had to change the name of the nodes. For each of the two nodes, I gave each a new name. The code has "0" as the default name, so I changed the two nodes to 1 and 2. I had to change this part of the code:

#define node_id '0'

to: #define node_id '1'

Then, I saved the file, and flashed it to the first node. Then I changed it to node 2 and flashed the second node.

After I programmed the boards, it was time to test them. I opened the arduino IDE, and then opened up the serial monitor. I entered 0 into the command line in the IDE, and all of the boards flashed once, and then the bridge flashed again. Exactly what it was supossed to do! Then I tested node 1 and 2, and they worked as well. 

The response in the IDE was a little funky, however. When I entered a number, the response was jibberish. After some fooling around, I figured out that the timing in the c code was a little off for the boards. For each of the boards, I changed the timing in the line:

#define bit_delay_time 100// bit delay for 9600 with overhead

to

#define bit_delay_time 101// bit delay for 9600 with overhead

This fixed the problem and now it works perfectly!

 

 

Published on   April 29th, 2013