Hydroponics project with Rpi PH EC and the works (In progress)

Updated 03-02-2018!

About This Project

I am going to try to make a hydroponics project with Cayenne. I mainly liked not having to do the web based and some of the logging features. However I am not sure how well I will be able to maintain the PH and EC levels with the triggers setup the way they are. I may have to have some pieces that are coded in the device driver so I can have more control maintaining the water parameters. We will see it is my first project in cayenne.

I got the EC board and probe setup now. Lately been busy changing plans a bit ended up making an intelligent doser with a pro micro board.So took a while to write the code for that. Also, I have to do a lot of smart averaging to get the sonar to work reasonably well on the Rpi. So I was working on a ATiny trinket board to be a I2C sonar backpack. I ended up having a lot of trouble with it due to not knowing about the PI I2C bug where it doesn’t clock stretch right. I also had problems with the I2C library for the slave. I also ended up slowing down the bus on the Rpi and so far that is working with my test code. I just need to either setup the sonar/trinket with a level shifter or wait a long time till I get my 3.3V sonar module in from china. lol

What’s Connected

Triggers & Alerts

I will attempt to use what I can but some things maybe not so much…


Not sure yet maybe for recycling the tank water.

Dashboard Screenshots

What I got so far…

Photos of the Project

4 channel Doser

Rpi core setup




Nice! Excited to see your continued progress. :slight_smile:

Bump… Updated some of my progress.


Now I got the I2C backpack working for the sonar sensor. I found out I couldn’t do the echo/trigger on the same pin on this model I had. :frowning: So it required some rework and hacking of the ping library to change polarity of the trigger signal since I didn’t have a non-inverting buffer handy. I also just wanted to have some isolation on the USB pin that I had to share with the trigger pin.

For giggles I add the schematic too… This is with the fix.

1 Like

Thanks for sharing your updates!

Looks like you might have a good setup to show off here :slight_smile:


1 Like

OK 8 plug relay box almost done. I have to see about a cover plate and a strain relief for the power cord.


well got the relay box working and getting the box for the RPI setup. Next the plumbing for the probes and the doser injection. Then we see how complicated the code gets to get this all really working.


Well I ran into some problems with my truck and sort of got distracted from my project. lol Then I wasn’t paying attention and killed my seedlings I had going… I really need to maybe make up something for automating keeping my seedlings alive first. :frowning:

Blockquote Killed my seedlings I had going… I really need to maybe make up something for automating keeping my seedlings alive first. :frowning:

Done exactly this myself :roll_eyes:

Have been tinkering in spare time for 6 months on this and seem to be working from the end backwards!

Working on similar project will post some stuff at some point, mine is currently based on arduino hardware, will keep my eye on one this as I did start the project with a Pi and then moved across to arduino, can I ask what is the main reason you opted for the pi? Local server or something else?

My system should do similar features to yours, I have many parts working but still many to do - what are you using for EC/TDS sensor, I have found getting one for sensible money difficult. PH was simple/cheap enough… Just building the ‘doser’ module at the minute, already have the environment and feed stuff sorted seems to be working okay


I opted for the PI because it seemed like it would be more able to do complex things with it and I could write the code in python. The other reason was just because I already had a PI board laying around collecting dust. I ended up parsing out some of the functions to mini Arduino boards. So yeah maybe it been better just to use a single Ardunio board… Shrug…

As for the EC/TDS probe I used this one below because I found a sweat deal on a used one for $20 now its like over $100. I wonder if they had messed up on the price because it went up not long after I bought mine. lol I just took the connector off and routed it to a BNC connector cable. Luckily they give you a sheet with the pin-out, and I didn’t need to use the temperature sensor in it.

Cheers for the reply, be interesting to see how it turns out for you, you definitely have a better understanding of these things than me, and a nice workshop :wink:

I am not familiar with python so probably limits me on the Pi front.

That sensor was a sweet deal. I can’t find anything for less than $100 either :persevere:

Did you use a module or link directly to Pi - Meaning was this simply a case of analog reading between two probes or is some circuitry involved in the middle - most the PH and EC probes I have seen seem to have a separate module with them.

I have seen some DIY versions that use Eurostyle plugs as the probe - unsure on accuracy though.

I’ll keep my eyes on the project, at my end I’m hoping to get something up and running and then open it up to an opensource approach and work with a group to improve etc. These controllers should be available to people. Commercially they are just extortionate!


If I understand what your wondering correctly I used the Atlas EC module it was about $58 on Amazon. You could do a DIY one probably for a lot cheaper, but yeah not sure how accurate it would be etc.

Yeah I did come across at a controller like this one that looked like it was open source… https://thegreenautomation.com/documentation/ . The software was fairly complicated to setup the way they did it. I had to install visual studio and other add on stuff to get it to compile. I sort of gave up on it after I decided to to use my PI instead.

Well life has tossed me a bit of a curve ball lately causing much distraction and stress. So the project sort of got put into idle mode… Hope I can get back to doing some stuff on this again. I wasn’t too far off at least getting everything put together… :frowning:

I just thought I stop by and say sorry folks I got distracted this summer and I getting married soon. Needless to say I haven’t worked on the project for a while now. I hoping that I get back to it this winter when things settle down a bit.

I have been working on doing the same thing for the past few weeks piecing it all together.
water temp
humidity/air temp
light meter
8 relays
ph meter
2 pumps ( just got to this they aren’t working/configured yet )

how did you get the pumps working with the pwm since they pi 2.0 from cayenne doesnt support pwm or a2d anymore?

I didn’t show that maybe very clearly but If I follow which pumps your talking about right. I just used a arduino pro micro board ( it was a knock off, but something similar) to act as a bridge (using a protocol similar to the atlas modules) between the rpi and the dosing pumps. I didn’t end up using pwm on them I just have it setup so you can tell it to turn on the dosing pump for so many seconds.

hey I just noticed they have that EC probe on sale again for $32 dollars… if anyone’s looking for one its a good deal. Just need to change the connector.

@pihydro.0001 you can control all this and send/recieve data using cayenne MQTT python library.
if you want i can help you out with it.

where is it on sell at? PM me the link please.
I was thinking about doing this. with the timed seconds per motor with the relay’s for the pumps to be on. I’m just scared to actually use cayenne for that since sometimes I click the on/off button and it might take 1 second or it might take 5-6. with a motor running that would be a big difference esp on a 20 gallon DWC tank.

What I really want is to be able to add buttons/tiles that execute scripts\path on the pi that would be amazing I’m going to look into that tonight.