Week 14: Networking and communications

Assignment: design and build a wired &/or wireless network connecting at least two processors Group: send a message between two projects
Learning outcomes: Demonstrate workflows used in network design and construction, Implement and interpret networking protocols
Assessment: Have you: a) Described your design and fabrication process using words/images/screenshots b) Explained the programming process/es you used. c) Outlined problems and how you fixed them d) Included original design files and code

Groupwork Getting started Designing the boards Milling and stuffing Programming Problems

Getting started

To be honest, this week when I saw the lecture, and heard the assignment I was really lost in it. I understood nothing and did not even know wehere to start. There was just so much going on. So when i am writing this, it is not week networking week anymore. Actually 4 weeks have passed since it and I am frantically trying to get this done as all weekly assingment documentation needs to be finished in 9 days.

Back on the horse I guess - Have to start somewhere. Hopefully I will find help when I get lost. I was first thinking of using my own boards for this assignment but I figured it will be better to play it safe at this point. So I will go with Neil's asynchronous serial bus example, mill and stuff the boards according to his example, and use his C code just to try and understand how this networking thing works.

In the example (see video), Neil has connected 3 boards (nodes) to a computer through an ftdi cable, in a way that is called an asynchronous serial bus. The main function of Neil's Hello.bus.45.C code works like:
--> Reads data from the input pin, stores it in rxbyte
--> Flashes all of the leds
--> Checks which node id is called (0,1 or 2)
--> Turns on the LED in the corresponding board
--> outputs the node id into the serial communication
-And starts over...

As I understand it, the communication happens through the tx and rx pins (transmit and receive). So the main computer is first transmitting a signal. The other boards are receiving it. If the signal calls for their specific board, they produce and output (light the led).

Designing the boards

In the electronics design I used Eagle software and followed the process documented on week 7. I looked at Neil's board pictures for reference:
- Bridge board
- Node board

I started with node 0, the bridge board.
Node 0 will flash a green led if it's signal is called. In addition I added one additional led to the design. It just lights up red to signal that the board is receiving power. I got this idea from Dorina, a FabaAcademy graduate from 2016, and a fellow researcher from the Interact research group. I was asking her for advice and her documentation provided very good instructions for this whole phase.

Here is the schema for the bridge board.

and all components organized all nicely into a board. Only took me like 2 hours. I am evolving

The detailed partlist. I have noticed it is good to print these bad boys out (along with the board layout), attach some double sided tape to it, and collect the components right next to the explanation. That way you are not that likely to make mistakes later on when soldering

Next I designed node 1.
Node 1 will flash an orange led if it's signal is called.
Here is the schema. A little less stuff than with the bridge board.

The layout of the board

And the partlist

Lastly I did the node 2.
It is basically the same board as node 1, but it will flash a blue led if it's signal is called.

Board layout

...And partlist

Lastly, I exported an image of the traces (top layer) and outline (milling layer) of all of the boards to my computer, to prepare to mill them out.

Design files:
- Node0 (bridge) schema
- Node0 (bridge) board
- Node1 schema
- Node1 board
- Node2 schema
- Node2 board

Png traces + outlines
- Node0 (bridge) traces
- Node0 (bridge) outline
- Node1 traces
- Node1 outline
- Node2 traces
- Node2 outline

Milling and stuffing the boards

When machining the board I used the same workflows already identified on week 5 of Fabacademy.

Fist I went to FabModules website to work on the traces and outline .png files.
I imported my bridge board traces file,
- I selected the input format to be png.
- I selected the output format to be for Roland Mill (rml), which is the brand of milling machines that we have at FabLab Oulu.
- I specified the I am doing a PCB traces
- I selected what Roland Mill machine I am using - It is SRM-20. When I select this, the FabModules gives me some default settings for the machine.

However, as different machines have different settings, milling bits etc. I then proceeded to modify those settings according to what our local instructor had advised us.

- I changed the x,y and z values from 10mm to 0mm.
- I also did some slight modification to the process settings this time, according to what were the last "succesful" settings used by other FabAcademy students. advised I used cut depth 0.09mm and tool diameter 0.22

--> I proceeded to press calculate, and got the following result that shows me milling lines and offsets. I saved it to my computer as a .rml file

Next it was time to start working on the outline file.
- I again defined that the input file is image (png)
- I then defined that the output format will be Roland mill (rml).
- I specified that this time I am doinf PCB outline.
- I selected the output machine to be the SRM-20 again, and changed x,y and z values from 10mm to 0mm.
- I also did some modification to the process settings: cut depth was 0.6 and tool diameter 0.9.

--> Pressing calculate gives me a picture that shows me milling lines and offsets. At the first try it gave me this picture, which shows two sets of milling lines like this:

I repeated the process for the traces + outline files of node1 and node2 as well.
rml files for milling the boards
- Node0 (bridge) traces rml
- Node0 (bridge) outline rml
- Node1 traces rml
- Node1 outline rml
- Node2 traces rml
- Node2 outline rml

I took my rml trace and outline files and headed towards the milling machine and the computer that it is controlled with. Here is the Roland Mill SRM-20 that is used in FabLab Oulu.

- I removed the inner baseplate from the machine
- I took a fresh copper plate that I will be milling my hello world PCB into, placed double sided tape on it's bottom, and secured it on the baseplate.
- I put the baselate back in the machine and secured it to place, and closed the lid of the machine
- I put in the 0.4mm v-shaped milling bit to the milling machine with the help of the allen key

Next I started to work on the computer.
- I opened up the application that you use to control the machine. the UI of the Roland Mill at FabLab Oulu is called VPanel for SRM-20.
- I used the XY movement keys to move the milling bit to the front left corner of the copper plate, and then hit the X/Y button (9) to set the origin.
- I used the Z movement keys to lover the milling bit close to the copper plate, then used the allen key, loosen the milling head so that it touches the copper plate, and then tighten it back on. Then used the Z movement keys to lift it a bit from the plate and then hit the Z button to set the Z position of to the base point.
--> Once I got the coordinates fixed, I pressed cut, cleared the cutting queue by pressing "delete all", and uploaded my own traces file there. I decided to start with the smaller "node1" board, and after I selected it, I pressed the output button to send my file to the machine to be milled.

The milling of the traces did not go quite well the first couple of times. Too much copper was removed. I thought it was a problem with my settings in FabModules, and tried a second time, this time reducing the number of offsets to two, and also making the cut depth smaller (0,07). As you can see, this did not help. At this point we were wondering what went wrong with other FabAcademy students, and Ari noticed that I had not secured the copper plate well enough into the sacrificial layer. He helped me fix this, and the third board came out just fine with the original settings. Our local instructor Juha-Pekka explained to me that this well exemplifies the troubles with a V-shaped milling bit: If the depth is not just correct, you can easily end up removing too little or too much material.

- When the traces were milled, I vacuumed the board (without removing it from the machine), and set out to cut the board out of the copper plate.
- First I changed the proper milling bit to the machine. We used the flat headed 0.8m tool. Then I repeated the some of the steps described above for the outline file:
- I used the Z movement tool to lover the milling bit close to the copper plate, then used the allen key, loosen the milling bit so that it touches the copper plate, and then tighten it back on. Then used the Z movement keys to lift it a bit from the plate and then hit the Z button to set the Z position of to the base point.
--> once I got the coordinates fixed I pressed cut, and a dialoque window opened up. I cleared the cutting queue by pressing "delete all", and uploaded my own outline file there. Next I pressed the output button to my file to the machine to be milled. Once it was ready I vacuumed the board.

The above porocess was repeated also to the bridge board, and to node2 board.
A photo of the bridge board outline being milled

Once all of the boards were cut, I carefully removed the PCBs from the machine. (As there usable copper board still left, I left it attached to the baseplate). I heard that the new copper boards we use do not need to be rubbed with steel wool like the old ones, so I just took the boards, collected my components, and marched to solder them on.
Here are all three milled boards

The milling was otherwise OK; but my texts (node names, the tx and rx pins) were almost completely removed. I should have made the font somwhat bigger. It helps anyway to separate the boards as there are some traces still left.

I went to pick out my components with a list I had prepared and headed to the soldering station. While soldering, I kept my computer open and looked at my board files, so I could check where everything goes

Here is the soldered bridge and the partlist

Node 1

Node 2

The soldering went by fine, quite guickly. I had some trouble with the last node I soldered (node2).
-When I soldered on the ATTIny i noticed it was a little crooked, and the pins on the other side did not attach to proper pins. I took out the desoldering braid and tried removing the solder, but managed to solder the braid also stuck to the attiny. It took quite a bit of heating to get that mess out. The copper on the plate looked unharmed, but I replaced the Attiny just in case, I had heated it for quite some time.
- I had some trouble figuring out which way the blue led is supposed to be soldered. The markings on it were a little different than the other LED lights I had soldered. I remembered that on them, the line on the top of the component is supposed to be towards the ground connection. The blue led on the other hand seemed to have the direction markings on the bottom. After figuring this out with my fellow fab students Peetu and Ari, I soldered it on in a way that the green line on the bottom of the component is towards the ground. Here's hoping that it works.

Edit: It did not, I soldered it on the wrong way and had to unsolder it later and replace. There was a line on top of the component I should have looked at, but just got confused by the markings at the bottom.

Lastly, I prepared the cable to connect the boards together

Programming and testing the boards

I used Neil's Hello.bus.45.C code for programming the boards.

I started with the bridge board (node 0).
- I opened up Atmel studio an created a new C executable project
- I selected the device to be Attiny45
- I replaced the computer generated snippet of code with Neil's C code.
- I added the line #define F_CPU 8000000UL, to define the clock frequency for the microcontroller.
- I hit build --> Compile, it went through fine
- I hit build --> Build, and it went through fine
- I opened tools, AVRdude to program, and I ran into problems:

