This week the assignment was about networking and communication. The aim of the exercise was to design and build a wired &/or wireless network connecting at least two nodes. For this week assignment I made three boards and connect them with an asynchronous bus in a daisy-chain configuration using RS-232 protocol. I made one bridge for master and two nodes for slaves. Here is the link to see the details.
The bridge transmits on the bus, addressing each node individually via a node_ID. In a daisy-chain configuration, the RS-232 signal enters through one receiver and is looped through to a transmitter. This configuration is repeated for subsequent devices along the data transmission line. Cable breaks are a major problem with this technique. A break between slave 1 and slave 2 prevents all downstream devices from transmitting or receiving data. Other multi-drop RS-232 techniques involve pre-buffering or boosting the RS-232 output drive (enabling it to drive multiple 5kΩ inputs in parallel). I used Neil`s hello bus, taking the boards from the class site. Milling and stuffing went without a problem. x1 Bridge (Here is the link to download the files for Bridge.) and [x1 ATtiny 45, x1 Resistor 10k, x1 Resistor 1k, x1 Capacitors 1uf, x1 jumper with 4 pins to which I will connect the cable that allows the board to communicate between them, x1 LED, x1 jumper with 6pin necessary to program it with USBTiny and 6pins for FTDI cable) x2 Nodes [board - traces - outline] and [x1 ATtiny 45, x1 Resistor 10k, x1 Resistor 1k, x1 Capacitors 1uf, x1 jumper with 4 pins to which I will connect the cable that allows the board to communicate between them, x1 LED and x1 jumper with 6pin necessary to program it with USBT(Here is the link to download the files for Node.)
I programmed the boards using the code provided on the class website. Before flashing this code , I had to edit the file "hello.bus.45.c" with the program Notepad + +, in order to give a different identity onto each board. Here is the link to download the files for Code.
First I flash the bridge connecting it to the FabISP and the FTDI cable: sudo make -f hello.bus.45.make program-usbtiny. To program the nodes we need to modify the hello.bus file. So, in the line "#define node_id '0'", I changed the number 0 with 1 (and then 2, as shown in the previous picture), i.e. the number that define one of the two nodes. I saved the file and I flashed it on the first node with the FabISP: Each board needs to have a different nodeID. I assigned nodeID number 0 to the bridge and changed the nodeID number to 1 and 2 for the two nodes. ONE OF THE NODE (NODE 2) WASN'T WORKING HERE BECAUSE OF THE PIN HEADERS, WHICH I USE WAS WRONG ONE THAT YOU CAN SEE IN THE IMAGE BELOW.(LACK OF AVAILABILITY OF HEADERS IN THE FABLAB)
At this point I was ready to test my serial bus. So I connected the boards with a cable and then plugged the bridge into the computer. Then I opened the Serial Monitor window in the Arduino IDE (which is located inside Tools - set 9600 baud) in order to communicate with all the boards.
Everytime I type a number between 0,1 and 2 and press enter, there is a general blink in all the boards'LED (which proves that there has been a first step of information). Then there's the blink of the node I have chosen (in response to the number that I typed). Since the blink was quite fast, I decided to to change the timing often the comunication. I opened again the file "hello.bus.45.c" with Notepad++ and I changed the line #define led delay() delay ms(100) // LED flash delay into -> #define led delay() delay ms(1000) // LED flash delay