MacroDuino Project Page

Page for the MacroDuino project. The aims of this project are to make it easier to get a project up and running without writing any (hopefully) code. The vision behind it is to be able to put a couple shields on an arduino, upload a sketch and have it doing what you want without spending time writing code and debugging. You could also think of it this way: if the Arduino is a rapid prototyping device than the MacroDuino code is rapid coding. You spend 5 minutes setting up the code and configuring it and you're done.

Also, I'm splitting the docs up and making more videos. Please be patient while this documentation is updated.

Background

The MacroDuino code is broken up into several different pieces. The first are the interfaces. Right now there are two interfaces: serial and ethernet (official ethernet shield). The second part is the control. The control function takes the input from the interfaces and parses it into a command for the arduino to execute. The nice thing about this is that in order to add another interface all you need to do is write a small function that gets the input data and formats it so the control function can understand it.

Next there are macros. Macros can be anything and right now there are quite a few of them. All macros are stored in EEPROM so there's no need to worry about setting them up again if the power goes out. Macros basically watch something (pin, time, or temperature) and perform an output based on the input.

The last part are outputs. Examples of outputs are digital pins, pins on a PCF8574, an LCD display etc. These outputs are controlled via macros (and individually).

If you find something that doesn't work let me know. I may have made a mistake in the documentation. Just use the contact link above and I'll fix it ASAP.




Code

MacroDuino Code on Github

MacroDuino Webapp Code on Github

Webapp

Configuring The Code Video

Using The Webapp

Using Cosm With MacroDuino

Interfaces

Serial

The serial interface expects data in this format:

COMMAND/ARGUMENT1/ARGUMENT2

For example, lets say you wanted to turn pin 9 on. You would send 4/9/1.

Ethernet

The ethernet interface works almost the same as the serial interface. It expects a URL like this:

http://my_ip_address/COMMAND/ARGUMENT1/ARGUMENT2

So to turn pin 9 on you use a URL like this: http://192.168.1.100/4/9/1

Commands

The command list is quite long, but since they are all the same format it is hopefully easy for beginners to understand. If you have any questions or suggestions feel free to email me.

*all commands are numbers*

Comments

I can't download the code...

Sorry about that. Got the link mixed up again. It should work now.

Really great site, I really like the idea of setting up macros via the serial interface. I wrote a programme, in VB, to set the time on the DS1307 to the PC time. Using a VB GUI inteface I imagine some pretty complex control strategies can be setup for the Arduino, allowing easy configuration with a PC connected and continuous control when the PC is disconnected.

Can you still ramp up and down with WDS1307MACROSET using type 1 and 2 as before?

Not with the current code, but that is going to be added back in.

Updated the code to do 1 hour fades with the macro. Set type to 2. Minute on and minute off should both be 0 so that means you can only do fades starting at the top of the hour.

Some suggestions: - Allow for temperature to be printed in F and Celsius. - Store Max and Min values for Temp and PH, (or any other sensor) .RESET Counter .PRINT MAX MIN Temp (since last reset) 23/05/2010 03:00 min t 28,30C 23/05/2010 14:03 Max T 29,00C .Print Max Min PH 23/05/2010 20:00 min PH 6,78 23/05/2010 09:00 Max PH 7,0 I like very much your project. Quite interessed to control my LED PWM driver for Sunrise and Sunset and also to connect PH probe to control CO2 injection.

I was hoping nobody would catch the F and C lol. That's in my todo list.

I like the max and min value ideas. I just had an idea that you you could set any of the macros to automatically log the min and max values during the configuration stage.

European people always are problematic !!! C instead of F.... Nuno Live from Portugal

LOL, and in Canada I use both depending on the application.

The buttons don't seem to work in Firefox?

That's right. You need a webkit based browser to be able to use the app on your computer (Chrome, Safari, etc.). It will work great on android and iphones.

Im interested in how you interfaced Visual Basic and Arduino!! Im working on Arduino Uno for my fresh water tank..

Not sure what you mean by that? I haven't used VB in this project.

Hi Andrew,

I have a DS18B20, why does the debug return this?

 

