Billie's Hydroponic Controller

Hi Billie,

Very very interesting project you've got here.
I'm also working on one of my own, to control EC, PH and measure humidity and temperature.

I'm trying to test your code, so i'm using arduino 1.0, all the libraries needed (including eeprom and extended eeprom) but i'm facing the same problem DerekPDX had (posted on 30th january).

Do you have an idea about how i can manage this issue?

Many thanks

Hello,

I've figured out why you get the error.
There's been a couple of changes in the library...The current version uses EEPROMEx.h as filename whereas the old library used EEPROMex.h. Change that in the code (#include <EEPROMEx.h>) and the first compile errors disappear.
Next you'll have to edit the EEPROMEx.h file...Change #include <EEPROM.h> into #include <avr\EEPROM.h> and this makes the rest of the compile errors go away...
There's also an #include <avr/EEPROM.h>, but I think this is an error and should be #include <avr\EEPROM.h>. If anyone can collaborate?

Hi Billie,

so I got my sainsmart kit today (the one with the mega2560, the tft shield and the tft itself.

First of all (and after paying more money for customs and customs service that for the kit+shipping itself) I was quite pleased with the overall quality of the product.

I also stumble in that problem with EEPROM.h. What I did was to remove the line that includes EEPROM.h inside the EEPROMEx.h. It was a matter of error/try so I can't have any valid input on why it works (maybe I'll get to that latter If I have the time to do further testing).

I can also confirm that the SDcard slot on the sainsmart TFT works "out of the box" with your sketch, so cheers for the sainsmart guys.

I'm going to setup some probes and make some lab tests in order to get everything working before I'll go live.

The only issue I have is sometimes the "buttons" don't work. Then I wait 10 seconds and try again. Sometimes it works, sometimes it doesn't and I have to wait a bit more. It's very strange. It happens for instance on pH Settings page 2 with the back button (lower left) and soothing ON/OFF button. Is there something you experienced yourself?

best regards,
Tiago

Hi Billie,
Thank you for the fast reply, the code works perfectly now (on arduino 1.0 and 1.0.5).
I've PMed you to talk about my project without getting off topic here.
Charlie.

tmarquespt:
The only issue I have is sometimes the "buttons" don't work. Then I wait 10 seconds and try again. Sometimes it works, sometimes it doesn't and I have to wait a bit more.

Hello Tiago,

The buttons react slowly. That's because of the 'delays' that are still in there. Just keep pressing the button until you enter a new window and everything is ok :wink:

cybergogo:
Hi Billie,
Thank you for the fast reply, the code works perfectly now (on arduino 1.0 and 1.0.5).
I've PMed you to talk about my project without getting off topic here.
Charlie.

Charlie,

Glad to see you getting it to work :slight_smile:
Hope to see a movie when you get everything up and running :wink:

With kind regards,

Billie

Hi Billie,

On PH Settings, the setpoint and hysteris appear both as "NAN".

what am I missing here?

thanks,
Tiago

Tiago,

Can you elaborate a bit further? NAN = Not a number?? Or what?
Do you get errors during compiling?

With kind regards,

Billie

Hi Billie,

this is what I mean.

right now the probe is disconnected, but with the probe the behavior is the same. I'm using your unmodified sketch (other than the pin for LDR)

+/- buttons on setpoint and hist don't work. Maybe because of this NAN issue.

any hints?

regards,
Tiago

anh... just hit me... I had a problem with eepromex.h and eeprom.h
made some changes to eepromex.h and probably that's where my problem lies.

gonna clean up the eepromex library.

First of all...Cool to see the controller being of use to someone :wink:

tmarquespt:
anh... just hit me... I had a problem with eepromex.h and eeprom.h
made some changes to eepromex.h and probably that's where my problem lies.

gonna clean up the eepromex library.

That could be it...When you enter the pH adjustment screen the program reads the values for setpoint and hysteris from eeprom...
You could also try and whipe the values stored in eeprom. I faintly remember having problems in the beginning because wrong values stored in eeprom...

Real neat controller Billie!!

Great work on setting up your hydro setup. It's amazing how many plants you have squeezed into that space. It's great to see other projects and share the knowledge. Looks like there are a few people interested in controlling their own food production.

I just have one constructive feedback on the plant physiology side of things. If your able, you should really incorporate EC/CF control. Although pH controls nutrient uptake, nutrient availability is equally important. EC is a great tool for controlling, among others, such things as internode stretching, hardiness and taste. You can also control visual aspects such as cracking/splitting with EC control (particularly important with tomatoes). I think you'll have better control of plant size, especially during seasonal changes (i.e. winter vs summer ).

I'm making a similar controller using a mega connected to a raspberry pi with a 10 inch touch screen controlled by a website.

Anyway, that's my 2c worth, I look forward to your future releases!

Regards,
Damian

@Billie

Spot On!
clearing the eeprom has done it :slight_smile: Wouldn't have thought of that.

thanks,
Tiago

Hi Billie, now that it's setup, the issues begin :slight_smile:

Regarding the LDR in you sketch you have int lightSensor = 60; I can't get any readings on light (it's only bouncing between 24,25,26) no matter the actual light condition. I know the LDR works because if I set the lightsensor to pin 14 it gives me a range 250~32000 (32000 with the phone led flash next to the ldr). Any hints?

Also would love to know if you have any newer version as this is already a couple months old and you probably have tweaked it already for some issues encountered along the way.

