Go Down

Topic: Billie's Hydroponic Controller (Read 81 times) previous topic - next topic

acuser

#105
Nov 23, 2013, 05:17 pm Last Edit: Nov 23, 2013, 05:42 pm by acuser Reason: 1
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))


odometer

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.
Code: [Select]

// 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.

retrolefty


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.
Code: [Select]

// 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.



Great advice, use integer for analog sensor math and just convert to float for display purposes if you must.


odometer

I found this in the source code:
Code: [Select]

            void fotoLoop()
            {
              lightADCReading = analogRead(lightSensor);
              // Calculating the voltage of the ADC for light
              lightInputVoltage = 5.0 * ((double)lightADCReading / 1024.0);
              // Calculating the resistance of the photoresistor in the voltage divider
              lightResistance = (10.0 * 5.0) / lightInputVoltage - 10.0;
              // Calculating the intensity of light in lux
              currentLightInLux = 255.84 * pow(lightResistance, -10/9);
            }

What is that [font=Courier]-10/9[/font] near the bottom?

acuser

Yes Yes Yes

I solved my problem

I think the Sainsmart shield V1.0 is not compatible with UTouch Library. I tried using the ITDB02_Touch Library and
it works great. You need to change  WProgram.h to Arduino.h in the cpp file, this may only be necessary if your using
IDE 1.0 or later. Like I said in my previous post Im a noob, but this worked for me.

Well until my next problem
Later Guys

acuser

Im starting to breadboard some of this project and im confused on pins

code
define dht_dpin 69 //pin for DHT1
int lightSensor = 60; //pin for Photoresistor

I have read the thread and looking at Billies drawing DHT =pin  A15  Photoresistor= pin A14

Im guessing the 60 and 69 could be the atmega but how do you get a15 and a14 from that.
I know the A15 and A14 is the way to wire it, im just trying to understand and learn what I can of the code.

This is a lot harder than I thought it would be Im just hoping I can fumble my way through and get most of it working.

Thanks Guys

dissention2112

Hey Billie,

For the hydro setup your running this for, how many plants are you tending this to? And are you using the Arduino programming language or C#?

I am very interested in building this setup and have been looking into the parts but I want to get the correct parts and don't want any issues.

Jshwaa

Billie,

I'm sure you've been asked this, so forgive me for not reading the previous 8 pages of posts on this subject, but...

What exactly does your controller do in response to a pH reading being above or below a setpoint?

I understand that you have fans to 'control' temperature, but what does your controller do in response to a temperature that is too low, or to a temperature that is too high despite every fan being on?

Also, for your data logging to the SD card....

What is the format of the information that you log?  Do you log all sensor information continuously, or do you log 'events' such as broken setpoint thresholds (high/low temp/pH)?

Thanks in advance.




bIG_dEAL

#113
Jan 14, 2014, 06:08 am Last Edit: Jan 15, 2014, 08:57 pm by bIG_dEAL Reason: 1
Hi Billie.

Before I ask my question I wanted to say many thanks for all your hard work. This thread has been by far the most useful resource in building my own (very similar) project. Hands down awesome!

I just wanted to ask... Have you tried to use the integrated SD card slot on the rear side of the LCD/TFT panel?
When I use the adjustable shield directly on top of the Mega, it works, but with the (8-bit) wiring like in your picture and adding MISO, SCK, CS(SS) and MOSI  to pins 50,52,53,51 (and shield's 16,17,35,34)  I have no luck so far. I am not sure which other pins I should connect or if it is at all possible. I do not know if you are using the break-out SD module for convenience or if you have ran into problems also.

I would really appreciate if anyone can help, I hope it is not too off-topic, but I am still quite a noob and this is the first time I am really running out of ideas. I don't mind to use a separate module but for the sake of compactness I would like to at least explore the idea of using the integrated SD.  I am using Mega 2560 with a Sensor Shield and a custom cable, connecting the same pins on the TFT shield as in your photo and their counterparts on the sensor shield. Everything works, except the SD-card.

Thanks!

gaobeihua

Thank you very much for your great work.
I am new... trying to learn form zero... and with very little free time. Would it be possible to get a diagram on paper to unferstand how to do the connections?. I have already bought all the parts, but my knowlegde is quite limited... so I really do not think I can do it unless you help me how to.
Keep up with your great work. Congratullations
Gao


Tonno


zatheros7

Trying to replicate this project, playing with the software while waiting for parts to come in.
I am getting this message when I compile on both ide ver. 1.0 and 1.05
Billie_s_Hydroponic_Controller_V1_1_2b.cpp:39:57: error: ITDB02_Touch.h: No such file or directory
Billie_s_Hydroponic_Controller_V1_1_2b:45: error: 'ITDB02_Touch' does not name a type
Billie_s_Hydroponic_Controller_V1_1_2b.cpp: In function 'void graphSetup()':
Billie_s_Hydroponic_Controller_V1_1_2b:159: error: 'myTouch' was not declared in this scope
Billie_s_Hydroponic_Controller_V1_1_2b:160: error: 'PREC_HI' was not declared in this scope
Billie_s_Hydroponic_Controller_V1_1_2b.cpp: In function 'void graphLoop()':
Billie_s_Hydroponic_Controller_V1_1_2b:498: error: 'myTouch' was not declared in this scope

Any insight or help would be appreciated

bIG_dEAL

@zatheros7

The error should be self-explanatory.
At the start of Billie's sketch read:

Software Requirements:
  ----------------------
  -ITDB02_Touch library

You either don't have it or have extracted it incorrectly. Should be in your libraries dir.
The rest of the sketch then can't compile as stuff from that library is missing, hence functions, definitions etc. don't make sense.

Don't want to be a troll, but this is quite "advanced" stuff and if this is what has gotten you stuck already, you will probably have a bit of a tough time.I got into Arduino just a few months ago and had no prior serious programming experience (bit of basic maybe). Started with the usual silly stuff and by taking small steps (in a quick succession ;) I can now read Billies code and understand exactly what is going on.

Good luck anyway! It's really great fun!


zatheros7

@ bIG_dEAL
Thanks for the reply.  And yes you are correct,  it was self explanatory. All the files appeared to be installed in the correct place, except it was not working.
After the fourth or fifth delete / start over/  reinstall cycle, it apparently installed properly and I was able to get it to compile.
( Now remembering similar problems from the past working on old IBM equipment running open object REXX.)
I too have been playing with the arduino for a while,  doing various and sundry exercises trying to gain a better proficiency with the software.
Just discovered Billie's project about a week or so ago. I had tried to do a basic controller a couple of years ago, using the practical maker PH board from Andrew Oke but was not happy with the fact it would only read / control half of the PH range. I wanted to be able to have ultimate control  up or down for my hydroponic setup. Here Billie has done it with super deluxe features and more. I should have most of my parts by the end of next week. Looking forward to getting this project completed. Once you get all the hydroponic parameters nailed down, explosive growth is a hoot!


P.S. Thank You Billie!

Go Up