Microsoft MakeCode

How do I make a auto on/off humidifier with microbit

I have a dfrobot environmental board v2.0 and a delay board on hand.
Which model of humidifier preferred?
How can i make a auto on humidifier when the room too dry and off when the room too humid.
Thanks a lot

There appears to be 2 types of consumer grade room humidifier: Steam or Ultrasonic. Here’s some information on the differences. I have used the DHT11 humidity/temperature sensor with MakeCode Microbit and DFRobot Micro:IoT board . It may be possible to make a switching system to turn on/off your choice of humidifier once you have bought it:

1 Like

An alternative to the DFRobot relay would be the IoT Power Relay sold by SparkFun. It provides a pretty safe way to interface to high power devices.

You could do something like the following:

  1. Use the Micro:bit with an existing extension for a humidity and temperature sensor. There are several available. I haven’t used it, but SparkFun’s gator:environment looks promising.
  2. Read the sensor at a regular rate, but you may want to ensure there’s a bit of a delay, like 1 minute. Start by just controlling something on the display to see if it’s working as expected.
  3. Once you’re sure the sensor is working and would turn the humidifier on/off as you’d expect, update the code to use a digital output to control the IoT Power Relay. (I wouldn’t yet connect a humidifier…I’d start with a simple lamp and test your work again). For example, you could select P0 to be the output. P0 and GND would be connected to the IoT Relay. You’d use the digital write in the Pins palette of the Advanced menu to turn it on (1) or off (0).
  4. Once you’re pretty sure everything is working, add the humidifier. You could probably set the humidifier to a setting that would ensure it was always on when there’s power. That way the micro:bit is just essentially “plugging it in” based on the sensor value.
  5. I’d maybe update the delay to ~5 minutes or so once you know it works.

I suggest the delay because the micro:bit will be able to change the output controlling the IoT Relay quite quickly — probably a lot faster than you’d want to turn a humidifier on/off. Humidifiers probably shouldn’t be turned on/off multiple times a second.


1 Like