CRC is not valid! Device is not a DS18S20 family device. jsonp555-5555075({VALUE:{SENSOR:0,VALUE:3210}})   Hardware: Duemilanove ds1307 pin 4 and 5 ds18b20 pin 0    I have no port expander, and it will not recognise the 18b20 on the onewire pin. Thanks, Scott

I believe that's because the 1wire pin is pin 2. 

This is great!

I'm new at the arduino but have a Mega2560 and Ethernetshield. My goal is do home automotion. It's a Dutch project called Nodo. But before I start I want to learn something. Can you help me? I would like to have the code and webapp to turn on and off the LED with the webapp.

But how to get the code? 

Hi, i got a problem i'm trying to program a Arduino Ethernet, but i can't connect with it... i'm using Arduino 1.0, some people say the Arduino 1.0 find the IP of Ethernet board and put in Tools>Serial Port> IP xxx.xxx.xxx or something like that,to connect but that dont happen with me... i already test ping by DOS and its ok... Someone can give me a help, what i can do or what i'm doing wrong? Model: Arduino Ethernet http://arduino.cc/en/Main/ArduinoBoardEthernet OS: Windows 7 Compiler: Arduino 1.0

 

@Albert, You can find the macroduino code here: https://github.com/practicalmaker/MacroDuino

 

@chicomoura, I'm not exactly sure what your problem is because I don't use the Arduino Ethernet board.

Hi Andrew, I'm receiving an error on verification prior to uploading the latest code: MacroDuino.cpp:66:21: error: Pachube.h: No such file or directory MacroDuino.cpp:74:27: error: cosmFunctions.h: No such file or directory MacroDuino.cpp: In function 'void loop()': MacroDuino:143: error: 'sendCosmData' was not declared in this scope Any idea what the root cause is here? I just finished adding the library to my Documents/Arduino/Libraries folder on Win7.

I just renamed the Pachube stuff to cosm. If you comment the #define COSMENABLED line it will compile. If you want to use the Cosm stuff I'll be bundling the library in today sometime.

Thanks Andrew; I'll keep an eye out for the updated library as I'll be using Pachube soon enough. Wonderful response time :)

You should check out the videos. Using MacroDuino to Cosm is dead simple and you can display that data on the webapp dashboard.

Sweet videos; very well laid out and COSM seems much easier to tackle than Pachube. Question: Is the ethernet port on the controller viable for networking or is it just a straight up port for other goodies?

The ethernet port on the controller is actually 4 PWM pins.

Seems I forgot to put the using the webapp video up.

Great work Andrew :) thx I have the same problem met cosm missing the cosh.h file ( cosm lib. is empty ) hope to get the cosm update soon because it looks very nice in the demo video. I have an other question i'm using an ethnet shield and this shield stops working then i have to reset the complete arduino ? does anybody have this problem to ?

I just saw that. There was a problem when I put the new code on github. The new library is in the Libraries folder (CosmArduino) and after you put that in your libraries folder everything should compile.

Hello. This is exactly what I've been looking for. Very simple to setup and easy to use. I am not all that experienced with coding the arduino, so this is something that I could base some projects on. I'm currently testing four DS18B20 sensors uploading values to cosm.com. Sensors A, B, C & D, all connected to PIN 2. So far this is working great. I would like to get the values in Celsius, but when I uncomment the #define CELSIUS I get this message: In file included from MacroDuino.cpp:84: supportFunctions.h:370:13: error: operator '==' has no left operand What can be the cause of this error? Cheers, lj

Good catch. I've updated the code and it should compile now.

Hello again Andrew.
Now the code compiles when I uncomment #define CELSIUS, but I'm still getting the values only in fahrenheit in Cosm.

One more thing. This is not a problem for me yet but something I noticed, that made me scratch my head for a few minutes.

When I use four DS18B20 sensors connected to PIN 2 and the COSM_UPDATE_INTERVAL is 10000 the values are all being sent to Cosm and everything works.
But when I change the COSM_UPTDATE_INTERVAL to 15000 or more I only get the values from sensors A & B and the data stream for sensors C & D freezes.

