Fab Academy



Measure something: add a sensor to a microcontroller board that you have designed and read it


This week’s assignment was to measure something by adding a sensor to a microcontroller board that we had designed and then be able to read it. I was first going to make a hello.MXD6235MP.45 which i will probably use in my final project but decided to start this week of by making hello.mag.45 because of some issues with the inventory.


Designing and milling out the board


I decided to draw the board in eagle even though it might end up with the same layout as the one on the archive just to get a little bit more experience on eagle. So i went through the same steps as in week 6 but had one problem when i was getting all the components for the schematics, i couldn’t find the Hall effect in the libraries so looked through some student pages from last year to see if someone had the same problem then, and found one page with some very good documentation on my problem, at Sigríður Helga's page there a really good step by step guide on how to create both a symbol and a device so that we can add a component to the schematics drawing.



After creating the component and connecting everything in the schematics i was able to route the components after 3 attempts and i decided to add my name to the board for fun. Then i was ready to mill the board in the milling machine and i went through the same steps as in week 4.






Programming the board


After the milling was done i soldered the components to the board and i can feel that i’m getting better at it the more i do it. Then i connected the board to a avrISP to check if the board would be useable and work correctly, and thankfully i got the good green light so now i could go on and program the board and to do that i decided to use the linux environment like my fellow fab lab partners because it looked pretty straightforward.



I started of by downloading the make file, c file and python file from the archive and put them together in a file on the desktop. Next I opened the Terminal and found the folder with the files there. Then I plugged both the fabisp programmer and the hello.mag to the computer in the USB ports.

Now it was time to send the program to the board by running the make file, and to do this i wrote:

sudo make -f hello.mag.45.make
sudo make -f hello.mag.45.make program-usbtiny

And if you are going to use an AVR microcontroller to program the board you should write:

sudo make -f hello.rgb.45.make program-avrisp2



Now i could disconnect the FABISP programmer but i kept the hello.mag connected because now i was going to run the python file. But first i had to figure out what serial port i was using and i did that by writing: ls/dev in the terminal and in my case it was serial port ttyUSB0 Now i was able to write this command:

python hello.mag.45.py /dev/ttyUSB0





Which opened a window with one bar who read magnetic field and here below you can see a video of me testing it with a magnet.

video-1462960979 from Arnar Sveinn Guðmundsson on Vimeo.


I also included a input device in my final project using a accelerometer and buttons, but you you can read more about it on my final project development page.


Files

Board traces
Board outlines