Pages: [1]   Go Down
Author Topic: Arduino Mini based plant waterer with OLED and keypad input  (Read 1006 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,

Firstly I'd like to say I'm new to Arduino though not microcontrollers having used the PICAXE range before, also I'm new to C/C++ though not programming as I use Object Pascal (freepascal) and Basic (PICAXE) and a tiny bit of Python and even Assembler many years ago.

This started off as another PICAXE project but it became too complex a task to work with basic, especially the lack of functions or strings, so I bought an Arduino Mini and dived in.
I will say though that using the PICAXE usb<>serial cable and it's stereo socket helped a lot, I could use it at the same time as the Arduino usb<>serial, the Arduino's for programming and the PICAXE cable to view the output from my program.

Although it's not completely finished, I'm unlikely to continue any further programming / electronics now that it's working  unless something breaks, that part is 'complete'., I do have to add lighting though.

Anyway, here's the link to the youtube video

I would really like some feedback on the code as I'm new to C and I was having problems with character arrays, I cheated in the end and removed some for loops I was using and just cludged it a bit.

And here is the code, sorry it's 743 lines / 15,950 chars so the forum has refused it as inline text. See attached instead.

* plant.ino (15.58 KB - downloaded 16 times.)
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1422
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
though not microcontrollers having used the PICAXE range before

Welcome!

I left long ago and CactusFace is often around... Not a year yet for him.  I've seen one or two others from time to time.

You will notice not as much hand-holding here. The expectation to work hard for an answer is engrained in this site.  Just remember to post your code when you ask a coiding or interface question and the big boys & girls will stay happy  smiley-eek-blue

I use Uno 328 / Mega2560 / Mega 1284 / attiny85
Only the Uno and Mega2569 are stock
I also use ProMini / Mini Leonardo from the land of the clones

Logged

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

Hi and thanks for the reply,

I'm also on the picaxe forum but under a different name (technobug), I intend to use both in the future, the arduino for complicated tasks or tasks requiring fast processing and the picaxe for the simpler and cheaper tasks, a lot can be said for the picaxe, namely being able to write a usable program in just 3 lines smiley

 I'm going to experiment with having picaxes daisy chained via serial to an arduino and take it from there, the picaxes controlling steppers and servos and the arduino telling them what to do.

I really really want a 3d printer, but sadly Santa only brought me a Onesie lol
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1422
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and the picaxe for the simpler and cheaper tasks

That was my idea at first.  But, I just gave away a few weeks ago all of my PICAXE chips: 20X2, 08M2, 14M, 18M.... all in all, about $200 worth of silicon and parts. 

Why?  Because it is simply easier to use a tiny45 or a 328P-PU bare (internal RC @8MHz) for stuff.  Just one set of datasheets.  Just one compiler.  Just one set of reusable code.

http://www.instructables.com/id/Build-A-FLAT-duino/
http://www.instructables.com/id/Arduino-Digital-and-Analog-logging-using-V-USB/
http://forum.arduino.cc//index.php?topic=169826.0
http://www.instructables.com/id/DS1307-Mental-Health-for-Arduino-Users/
http://forum.arduino.cc/index.php?topic=139907.0
http://www.instructables.com/id/Under-8-Arduino-Serial-Data-Logger-Record-to-SD/
Etc, Etc, Etc.

PICAXE is great... like a bicycle with training wheels.... once those training wheels are off, you know you are never going back!

Ray
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 348
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

True, the AVR chip is 8 MIPS bare and standalone.
The PICAXE doesnt even come close.

Without overclocking the 8-bit AVR is 20 MIPS.

That is some serious processing power.

In a single chip.
Logged

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

The more involved I get with Arduino the more I'm starting to come round to your ways of thinking, I've been looking into the minimum operating circuits of the chips.
I just wish the Arduino had a debugger! How I'd love to be able to set breakpoints and step through code.

I've snazzied up my plant waterer with lighting (currently only red and white) and an enclosure (a R.U.B), it now has a switch for the lighting going to 5v and 12v 4mm banana plug sockets so I can unplug them easily. I also tidied up (shortened) the wiring and used my favourite do everything 'stuff' to secure it all in the box - that being hot glue..
It's still only about 99% though, I need to add more lighting as I ran out of LEDs of the right colours.
I need ultra bright blue, green, white and red LEDs for a nice full spectrum, although the radishes have really sprouted quite well with just white and red during the night and daylight smiley

I look forward to munching my way through these in the coming months smiley-grin

ps. I've noticed how obviously sites share information with advertisers, I keep seeing adverts for 'growell lighting' on different pages ever since I started looking at what I need, that and Thai brides.....
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 1422
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I just wish the Arduino had a debugger! How I'd love to be able to set breakpoints and step through code.

You could develop in Atmel Studio.  There is a commercial simulation product, too, https://gitorious.org/simavr

I come from a Fortran77 on Honeywell paradigm and the concept of well placed diagnostic print statements seem to serve me OK.  When I had access to a simulator and breakpoints, I rarely used the features.  As the 328P is only like $2.10, I am not overly concern about multiple compiles and downloads wearing on the 10K+ estimate of flash memory lifetime.  smiley-grin

Of course, I am doing this stuff from a hobby perspective and would certainly want to use better tools in a commercial programming job.  But, then I doubt that I would be using the Arduino GUI and libraries although I see no particular reason the hardware would not poses mustard, except that non-clones are a bit pricy for anything other than a protype.

Ray
Logged

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

Very cool project! Great job!

Could you post your code and make a Fritzing file for all us newbies to learn from?

Logged

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

Very cool project! Great job!

Could you post your code and make a Fritzing file for all us newbies to learn from?



Hi, the code is attached to the bottom of the first post. Admittedly I've changed it a little since then and I intend to change it some more, even though that wasn't my original intention.
I've added lighting and an enclosure for the electronics, when I get around to updating the source (it works so I'm in no hurry) I'll upload the newer version.
The source is fairly well commented and between that, the video describing the parts and the internet it's pretty easy to see what's going on and where. I'm new to C++ so be aware that my code is not going to be 'best practice' in places.
As for this Fritzing file, I just googled what this is and I'm going to give it a whizz, but don't expect me to upload anything any time soon, or ever... I might abandon it:)
Logged

Pages: [1]   Go Up
Jump to: