Week 15 Networking & Communication

This week we are going to make board that will communicate in a network

Materials
  • Spray Paint
  • Solvent
  • Copper Board
  • Ferric Perchloride
  • Electronic Component
  • Solder Paste
  • Tweezers
  • Antistatic table
  • Cable

  • Designing the Boards


    I follow the same process as Week 6 using Eagle and routing by hand

  • Making the schematic

  • In this step we need to add components by typing add and we could choose them from a list part. We also could make change of position by dragging them, change of value or name by typing the respective command.

    via GIPHY



  • Routing the board

  • On this enviroment we can place elements dragging them, we can also rotate them typing rot and clicking or dragging them to the desire angle. We have to type route and clicking one pad and this will show to which pad is connected, you can select between different types of lines and nodes; and we can delete a wire writting ripup and clicking it.

    via GIPHY


    Making the Board


    I follow the same method and steps as Week 6 to make boards that will use Serial Communication to talk between them (You can select anyone you want from Fab Academy web site)




  • Cut a vinil stencil, paste it to the board and paint it with black spray paint
  • Etch the board and clean it
  • Put the tin paste, place the components and solder

  • Programming the board


    I have to say that you could program the board from Arduino IDE or from your OS Terminal (You need to instal Cygwin Terminal for Windows).

    I used the second way, and what we have to do first is download C file and Make file from Fab Academy web site. I decided to program a Thermistor so I had to download its respectives files.

    But before doing anything it's better to understando what we are doing.

  • C file it's the file that contents the configuration and indications for speaker's function, on C programming language.
  • Make file contents the indications for the make command to generate certain types of file that we expect to obtain. But basically we expect to get an HEX file, that is a file with the C commands translated to Hexadecimal commands, that is the "language" that microcontroller understands.
  • Make command is a Linux tool that make the revision and compilation of the code, but also charge it to the microcontroller if is indicated.

  • Now that we know that, this is the make file that we need to use on Windows, bold lines indicate the changes I needed to do to work. If you are working on Mac or Linux you need to erase those changes.


    PROJECT=bus
    SOURCES=$(PROJECT).c
    MMCU=attiny45
    F_CPU = 8000000
    CONFIG = C:/Program\ Files\ \(x86\)/Arduino/hardware/tools/avr/etc/avrdude.conf
    CFLAGS=-mmcu=$(MMCU) -Wall -Os -DF_CPU=$(F_CPU)

    $(PROJECT).hex: $(PROJECT).out
        avr-objcopy -O ihex $(PROJECT).out $(PROJECT).c.hex;\
        avr-size --mcu=$(MMCU) --format=avr $(PROJECT).out

    $(PROJECT).out: $(SOURCES)
        avr-gcc $(CFLAGS) -I./ -o $(PROJECT).out $(SOURCES)

    program-bsd: $(PROJECT).hex
        avrdude -p t45 -c bsd -U flash:w:$(PROJECT).c.hex

    program-dasa: $(PROJECT).hex
        avrdude -p t45 -P /dev/ttyUSB0 -c dasa -U flash:w:$(PROJECT).c.hex

    program-avrisp2: $(PROJECT).hex
        avrdude -p t45 -P usb -c avrisp2 -U flash:w:$(PROJECT).c.hex

    program-usbtiny: $(PROJECT).hex
        avrdude -p t45 -P usb -c usbtiny -U flash:w:$(PROJECT).c.hex -C $(CONFIG)

    program-dragon: $(PROJECT).hex
        avrdude -p t45 -P usb -c dragon_isp -U flash:w:$(PROJECT).c.hex


    These changes are because sometimes (in my case) make couldn't find the configuration file, so we have to help it.

  • Tip 1 - If you don't know where is the file neither, you can type whereis.exe avrdude on the Terminal that you are using, this will tell you where is installed AVRDude and you can look for the configuration at the folders of the same level. This means that if you find AVRDude on "avr/bin/avrdude.exe" you need to go up to the "avr" directory.

  • The C file that is on the FabAcademy web page verify which node are you talking to, through the serial monitor of Arduino, all boards blink at the same time, but only the board you are talking to, blink once again.


    To program this C code on the board we need to follow this steps:

  • Connect FabISP to your Input Board and both with the computer with their respective cable
  • Open Cygwin Terminal
  • Type cd cygdrive, enter
  • Type cd C (or your hard drive name), enter
  • And so on until you get to the file where you have the C file and Make file


  • Type make -f bus.make program-usbtiny, enter


  • You have to do this for every board, but you have to change the C file or make different C files for each one and change the Line 41: #define node_id '#' and change # for the id you want to put to each board
    ID MIGHT BE DIFFERENT!

  • Speaking to the Network


    We are using asynchronous communication, this means that the start and end of the communication is not syncronized or driven by a clock signal; instead in this communication the syncronization is given by synchronization signal, that is information that says to the other device that is about to receive data, and then, similarly, it receive information to stop the communication and prepare for the next start signal.

    For this we need to:

  • Connect all the FTDI port in parallel and the USB to the Computer
  • Open Arduino, go to Tools and open Serial Monitor
  • Write node # instead of # write the id number of the board you want to speak and send. You will see that all the board blinks but the board you write in the Serial Monitor will blink one more time than the others
  • You could do this as many time as you want