So I'm new at this, I have a hydroponic garden that i would like to automate, here's what i have but i need some help with the coding please!
I have 8 5vc coil relays with 250/120vac contacts
external 5vdc power supply for relays
Arduino Uno connected via usb 2.0 to raspberry pi 4B 4GB Ram
3.2 or 3.5" TFT display
Important note: the relays are working on Inverted logic, meaning High or 1 is Off and Low or 0 is on**
// D3 = Blue Led indicator for Grow Lights
// D4 = Yellow Led indicator for Air Pump
// D5 = Red Led indicator for Sump Pump
// D6 = Relay 1 = Grow Lights
// D7 = Relay 2 = Intake ("Exhaust Fan")
// D8 = Relay 3 = Exhaust ("Exhaust Fan")
// D9 = Relay 4 = Air Pump
// D10 = Relay 5 = Sump pump ( waters plants)
// D11 = Relay 6 = Recirculation Fan
// D12 = Relay 7 = Heating lamp (Future Use - During Winter)
// D13 = Relay 8 = 5Vdc Power Source
// A0 = DH11 Temp. and Humidity Sensor
// A1 = Soil Moisture sensor
I have some of the program done, but i think i would like it different as I'm using delays in milliseconds for 16 hours not quite sure it will function properly, so here's what i would like if anyone is interested in helping:
in void loop()
real time without adding any extra circuitry to turn relayPin1 on for 16 hrs
real time to turn relayPin1 back off for 8 hours
time interrupts every 10 seconds to check for temp if 26 degree Celsius or 80 degrees Fahrenheit, turn on relay pins 2 and 3, and if below 21.11 Celsius or 70 degrees Fahrenheit turn off relay pins 2 and 3. Would also like this to display on the tft screen attached to the raspberry pi 4b.
would like the soil moisture sensor to read every hour with a limit of 100 and if the limit is less than or equal to 20 and greater than or equal to 11, to turn on relay pin 4 print out Soil moisture at 20 percent turn air pump on and display on tft, as well as turn on the yellow led indicator light.
if soil moisture is less than or equal to 10 percent then turn on relay pin 5 sump pump and red led indicator light. print to tft screen on raspberry pi.
if soil moisture is greater than or equal to 21 and less than or equal to 80 print soil moisture is in normal range to the tft connected to raspberry pi. Turn off relay pins 4 and 5 and indicator leds.
else soil moisture is greater than or equal to 81 wait two hours to check moisture again and print Soil moisture is way too high to tft screen on raspberry pi. Turn off relay pins 4 and 5 and indicator leds.
Recirculation Fan Relay pin i would like to turn off and on every 30 mins, but only while grow lights are on, so would need to be done with real time, and print on tft when on and when off
The 5vdc on Relay 8, is to externally power cooling fans for Raspberry Pi, and Arduino based off of the temp. of the raspberry pi processor in which i would also like to print to the tft screen as well.
Any help with this would be greatly appreciated, as i expect to start a new job and won't have much time to complete after today. With Raspberry pi running two 32" monitors, until program is finished i needed the external power to run relays and fans or had power issues, even with the 5.1 3.2A factory power supply.