I'm going to kickstart my NFT test project

best regards,
Tiago

Damo1984:
I just have one constructive feedback on the plant physiology side of things. If your able, you should really incorporate EC/CF control. Although pH controls nutrient uptake, nutrient availability is equally important. EC is a great tool for controlling, among others, such things as internode stretching, hardiness and taste. You can also control visual aspects such as cracking/splitting with EC control (particularly important with tomatoes). I think you'll have better control of plant size, especially during seasonal changes (i.e. winter vs summer ).

Hey Damien,

Thank you! :slight_smile:
I already measure the EC value but for now with a pen instead of using the controller. I couldn't find a good priced EC module to put in the controller...
EC control is very important, I know. To high and the plants don't grow well and to low and the same happens. For my peppers I let the EC value swing from 1.8 to 2.4 depending on the weather conditions.
In the new controller EC measurement will be incorporated. But as stated earlier I'm still learning how to use Eagle, so making the new board will have to wait until I and my finances are ready to do so :wink:

tmarquespt:
Hi Billie, now that it's setup, the issues begin :slight_smile:

Regarding the LDR in you sketch you have int lightSensor = 60; I can't get any readings on light (it's only bouncing between 24,25,26) no matter the actual light condition. I know the LDR works because if I set the lightsensor to pin 14 it gives me a range 250~32000 (32000 with the phone led flash next to the ldr). Any hints?

Maybe there's a problem with your A4 pin..?? Do you mean you use A14 = 68? If so then use that pin :wink:

tmarquespt:
Also would love to know if you have any newer version as this is already a couple months old and you probably have tweaked it already for some issues encountered along the way.

Nope, no new version to be tested until this season is over. I don't want to risk my harvest by overdosing at the moment. This winter I'll be recoding the device to suit the new hardware (EC, new screen, ethernet module).

tmarquespt:
I'm going to kickstart my NFT test project

Nice setup!! :smiley:

With kind regards,

Billie

It would be a big help if you could show us a wiring schematic for your setup, it looks nice!

Are these simple enough? :smiley:

congratulations for your perfect project!
I want to make an automation to control the electrical windows of my greenhouse via sms
and i want to ask you if this touchscreen is readable on sunlight conditions.

Another question i have is : Do you think that this system will work stable on real conditions on a greenhouse?
My greenhouse is about 5000 m2 ,with high temps.

Sorry for my english 8)

v4nelle:
congratulations for your perfect project!

Thank you very much! I did my best at the time, probably could do a better job programming it, but as you say it works so...Call me lazy :wink:

v4nelle:
I want to make an automation to control the electrical windows of my greenhouse via sms
and i want to ask you if this touchscreen is readable on sunlight conditions.

When the sun is shining directly on it it's difficult to read the screen...

v4nelle:
Another question i have is : Do you think that this system will work stable on real conditions on a greenhouse?
My greenhouse is about 5000 m2 ,with high temps.

It works stable, although you probably will need to buy better pH probes then the one's I've used. Also and this is an important one. Make sure the controller is shaded. High temperatures will mess up the stability of the device. Next year I will be installing it outside of the greenhouse in a waterproof housing and in the shade...

Have fun and if you got it working post some pictures here!! :smiley:

HI Billie

Please bear in mind I'm a complete noob, just had my board for about 5 days.

Awesome sketch. I'm waiting on a few more parts to arrive, mainly cabling cant really hook anything up using my sainsmart board and shield tft, it pretty well covers everything up including the reset button.

I couldn't get the ITDB02_Touch library to work so I am using Utouch and its works fine until I power the board down. When I repower the board the touch screen does not work until i 1. reload sketch several times 2. touch a 100 ohm resistor across reset and gnd. to reset the board.

I am using 1.0.5 but i did try it on 1.0 and it does the same thing. I've pasted the top part of the sketch where I have changed it the rest is as you wrote it.

I've been searching google for a answer for the last four days but I cant find a solution, but I probably wouldnt see it if I was looking right at it.

Anyway I hope you or somebody can give me some ideas because I am hopelessly stuck.

Thanks

#include <UTFT.h>
#include <UTouch.h>
#include <UTouchCD.h>
#include <SD.h> //SD card library
#include <Wire.h> //One Wire library
#include <RTClib.h> //Real Time Clock library
#include <EEPROMEx.h> //Extended Eeprom library

UTFT myGLCD(ITDB32S,38,39,40,41); //pins used for TFT
UTouch myTouch(6,5,4,3,2); // original values 6,5,4,3,2);

#define dht_dpin 69 //pin for DHT1

void graphLoop()
{
if (true)
{
if (myTouch.dataAvailable())

{
myTouch.read();
x=myTouch.getX();
y=myTouch.getY();

if (page == 0)
{
if ((x>=255) && (x<=312))
{
if ((y>=17) && (y<=47))

As for the NaNs for pH: I think it is because you might have a problem writing / reading float values.
I believe in killing floating-point arithmetic whenever practical.
It is usually not difficult to find ways to avoid it.

// This is evil:
float pH = 0.0178 * sensorValue - 1.889;

// Instead, use:
int pH = (2 * sensorvalue) - ((11 * sensorValue + 9445) / 50);
// This gives you 100 times the real pH,
// so if the real pH is 5, the pH variable will be 500,
// and if the real pH is 5.25, the pH variable will be 525, etc.
// Just insert a decimal point (or decimal comma!) for display.