8
Nilton Anchayhua Fab Academy 2015
Home
Assignments
Final project
About me
Week 1 - Principles and practices, project management Week 2 - Computer aided design Week 3 - Computer controlled cutting Week 4 - Electronics production Week 5 - 3d scanning and printing Week 6 - Electronics design Week 7 - Embedded programming Week 8 - Computer controlled machining Week 9 - Molding and casting Week 10 - Break Week 11 - Input devices Week 12 - Output devices Week 13 - Composites Week 14 - Networking and communications Week 15 - Interface and application programming Week 16 - Applictions and implications Week 17 - Mechanical design - machine design Week 18 - Invention, intellectual property and income Week 19 - project development

NETWORKING AND COMMUNICATIONS

I realized serial communication nodes 0 1 and 2 and added one more to see the functionality of this communication. and it turned out very well. This work, when You send a char "0" from "term.py", (interface) so all nodes flash their own led, then the node 0 back the String "node" to the interface, whit the number of node and flash the own led and send the number "10" to change the line. This is for all nodes, but in my case I add another microcontroller that send my name "nilton" and the "fablab tecsup".
The first node has connections to the FTDI, then other nodes only communicate via the RX and TX pins and the power source.
The communication program works with 9600 baud and has implemented a function that sends words and characters. I learned that the number 10 means that a line is left blank in C language. communications work sendind
Serial Communications is the process of sending data one bit at a time, sequentially, over a communications channel, this constrast to parallel communications, The program define the port B to work with the serial communications, PB3 is a Rx pin and PB4 is a Tx pin, the flag of any microcontroller can be change if you change the node_id, from 0 to 3 in my case, because I have 4 nodes. In this program Neil implement many functions, like get_char() (Rx), put_char() (Tx), these functions is for receive or send 8 bits, however there is another functions like put_string() (it send many bytes),
After understanding the logic of the program sending only I modified the words, as you can see below.
                 while (1) {
      get_char(&serial_pins, serial_pin_in, &chr);
      flash();
      if (chr == node_id) {
         output(serial_direction, serial_pin_out);
         static const 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
     static const char message1[] PROGMEM = "nilton fablab tecsup "; new message
         put_string(&serial_port, serial_pin_out, (PGM_P) message1);
     put_char(&serial_port, serial_pin_out, 10); // new line
         led_delay();
         //flash();
         input(serial_direction, serial_pin_out);
            
You can see in the video, the communication between the nodes, I change the flash function, because it only work when in the serial terminal send the right node, I mind that the led is ON only when is sent the right node.
You can download the archives from here