Week 10

Input devices

The task of this week was to measure something: add a sensor to a microcontroller board that you have designed and read it. I chose to measure temperature and I added an NTC thermistor.

Design and fabrication

I designed the board in Eagle based on Neil's board example, milled it and soldered with reflow technique in a special oven.

The Schematic

The Broad Layout

The board layout was exported as png.Then it was processed and converted. The toolpath code resulted in two rml files (one for outline and one for traces).

After milling, I have soldered the board using pick and place and reflow techniques. The result is shown below.

Programming

Next I used Neils's c code to program the board using Atmel Studio and avrdude. In the c code in Atmel Studio, I have added #define F_CPU 8000000UL line before #include to specify the clock frequency of the Attiny45 microcontroller according to the datasheet. This information about internal clock frequency was found on the datasheet. The orientation of the cables was as follows (green on top).

When writing the .hex file to the flash memory of Attiny45, the avrdude line should contain the correct name of the microcontroller (t45).

Next step was to test the temperature sensor using a Python interface code. I used Neils's c code again for this purpose. For this step I used the linux computer which has Python installed. First I just entered the command sudo python hello.temp-45.py in the terminal. I was pointed to install the package python-tk; I used the command sudo apt-get install python-tk. Then I ran again the sudo python hello.temp-45.py and I was pointed to install python-numpy package; sudo apt-get install python-numpy. After this I run the python code, but in addition I added to the command line the serial port identifier: dev/ttyUSB0. The result was nice! The sensor senses variations in temperature and the python interface program displays the temperature.

Summary of the week

It was a very interesting week and the outcome was very nice! I had some problems at milling (the rml file was not created well, the settings were not recognized; after some trials the milling machine started, but the milling was not done correctly so I had to cancel the job. Then the bit got stuck. I continued the next day with the help of Local Instructor. Many thanks to the instructor for the troubleshooting; I also learned that the rml files can be opened in Notepad where we can spot eventual errors in the file. I would also thank the local Instructor for supporting me during the programming.