Introduction to Physical Computing / Week 3 / Microcontroller Basics
This week’s labs beckon the initiation of programming using an Arduino microcontroller, and processing analog and digital input/output.
I’m going to revise the concepts first (for embedding the
Introduction to Physical Computing / Week 3 / Microcontroller Basics
This week’s labs beckon the initiation of programming using an Arduino microcontroller, and processing analog and digital input/output.
I’m going to revise the concepts first (for embedding the definitions into my memory) : An Arduino board is a microcontroller that has a lot of circuitry built around it ( digital and analog ports, voltage regulators et cetera). The Arduino board comes with an Arduino IDE, which is a simplified programming tool that compiles commands into assembly language and loads them to the board. Consequently, circuits using analog and/or digital sensors can be connected to the board and the inputs/outputs can be processed using programming logic. Fun!
The labs from this week required us to deal with digital input and output, and then move on to analog input. Digital inputs can be obtained from digital sensors, which are sensors that can sense binary data ( 1 or 0, HIGH or LOW, ON or OFF). It’s basically like Hodor from Game of Thrones. It either says Hodor or nothing at all. Examples of digital sensors can be 2-state switches or pushbuttons.
Analog sensors, on the other hand, sense a range of values which can be understood and translated using programming logic. Examples of analog sensors can be potentiometers, variable resistors such as photosensitive resistors and force-sensitive resistors.
Lab 1 : Digital Output from Arduino
The first lab revolved around generating a digital output and passing it to the circuit using Arduino. The digital output periodically switches on and off an LED. The following example switches the LED on and off every 500ms.
Lab 2: Digital Input/Output
The second lab is about receiving digital inputs into the Arduino using a pushbutton, and processing that input to light up an LED (using the digital output circuit from the previous example).
Error: I ran into an error while performing this lab. My LED was connected to the +5V line on my breadboard, which would render the LED on permanently on the board. The LED is supposed to be detached from the +5V line since it’s voltage is dependent on the digital output we produce from the Arduino board.
Lab 3 : Analog Input to Arduino
In the third lab, I used an Arduino board to receive an analog input using a potentiometer and then processed the input and displayed the results on the computer.
The values changed between 17-1023 depending on how the resistance was being varied on the potentiometer. My idea is that the output didn’t go down to a minimum zero because even when the dial was turned all the way, the potentiometer still presented some minimal resistance.
Observing User Interaction in a Public Space, and a Simple Application of Microcontrollers:
I’ve observed that students spend a lot of time working out the codes to the lockers. And it’s a lengthy process, plus it’s highly prone to go wrong even if the student remembers her/his passcode. An alternative solution to this can be using a simple numberboard and a microcontroller to read the passcode and process it.
The idea is to use an analog input and verify if the correct password is being entered or not. The students can work out their passcode on a numbered lock and subsequently the code can be verified using a logic. It’s nothing new, this is being used all around us. For example, buildings, safety deposits, ATMs and even suitcases. However, using it in a school system would save the students some time, and perhaps prevent them from getting late to classes (haha).
Extending the idea into mobile applications, we have numberboards on our cellphones. Perhaps, a student can connect to the lock using the wifi network when in the vicinity and open the lock as he/she walks up to the locker in the hallway. This makes the opening of locks super easy and more time-efficient.