1

I'm pretty new to these types of projects I'd like to work on a greenhouse project with an Arduino Uno. The goal is to be able to sense temperature and control a heating lamp, detect humidity and control a humidifier, and connect a soil hydration sensor and connect a small water pump for irrigation. Could the Uno support all of this power that could theoretically run at the same time? How would controlling the 3 isolated functions look in the Sketch?

1

Your question is 2 fold:

  • Power requirements: The actual power requirement depends on the devices, but the Arduino will certainly not be able to provide power for a heating lamp. It just cannot provide that much current (you would fry the Arduino). But the Arduino is also only powered from outside. I guess you have a power source, that can provide enough power for all the devices. Then you can connect these devices in parallel to the power source (meaning + and - of the heating lamp power goes directly to the power supply). That way the current for the devices doesn't flow through the Arduino. The Arduino will only use control signals, which don't have high current. Sensors are normally either analog sensors (which connect to the analog pins with only neglectable currents) or use communication interfaces, which are also ok. The current hungry output devices (humidifier and heat lamp) either have a digital control pin, a communication interface, or they must be controlled via a relay (depends on the actual devices).

  • Controlling all the devices: The Arduino can only do 1 thing at a time. But that is no problem, since you can do things sequentially very fast. For example write one function for every device, that you want to control. In that function you communicate with/control the device according to some variables (like the measured temperature). The loop() function can then look as simple as:

    void loop(){
        measure_temperature();
        measure_humidity();
        measure_soil_hydration();
        control_humidifier();
        control_headlamp();
    }
    

    If you want to only do this periodically (not all the time), you can either add a delay() or - better - use millis() like in the BlinkWithoutDelay example (there are also many tutorials about millis() on the web). Make sure, that the individual functions are not blocking. They should do, what they need to do, and exit quickly. No long staying in loops or waiting for an event there.

1

Yes, you can run all of those from an UNO, but you'd probably be better off using an ESP32 so that you can add a web portal to your project for relatively the same cost.

You would be able to run the HDT or similar sensor and temperature sensor as well as the hydration sensor directly from an MCU. The other components would require something else, like NPN MOSFET low side power switch (like an FDS3890) that could be controlled by the MCU. You will need to look at the datasheets for each component you buy, find the power ratings, and make sure you have components rated to support the voltage and current of your devices (A good rule of thumb is twice the expected use, so if you have a 12V pump that can sink 3A of current, you should get a MOSFET that can handle 24+ volts and 6+ Amps.

Each sensor will likely have a library you will use and has samples. Googling each one and working on one individual function at a time is a great way to learn and progress your project.

Some MCU only have one core and everything is placed into a loop. Others (like that ESP32) have multiple cores, and can use a RTOS for task scheduling.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.