UP | HOME

Week 14 Assignments

Table of Contents

Week 14 - Networking and communications

This week assignment involves communicating several boards using any kind of protocol. As I plan to explore this topic further in my final project I decided to test the hello.bus example to connect several boards using RS-232.

Boards required

I prepared several boards based on the hello.bus models. The node boards are supposed to be the terminals in the bus where communication is started. Then the bridge boards will pass messages along to the other boards in the bus.

To manage several nodes I had to modify the hello.bus code, changing the nodeid value to a different unique ID. Nodes will be adressed by their own node ID over the serial port once we start the communication.

This configuration

Once assembled, this is the final setup of the bus including nodes 0, 1 and 2.

floating_bus.jpg

Testing communications

To test communications, I opened Arduino serial monitor and selected the FTDI port. I checked the main loop to verify how the boards were supposed to react:

while (1) {
      get_char(&serial_pins, serial_pin_in, &chr);
      flash();
      if (chr == node_id) {
         output(serial_direction, serial_pin_out);
         static char message[] PROGMEM = "node ";
         put_string(&serial_port, serial_pin_out, (PGM_P) message);
         put_char(&serial_port, serial_pin_out, chr);
         put_char(&serial_port, serial_pin_out, 10); // new line
         led_delay();
         flash();
         input(serial_direction, serial_pin_out);
         }

Whenever a board gets a character it blinks and if this character is the nodeid, then it should blink again sending a message to the serial monitor like this: "node nodeid". Using the serial the monitor I was able to verify the boards worked as expected.

Date: 2013-03-13 Wed

Author: César Garcíaa Sáez

Org version 7.9.3f with Emacs version 24

Validate XHTML 1.0