WEEK 13 | Networking & Communications
This week Fab Lab Wgtn is making a digital Jargon-o-meter. For that purpose, we decided to build our "WellyNet" network.
Networking Class & Specifications
STEP 1: Brainstorm around the white board.
What are the specifications that all the different boards need to respect?
Which pin(s) do we use to communicate?
How do we organize the data in our programs?
How much power do we provide?, etc.
Here, you'll find our WellyNet Specifications file.
Super bonus: having Daniel to answer our questions and guiding us all week long.
SoftwareSerial library
To solve that problem, Daniel found on GitHub the SoftwareSerialHalfDuplex library. From that library, he created WellyNet library on Github also.
Then, he hacked the WellyNet library in order to communicate as we decided:
- Header (3 bytes): destination, sender, message's length
- Message
Reference boards & terminal
Jasmin, Geoff, Craig and Ben worked on the terminal and the reference boards.
- The terminal provides power to Wellynet,
- The reference boards are made to test WellyNet library.
We needed to add a clock (20Mhz crystal) to the first version of the reference board. The internal clocks are not as accurate as the crystal so we had mistakes in the transmitted data.
High five button
First, we had to be careful with the power. The power provided to the board while we're programming it cannot be the same as the one provided by the network. Indeed, we cannot provide power through the 6 pin header while we use it to send the program. So I created a bridge from the FTDI cable (VCC1 on my schematic) to VCC. For that purpose, I used a 0Ω resistor. I'll need to take it off once my board is programmed.
We also saved the "SCK" line in case we want to tell the board to be "quiet" while another board is "talking".
Once my board was soldered, I couldn't burn the bootloader. I realized that my schematic was wrong. MISO was connected to MOSI and MOSI wasn't connected to anything. Good job Anna...
When we connected my board, power was going through but didn't receive the message expected: "I am 1". That meant that the board wasn't communicating. Daniel checked my program and it was okay. The reference boards which were working the day before weren't working anymore. So Daniel checked his WellyNet library code and he realised that his last modifications caused memory issues. Arduino has more memory than our board that is why our WellyNet programs were working with this board.
Daniel fixed the memory issue and my board was finally sending and transmitting data through WellyNet.
When the "high five button" is pressed, the board will send to the network: "the destination: broadcast" + "its address: 1" + "the message: E".
Thanks to Daniel's example in the WellyNet library, my board was easy to program.
According to the library using "0x00" as a destination should address the message to the all network but we had some issues with this part. So we decided to send the "E" message to the destination "2" and we set up the address "2" on every board.
Click here to download the schematic, the board and the .png files.