Smithers Grow Controller Dev Project

  • Thread starter Smithers
  • Start date
  • Tagged users None
Smithers

Smithers

213
63
Hey all.

I am starting this thread to document the journey of a huge heady nerdy project I have just jumped into. I decided to build a PLC driven relay rack to control my future garage and grow space! I have done electrical panel building and machine troubleshooting as a day job a long time, never build my own unit for my own uses. I want to expand my electrical/software skills and further my career, so why not learn ladder logic and industrial PLC. After turning it on, in minutes I have running programs that would have taken me hours in Arduino. This is going to be amazing for me. I'm forever going to be tinkering to make this thing smarter. I have SO much to learn, but this thing is gonna be the balls. With another $400 upgrade it'll have it's own HDMI control screen, and could text me alerts and push data and graphs to my phone. Gonna take me years to fully understand how to use it all... Expensive option, yet so so easy in comparison to how I've tinkered in the past.

I already owned 75% of what's in the pictures of the rack either from my prior jobs, or leftover parts from gig work building sfx systems. The big purchase last weekend was the Productivity1K PLC and wire, sensors (about $700). I started building the panel yesterday morning in a rack tray, and designed as I went. It's at the point I can turn it on and connect to my PC. It'll be changing around a bit for sure, neatened up, there's more features to add. The input/output wiring isn't done. Modbus sensors for Temp/Hum/Co2 arrived today but need connections soldered, and for me to learn a bit about that modbus rtu, and wire up some cat5e to get my data.

Don't try this at home folks! It's easy to do this wrong, and I expect a certain degree of failure in exchange for my efforts of growth. Call me crazy, this is half for career building, but in the future hopefully this controller will be something wicked.

My garage grow build project is hitting a delay before it's gotten started, another week or two before progress on that front. Too much stuff in there, need a storage unit for cleanout, soon. Soon.

Controller Priorities:
Get SCD30 temp/hum/co2 sensor network working
Get data from sensors logged to sd card, get export graphing to work
Wire remaining panel I/O
Sample the lighting controller output signal to A/C input card for Night/Day schedule reference
Start writing code for keeping schedules and getting hu, dehu, heaters, all that stuff to work based on sensors
Muddy after that but a million ideas

Dc rack

Ac rack
 
Smithers

Smithers

213
63
I didn't realize I'd need a few extra components for the environmental sensors, so I can't test them until at least early next week. I did get 1 of 2 soldered up for connection, and after testing I'll build the other one. Parts have trickled in, but I'm waiting for my 3.3v power supply due Monday to test either of the functions I've been working on.

The programming has been a learning experience for sure. It's all visual, and there is a lot of guesswork as I fumble through learning different functions. It's like a flow chart.

For my motion detection feature, I'm using a PID sensor (think exterior motion detect flood light) to decide if I'm in the room or not. I wanted to know if drastic temperature swings or ill effects are caused by me being in the room or are from an actual problem. Later, motion in the room could alert me, or could prevent me from being alerted based on the situation. Also, I wanted to be able to drop CO2 levels automatically to regular levels if I'm in the room, and return to operation levels shortly after I leave.

