Classes >>Input Devices

For this task it was very usefull to follow the tutorial from Providence where it is step by step, the procedure to programming the boards.

STEP 1: PREPARING THE BOARDS

I wanted to do the input devices task making and using the light and temperature devices. Below it is showing both desings.

The Hello Light Board

 

The Hello Temp Board

 


Here are the boards (right) ready to be programmed with the FAB ISP board (left) made in a previus task

 


STEP 2: PROGRAMMING THE BOARDS

 

First, I am going to program the Hello Temp Board to convert it on a termistor in which the temperature sensor is a kind of resistor (R5 NTC) that changes the resistance value in according with the sensed temperature. We need the archive hello.temp.45.c to generate the hex, and the makefile to build the file hello.temp.45.hex.

Similary the hello light board has a light sensor (phototransistor) that create a different current passing through its terminals. We need the archive hello.light.45.c to generate the hex, and the makefile to build the file hello.light.45.hex.

Here the program commands:

FOR HELLO TEMP BOARD

sudo make -f hello.temp.45.make program-usbtiny
avrdude -p t45 -c usbtiny -U flash:w:hello.temp.45.c.hex

FOR HELLO LIGHT BOARD

sudo make -f hello.light.45.make program-usbtiny
avrdude -p t45 -c usbtiny -U flash:w:hello.light.45.c.hex


STEP 3: TESTING THE BOARD WITH PYTHON

 

Python TK in UBUNTU

To display the temperature sensed by the thermistor is necessary to have an interface that translates the sensed signal to represent a graduated scale on the monitor. For that we will install the Python TK in UBUNTU enviroment, and use the correct serial port. For that we must open the terminal , as administrator and typing - ls /dev - we find "ttyUSB0" (port 0)
To complete this final step we must write on the shell: hello.temp.45.py /dev/ttyUSB0

Here the program command:

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

 

Here, testing the hello light board also in UBUNTU enviroment. Then we must to write hello.light.45.py /dev/ttyUSB0 to access the visual interface.

Here the program command:

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

Python TK in Window

Here, using the python i a window enviroment, to which we had to install the next programs:

1.(Active Tcl) http://www.activestate.com/activetcl/activetcl-8-6

2. (ActivePython) http://www.activestate.com/activepython-3

3. (Active Serial) http://sourceforge.net/projects/pyserial/

Checked the serial port:

Here the program command:

python hello.light.45.py com13

Actually the task was not entirely successful for the temp board because the temperature records obtained did not agree to real measured temperature. I expect to solve the problem by cheking the program or changing the sensor.

 

 

 

BACK