Week 8: Input Devices

Group assignment: Probe an input device's analog levels and digital signals

Diana was sadly sick this week, so we did not complete this assignment all together, but we actually did do this during last week's group assignment!

Assignment: Measure something: add a sensor to a microcontroller board that you have designed and read it

I technically did this week's assignment as part of testing my PCB from week 6, but I will elaborate more on it here. If you recall, my vending machine needs to know whether or not the user inserted a coin. To do this, I will use a phototransistor to sense how much light has been allowed to shine on it. For now, I am using this PCB, and the following code:

PCB to use code

When I covered the phototransistor with my fingers, it indeed showed me in the serial monitor that no light above the threshold was detected. When I removed my fingers, it went back to telling me that it could detect light above the threshold.

uncovered covered

I experimented with the sensor a little bit. Just covering it with something as thin as a tissue was not enough to register a change, at least at this current threshold. I debated working a bit more on figuring out the suitable threshold for my project, but that would be better to do later when my vending machine is at least partially built, so I can choose a more accurate value.