Show Posts
Pages: 1 [2] 3 4 ... 7
16  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 13, 2013, 02:21:27 am
Quote
Minor but you can remove some some code in that -

'lcd.begin' performs a ''lcd.clear''
'lcd.clear' sets the cursor position to 0, 0


Will remove some codes as explained above...

Quote from: wildbill
It looks to me as though you should set lastPump to millis() when you turn the pump on, not adjust it when you're turning it off.

As if i can see that working .. smiley, anyway i shall test it in the afternoon and update the post here.

Thanks

Regards

Taz ..
17  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 12, 2013, 03:19:52 pm
Hello . .

Find attached code still titled under Rev 5 (Updated Version) smiley

All is well, except for the "Pump time off" .. .. as explained above in regards to control behavior of pump.

Thanks . .

taz ..
18  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 12, 2013, 12:25:27 pm
Im actually not at home with my pc.. i cannot post the latest code right now.. i shall do it as soon as i can!

The way the pump behave is i made it run for 7 seconds before going off or moist percentage is > than 90 ..

Actually i just simulated it with a led, the reason behind such action is my pump output flow is quite big, so to prevent any flooding from happening i think of this.

my led representing the pump would light on for 7 sec on removing the soil probe,since i kept these in the air,my led will flash off and then on again because its still under 85 % ..

since i updated my code with a timer for my lcd display as being flashy, my pump wont stop with the timer 7 sec, only if soil percent >90% ..

I shall post the code at soonest ..

thanks!!
19  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 12, 2013, 09:31:58 am
No not all.. its just displaying up to 2dp.. i think it has an incremnt value of 0.5.. aprox. if im not wrong.. i know the lm35 has a resolution of 10 mv per degree celsius.. ..

i do know that it will be far better if this voltage would have been amplifie before being read by the analog pin .. but still its fair enough for the actual project.

Any help on my pump time off issue.. i did try to change values of the timerRate but to no avail.. is there anything im missing.. ??
20  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 12, 2013, 08:53:37 am
Thats great bill, . .

I did as you suggested, reading the pin twice, and ignoring the first reading,. .  Im getting my real temperature reading . . Room temperature actually reading 26.86 *C . .

My only issue now is, the pump time off . .

Will be looking in that!

Thanks again . . + karma for you ..  smiley-grin
21  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 12, 2013, 08:00:33 am
Thats make some sense why the reading is as such.

Do i need to take another reading on same pin and ignoring the previous or can i take a sample of 2 to 3 readings and then calculate an average ?

Another thing i just updated with the code:

I removed alll serial command lines, and eventually my lcd display menu would act as flashy, i implement a timer [millis()] with a delay of 450ms, and my flashy display get solved. However, my pump conditions to run is either run for 7 sec or if percent moisture is > 90 %, when i remove my soil probe, it appears as if my timer with the pump is not working, that is it does goes off after 7 sec. Which it did before i implement the timer for the lcd display.

Code:
void pumpControlOFF (){
  if (( millis() - lastPump >= timerRateX ) || (percentage_Moist >= 90.00)){
    lastPump += timerRateX;
    digitalWrite(pump_Active,LOW); 
    pump_Status = false;
  }
}

Code:
  /*--- Function for swap menu display ---*/
  if (millis()- lastdisplay >= timerRateZ)
  {
    lastdisplay += timerRateZ; 

    SwapMenu();
  }
Thanks
22  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 12, 2013, 02:51:08 am
Hello,

I did close up all serial comminication within the code.

Change the Switch button place to A2, analog pin, Enable pullup resistor on the pin as well.

All is working nicely as it should, still some fine tuning is needed please . .

I know that i did place a flag called ButtonRead, to activate my Swapmenu function, and after each 6 seconds the Controller will read that, explaining my delay in swapping display on my LCD. I did that, as what explained in the arduino tutorial when activating analog pins to act as digital, a delay should be implemented to avoit jitty and electrical noise in reading analog sensors. Any approach how can i tackle this more easily.

