Introduction: Hydroponics Blynk Monitor & Control System

In this project I created a control system that monitors, and controls, all aspects of a medium sized hydroponics ebb and flow system. The room I built it for uses 4 x 4'x4' 640W LM301B 8 bar systems. But this instructables is not about my lights. It's the control box. In my box I am able to set my time on/off for lights, as well as hydroponics pumps, it also turns on various intake and exhaust fans for cooling. I'm sure most people who do these kinds of DIY's are probably like meh whatever that's easy. And they're not wrong. That is definitely the easy aspect of it. It got a little more complicated after adding in both an LCD screen display, as well as blynk for data acquisition. The display was easy enough, I found the code on another instructables linked here: https://www.instructables.com/id/ARDUINO-SPFD5408-...
The blynk aspect presented a few challenges. Getting all the code to work on blynk was simple enough, but then I ran into a handful of problems when for whatever reason blynk stopped working. It caused all of my code to stop working also because I had written it all into the simple timer code and just had the blynk.run in the main loop. So anyways the point is, after many many hours working and getting this operating here is my project. The code has been modified to run fully autonomously outside of blynk. At the beginning of the loop it will check to see if blynk is on, if it is on then the code will continue with blynk, but if it returns that blynk is not functioning or off it will try to connect for 10 seconds, then proceed to turn serial communication off and continue running the operation of the controller, with the LCD still displaying the important information. It will continue to attempt to log on to blynk until it either logs back on, or you troubleshoot why it's not logging back on. This project uses AC power, which is dangerous. If you are not comfortable with wiring up AC power DO NOT ATTEMPT THIS, and ALWAYS make sure you are not working on live power. If you have an electrician friend perhaps they can help. My roommate is an electrician and supplied me with a 60A sub panel with 4 15A breakers which feed into my splitters which are then divided into lights, fans, pumps, etc. Remember to never run it at 100%. Safest is to calculate your power consumption per relay with Ohm's law and power calculation. Ohm's law is V=IR, and power is P=IV. the relays max out at 10A which means realistically it's safest to ensure you're only running 6A through a single channel. I've included a basic map for my relay pinouts, and my code is pretty well notated. I will upload a detailed schematic in the near future to include everything. That being said, all you DIY folks out there are probably pretty adept at reading between the lines. If you have any trouble with blynk there's a million tutorials and even instructables showing you how to use it. I ran my via usb serial, but you can use wifi, or ethernet for your purposes it would only be a quick minor change. Anyways have fun I hope some people get some use out of this.

Supplies

Step 1: Libraries Required

Step 2: Real Time Clock

after you've downloaded the library for the real time clock there are examples in your library to give you an idea of how it works. Here's the code I used to set the time. Since there's a battery once the time is saved you don't need to continue using the time upload code.

Step 3: PH Meter

It's probably pretty important to give your pH meter a test, and calibration, outside of the main code just so you know how to calibrate the offset. Here is the code that I used, it's also integrated into the main block of code. Just throwing it out here so you can play around with it, also maybe you're just interested in the sensors and not the rest of the project.

Step 4: Schematic

This is the schematic for the electronics & electrical portion of the project. All the pins are labelled, and they are notated in the code.