Assignments: add an output device to a microcontroller board you've designed and program it to do something
I tried to use LCD with ATtiny44 to show data micro controller has.
For the assignmet of this week, my LCD shows data from thermistor (NTC).
Re design ATtiny44 main board
At the beginnning, I re-designed Attiny44 mainboard. (You can check old version HERE)
since old one shared only 2 I/0 pins with its shields, It was impposible to use LCD on shield which is required 8 pins including VCC and GND to use.
This is new design of the main board which shares all pins except two pins which are used for external clock.
The main board can conect not only extra 2x3 header but also ISP header with its own shields to give more possibility to them.
To prevent 5v regulator burn by connecting power conversely, 2-pins MTA connector is used in the design which is one of shrouded connector so it can't fit in if it's inserted wrong direction. One thing I should add to new design is one more pin to share non-regulated Voltage with shield so shilds can handle components requiring more than 5v.
LCD shield
And I also made an LCD shield fitting with new main board.
There are two 2x3 idc connectors are on the bottom of the board so it can connect with ISP header and extra 2x3 header on main board.
Futhermore, this shiled can give connections of PA6, PA7, VCC and GND of ATtiny44 through the 2x3 header on it self.
In this week, I used it for thermistor shield.
Run sample code
After milling and soldering, I've got sample code from Academy page (C and Makefile) and uploaded it to my board the let it run.
Here is video...
Yey, It works without any problem :)
LCD + Thermistor
Then I started coding to merge smpla code I used above and another code for thermistor from "input devices" week so the board gonna be able to get data from thermistor then show it on LCD.
Merging almost went well but I was stuck with one problem about getting data from ADC of ATtiny44.
ADC gave back the input only once at beginning then stop while program is running.
After checking circuit, pin assign, and two files I merged, the problem wasn't solved yet.
But then, I found forum talking about similar problem I had and I follow suggestion one mention in it. Result is perfect. It start working collectly.
The problem was caused by way to get data from resistor ADC stores data. ADC stores data in two 8bit resistors (ADCH and ADCL), ADCH takes higher part of data and ADCL takes lower part. There are two ways to get data from these resistors one is taking data separately then combine them together and another way is taking combined data from both of them directly. The former I used didn't work well and the latter is correct answer in this case. So I changed the code like below...
(x) value = ADCH * 256 + ADCL;
(o) value = ADC;
//static unint16_t value
Then I put temperature shield made in Input devices week on LCD shield so now my board has 3 layers.
(Bottom)Mainboard - LCD shield - temperature shield(Top)
and here is video...
When I touched NTC thermistor with cup of hot water, the number shown on LCD increased rapidly and stop at 511.
Now I wonder how to sensor more high tempature (probably using RTD thermistor instead ?)
And the number is not converted to actual temperture yet because I saw some article explaning calculation with float or double makes proccessing very slow.
I have to learn it more so if you have any advices please tell me.
Resource
LCD + TEMP: this ZIP file contains Eagle file, PNG for milling, Makefiles and C codes to make boards.