Input devices..
Assignments
Our tasks for this week are:
- Group assignment: Probe an input device’s analog levels and digital signals
- Individual assignment: Measure something: add a sensor to a microcontroller board that you have designed and read it
Group Assignment
A link to our group documentation of a Hall effect sensor is here.
Individual Assignment
Input 1: Potentiometer
I used the cardio dev board I designed and fabricated in Week 8 to measure the readings from my little trimmer on the serial monitor.
The input was using a little screwdriver to physically rotate the trimmer that’s directly wired onto my board.
Code (Arduino IDE):
const int pot = 0; //the potentiometer/trimmer is on pin 0 of my board
void setup() {
pinMode(pot, INPUT);
serial.begin(115200);
}
void loop() {
int potValue = analogRead(pot);
serial.println(potValue);
delay(100);
}
Input 2: Piezoelectrode
I also connected a simple piezoelectrode to my dev cardio board to test how well it detected heart rate via a fingertip.
Troubleshooting
In the first tests there was a short that was occurring when I turned the trimmer. But with Adai’s help (thanks Adai!) we located the issue and after a quick and careful re-solder (did I mention how small that little trimmer is? I probably had too much solder on it originally) we were able to successfully get readings in the serial monitor!
Programming
I used the Arduino IDE to read the signal from the trimmer when I rotated it with the screw driver.