Pages: [1]   Go Down
Author Topic: Grow Room Controller  (Read 4337 times)
0 Members and 1 Guest are viewing this topic.
Oregon, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just finish publishing my first big project smiley-mr-green. It's a grow room controller that uses an Real-time clock and the TimeAlarms library to control a grow light, the arduino takes readings using a SHT15 digital temperature and humidity sensor that allows it to maintain the temperature using a heater and exhaust fan. It also logs data and events in two separate files and organizes them in a directory structure like so: "YEAR/MM/DD/". The controller displays info using a Serial LCD display and debug info over the Serial Port. I consider myself a learned novice at C++ so it's code is not to awesome smiley-roll-sweat (I think it could lose some weight considering it takes 32Kb smiley-eek-blue). Any polite criticism is appreciated  smiley
Here's a link to my project page: http://arduinogrc.blogspot.com/
« Last Edit: September 30, 2011, 09:47:54 am by Nik G » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Code looks not bad, reasonable amount of comments, good use of functions (did not scan all 900 lines smiley-wink

I see some repeating patterns that could be combined in some functions (esp LCD math to display values /10 & %10 )

Furthermore you use Strings quite extensively, rewriting the code so you use only char arrays could shorten your code.
Yes you should estimate how long the arrays need to be but that is not too complex.

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Oregon, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Code looks not bad, reasonable amount of comments, good use of functions (did not scan all 900 lines smiley-wink

I see some repeating patterns that could be combined in some functions (esp LCD math to display values /10 & %10 )

Furthermore you use Strings quite extensively, rewriting the code so you use only char arrays could shorten your code.
Yes you should estimate how long the arrays need to be but that is not too complex.



Awesome. I'll work through those and release an update along with a version that'll fit on an Uno once the code loses enough weight lol
Thank you for you input  smiley
Logged

Oregon, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I Just finished. Again, thank you rob for for looking it over, I did what you said and now there's only one string(which is a function) and the code for displaying numbers on the LCD is streamlined. It is now small enough to fit on an Arduino Uno and I saved enough space to add a humidity controller  smiley-mr-green.
Check it out: arduinogrc.blogspot.com
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Another step to take is to place const char array's in flash memory, so they will not use precious RAM. Search for PROGMEM ...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Cardiff, UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
Programmer of all sorts
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like a sweet little project smiley  I have to ask; what crop are growing?  smiley-twist
Logged

My Arduino 7 segment LCD/LED library

http://code.google.com/p/arduino-seven-segment/

Maidenhead, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 46
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Great job.  One addition could be using your ethernet sheild to tweet status changes: "Boy it's cold in here [15C], turning heater on."  You could then view the twitter stream to see what it's up to in real time, which would avoid you having to download files from the SD card.

I have to ask; what crop are growing?  smiley-twist

Personally I don't want to know...  smiley-zipper
Logged

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

Heh, no pics of the grow room.  smiley-cool
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8474
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
now there's only one string
If you meant String it would be nice to get rid of that as well so you don't pull the String library in at all. That must be fairly large.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Pages: [1]   Go Up
Jump to: