8. Input & Output Device¶
This week, we learned about different types of inputs and outputs. I wanted to benefit from this week by working on something related to my final project. The part of our project related to this week was programming a microcontroller that is connected to a humidifyimg module.
Circuit Design
I chose to work on Arduino using the Adafruit Microcontroller, as I used it previously in Week 4 of Embedding Programming and was familiar with it.
I started by connecting the humidifier module to the microcontoller; and made sure to follow the following steps:
- VCC to VIN (5 V or 3.3V)
- GND to GND
- Digital input pin to ON/OFF button
- Analog output pin to an analog-to-digital converter (ADC) pin on the microcontroller
Next step was connecting the relays and microcontoller to a bigger base, which is the breadboard
I inserted the VIN and GND pins to the microcontroller’s power supply, and connected the digital input pin to the ON/OFF button.
Code Testing
I wrote a Python script that reads the analog output from the humidifier module. Based on the humidity level detected, the script controls the LED lights to indicate the changes in humidity.
Finally, I turned it on to test if the code was successful, and it worked perfectly.