Tutorials - Fab Academy at AS220 Labs - Providence, RI

Networking - Hello Serial Bus

bus

The purpose of this hello world example is to network several boards together in the form of a serial bus. The bridge board is connected to a computer via a FTDI cable. The two node boards are connected to the bridge board.

You can connect as many node boards as you like, but you will need at least 2 boards to complete the assignment:

  1. a bridge board (with an FTDI header to conncet to your computer)
  2. at least 1 node.

Get the Board Files and Code

  1. Download the Fab Academy board diagrams / pngs (under "Bus")
  2. NOTE: There is an issue with Neil's C code compiling, use this code instead
  3. You will need to make a bridge and at least 2 node boards
  4. Mill and stuff the boards

Modifing the C Code

  1. For each node in your network, you will need to modify the modify the "hello.bus.45.c" code. The "bridge" board with the FTDI header is also technically a "node".
  2. Each node needs to have a different node ID number (0, 1, 2, 3, etc)
  3. In the c code, you need to change the line:
    #define node_id '0' 
    Save the file. Conncet the bridge board to your computer with the FTDI header and using your FabISP, flash the bridge board as node 0.
    sudo make -f hello.bus.45.make program-usbtiny
    Next, modify the C code again and change the node id to 1
    #define node_id '1' 
    Then save the file.

    bus

    You will need your bridge board to power your node boards and conncet them to TX and RX. Plug your boards in as shown in the picture above. Then flash the node board as node 1.
  4. sudo make -f hello.bus.45.make program-usbtiny

    Repeat as this process for all of your nodes.

Use the Serial Monitor in Arduino to Talk to Your Network

After flashing boards with 3 different node numbers:

  1. Plug your bridge into your computer (with the nodes attaches).
  2. Connect the nodes with a cable as shown in the picture.
  3. Open a Arduino IDE
  4. Open the serial monitor from the "Tools" menu > serial monitor
  5. Make sure the baud rate is set to 9600.
  6. Enter number of a note (pick a number) into serial monitor - press the <enter> key or the "send" button on the serial monitor.
  7. The LEDs on all the boards should light up once.
  8. After all the boards light up, the board with the number you entered into the serial monitor should light up again.
  9. The node name (ex: node 1) should also be displayed on the serial monitor.

serial monitor

Bus In Action

This video shows node one being flashed a few times, then node 0

Alternate Method - If you don't want to use the Arduino IDE.

  1. After flashing boards with 3 different node numbers:
  2. Download term.py.
  3. Run term.py
In Ubuntu this is:
python term.py /dev/ttyusb0 9600
The node name (ex: node 1) should echo in on the serial monitor and the LED on the board that was flashed with the node id of 1 should flash.