Networking and Communications

Week 15

Assignment

Our assignment this weak is to

Hello bus

I decided to make the hello bus. Carl milled out the bus Niel made so I decided to try and program it to understand better how it workes.

To make the bus work you have to define the node. I made the bridge 0 and the node 1. To do that write "gedit hello.bus.45.c"

When I sent the program by writing "sudo make -fhello.bus.45.make program-usbtiny"

I was getting an error "missing separator. Stop"

It took me some time to figure out why I was getting this error but it means that there is a space where there should be a tap in the make file.
I fixed it and programed the node and the bridge and it looked like it worked. To test the board download the term.py that can be found in Input week. To open it I write "python term.py /dev/ttyUSB0 9600" you can also use Arduino to check it. It did not work. I tried a few times to reprogram the boards but it would not work. After programing again and connecting it again it worked. I think I connected it wrong the first time. Now it workes.

Final Project

My plan is to make a network in my final project. I will have the board talk to an ADXL345. In the data sheet of the ADXL345 it says it is the slave. That means the Attiny44 is the master. When you program a bus you have to define who is the slave and who is the master like I did before by defining the node.
I designed the board in eagle and it is the board I will be using for my final project. Then I milled it in rolland milling machine and soldered. There were not many problems I got into there but I did have to make a new board because I did not have resistors with the accelerometer and then some other things needed to be changed.

I then made the code using arduino. I used the USIWire library so the attiny could talk to the ADXL345. I used this example code to work after and changed so it would work with my board. I also used Niels code for hello echo and changed it so it would work for me instead of using the software serial library because it takes a lot of space. My code worked and I could get it to read the accelerometer. But I need to unplug the isp and turn the battery on and off so it will give me the correct reading, if I do not do that it will only give me zero as a reading.

Problems and solutions

My first problem was with the make file were there was suppose to be a tap not a space so I kept getting an error. I just put taps instead of the spaces and then it worked.

I also had a problem getting it to talk to eachother but I think that was because I connected it wrong.
I kept getting only a zero as a reading from the accelerometer but I realized I needed to unplug the isp and turn the power on and off and then it worked fine.
I was also having some problems with my computer thinking that the USIWire library was a troyan so I had to get arduino that was not from windows play store and then it stoped complaining.

Software I used

Arduino -For programming.
Microsoft Photos - For photo editing.
Gimp -For photo editing and making the outline.
Eagle -for drawing the circuit board
Inkscape -For making the outlines.

Files from this week

You can find all the files you need for niels board in the archive
The code