Skip to content

7. Input & Output device

We were introduced to the types of inputs there are in different microcontrollers. All inputs like sound, temperature and lights uses its power source like usb and batteries and are connected to the microcontroller. In my project I wanted to control the humidifier module by an on and off button.

Humidifier Module

  • I selected a humidifier module that can be controlled by digital input and has an analog output for humidity control.

Design the Circuit

  • I connected the humidifier module to the Adafruit Microcontroller:

  • VCC to VIN (5V or 3.3V)

  • GND to GND

  • Digital input pin (e.g., D2) to ON/OFF button

  • Analog output pin (e.g., A0) to an analog-to-digital converter (ADC) pin on the microcontroller

I then used a breadboard to connect the components:

Connect the VIN and GND pins to the microcontroller’s power supply.

Connect the digital input pin to the ON/OFF button.

Write the Code

  • I used Python language and created a script that reads the analog output from the humidifier module and controls the LED lights based on the humidity level.

Test

  • I powered on the circuit and test the humidifier module by pressing the ON/OFF button.

  • I then verified that the LED lights respond to the humidity level changes as expected.


Last update: July 17, 2024