Cheers,
lj

I'll have to play around with the code so I can reproduce this and try and get it fixed.

will this work with any of the "cheaper" arduino ethernet alternatives? http://www.arduinopassion.com/4-official-arduino-ethernet-shield-alterna...

As long as they're compatible with the official ethernet library I don't see why not.

Hi Andrew, i dont undestand why in runDigitalMacro theresn't the command to set the pin off "digitalWrite(EEPROM.read(mem_address + n), 0);" Maybe i miss something :) Thanks

ok...i need another macro to set pin to 0....

Hi, I've config my code and uploaded to the arduino. with serial I've set the ip-adress, submask, and gateway. But if i type (192.168.1.100) the ip adress, he can't find the device. Can you help me?

In the serial monitor type 255 and then . Can you paste what it spits out here?

Using chrome's developer tools I found that retrieving the feeds from cosm never succeeds. Wondering if they're url has changed and where in your code I could fix that. The failing URL is below http://api.cosm.com/v2/feeds?user=aylr&key=mykey&callback=jQuery17107004...

Humm, it's been awhile since I've hooked into cosm so something may have changed. I don't have time right now to fix the code, but if you find that they've changed the URL I can plug that in and push it out to the web app so it works again.

Hi. I've been using the macroduino with cosm.com for a few months now and it is working perfectly. So far I've only been measuring temperature with the DS18B20 sensors. Now I'm trying to set up a water flow sensor as well. I've gotten the flow sensors values to the arduino, and it is working great on an individual code. But I'm no sure how I can implement this with the macroduino code. The sensor is a hall sensor sending pulses to a digital pin on the arduino.
Do you have any suggestions how I could get this working and sending the values to cosm? :)
Cheers. LJ

Hey LJ, It might be best if we had a skype chat about how you'd go about adding support for other sensors. Documentation for that area is lacking. Andrew

Hi Andrew. Sorry for the delay. Been traveling and working the last weeks. Yes that sounds good. I've been experimenting a bit with the code trying to add the sensor, but have not been able to get it to work yet. My Arduino programming skills are probably on a to lower level for this.. You can add me on skype username "leifskeif" and we could have a chat when you get the chance.

HI,
I am having a similar problem to TIm above. I have set the Ip.subnet and gateway. Sending commands through the serial connection works fine. I send 255 and get the right ip,subnet and gateway returned. I can control some LED pins as well without problems. However, when i send through the ip address i get no response. the Arduino returns nothing. The Webapp is alos not able to find the device when i enter the ip either. I am using Ether10 Ardiuno and have run other webserver sketches with no problems so i believe it is 100% comp with ethernet.h.
Any ideas why this is not working?

Not sure, but we can try and find out! In macroduino.ino uncomment DEBUGETHERNETQUERYSTRING. Then hook it up to usb and ethernet. Whenever it receives something over ethernet it will print it out over the serial port. Can you post what comes back? As for etherten it looks like it uses the w5100 chip so it should be fully compatible.

Looks to me that your hardware and software would be great to adapt for pool measurements. Specifically thinking of a salt water pool that needs to have PH, EC and ORP monitored. Has anyone attempted this? Any issues you see here with this...I think you'd get a lot of traction with another separate customer base.

F

Hey Farsonic, You're absolutely right. Essentially, I'm *trying* to make this kind of like an OS for arduino. You decide which features you want and uncomment it to include the functionality. I don't see any problems with applying it to pool measurements. It's essentially the same as an aquarium/aquaponics in what you need to measure etc. If you attempt it make sure to post about it in the forum because I'm sure there are other people looking to do exactly that.

Will the cosm files work with xively? I cannot seem to get it to connect. Also does cosm need to be working to use the webapp?

You'll probably need to update the cosm library because I haven't gotten around to it yet.

You don't need cosm working in order to use the webapp.

I cannot seem to load the web app. http://app.practicalmaker.com/ I get a server is not responding error in safari. Google give me 

Oops! Google Chrome could not connect to app.practicalmaker.com

 

Any thoughts as to what is happening?

Thank you!

Add new comment