11. Input devices¶
Assignments for the week¶
Group assignments¶
- Measure the analog levels and digital signals in an input device
Individual assignment¶
- Measure something: add a sensor to a microcontroller board that you have designed and read it.
Requirements¶
- Described your design and fabrication process using words/images/screenshots or linked to previous examples.
- Explained the programming process/es you used and how the microcontroller datasheet helped you.
- Explained problems and how you fixed them.
- Included original design files and code.
Group assignments¶
See 2019 Fablab Taipei Group site Week 11
Individual assignment¶
Design¶
Princeple of LED as input¶
When a LED exposes to light, It will generate a voltage difference between two pins just like PV pannels.
On the other hand, light-sensitive resistor only change it’s resistance.
Datasheet of ATtiny 45¶
Download Datasheet of ATtiny 45 here,
and It says:
When designing a system where debugWIRE will be used, the following must be observed: • Pull-Up resistor on the dW/(RESET) line must be in the range of 10k to 20 k. However, the pull-up resistor is optional. • Connecting the RESET pin directly to VCC will not work. • Capacitors inserted on the RESET pin must be disconnected when using debugWire. • All external reset sources must be disconnected.
No debugWIRE used by this board, so It do not need a resistor compare to echo hello-world board
Add a capacitor to make the power supply more stable.
Two LED in series to be a voltage input
6-pin SPI as the programing interface.
Board¶
Drawing progress is on Eagle, same as week 7. Electronics design.
BOM¶
Parts | Spec. | Quantity |
---|---|---|
ATtiny 45 | 1 | |
Resistor | 220 ohm | 1 |
LED | Yellow | 3 |
Heder | 2x3 | 1 |
1x2 | 1 |
Make the board and Test It¶
Code¶
/* Week 11 assignments for Fab academy 2019 */ // Pin3 is In and pin4 is Out void setup() { // initialize digital pin as input and output. pinMode(3, INPUT); pinMode(4, OUTPUT); } // the loop function runs over and over again forever void loop() { int response= digitalRead(3); digitalWrite(4, HIGH); // LED on time delay(response); digitalWrite(4, LOW); // LED off time delay(response);