Show Posts
Pages: [1] 2 3 ... 5
1  Community / Exhibition / Gallery / Re: MacroDuino (configurable code) on: July 21, 2011, 05:34:09 pm
Well, you could add the jumps part into the interface code. Basically you'd have a check when reading the current line to see if the command = 100. If it equals 100 than go back x lines.

// need global current_line_num variable
// this code won't work because i haven't used the sd card library in awhile
// mostly this would just be how the code should work

char current_line_char = read_sd_card_line(current_line_num);

char *command = strtok(current_line_char, '/');

//atoi... mostly because I forgot the syntax

if(command == 100) {
char *go_back_num = strtok(null, '/');
//atoi go_back_num
current_line -= go_back_num;
// break out of this iteration of the loop so it repeats at the new current_line start
} else {
pass to command function

As for if and while constructs that would be quite a bit harder because you add if and while, 2 arguments and all the operators for the arguments. I don't use strings to keep down the space and because they chew up lots of ram. It could be done, but it would take quite a bit of time to do so.

I really like that idea of reading commands from an sd card though. I'll try and get it into the code soon and we can work from there.
2  Community / Exhibition / Gallery / Re: MacroDuino (configurable code) on: July 21, 2011, 05:12:20 pm
I may be a little confused about what was asked.

You could write an SD card interface which would read commands from an SD card (thanks for bringing that up, I have ideas for that already).

You can't read a program from the SD card and run it within the Arduino.
3  Community / Exhibition / Gallery / Re: MacroDuino (configurable code) on: July 21, 2011, 09:08:34 am
I don't think so, but you never know. I seem to recall doing some research awhile ago about that and found it wasn't possible.
4  Community / Exhibition / Gallery / MacroDuino (configurable code) on: July 20, 2011, 07:53:01 pm
Hi All,

I just wanted to share some code that I've been working on for the last few months which is called MacroDuino (

The basic idea was to create some code that would let you enable or disable some variables which would enable/disable different parts of the code, upload it to the arduino and configure a variety of different things over the serial monitor or ethernet.

I tried to break everything down into different groups. The first would be interfaces. Right now there are two (serial and ethernet). Basically you send a command to the arduino and this parses it and passes it to the control function. It's rather easy to add a new interface too, just include whatever libraries are needed and make sure you parse everything out except for the command. Than you just pass the command string to the control function.

Now comes the interesting part. There are to many commands to list, but I'll go over some of the neat ones.

- control digital pins (and set pinmode)
- read analog pins
- read ds18b20 temp sensors
- read ds1307 RTC (and set)
- LCD output (my own board, but can easily be ported to liquidcrystal) with configurable display options
- setup macros (analog/digital/temperature/time input) with digital pin/port expander output
- log analog/digital/temp readings to pachube
- webapp ( need a webkit browser to use correctly as it depends on sqlite to store settings (may change to localStorage)

The neat thing about the webapp is that it's hosted on my website so there's no need to host it locally. It uses jsonp to get around the same-origin policy with web browsers. jsonp was actually pretty easy to implement. All that was needed was to parse out the function name that jquery sent and print it back once the control function was finished.

There are still quite a few space improvements to be made to the code (I got a little lazy towards the end), but right now with everything + debug enabled its less than the space of the atmega 328. Disabling functions (ie. pachube) saves space and is done by changing variables in the main code. That way you can easily add your own stuff and still have everything fit onto a standard Arduino.

5  Community / Exhibition / Gallery / Re: Aquarium Controller on: July 20, 2011, 07:16:34 pm
It's a small world after all...

I see where you set the weather variable on and off, but my proposed way would just add a little more randomness to the weather. With a little more random stuff you could probably not even need to check whether it's a cloudy day at all, but just randomize when clouds and thunderstorms happen and randomize duration.

As an aside, what are you using to power your LED's? I also see the moon calculation bit. I looked into that awhile back and the code I found was a lot longer than yours. How accurate/where did you find your code? It looks like a really elegant solution.
6  Community / Exhibition / Gallery / Re: Aquarium Controller on: July 20, 2011, 06:53:21 pm
Nice code! I think I'm going to merge some of your moonlighting and general lighting functions in my own code.

I actually did something similar which I called MacroDuino ( Basically it can do pretty much everything yours does except some of your advanced functions like moonlighting. I don't really want to re-invent the wheel so I'll just merge those parts in (it's hosted on github).

Just doing a quick look through your code, would it change anything to change the clear/cloudy weather days to a random function?

Something like:

type_of_day = random(1,3);
is_equal_type_of_day = random(1,3);

if(type_of_day == is_equal_type_of_day) {
//do cloudy stuff
} else {
// do sunny stuff

My math is a bit rusty right now (tired), but that would give you a maximum of 9 days max between a cloudy day(?). You could change those values to get cloudy days closer together as well. Of course type_of_day and is_equal_type_of_day would need to be global variables that the RTC sets at the beginning of each day.

Anyways, love the code and I'll keep watching!
7  Using Arduino / Networking, Protocols, and Devices / Re: I2C ByVac Keypad +Arduino on: April 11, 2011, 06:56:27 pm
Sorry for the late reply... been quite busy.

The library you're using was written for that I2C keypad. I haven't used a mega so I can't know if it's hooked up correctly, but there are a couple things:

The first was that I think his keypad memory mappings were wrong. There should be a sketch on my library download page that is for re-programming the eeprom values with correct ones.

To trouble shoot just run the sketch you posted and see if you get anything back. If nothing comes back you may want to use an I2C address finder sketch (don't remember what it's called exactly). You load it onto your arduino and it will print out the addresses of connected I2C devices. If you don't want to do that look in the datasheet for the factory reset. I don't remember how to do it, but the datasheet tells you how.

Hopefully this will help you get up and running, but if not I'll do my best to help you get it working.
8  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: April 30, 2010, 11:32:32 am
I remember running into that error before. Took me hours to figure it out.

In the rtc code you may be missing a closing bracket which is throwing the error.

If you could post the code that would help.
9  Forum 2005-2010 (read only) / Interfacing / Re: Aquarium Reef Controller, stage 1, the LCD shield, on: April 27, 2010, 08:05:06 pm
Cool project! I started a similar one several months ago (ongoing).

Just figured I'd let you know that a bunch of the code you're trying to write I've done already. It's not commented that great, but you can check it out:

Which pin do you have the battery hooked up to the DS1307? IIRC positive goes to the pin and the battery gets grounded. (may not be right since it's been a really long time since I've setup the rtc).
10  Forum 2005-2010 (read only) / Development / Re: Library for TLC5940 16-channel PWM chip on: August 20, 2009, 03:41:24 pm
Where did you get the TLC's? Digikey is backordered until Sept. 14 and I can't find any elsewhere.

Can't wait until you put it online.
11  Forum 2005-2010 (read only) / Development / Re: X10 - Arduino Projects on: August 12, 2009, 12:43:30 pm
Bookmarked your blog. I want to get into X10 in the near future so it will be a great resource.

12  Forum 2005-2010 (read only) / Development / Re: Dallas Temperature Control Library released ;) on: August 12, 2009, 12:04:32 pm
This is great! It'll be really useful in my thermostat project.

Thanks to everyone for this code. Now to twiddle my thumbs until my sensors arrive  smiley-sad
13  Forum 2005-2010 (read only) / Development / Re: aquarium control on: September 07, 2009, 09:43:59 pm
I'd open up a dispute with paypal. I'd ordered parts in July and couldn't get them to respond (using every email address I could find). There's no phone number listed anywhere and I searched quite a bit.

It's sad because I was going to order quite a bit of stuff with them.

It looks like they're gone on an extended vacation or they just quit.

If anybody has any other info feel free to share.
14  Forum 2005-2010 (read only) / Development / Re: aquarium control on: August 19, 2009, 04:18:57 pm
Yep, that's where I got most of my part list.

Well, the sump is done I just need to wait for the silicone to cure and do leak tests, but than it's full steam ahead on the controller.
15  Forum 2005-2010 (read only) / Development / Re: aquarium control on: August 19, 2009, 12:41:57 pm
Well, I find I have less and less time to care for the aquarium so why no do a write up about it and make some money.

I haven't really started with any of the hardware because I'm still waiting on parts from

Here's the overview of what I'll be doing (I'll be outlining the project on my site... links to come).

Currently building a sump (almost done) 20 gal. for a 75 gal. show tank.

-float switches on the top which will switch the return pump off if it gets high.

- monitor temp. (circuits done and code, just need to get some telephone wire and heat shrink tubing). if temp gets low turn on heater (i don't need to worry about cooling it down)

- monitor PH. got the circuit working, but I blew up the TL062... need to order more.

- RGB PWM LED control (100 rgb, so I can change the color. Mostly just to show off. The wavelengths from them are what's needed.

- salinity sensor (if salinity goes up or down add salt mix if down, add RO if high)

- calcium sensor (add calcium if low)

- ATO in the sump. I have an overflow box which will keep the level in the tank constant. Was going to drill the tank until I found out I'd have to add a bunch of stuff to get the flow rate up.

- RTC to control lights.

- keypad so I can control stuff.

- control when the powerheads turn on and off (maybe?)

There's a bunch more stuff that I've probably forgotten, but the goal is to have an automated tank where all I worry about is cleaning the glass.

That being said I'm still waiting on parts from (anybody know why they're not replying?), plus a bunch of parts from ebay.

The sump is going in next week because I'm going away over the weekend and really don't want to accidentally flood the house.
Pages: [1] 2 3 ... 5