Code:

    switch(itemIdx){

      /*-- Soil Moisture Reading Sequence--*/
      // Allow current to flow in Forward and Reverse direction while reading value from Soil Moisture Probe in both direction. Allowing delay between reading of analog sensors. 

....

    case 4:
      ReadPhoto = true;
      break;

    case 5:
      TempRead = true;
      break;

    case 6:
      ButtonRead = true;
    }
  }


Code:
  /*--- Function for swap menu display ---*/
  if (ButtonRead){
    SwapMenu();
    ButtonRead = (! ButtonRead); 
  }

Am having a weird issue, since morning, before coding the Revision 5 of my code, i.e. still running Rev 4 my temperature reading is unstable, it display values like 45 C and 18 C.
Yesterday night, before it did work nice, displaying amb. temperature in the range of 24 C.

When i run the code for temperature alone, i get correct values. . . Where is my mistake here . . . ? ? ?

Thanks for your time and consideration towards my issues . .

Find attached Rev 5 of my code.
23  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 11, 2013, 03:45:11 pm
Helo Bill,

You got the pin out of the forest . .   smiley-grin, it seems, that i did add new case number and forget to update the value for itmIdx & N_items;

Quote from: wildbill
What's the purpose of funcActive, ReadPhoto and TempRead?

funcActive purpose is to make the function "pumpControlON()" only after reading percentage moisture value, as my threshold value to run my pump rely on this value.
Why, i used this state, because since only after about 3000UL will i get my percentage reading,whereby the loop speed is in ms.

ReadPhoto & TempRead are used to take reading from analog pins within a time interval, so as to prevent noise occured when taking reading on several analog pins at almost same time.

Thanks for your treat bill, my sketch is working nice.  smiley

However,debugging continues smiley, my display is still swapping menu automatically, and when i pressed my switch it swap the menu quicker.

Just a suggestion here : pin 1 and 0 are for Tx & Rx, im additionally using Serial.begin, while having connected my switch button on pin 1 and moreover activated the INPUT_PULLUP.

Any suggestion if the bug is derivating from these, stuffs.
[edit] i just comment on the : // Serial.begin (9600) . . and here my display work as the code dictates . . smiley, but when my switch case for modedisplay return to 0 each time, everything seems to reset and start over again along with small bugs.

If im commenting the //Serial.begin (9600), should i also be commenting all instruction within the code making use of the serial port ?
(. .trying this in meantime . . )

Explanations are welcomed;

Thanks  . . .

taz . . 



24  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 11, 2013, 11:59:46 am
Hello,

I have made modifications of the code and compile all what i need to run the Greenhouse project up to here.

I shall resume whats in there quickly:

1. Monitoring soil moisture - - Setting pump to active upon a threshold value.

2. Monitoring temperature -- Setting Fan active upon threshold value.

3. Monitoring light intensity -- Setting Grow Light to active upon threshold value

4. Display Soil moisture percentage on 16 x 2 display

5. Display raw analog of photo reading and ambient light condition value on LCD

6. Display Temperature reading on LCD

7. Display Output status if active or inactive on LCD

8. One pushbutton to change in between menus of the LCD.

-------------------------------------------------------------------------

Attached herewith the code, which i compiled and shortened at my best try . .   smiley-slim

However, i running some bugs as follows:

1. My temperature part of the code is not working, returning me a value of 0 both on LCD and serial port. Neither my FAN being activated.

2. WIhtout pressing the pushbutton, my Lcd menu is changing automatically, which i do not want.

I have tested all parts of my hardware till now, they seem to be ok, as i did run the temperature code part alone and it worked nicely.

May be i have an issue with my switch button, i do not know if i can enable INPUT_PULLUP on pin 1 of the uno. . . as in almost all e.g. they are using pin2.

Thanks for any suggestions, i shall appreciate it as much, as im learning.  smiley

Regards

