Week 15 Networking and communications

 

This week assignment at Kuwait Fab Lab is to involve communicating many boards by using any kind of systems so I decided to test the hello.bus example to connect several boards using RS-232.

I made several boards based on the hello.bus models. The node boards are  to be the terminals in the bus where communication is started after the bridge boards will send messages along to other boards in the bus.

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

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

Testing communications :

To test communications, I used Arduino serial monitor and selected the FTDI port then I checked the main loop to make sure how the boards were supposed to react:

### AHMAD ALENEZI

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);

         }

Once a board gets a character it blinks and if this character is the nodeid, then it should blink again which meaning to send a message to the serial monitor like this: "node nodeid" by Using the serial  monitor I can now to verify the boards worked.