Project GrowRoom

First of all i want to thanks everybody for the attendion and for this forum where we can reach great amounts of information.

I need some help to guide me to make my first project. i have no skills at programming but i am studing a lot.

I want to monitor and maybe control a growroom i have in my house. Each Growing project must remain active (powered up) for about 4 to 5 months. Can arduino suport remain being turned on for so much time without turning it of ? Or i need a better aprouch ?

The project consists in:

1X Arduino Uno
1x ESP8266 (to show sensors data on a web server)
1X DHT22 (Temperature and Humidity Sensor)
1X 4 Relay Module (using 1 For controling lamps, 1 for exhaustion fans and 1 for ventilation)

These stuff i already have. So i need to control my lamps to turn on for some time and then to turn off. This must be done everyday. When the lamps turn on, i need the exhaust fan to turn on too and remain turned on 15 minutes after the lights go off. The ventilation Need to have a separate daily schedule too.

So i need some guidance on how to achieve my objectives, how should i structure the code and the loops, how can i use arduino to an aplication that will be powered on for so long.

Thanks everybody again.

How to accomplish this 1 step at a time with LOTS of reading. That's how.

Put everything but the UNO away, for now.

  1. Learn to program the UNO. There is an onboard LED on Pin 13. Learn how to control it, make it blink and make it turn on/off using an input.

  2. Learn how to print things to the serial monitor. Use #1 and when the LED turns on send ON to the Serial monitor, and the same for OFF. Don't know what the Serial Monitor is, look above at resources and do some reading.

  3. Get out the relay module. Use #2, add another output and another input. Use the output to control the relay. You should hear it click when it turns on. A voltmeter set to read resistance can be used to check the relay contacts to verify the relay turns on and off. If you don't have a voltmeter, get one and learn what the functions are. Even the cheapest one will be 100x better than none.

So far its been easy. The next steps are far more difficult.
4. Get out the DHT22. Learn to load the library(ies) required. Get it to print out the readings to the Serial Monitor.
5. Modify #4 to use the readings to control the relay.

  1. Get out the ESP8266 and connect it. I can't detail this further as I have yet to use the ESP8266. Because you have #5 sending reading to the serial monitor, you will be able to compare the webpage to the serial monitor to verify if it is all working correctly.

I will now put out a question and warning. The lights and ventilation, are they 120V AC or 240V AC? If they are either you will be playing with dangerous voltages on the relay board. If they are 240VAC, the board is likely not designed properly to handle that voltage. The relay may be rated for 240VAC, but not the board design. Just because you have a 10 cylinder engine in you car doesn't mean you can tow a freight trailer. It's all or nothing.

You can use one relay to control another. Most likely a relay not mounted to a circuit board can be used be safely, such as a relay like this one Jameco General Purpose Relay

WOW....That was fast. Thanks for the responde sir.

Well, i already know how to control leds, relays and to read and print data from/to the serial monitor. I already have the libraries added to arduino ide. The problem is just putting all parts togheter and how to organize my code. AND MOST IMPORTANT, CAN ARDUINO REMAIN TURNED ON FOR SO LONG WITHOUT FREEZING OR BURNING ?

About the voltages, Yes, there will only one 220v ballast that powers a 400w lamp. The ventilation fan and exhaustion fan is both 110v.

Thanks for the warning, i didn't mind about the safety but now after your advise i see there is more research to be done.

Your commercial AC power will probably fail long before the Arduino fails. How often and for how much time does your power fail?

Paul

ugo_arrigoni:
Thanks for the warning, i didn't mind about the safety but now after your advise i see there is more research to be done.

The other option is an "ice cube" relay with a socket base. Those too are usually rated and safe for use with 220V.

ugo_arrigoni:
Well, i already know how to control leds, relays and to read and print data from/to the serial monitor. I already have the libraries added to arduino ide. The problem is just putting all parts together and how to organize my code.

The key is to minimize the amount of programming in loop(). 80% of the programming in loop() should be a called to a sub-function. As an example, the read from the DHT22 should be done in a separate routine. If you really go all-out with that philosophy, then loop will have only three function calls. DHT22_read(), relay_control(), and ESP8266_write(). I'm not sure about the last it may take more, but for sure on the other two.

Here's step 4 loop routine.
loop()
{
DHT22_read();
}

For step 5:
loop()
{
DHT22_read();
relay_control();
}

There you go, one function already written :grinning: Seriously though, if you follow that methodology, then adding and testing of each new piece is much easier.

What is the role of the Uno in that? It seems rather redundant. An ESP8266 can handle all that ten times over by itself, and in the meantime operate a highly responsive web server.

Thank you @adwsystems, It is getting clear now how the loop function should be structured. @wvmarle , i bought the ESP-8266 just to send the data from the sensors to a web server that i can access anywhere anytime. It was before i realized it all could be done without the arduino itself. About the relays, it is very important that they are reliable. That's why i've been thinking about instead of connecting them to the arduino, i use normal temporizers as i been doing and buy a luminosity sensor to just "check" is the light is on or off. I think it will be easier with the amount of skills i have by now.

I really wanna thank everybody for spendig your time to teach me.

You will want to look into putting your board(s) into deep sleep mode.. and learn how to 'wake them up' upon a specific event happening.

This is how you get your battery to last longer.

ugo_arrigoni:
a luminosity sensor to just "check" is the light is on or off.

In practice you'll likely find that the relays are more reliable than the lights themselves, effectively turning your sensor into a "light broken" sensor.