taz . . .
25  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 10, 2013, 01:52:41 pm
Oops was busy adding new lines and forgot about modification.

A small recap please,  smiley-kitty . .

I need not to test for a boolean if it is true or not right ?

intead of above i should i be using something likewise :

Quote from: lloyddean
And didn't you mean -

Code:
    if ( ! FanStatus )
    {
        FanControlON();
    }
    else
    {
        FanControlOFF();
    }


Im getting to it, now smiley-sweat .. thanks again . . 
26  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 10, 2013, 01:29:42 pm
Hello,

Im back again after some workings on the code.

I added up from the previous revision, an lcd 16x2, with some new lines in the code, but here im stuck with some bugs in the code.

My temperature part of the code is not giving me values. I suspected some wiring went wrong, however, when i test the temperature code alone, it works as nice as it should be. . .

With this new revision i added the lcd, and some menu to be displayed like, intro menu, soile percentage menu and LDR Raw reading. . I went through a pushbutton to swap between menus.

Here also without pressing my button, the lcd is changing menu.

Find herewith attached my code. Any suggestions where i can tackle for this bug.

Thanks in advance . .

 

27  Using Arduino / Programming Questions / Re: Noob questions on: March 07, 2013, 12:56:03 pm
Jim suggestion is right  . . how is your switch wired, is it pull up or pull down.

Based on these facts, you will test the status with either low or high, depending on your wiring, something like:

Code:
ButtonState = digitalRead(SWITCHL);

if (ButtonState == low)
{
  // execute your needs here
}

additional link supplied by jim, i request you to go through a basic tutorial, which i myself start with when i first had my arduino, read it, its so fun and make things so clear and comprehensive, and im pretty sure you will like it.

Here you go : http://www.ladyada.net/learn/arduino/lesson1.html

..............

taz . .
28  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 07, 2013, 12:31:32 pm
Quote
You have some very repetetive code there. Consider adding a function that takes a boolean and a string. Let the function print the string, test the boolean,  and println "active" or "inactive" depending on its value. Then use if for all that conditional printing you're doing.

Thats seems interesting, i will try to do this . . any help or source where i can start to grasp a good comprehension about the subject. I think i will be starting with Arduino Reference for string in the meanwhile . .

Thanks . .

Quote

'false' is always zero, not false is alway not 'zero' yet not 'exactly' 'true' while 'true' is only 'true'.


Seems confusing, but i shall read it for a proper understanding, i shall keep things posted here, and in time of trouble, i shall ask for a push from time to time . . smiley-wink

I am actually editing my code for implementation with a 16X2 lcd, and display all my serial print to the latter.

Thanks for your precious time and support . .

See ya ..

taz ...
29  Using Arduino / Programming Questions / Re: Noob questions on: March 07, 2013, 11:05:10 am
you will need to have something as such wiithin your code :
Code:
pinMode (SWITCHL,INPUT);

and the use of
Code:
digitalRead(SWITCHL);

test the status of SWITCHL and execute what you need it to do, again IF statement will come into action.

You may want to use the debounce method to avoid incorrect reading of data.

.........

taz ..
30  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 07, 2013, 10:59:49 am
hello!

Thanks for the suggestions..

Ok i did get it, i will work to shortened and remove some repetitive codes further up, but will have to do some more reading what i see  smiley-draw

The serial print for now is just to test if code is running properly, however i will be using LCD.print to display all these stuffs which is in serial.print for now.

Quote

Code:
Serial.print(" Pump Status : ");    Serial.println((pump_Status ? "ACTIVE " : "INACTIVE "));
Serial.print(" Light Status : ");   Serial.println((LightStatus ? "ACTIVE " : "INACTIVE "));
Serial.print(" Fan Status : ");     Serial.println((FanStatus ? "ACTIVE " : "INACTIVE "));


One question here, how will the code know that if pump_Status is 'true' to display ACTIVE or INACTIVE . .

thanks
taz . .
Pages: 1 [2] 3 4 ... 7