Networking and Communications
Design and build a wired and/or wireless network connecting at least two processors
Which network board should I make!?
Eventually, my plan was to complete all of them but I started at the beginning and I made the hello.bus.45 boards, which meant making 1x hello.bus.45.bridge board, and 2x hello.bus.45.node boards.
I downloaded the .png files, and the only difference between the bridge and node boards was that the bridge has 6 extra pins for connecting to the FTDI cable, while the nodes have only a 4 pin header to communicate.
Note that the bridge gives power to other nodes.
Designing the hello.bus.45 boards
repeated all the steps learned before when designing the previous boards
I created two new projects:
EAGLE → Projects > eagle > Networking and Communications > hello.bus.45.bridge
EAGLE → Projects > eagle > Networking and Communications > hello.bus.45.node
Designing the hello.bus.45.bridge schematic
components added from fab library
- 1x ATTINY45SI (Microcontroller)
- 1x FTDI-SMD-HEADER (FTDI header)
- 1x AVRISPSMD (ISP header)
- 1x PINHD-2x2-SMD (4 pin header)
- 1x LED1206FAB (Light Emitting Diode)
- 1x CAP-UAS1206FAB (Capacitor)
- 2x RES-US1206FAB (Resistor)
Laying out the hello.bus.45.bridge board
Checking the design rules for the hello.bus.45.bridge
Minimum clearance between objects in signal layers = 16mil
Everything ok!
Exporting the hello.bus.45.bridge board
In the “Visible Layers” dialog Window, hide all layers except “Top” and “Dimension”.
File > Export > Image
In the “Export Image” dialog window
- Monochrome
- Resolution = 500 dpi
- Area = Full
Use Gimp for creating a white border around the image:
open *.png file select the PCB using the inner white line “Image > “Crop to selection” “Image > canvas size”
Width = +20 Height = +20 Under “Offset”, click “Center” button
Click “Resize” button Create a new layer with white background and place in under the traces layer “Layer > Merge down” “File > Export as….”
And use also Gimp for creating the outline cut *.png file
select the traces “Edit > Fill with BG color” or “Edit > Fill with FG color”, depending which one is black “Colors > Invert” “File > Export as….”
Designing the hello.bus.45.node schematic
components added from fab library
- 1x ATTINY45SI (Microcontroller)
- 1x AVRISPSMD (ISP header)
- 1x PINHD-2x2-SMD (4 pin header)
- 1x LED1206FAB (Light Emitting Diode)
- 1x CAP-UAS1206FAB (Capacitor)
- 2x RES-US1206FAB (Resistor)
Laying out the hello.bus.45.node board
Checking the design rules for the hello.bus.45. node board
Minimum clearance between objects in signal layers = 16mil
Everything ok!
Exporting the hello.bus.45.node board
In the “Visible Layers” dialog Window, hide all layers except “Top” and “Dimension”.
File > Export > Image
In the “Export Image” dialog window
- Monochrome
- Resolution = 500 dpi
- Area = Full
Use Gimp for creating a white border around the image:
open *.png file select the PCB using the inner white line “Image > “Crop to selection” “Image > canvas size”
Width = +20 Height = +20 Under “Offset”, click “Center” button
Click “Resize” button Create a new layer with white background and place in under the traces layer “Layer > Merge down” “File > Export as….”
And use also Gimp for creating the outline cut *.png file
select the traces “Edit > Fill with BG color” or “Edit > Fill with FG color”, depending which one is black “Colors > Invert” “File > Export as….”
Making the hello.bus.45 boards
Milling the board
Fab Modules Roland SRM-20 Desktop Milling Machine one sided FR1 PCB 1/64” milling bit for the traces 1/32” milling bit for the outcut
Gathering the components
→ hello.bus.45.bridge
- 1x AVR ATTiny 45 Microcontroller IC 8-Bit 10MHz 4KB (2K x 16) FLASH 8-SOIC
- 1x 6 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 4 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 6 Positions Header Breakaway Connector 0.100" (2.54mm) Surface Mount, Right Angle
- 1x LED SMD 1206
- 1x 1µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
- 1x 10k Ohm 1/4W 1% Resistor 1206 SMD
- 1x 1k Ohm 1/4W 1% Resistor 1206 SMD
- ATTiny 45 microcontroller → Digi-key Part Number: ATTINY45V-10SU-ND
- 6 pin ISP header → Digi-key Part Number: 609-5161-1-ND
- 4 pin header → Digi-key Part Number: 609-5160-1-ND
- 6 pin FTDI header → Digi-key Part Number: S1143E-36-ND
- SMD LED → Digi-key Part Number: 160-1167-1-ND
- 1uF capacitor → Digi-key Part Number: 445-1423-1-ND
- 10k Ohm resistor → Digi-key Part Number: 311-10.0KFRCT-ND
- 1k Ohm resistor → Digi-key Part Number: 311-1.00KFRCT-ND
→ hello.bus.45.node
- 1x AVR ATTiny 45 Microcontroller IC 8-Bit 10MHz 4KB (2K x 16) FLASH 8-SOIC
- 1x 6 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 4 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x LED SMD 1206
- 1x 1µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
- 1x 10k Ohm 1/4W 1% Resistor 1206 SMD
- 1x 1k Ohm 1/4W 1% Resistor 1206 SMD
- ATTiny 45 microcontroller → Digi-key Part Number: ATTINY45V-10SU-ND
- 6 pin ISP header → Digi-key Part Number: 609-5161-1-ND
- 4 pin header → Digi-key Part Number: 609-5160-1-ND
- SMD LED → Digi-key Part Number: 160-1167-1-ND
- 1uF capacitor → Digi-key Part Number: 445-1423-1-ND
- 10k Ohm resistor → Digi-key Part Number: 311-10.0KFRCT-ND
- 1k Ohm resistor → Digi-key Part Number: 311-1.00KFRCT-ND
Soldering the components to the board
Making the data cable
10 wire ribbon cable to 4 wire ribbon cable
Understanding the C code
Programming the hello.bus.45 boards
Create 3 directories:
bridge node (1) node (2)
And copy the hello.bus.45.c and hello.bus.45.make files in each of the directories.
Programing the hello.bus.45.bridge board
Connect the hello.bus.45.bridge to the computer using a FTDI cable Connect the hello.ISP.44 to the computer using a miniUSB-A to USB-B cable Connect the hello.bus.45.bridge and the hello.ISP.44 using the IDC cable Check that everything is ok using the system profiler
Open terminal Navigate to the directory where the hello.bus.45.c and hello.bus.45.make files for the have been saved
Type
make -f hello.bus.45.make
Terminal response
avr-gcc -mmcu=attiny45 -Wall -Os -DF_CPU=8000000 -I./ -o hello.bus.45.out hello.bus.45.c
avr-objcopy -O ihex hello.bus.45.out hello.bus.45.c.hex;\
avr-size --mcu=attiny45 --format=avr hello.bus.45.out
AVR Memory Usage
----------------
Device: attiny45
Program: 768 bytes (18.8% Full)
(.text + .data + .bootloader)
Data: 4 bytes (1.6% Full)
(.data + .bss + .noinit)
And the “hello.bus.45.c.hex” and “hello.bus.45.out” files have been created
Then, type:
make -f hello.bus.45.make program-usbtiny
Terminal response
avr-objcopy -O ihex hello.bus.45.out hello.bus.45.c.hex;\
avr-size --mcu=attiny45 --format=avr hello.bus.45.out
AVR Memory Usage
----------------
Device: attiny45
Program: 768 bytes (18.8% Full)
(.text + .data + .bootloader)
Data: 4 bytes (1.6% Full)
(.data + .bss + .noinit)
avrdude -p t45 -P usb -c usbtiny -U flash:w:hello.bus.45.c.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9206
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "hello.bus.45.c.hex"
avrdude: input file hello.bus.45.c.hex auto detected as Intel Hex
avrdude: writing flash (768 bytes):
Writing | ################################################## | 100% 1.22s
avrdude: 768 bytes of flash written
avrdude: verifying flash memory against hello.bus.45.c.hex:
avrdude: load data flash data from input file hello.bus.45.c.hex:
avrdude: input file hello.bus.45.c.hex auto detected as Intel Hex
avrdude: input file hello.bus.45.c.hex contains 768 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 1.77s
avrdude: verifying ...
avrdude: 768 bytes of flash verified
avrdude: safemode: Fuses OK (H:FF, E:DF, L:62)
avrdude done. Thank you.
And the hello.bus.45.bridge has been programed
Programing the hello.bus.45.node(1) board
Connect the hello.bus.45.bridge to the computer using a FTDI cable Connect the hello.bus.45.bridge to first hello.bus.45.node sing the data cable Connect the hello.ISP.44 to the computer using a miniUSB-A to USB-B cable Connect the hello.bus.45.node (1) and the hello.ISP.44 using the IDC cable Check that everything is ok using the system profiler
Go back terminal Navigate to the directory where the hello.bus.45.c and hello.bus.45.make files for the hello.bus.45.node (1) have been saved. Open the hello.bus.45.c file and edit line 41
#define node_id '0'
to
#define node_id '1'
And save.
Then , type
make -f hello.bus.45.make
Terminal response
avr-gcc -mmcu=attiny45 -Wall -Os -DF_CPU=8000000 -I./ -o hello.bus.45.out hello.bus.45.c
avr-objcopy -O ihex hello.bus.45.out hello.bus.45.c.hex;\
avr-size --mcu=attiny45 --format=avr hello.bus.45.out
AVR Memory Usage
----------------
Device: attiny45
Program: 768 bytes (18.8% Full)
(.text + .data + .bootloader)
Data: 4 bytes (1.6% Full)
(.data + .bss + .noinit)
And the “hello.bus.45.c.hex” and “hello.bus.45.out” for node 1 files have been created
Then, type:
make -f hello.bus.45.make program-usbtiny
Terminal response
avr-objcopy -O ihex hello.bus.45.out hello.bus.45.c.hex;\
avr-size --mcu=attiny45 --format=avr hello.bus.45.out
AVR Memory Usage
----------------
Device: attiny45
Program: 768 bytes (18.8% Full)
(.text + .data + .bootloader)
Data: 4 bytes (1.6% Full)
(.data + .bss + .noinit)
avrdude -p t45 -P usb -c usbtiny -U flash:w:hello.bus.45.c.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9206
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "hello.bus.45.c.hex"
avrdude: input file hello.bus.45.c.hex auto detected as Intel Hex
avrdude: writing flash (768 bytes):
Writing | ################################################## | 100% 1.22s
avrdude: 768 bytes of flash written
avrdude: verifying flash memory against hello.bus.45.c.hex:
avrdude: load data flash data from input file hello.bus.45.c.hex:
avrdude: input file hello.bus.45.c.hex auto detected as Intel Hex
avrdude: input file hello.bus.45.c.hex contains 768 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 1.76s
avrdude: verifying ...
avrdude: 768 bytes of flash verified
avrdude: safemode: Fuses OK (H:FF, E:DF, L:62)
avrdude done. Thank you.
And the hello.bus.45.node (1) has been programed
Programing the hello.bus.45.node (2) board
Connect the hello.bus.45.bridge to the computer using a FTDI cable Connect the hello.bus.45.bridge to first hello.bus.45.node sing the data cable Connect the hello.ISP.44 to the computer using a miniUSB-A to USB-B cable Connect the hello.bus.45.node (2) board and the hello.ISP.44 using the IDC cable Check that everything is ok using the system profiler
Go back terminal Navigate to the directory where the hello.bus.45.c and hello.bus.45.make files for the hello.bus.45.node (1) have been saved. Open the hello.bus.45.c file and edit line 41
#define node_id '0'
to
#define node_id '2'
And save.
Then , type
make -f hello.bus.45.make
Terminal response
avr-gcc -mmcu=attiny45 -Wall -Os -DF_CPU=8000000 -I./ -o hello.bus.45.out hello.bus.45.c
avr-objcopy -O ihex hello.bus.45.out hello.bus.45.c.hex;\
avr-size --mcu=attiny45 --format=avr hello.bus.45.out
AVR Memory Usage
----------------
Device: attiny45
Program: 768 bytes (18.8% Full)
(.text + .data + .bootloader)
Data: 4 bytes (1.6% Full)
(.data + .bss + .noinit)
And the “hello.bus.45.c.hex” and “hello.bus.45.out” for node 2 files had been created
Then, type:
make -f hello.bus.45.make program-usbtiny
Terminal response
avr-objcopy -O ihex hello.bus.45.out hello.bus.45.c.hex;\
avr-size --mcu=attiny45 --format=avr hello.bus.45.out
AVR Memory Usage
----------------
Device: attiny45
Program: 768 bytes (18.8% Full)
(.text + .data + .bootloader)
Data: 4 bytes (1.6% Full)
(.data + .bss + .noinit)
avrdude -p t45 -P usb -c usbtiny -U flash:w:hello.bus.45.c.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9206
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "hello.bus.45.c.hex"
avrdude: input file hello.bus.45.c.hex auto detected as Intel Hex
avrdude: writing flash (768 bytes):
Writing | ################################################## | 100% 1.23s
avrdude: 768 bytes of flash written
avrdude: verifying flash memory against hello.bus.45.c.hex:
avrdude: load data flash data from input file hello.bus.45.c.hex:
avrdude: input file hello.bus.45.c.hex auto detected as Intel Hex
avrdude: input file hello.bus.45.c.hex contains 768 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 1.76s
avrdude: verifying ...
avrdude: 768 bytes of flash verified
avrdude: safemode: Fuses OK (H:FF, E:DF, L:62)
avrdude done. Thank you.
And the hello.bus.45.node (2) board has been programed
Testing the hello.bus.45 boards
Connect the three hello.bus.45 boards using the data cable
Use terminal to navigate to the folder were the term.py program is
Check the USB port were the board was connected.
$ ls /dev/cu.*
Wich prompted:
/dev/tty.Bluetooth-Incoming-Port /dev/tty.usbserial-FTEZU7NB
Meaning that the hello.bus.45.bridge was connected to /dev/tty.usbserial-FTEZU7NB.
Then, type:
python term.py /dev/tty.usbserial-FTEZU7NB 9600
As soon as I hit enter, a new dialog window called “term.py” opened:
Hit 0 → All boards blink but bridge blinks twice
Hit 1 → All boards blink but node 1 blinks twice
Hit 2 → All boards blink but node 2 blinks twice
What I have learned
https://en.wikipedia.org/wiki/Bus_(computing))
https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
https://en.wikipedia.org/wiki/I%C2%B2C
https://learn.sparkfun.com/tutorials/serial-communication
https://learn.sparkfun.com/tutorials/serial-peripheral-interface-spi
https://learn.sparkfun.com/tutorials/i2c
Issues that I had
Tools used
Files to download
hello.bus.45.bridge
- 1x AVR ATTiny 44 Microcontroller IC 8-Bit 20MHz 4KB (2K x 16) FLASH 14-SOIC
- 1x LED SMD 1206
- 1x 6 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 4 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 6 Positions Header Breakaway Connector 0.100" (2.54mm) Surface Mount, Right Angle
- 1x 1µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
- 1x 10k Ohm 1/4W 1% Resistor 1206 SMD
- 1x 1k Ohm 1/4W 1% Resistor 1206 SMD
hello.bus.45.node
- 1x AVR ATTiny 44 Microcontroller IC 8-Bit 20MHz 4KB (2K x 16) FLASH 14-SOIC
- 1x LED SMD 1206
- 1x 6 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 4 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 1µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
- 1x 10k Ohm 1/4W 1% Resistor 1206 SMD
- 1x 1k Ohm 1/4W 1% Resistor 1206 SMD
hello.ESP8266-12E.ftdi
- 1x ESP8266 Wifi Module ESP-12E (http://amzn.to/2BA8Vn7)
- 1x Linear Voltage Regulator IC Positive Fixed 1 Output 3.3V 1A SOT-223-3 (#ZLDO1117G33DICT-ND)
- 1x 6 Positions Header Breakaway Connector 0.100" (2.54mm) Surface Mount, Right Angle
- 1x 10µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
- 1x 1µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
hello.HM-11.ftdi
- 1x HM-11 Bluetooth 4.0 BLE Module (http://amzn.to/2ALnbGh)
1x Linear Voltage Regulator IC Positive Fixed 1 Output 3.3V 100mA SOT-23-3
(#LM3480IM3-3.3/NOPBCT-ND)
1x 6 Positions Header Breakaway Connector 0.100" (2.54mm) Surface Mount, Right Angle
- 1x 1µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
hello.I2C.45.bridge
- 1x AVR ATTiny 44 Microcontroller IC 8-Bit 20MHz 4KB (2K x 16) FLASH 14-SOIC
- 1x 6 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 4 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 6 Positions Header Breakaway Connector 0.100" (2.54mm) Surface Mount, Right Angle
- 1x 1µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
- 3x 10k Ohm 1/4W 1% Resistor 1206 SMD
hello.I2C.45.node
- 1x AVR ATTiny 44 Microcontroller IC 8-Bit 20MHz 4KB (2K x 16) FLASH 14-SOIC
- 1x LED SMD 1206
- 1x 6 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 4 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 1µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
- 3x 10k Ohm 1/4W 1% Resistor 1206 SMD
- 1x 1k Ohm 1/4W 1% Resistor 1206 SMD
hello.nRF24L01P.44
- 1x AVR ATTiny 44 Microcontroller IC 8-Bit 20MHz 4KB (2K x 16) FLASH 14-SOIC
- 1x nRF24L01+ 2.4GHz Wireless Transceiver (http://amzn.to/2BDM3TL)
- 1x Linear Voltage Regulator IC Positive Fixed 1 Output 3.3V 100mA SOT-23-3 (#LM3480IM3-3.3/NOPBCT-ND)
- 1x 8 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 6 Positions Header Connector 0.100" (2.54mm) Surface Mount
- 1x 6 Positions Header Breakaway Connector 0.100" (2.54mm) Surface Mount, Right Angle
- 1x 10µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
- 1x 1µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
- 1x 0.1µF ±10% 250V Ceramic Capacitor X7R 1206 SMD
- 1x 10k Ohm 1/4W 1% Resistor 1206 SMD
hello.RN4871.ftdi
- 1x BLUETOOTH 4.2 BLE MODULE (#RN4871-V/RM118-ND)
1x Linear Voltage Regulator IC Positive Fixed 1 Output 3.3V 100mA SOT-23-3
(#LM3480IM3-3.3/NOPBCT-ND)
1x 6 Positions Header Breakaway Connector 0.100" (2.54mm) Surface Mount, Right Angle
- 1x 1µF ±10% 50V Ceramic Capacitor X7R 1206 SMD
- 1x 10k Ohm 1/4W 1% Resistor 1206 SMD