Input Devices

The assignment for this week is: measure something: add a sensor to a microcontroller board that you’ve made and read it

Making the board

I chose to make the temperature board. I downloaded the files from the Fab Academy site.

I milled the board and soldered its components. The FTDI six pins header component was missing from our Lab so I had to improvised..

The final board looks like this:

IMG_2511 IMG_2517

Programming the board

I used the knowledge I gathered in the Embedded Programming module. I used Eclipse to build the c code (this time it took me minutes to complete :) )

But when I tried to load the program to the board, things started to go wrong :(

First thing I had to do is telling eclipse to which port my device is connected:

Project –> Properties –> AVR –> AVRDude –> Programmer Tab –> click Edit next to the programmer and write the serial port at the right place

COM10

Next I got this error:

AVRDudeErrorAVRDudeError1

After some looking around I realized that my board had some disconnected solder joints.

I took it back to the lab and solder it again but I kept getting the same error. So I used the

-F option

AVRDudeparams

But then I got this error:

signatureErr

It took me a lot of time and google-ing (I found many suggestions and none worked).

At the end I tried to change the direction of the cable that connects my FabISP programmer to the temp board … and it worked!!

IMG_2633

Should have thought of it much sooner :( (and actually – the error message say exactly that – check your connections… rrrrr)

programmin

Some more notes:

I couldn’t program the board using the AVR mkII programmer. For some reason it just freeze

I worked with Atmel studio as well. With the AVR mkII it looked as if the board programming is going well, but then the board didn’t work (with the python app). I used it with the FabISP as well. I had to add it as an external tool and configured it to work with the WinAVR tools. As I changed the direction of the cable it worked – but that is clear as it uses AVRDude (in WinAVR – just like eclipse).

Running the python program

I used Eclipse to run the python program.

Python must be installed before you can install the python plug-in for Eclipse.

For the Python installation I followed Anna’s tutorial.

I needed to install NumPy too.

Configuring Eclipse for Python:

1.   Go to Help → Install New Software

image34_01

2.   Enter http://pydev.org/updates in the Work with field

3.   Select the PyDev for Eclipse option

PydevChoices

4.   Click “Next” and “OK” to continue installing PyDev.

5.   Select “I accept the terms of the license agreement”, then click “Finish”.

The installer will begin to download the plug-in.

A security warning may appear asking whether you trust the software being installed- click “ok”, then ensure the correct items are selected and click yes. The instillation process will continue.

When the installation is complete, you will be asked if you want to restart Eclipse. Select “Yes”. 

I run the python program and it kept crashing after few seconds (nothing went easy this week), so I debugged it in Eclipse and found out that every now and again the value that it reads from the board makes no sense (way out of range) and because this value is used later to compute the display it gets faulty values and somewhere along the way some variable get the value of NaN (not a number) and when the program tries to convert it to int (integer) it crashes.

I guess the problem is in my board, but becouse sometimes it DOES work right I thought the python code can be more tolerant … so I’ve changed it a bit:

fixedpy

It is not very pretty and it makes the display a bit jumpy sometimes, but it won’t crash …

(the sound in the background is me breathing on the board to make it wormer :)

And that is it ..