feed a program an external script, looking for advice on high level approach.

My background: I'm not new to programming, I've written several PC applications, web applications even PIC micro-controller projects in the past. I'm also not new to electronics at all with numerous projects under my belt.

Am am new to the arduino though. I have an Arduino UNO that I'm using.

My Project: I have a project where I'd like to feed the arduino a "script" from an external source.

Basically the "Script" would be like a macro of sorts identifying the state of the various outputs and how long they will remain in that state before changing to the next state in the script. The program on the arduino would wait for a "start" button to be activated and once pushed it would run through the script.

These scripts could be as short as 10 seconds or as long as 10 minutes with output state changes occurring every few milliseconds.

I guess you could think of it like a Christmas light controller and the various "scripts" would correspond to patterns you could play back on the lights.

I'm looking at a maximum of 20 digital outputs and 6 analog outputs though for prototyping purposes to start I'll probably only need 6 or 8 digital outputs.

Where I need help: Basically I'm not really sure the best way to transfer the script from my PC to the arduino. I'd like a method where I can have my Arduino installed and able to receive modifications to the script or new scripts on the fly. I'd also like the transfer method to be ubiquitous enough that I could give less tech savvy friends similar devices and have them create their own scripts/send and trade scripts with each other.

I'm sure I'm capable of finding how to program the finer points of interpreting the script and changing the outputs, but I don't really know the best method of actually getting the script quickly and easily to the arduino. Ideally I'd need to be able to run a script, and easily feed a new script to the arudino without much hassle so I can make revisions quickly. I would appreciate any suggestions as well as links to similar projects that I might use as a reference. I've done some searching but I didn't come up with anything, I'm not sure I'm even searching for the right terms, as "script" and "macro" are rather generic.

Thanks for taking the time to read this 8)

"a maximum of 20 digital outputs and 6 analog outputs "
That’s a bit more than an Uno can do, with just 14 digital outputs and 6 digital/analog outputs available.

I suppose you could down load some number of variables into SRAM, or EEPROM, (the onboard version of both are much smaller than Flash memory where sketches run from) and after the download do a restart to pull in the new data & use it.
The software guys here can really suggest better ways. The question often comes up if one can run a sketch from an SD card. You might look into writing a bootloader that can do that, I don’t think its been done yet.

I'm sure I could work out a multiplexed or serialized output if 14 digital isn't enough.

I hadn't thought of using an SD card, that would probably work quite well.

I don't know that I need or want to load the whole program from the card, just my script file.

thinking about it further reading from a thumb drive might even be better, as I wouldn't have to order an SD card port, I could just hack up a cable, and it'd be a bit more versatile too.

thanks for the suggestion!

Thumb drive requires USB host. I don't believe Uno as delivered will do that, not sure if Uno's Atmel chip that handles USB interface can be programmed for that.

not sure if Uno's Atmel chip that handles USB interface can be programmed for that.

I believe in theory in can, however the arduino IDE has no support for uploading firmware into the 8u2 chip, and if you changed it then you couldn't upload sketches as would normally done, so it would be an awkward feature at best. I think a shield based USB host device is a much more practical solution and I've seen one or two already offered:


Wow, great find! I had been thinking about how to do something like that, maybe with a part like this http://www.ftdichip.com/Products/ICs/VNC1L.htm Hadn't the time to really look into it yet, I think its more programming than I could handle at the moment. Maybe after I get some 1284 based boards built up, parts & PCB should be coming in hot & heavy this week.

What would be needed to be able to access a USB interface hard drive, such as http://www.tigerdirect.com/applications/searchtools/item-Details.asp?EdpNo=6076821&sku=W10-9030&SRCCODE=WEM2730BY&cm_mmc=email-_-Main-_-WEM2730-_-tigeremail2730

for the ultimate MP3 player? Guess a good display would be needed too.

There seems to be lots of hits about downloading nrew code into the 8U2, here as an example http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285962838/10#10 Maybe not officially supported yet tho. I don't have an Uno to try it.

Bitlash is a scripting language for the arduino. http://bitlash.net/wiki/start

Thanks, Grumpy Mike, for mentioning Bitlash, for I had missed this thread.

twistedsymphony, it sounds like Bitlash might be fairly close to meeting your requirements, and I'd be happy to help sort out the approach.

You can fit a surprising amount of functionality in EEPROM, and there is a python loader program (bloader.py) in the Bitlash distribution that you can use to upload new script from PC to EEPROM.

There is also support for running Bitlash scripts from SD card in the latest version, which should pretty much address any concerns about space limitations.


-br http://bitlash.net

looking around bitlash looks to be nearly what I'm looking for...

I've downloaded it and I'll be looking over the code later today.