Pages: [1]   Go Down
Author Topic: My Garduino Project 3 Box design  (Read 611 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi. I have a project ive been working on before. This is my very first arduino project. I am having a little trouble with my code and would like to see if anyone would have any interest in helping me out or give suggestions on my coding or wiring. Thank you.

* Growduino_v5.zip (26.57 KB - downloaded 5 times.)
« Last Edit: October 27, 2012, 11:35:53 pm by rcash88 » Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1251
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am sure that you will get a lot of help, but you need to be more specific - What is your program supposed to do? What is the problem? What have you already done to try and fix it?
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My Project is a 3 box grow-box for any kind of plants. It is two small boxes and one large box. Each have their own DHT11 (Temp/Humidity) sensor, very basic moisture sensor made from nails and resistors, and am still debating the other sensor i should use but I have it labeled in my sketch as a light sensor. All three boxes are lit by a custom LED panel composed of 100+ SMD LED strips of red and blue and have a split light socket for normal incandescent of CFL bulbs. There is an exhaust system made of PC fans and the cooling system is made from an old wine cooler box And there is a pump and drain system all witch are controled by an 8 relay module connected to my arduino.

My problem is my timing and other little bugs with my serial menu. Since i don't have a RTC then the time has to be set manually and the lights wont turn on/off according to my timing throughout the day. My GOAL is to make this thing take care of itself for at least a week straight. watering when the soil is dry and turning off the lights on schedule and maybe in the future making it log all activity.

The full code is attached on the first post
« Last Edit: October 27, 2012, 11:38:36 pm by rcash88 » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You've got hundreds of LEDs, temperature and humidity sensors, moisture sensors, pumps and relays. How about spending $9 and get a clock?

https://www.adafruit.com/products/264
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 I am going to buy one soon but i don't think the problem is 'the time' but more of the 'timing code'. This is my first time programming anything and i'm sure my 'grammar' isn't the greatest . The arduino will function properly for around 8 hrs and then only 1 or 2 boxes work then just one after a day day and a half. The arduino IDE will let me compile it so i know it works, just not for very long.

and i want this for my time
http://www.adafruit.com/products/255
« Last Edit: October 28, 2012, 10:22:06 am by rcash88 » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
float start_time;
float seconds_elapsed;
float seconds_elapsed_total;

Times should really be unsigned long.



Code:
  timeCurrent=millis();
  if(timeCurrent<*timeMark) {  //Rollover detected
    timeElapsed=(TIMECTL_MAXTICKS-*timeMark)+timeCurrent;  //elapsed=all the ticks to overflow + all the ticks since overflow
...

 if(timeElapsed>=timeInterval) {

You don't need to worry about overflow if you subtract. eg,

Code:
if(millis () - timeMark > timeInterval) {




You can save quite a bit of RAM by using the "F" macro for your string literals.

eg.

Instead of:

Code:
  Serial.println("Diag Mode is Running ");

Use:

Code:
  Serial.println(F("Diag Mode is Running "));



Using too much RAM might cause it to crash.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you very much. I will try your suggestions and let u know.

What exactly does the 'F' macro do to save ram.
And should i use the 'F' macro on ALL the serial.print and serial.println?
« Last Edit: October 28, 2012, 06:35:00 pm by rcash88 » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Those strings are already in program memory. It simply stops them being copied into RAM, of which you have a lot less.

Effectively the macro expands out to a bit of code that accesses the string directly from program memory rather than RAM.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And should i use the 'F' macro on ALL the serial.print and serial.println?

Yes, all the literal strings. There is no point for variables, which, well, vary.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Examples ...

Do this:

Code:
  Serial.println(F("Diag Mode is Running "));
  Serial.println(F("This will loop until other command recieved"));
  Serial.println(F("15 Seconds to push another menu item"));

But not:

Code:
  Serial.print(F(Fahrenheit(t1)));

That's because that is not a literal string.
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Those strings are already in program memory. It simply stops them being copied into RAM, of which you have a lot less.

Effectively the macro expands out to a bit of code that accesses the string directly from program memory rather than RAM.

One of the best F() macro explanations so far...
Logged

Pages: [1]   Go Up
Jump to: