I finished building out the electrical box and hooking everything up this weekend. The unit is now in place in the greenhouse, and the real-world is presenting issues I hadn't thought about...
- When you control the lights based on a light sensor, the lights coming on indicate there is plenty of light and the lights are turned back off. Yeah that worked out well. I did find that simply tipping the sensor over by 90 degrees allows it to read indirect sunlight without being affected by the electric lights.
- The light sensor itself still needs adjustment. It seems to max out before the sun is even overhead. I think it might be worthwhile to have two sensors tuned differently, so one detects the general daylight and the other is more sensitive to low-light conditions. Finding a sensor with an exponential rather than linear response might also be helpful.
- Things spend a lot of time switching on and off. I need to create a buffer to smooth out the information so that, for example, the heaters stay on for five minutes at a time instead of bouncing on and off for only a few seconds.
- Code updates are now a major issue. I had intended to set up the ESP for remote updates but never got around to it. Still have to work on that.
The data is being fed into a mySQL database now, but the current code is updating every 30 seconds. That's way more data than I really need to store. I wrote up a quick web page to display the last 24-hours of info and found it best to average out every 5 minutes worth of data to smooth out spikes. That also made a huge difference in the time required to render the graphs... for each 5-minute period I now have a single value to plug in rather than 600.
As for the outlet box itself, that was as easy as expected. I took a metal outlet box with a faceplate for four outlets, purchased one each of black and white outlets, and removed the tabs from one side to isolate each outlet. I have two power cords, one black and one white, which feed power to the corresponding outlet, and then from all of this I feed eight wires from the outlets to the relays. The socket colors allow me to keep track of the source of power for each device. Since the heaters pull so much juice I have to run two extension cords to the greenhouse, and each one feeds one heater plus one other device. It's not much of an issue right now because the heaters only run at 50% power, and only one of those stay on all night.
So far so good... now I just have to work out the issues with the code...
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.