Hydro Spinach version 1 day 2
That day I started to do Internet of things things 🙂
I thought that my growing things need to be connected. I have some Spark Cores on the shelve and wanted to use them. Now they are known as Photon Particle. Same thing different name and bit more memory but basically for the purposes of this post the devices are the same.
What it is? Its a micro controller, a device that when turned on runs a program over and over again. Program can control relays and read sensor data. It can use the sensor data to control the relays and so on. Spark Core has two parts in its programming.
The Setup. This part is ran ones when the chip is powered up. Commonly used to set up all needed stuff to run the program like time. You can read some super accurate time of the internet and set the system clock on that.
The Loop. This is the actual program and the Spark Core will try to execute this loop over and over again as fast as it possible can like its life depended on it. That is all it does. You can be quite creative in the loop. Read sensors set relays add a delay so that you can control the action runs. Usually you do not need the program to run 1000 time a second but something like ever 10 minutes.
I started with some simple things as I never used anything like a micro controller before. I have some electronics experience and basics from school about 15 years ago 😛 but thats about it.
Two things I know I want to do with the Spark core in my Hydro Spinach project. Firstly I want it to control the grow lights. 18h on and 6h off. Secondly I want it to read a sensor measurements.
Relays click click click
First test is to have a program changing the relay on and off. I made a small loop that changes the relay that is off every second. See the video 🙂 As you might hear that there is one of the relays that does not react to the controls. The indicator light changes but the relay does not "click". First I thought the relay board is broken. Stupid relay board. Sent it back to the supplier and got a new one in mail. Same thing. No click on one of the relays. After a little googling and research I found out that the Spark core pins have a signal strength of 3.3V. The relay board is a 5V relay that requires a voltage close to 5V in order to work. What happened was that the signal tried to make the relay "click" but did not have enough power to do so. It actually is so close to the required voltage that it sometimes works and sometime not. Two options. Get a 3.3V relay that will work with the voltage of the Spark core. Unfortunately they are not too common. I mean as a relay there are plenty but a ready made board that has all the bells and whistles is not easy to find and the ones I found were double the price of 5V relay board. Second option is to get a level changer. Its a tiny component that takes the 3.3V signal and changes it to 5V. These a quite cheap and easy to set up so this is what I went with. Ordered a bunch of them as they are like 2€ each 🙂
World of sensors
Second thing the micro controller of Hydro spinach needs to do is to read some sensors. Currently there are four sensors I planed to have.
Environment sensor made by Groove utilising Bosch BME280. It measures Air temperature, Air pressure and humidity.
Light sensor. Also important to the project as in case there is enough sunlight in the room the grow lights are not needed so I can save on energy.
Water temperature sensor. One wire sensor sensing the water temperature.
Camera to take a picture of the project progress.
I plugged the BME280 in and did some programming magic 🙂 searched for a ready library and example code and by the magic of copy pasting got a reading out of the sensor. See the video.
Now I am happy in the progress I made. First time and nothing really did not work so far.
Additional parts to the grow base.
I need to get on with the prototype build. Got the base done so now I need to build the top where the grow lamps are housed. Cut some triangles of wood and a piece of plywood on top of it. I was so lazy that I just wet the plywood a little and forced it on-top of the triangle frame I made for it. It worked sort of but does not look nice. Next time I will do some cuts 🙂 Glued some aluminium kitchen foil under it to be the reflector.
Grow lights is actually a 5 meter long led strip that I cut and soldered into a for to create 12 lines of LEDs under the reflector. Soldering each of the 12 pieces in to one another so that I can do the turn that is needed to create 12 straight lines.
Now I got to tell you what I spent the next 3h doing. The led strip has a adhesive tape under it so you can just use that to stick it under the plugged them in to the 12V power supply. Now who would have known that kitchen foil and the cheap led strip would create a short? Well it does so next I spent ripping the foil off the reflector and also the adhesive side of the led strip. Fun fun fun 😀 Man I was pissed off but at the end I got all removed and all the LEDs in the strip light up again.
Regarding the grow lights. I used this out of eBay. It says 14,4W. Now my power supply is 60W so it is plenty. After test running the rig for few hours I noticed that the power supply is heating up a bit. Just a bit but enough for me to worry a bit. Well turns out the led strip is 14,4W per meter and there is five meters in the whole roll. Of course I used all of it. For five meter run of the strip it totals to 72W. 12W over the power supplies max load. Now odd thing is that in theory when the max load is reached the power supply should automatically cut power as it thinks its shorting out but it does not. This makes me think of a future add on before the workshop burns down is to add a fuse to each out let. It really needs to cut power in case more load is applied then it can handle. Also ordered 120W power supply to compensate the power need.
Now all hydroponic applications need to have a fan that circulates the air around the plant leaves. Plans use up CO2 around the leaves really fast so the steady flow of air will make sure they always have lots of fresh air to go through. I got a un-used computer fan and wanted to mount that on the grow light top. Made a pice of wood with a angle that would make the fan point little inwards and screwed it to the top. Happy with that solution.
I screwed the sensor BME280 to the top of the grow lamp shade and the camera under the grow lights near the spine. The fan, sensors and camera required an extended cables and I accomplished that by taking a short grow cable and cutting it in half. Soldered one and a half meter of extension to each cable. Hope the length of the cable will not be a problem.
Electronics to the base
Added all the electronics to the base. Air pump, power supply and the Spark core. Ran some mains power into the box and used Wago connectors to route the power to the right places. Then the power for the water pump, the air tube and the temperature One Wire sensor I pulled from the little grove in the spine into the plastic box full of water and turned everything on to see if it works. Power for the Spark Core I needed to run directly from a usb charger. This I plan to replace with a custom power down step converter.
Thats again enough for one day 😀
- First ever connected setup utilising Spark Core.
- Still need to setup the Step up adapter between the Spark Core and 5V relay board.
- Light sensor and the camera are not utilised yet. Need to figure that out.
- That little load issues created two additional todos. Bigger power supply and fuses.
- Little odds and ends before I can start running the Version 1 🙂 At some point the improvements will need to be done into the V2 🙂