So I made a test program that takes the motion signal from the sensor (https://www.sparkfun.com/products/17372) and turns on an output that will remain on until the signal has been lost for at least 20 seconds. If motion is detected during the countdown of stillness, the counter is reset so the full time is waited again. The time table is shortened for testing, and this program is very clumsy as I learn, but it works! The real time delay for this feature will probably be 10 minutes of no motion before returning all to normal.

IMG 6911



Basic timer function



Modbus for the temperature / humidity / CO2 seems to be a snap after reading the info. I can't find out until Monday, but I'm pretty sure I can do most of what I want with a single command.
Modbus function


And then I'll be spending my time getting the condition statements for controlling those variables mapped out. Playing with the data logging will be fun.
 
Smithers

Smithers

213
63
I'm feeling pretty positive about a new direction I've needed to go for this project. I had been struggling with the Modbus network and haven't solved it yet. Coding for networks is sorta not yet something I'm good at, so my combo temp/hum/co2 network is back burner. I'd like to know the exact data in real time, but I don't need to. I have Inkbirds that know the setpoint and operating band. I fell back to the simpler plan of capturing the transitions of my Inkbird relays on/off, passing the power through my relays, and counting / analyzing the timing data between each transition.

After wiring the inkbird outputs to my AC input card, I wrote some code to build arrays of the elapsed time for 20 transisions of each: CoolOn, HeatOn, TempOK, HumidityLow, HumidityHigh, HumidityOk. The statistics feature can only handle 16 array points at a time, so the array size probably should be 16, or some multiple of 16. Anyway, the cool thing is, it only took me a half hour to figure out how to get Avg, min, max, StdDev data out each transition and get it graphing. I dumped a bunch of random time data into each array, and then held my probes next to a cold beer can and my face. The graph gets it! It's saved in the array, and the new data shifts right and drops the oldest into a temp variable. The data is stored as seconds within that state, and updates upon exit transition from said state. Now I just need to put this into a room with the 4 controlled elements and get the real data.

Human Machine Interface controller on order.

TempHumData
 
Smithers

Smithers

213
63
Today I checked off another feature from my list. The AC output from my Nearpow lighting controller 💡now goes into an AC input, so my controller knows if the lights are on/off. It then determines which Inkbird temp sensor I'll get the relay data from, the day sensor or the night sensor. It's a cheap solution to getting separate day/night temp control without having my own sensors working yet or buying things I don't really want. I will have 2 Inkbird ITC-308 sensors in the same room, one set up for my daytime settings, the other set up for night time settings. When the lighting controller turns off, the program sees the lighting input change, switches which data to capture and graph, and switches the appliance output controls over to run from the correct sensor. It works wonderfully! Since I will manually put the settings into the Inkbird units, I will know the exact temperature at every transition point, although, I will not have them in real time. I'm cool with that trade.

Out of 8 AC 🔌inputs on my first card, I've already used 7 for the 4 Inkbird temp relays, the 2 Inkbird humidity relays, and the Nearpow relay. The 8th is planned for a signal I covertly grab from my air conditioners compressor wire. The A/C is currently going to run by itself off it's own temp controller like normal for now... I so far just want to know the duty cycle and other run statistics. If I later upgrade to a mini-split, I will figure out a way to at least capture the run signals, if not directly control the unit.

I look forward to my EA9-RHMI and a few extras arriving Monday. The GUI will make sharing pictures of this a lot more fun, because nobody likes to see code right? Later in the week we leave for 12 days of camping across several islands in Maine. It'll be nice to get out of this heat for a while and see some family. 🦞🦀🧑‍🍳
 
ComfortablyNumb

ComfortablyNumb

6,099
313
I know a guy that does sets and stuff at the local studio. He does this kind of stuff as well. He is always trying to link various cameras into it.
 
Smithers

Smithers

213
63
I know a guy that does sets and stuff at the local studio. He does this kind of stuff as well. He is always trying to link various cameras into it.
I bet he is on point with what he does. Film sets know how to burn money like few industries, so you gotta be on your game if you are on a set. I'd love for some day to transition out of a manufacturing environment, into more art based work, it would be so much more interesting and rewarding. That's one hopeful side goal of this project, a new career.
 
Smithers

Smithers

213
63
Rudimentary communication between HMI and PLC up and running. Easy peasy, but early stages of dev for sure. The graph displays the two temperature bands for lights on/off and status of the Heater and AC outputs. I’ll be adding the hu and dehu with humidity data soon. I also want a status of the lights on/off on the graph.

Currently I’m simulating the Inkbird relays with some switches for testing because it’s faster/easier on my desk. When the lights kick on, the temperature setpoint changes to the day time temperature. When the heat or cool relays on the Inkbird trigger, the temp data is pulled to the corresponding limit of the temp range to illustrate that it is out of range high or low, otherwise it sits at the setpoint.

If I want to change the settings on the Inkbird, I also enter in the new settings to the input fields. This dynamically updates the PLC, which then shows up on the graph automatically.

02032C64 5777 45C5 8A78 001F5C050B94
 
Top Bottom