week 14, apr 24

weekly assignment: build a wired &/or wireless network with at least two nodes

tutorial used

i used this excellent tutorial by the providence fablab:
Networking - Hello Serial Bus

the electronics

for this assignment 3 PCB's were milled and stuffed, 1 node with a bridge to connect to the FTDI cable, and 2 more nodes.





software enviroment: LINUX under windows

the programming of the boards is done in C, so i decided to install a LINUX enviroment under my windows 7 laptop.
the chosen one was CYGWIN
the installation was pretty straitghforward, when it asks what packages to install i chose all, just in case.
now i can open a linux terminal under windows!











programming

the programming of the nodes was done with an AVRISP programmer, since my fabisp board doesn't work anymore.
i used the files from the providence tutorial to program my boards, since they supposedly fix some compilation program in neil's files, the fixed files can be found HERE

at first i set to program node #0 which is also the bridge. i typed the line suggested by the tutorial,
  • sudo make -f hello.bus.45.make program-usbtiny
  • and it didn't work.



    well first of all, and i don't know why yet, this terminal didn't like the sudo prefix, and second i didn't use the usbtiny! so i changed the line to:
  • make -f hello.bus.45.make program-avrisp2

  • now it works!
    so, take that into account if you use the AVRISP2 instead of the FABISP






    for each node that you program, you need to change the c-code with a unique ID so that they can be identified in the network.
    i named the nodes "0", "1" and "2".

    that is done in the define node_id line (see line 41 below).



    cables and connections

    before programming anything, you first need to connect the node boards.

    it goes like that:
  • 1. connect the FTDI cable from a USB port of your laptop to the FTDI connector on the BRIDGE node. it is important not because of the serial communication, which we don't need at first, but because it provoides the power to the system.
    double check: BLACK=GROUND
  • 2. connect the usb port of the AVRISP2 to an USB port of the laptop
  • 3. connect the flat cable of the AVRISP to the node (or bridge node) 6 pin connector.
    double check here too for correct polarity!
    at this point you should see a green licght in the avrisp programmer.
  • connect all the nodes in series with a flat cable that runs thru all the 4 pin connectors. the 4 pins allow for the communications (RX and TX) but also provide power to the second and third nodes!

  • the next two pictures show see how i connected the system to program the bridge node, node #0:





    to program nodes #1 and #2 the bus flat cable was connected too. as can be seen we didn't have a 4 wire flat cable, so i used a wider cable scavenged from an old PC.



    so, for each NODE you want to program you do as follows:
  • change the ID in the c-code.
  • connect the 6 wire cable from the programmer to the corresponding NODE board
  • go to the LINUX terminal window and PROGRAM the node.
  • testing the network

    at this stage, the avrisp can be disconnected, we are done programming.

    to test the network, open the arduino IDE:
  • go to tools and check the correct serial port. you can connect and disconnect the FTDI cable to see what is the correct serial port number. mine was port 14
  • go to tools and click on serial monitor

  • on the window that opens, you have a node text field, write the id number of one of the nodes (0, 1 or 2) and see what happens.

    if everything is good, the window will echo the name of the node (e.g. "node 0") and the nodes LEDs will light:
    first all three leds blink together, and then the "0" node blinks once again.