Home |
Weekly assignments |
Final project
week11:output devices
*assignment
-individual assignment:
add an output device to a microcontroller board you've designed and program it to do something
-group assignment:
measure the power consumption of an output device.
1.Learning what output device is and how it works(procedure)
From the start, I didn't know what output devices are and how they work.
So I had to learn and understand.
I'll explain what I learned about this week until I understand before showing my assignment.
Output devices
As far as I understand, 'output' means processing from computer code and causing result such as showing, lighting, moving.
Very simple.
We already learned many things needed last week.
It's almost same.
The difference is just vice versa processing.
Input and Output that's it.
So we can start.
I just had to choose which output device I would be desinged and programmed to do something.
I chose 'LCD'
2.LCD
First I also tried with arduino to understand more.
If you're beginner, I would highly recommend you to try with arduino first.
It was very powerful.
Lcd with Arduino
At first I refered to Neil's Hello LCD board.
Attiny44
Hello lcd board uses attiny44.
This is the attiny44 image.
This time also I followed arduino website.
Here is the link(LyquidCrystal library).
Code
Here is my code.
#include
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2);
lcd.clear();
}
void loop() {
lcd.setCursor(0, 0);
// print the number of seconds since reset:
lcd.print("Animos pdp");
lcd.setCursor(0,1);
lcd.print("Fighting!!!!");
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("I love you");
lcd.setCursor(0,1);
lcd.print("my friends");
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("This too shall");
lcd.setCursor(0,1);
lcd.print("pass away");
delay(2000);
lcd.clear();
}
Error
Just lighting.
Not showing message I ordered.
So I searched so many times but I couldn't find.
Accidently I found the answer.
How to solve
I didn't put potentiometer on breadboard perfectly.
So it made this error.
When I put it correctly, it worked.
It's more easier than Input device.
I don't have to add other libraies to programm it.
I just have to connect pins correctly.
Result
Here is the video.
Lcd with board
Chaniging 5v to 0 ohm resistor
I changed '5v' to '0 ohm resistor'.
Neil designed it for the situation not using computer power.
So He put 5v on the board.
But I would use computer power so I don't need it.
So I changed '5V' to '0 ohm resistor'.
Because capacitor needs resistor.
Schematic and Board on Eagle.
assemble
Components.
Milling and Soldering.
It should be connected to LCD pad.
I used breadboard and jumpers.
(PA0(ATTINY44)-DB7(LCD)
PA1(ATTINY44)-DB6(LCD)
PA2(ATTINY44)-DB5(LCD)
PA3(ATTINY44)-DB4(LCD)
PA4(ATTINY44)-E(LCD)
PA5(ATTINY44)-RS(LCD)-MISO(ISP)
R/W(LCD)-GND(LCD)-GND(ISP)
VCC(ATTINY44)-VCC(LCD)-V(ISP)
)
I tried to program it.
But I ran into unexpectable error.
Error
I used the same code as arduino.
But it didn't work.
And I found the answer.
The reason is the same code.
How to solve
Attiny44 pin numbers are different from Arduino uno board pins.
So I should've changed them. But I didn't.
That made the problem.
So I changed it worked.
I changed from(12, 11, 5, 4, 3, 2) to (5, 4, 3, 2, 1, 0).
And I changed message,too
Code
#include
LiquidCrystal lcd(5, 4, 3, 2, 1, 0);
void setup() {
lcd.begin(16, 2);
lcd.clear();
}
void loop() {
lcd.setCursor(0, 0);
// print the number of seconds since reset:
lcd.print("A donde");
lcd.setCursor(0,1);
lcd.print("va mi vida?");
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("No lo se");
lcd.setCursor(0,1);
lcd.print("para siempre");
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Es porque");
lcd.setCursor(0,1);
lcd.print("asi es la vida!");
delay(2000);
lcd.clear();
}
Result
It worked!!!
The messages are Spainish.
Because I major in Spainish.
meaning
A donde va mi vida?(Where's my life going?)
No lo se para siempre.(I don't know forever.)
Es porque asi es la vida.(It's because this is the life.)
Downloads
lcd board ino file
schematic file
board file