I did not know what this was all about. I checked that I had selected ATTiny45 and not 44 as the device. All was good. I checked my connections which also seemed to be fine. I think the problem had to do with AVRdude settings in Atmel studio, but as I was not sure how to change them, I just proceeded to copy the .hex file to the same folder as AVRdude.exe, and running it from there manually through the command prompt. That worked just fine.

I repeated the whole process for nodes 1 and two, creating new atmel studio projects and hex files, copying them to avrdude folder and doing the installation from the command prompt. The only thing I did was change the respective Node id in the code (Bridge=node0, node1, node2)
Node1 installed without problems

But Node2 did not.

I am quessing it is a soldering problem, I have to check it when I get back to the FabLab.

- C code for bridge (node0)
- C code for node 1
- C code for node 2

I decided to test the code with nodes 0 and 1 anyway
Opened Putty, selected serial communication and opened com6.
Result is not good.

---> Whatever keys I press, I only manage to light up node0. The led responds to all input from the keyboard.
--> Hoever, I never get any output on the terminal.

Decided to do some reprogramming of the boards, figured I'd try to do it through the atmel studio the whole way.
- Opened the code for the bridge
- Did compile
- Did build
- Opened options-->External tools
- Realized that the only thing I had to do was change the device from t44 to t45 in the following spot to make AVRdude work through Atmel, doh!

--> opened options-->AVRdude and installed the code to the bridge board successfully.
--> Repeated this also for node1 successfully, on node2 I still got the same error message as before.

Sadly, nothing changed, the only thing that lights up is is the green led on board 0 (bridge). This is probably not an issue with the code as the code is Neil's and tested by others also, the only thing I have changed is the cpu clock and the respective node numberings. So the only options are:
- I have effed up the design already in eagle, and the connections are not as they should be
- I have done some crappy soldering

- I have now doublechecked my board to Dorina's documentation (eagle) to see if I had drawn something erroneously. I do not find any problems here.
- I also tried uploading Dorina's code to my boards, to see if that might do the trick. It did not. I returned to my own.
- I looked at the soldering. Granted that I have used very little tin on places, everything seems connected (atleast on nodes 0+1).
- However, while looking at the node boards more closely, now I am thinking that I might have accidentally cut the ground connection while milling out the boards:

So tomorrow to the fablab, to check the boards and the soldering. Here's hoping I do not need to mill anything again.

Troubleshooting at the FabLab:
- I checked with a multimeter all of the ground connections, they are not cut so all is good.
- I strenghtened the soldering in a couple of the bus pins on node 1.
- I found an error in the connections on node 2.

--> The connection between these pins was not there. I heated up the pin on the attiny a bit, and added more solder to the programming pin header. That solved the problem and I was able to program the last node. Hoooooowever - It did not work.
- You guessed it - the blue led was soldered on backwards. I removed it with the help of the desoldering braid, soldered another blue led in it's place, and all was good. lights blinking on all boards - great success!!

The output in the terminal however left something to be desired:
- Node 0 was replying nicely
- Node 1 was replying nicely
- Node 2 was spewing out all sorts of nonsense

At this point I was pretty baffled. I reprogrammed all the boards, but the result was the same. The soldering was reinforced and connections checked with a multimeter. What more was there to do? Thankfully, our lab leader Jani was nearby. He told me that this could be an issue in the code, in the bit delay time specified. So I modified the code for node2 and changed it there from 100 to 102 as advised by Jani:
-#define bit_delay_time 102 // bit delay for 9600 with overhead

This worked, tada - Behold my asynchronous serial bus in action

- modified C code for node2

Problems had and lessons learned

- I think I tidied up my schematics a lot this week. Before this, my schematics have been a jumble of nets going to the Attiny pins, and it has not been especially nice to read. I had seen others just draw short net stubs from pins, but had wondered how they actually connect anywhere. This week as I was looking at Dorina's documentation and admiring her easy to read schemas, I decided to try it out. To help me I found this Sparkfun tutorial that explains the basics:
-- start by adding short, one-sided nets to the pins you want to draw a connection from. Terminate the net after a few grid-lengths, hit ESC to finish the route.
-- Next use the NAME tool – (left toolbar, or under the Edit menu) – to name the nets. With the NAME tool selected, clicking on a net should open a new dialog. Delete the auto-generated name (e.g. N$14), and replace it with the name you want to use.
-- After naming a net, use the LABEL tool to add a text label. With the LABEL tool selected, left-click on the net you just named. This should spawn a piece of text that displays the name you gave, left-click again to place the label down right on top of your net.
--> All of the nets that are named exactly the same connect automatically.

-Soldering: Check check and triplecheck the connections! Too little tin can cause a whole lot of headache and troubleshooting.

Copyright © Heidi Hartikainen 2018
Template copyright ©Blackrock Digital LLC 2013-2018
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.