Nov 102013
 

[EDIT] Here is a link to an update of these effects made by Stefan Mayer designed to work with the OctoWS2811 LED Library. Thanks a lot Stefan, great work!

[EDIT] I’m planning to clean up the Android control app source and put it on github, but in the meantime here’s the code.

[EDIT] If you end up using this code for a project please send me a link/pics/video! I love seeing what people do with this! If you like I’ll post a link to your project on the FastSPI FX – User Coolness post. Also make sure to thank Daniel Garcia (the genius dev of the FastSPI library) on the G+ FastSPI Community.

Here is an update to the Arduino FastSPI2 FX demo code (v0.51). I’m also introducing an Android Bluetooth Control App and a Chrome Extension.


I’ll continue to work on improving these programs but I think I have them to a point where it might be useful to some people- so here they are!

Here is the Arduino Sketch (v0.51)

Here is the Android App on the Google Play Store (v0.1a)

Here is the Chrome LED Controller Extension (v0.1)

— — — SETUP / NOTES — — —

ARDUINO:
- This version uses the Software Serial library and FastSPI2 library. Also the default serial speed is now 57600.
- The following is a breadboard layout and schematic for setting up a JY-MCU Bluetooth chip with an Arduino (Duemilenove or Nano) to drive a strip of addressable LEDs. This should work with any LED strip that is supported by FastSPI2 RC4 and later.
ArduinoBTLEDSimple_011_breadboard_bbArduinoBTLEDSimple_007_schematic_schem

ANDROID APP:
- To control LED strips via the Android app you’ll have to pair the JY-MCU module with your smartphone/tablet in the Bluetooth/Wireless settings. The PIN for these modules is usually 1234.

CHROME EXTENSION:
- To load the extension, unrar the file to a directory. Then in Chrome go to Settings>Extensions>Load Unpacked Extension. Then select the directory. Then you can launch it from there.
- This extension has been tested on Ubuntu 12.04 and WindowsXP. For Windows you’ll have to install the USB Serial drivers, but the automatic driver search seems to work fine for this.

— — —

If you find this really useful, please consider donating a little to the cause. Thanks!



I’m also grateful for bitcoin donations to: 1K5Yy77ejes2FZrHBG5fns3QAicnwZcduq

 

Oct 032013
 

[EDIT] Please check out the newest version of the FX Code (v0.51) with Android Bluetooth Control App and Chrome Control Extension.

[EDIT] Fixed a really dumb problem in the Arduino code, added a color picker to the python GUI, and uploaded a new video demo. The problem was I was using if (serial.available()) and should have been using while. That gummed up the works and made the LEDs flicker if you moved the sliders too fast. That’s fixed now. Should have waited and tested better but I was all excited to get this posted- live and learn, or more likely just repeat the same mistakes and correct myself as I go along.

Here’s another revision to the FastSPI2 effects demo code. Some code cleanups, a few new effects, and a python GUI (gtk). GUI can select effect by name and control brightness, delay, color-step, hue, and saturation of various effects.

Screenshot from 2013-10-03 19:52:46

Here’s the Arduino Code

Here’s the Python Code

 

If you find this really useful, please consider donating a little to the cause. Thanks!



I’m also grateful for bitcoin donations to: 1K5Yy77ejes2FZrHBG5fns3QAicnwZcduq

Sep 212013
 

[EDIT] Please check out the newest version of the FX Code (v0.51) with Android Bluetooth Control App and Chrome Control Extension.

[EDIT] Revised once again, and made a python GUI. See this new post.

This is a revision of the original FastSPI LED Effects Examples I wrote awhile back.

LED_POST

I’ve gotten some very positive responses for these examples so I figured I should update them to be a little less clunky (the operative term here being ‘less’, they’re still quite clunky) This revision will work with RC3 of the FastSPI2 Library.

These are little LED displays I made, one is a circular back-light and the other a wave shape with a little diffusion in front. Both are Arduino powered of course. I just ran the ‘demo mode’ on both and tried to start at the same time so they’re not in sync or anything. Just thought I’d show them on a couple of different configurations for the heck of it.

If you have any issues getting this to work please check through the comments on the original post page first. A lot of people have posted very helpful comments about their experience using the code that might help you on your way. And of course feel free to post your issue if you can’t find a solution- I’ll do what I can to help.

Most significantly I’ve removed the need for the SerialCommand library and the really hacky HSV->RGB conversion function in favor of the native FastSPI2 conversion which is much faster and cleaner and supports ‘rainbow’ and ‘spectrum’ modes (though for these examples I just stuck to ‘rainbow’.)

I also added one example of a ‘native’ FastSPI effect; the fill_rainbow function (new_rainbow_loop – mode 88). This is similar to the ‘rainbow_loop’ function except that is fades the colors into one another much better. I’ll add more ‘native’ effects functions like fades to the code later because they are much faster and have nicer aesthetic qualities than mine.

Change modes the same way as in the previous code, enter ‘m’ and then an integer for the mode number (listed in code). Also make sure you send a NEWLINE character. Mode 888 is ‘demo mode’ which cycles through all the modes, but this tends to block the next serial command.

Also you can change the maximum brightness with ‘b’ and then an integer from 0-255. By default it’s set to 64, about 1/4 brightness.

Here is the code.

[EDIT] I recently fixed a few issues where I messed up the HSV conversion and I utilized a few more of the FastSPI2 functions. Also finally started giving the code a version number. This one’s v0.3, I’ll do better with that in the future.

Most notably I added the ability to adjust parameters of many of the effects via serial commands. The following commands are now accepted:

(d)elay 0-INF | d50 | Adjusts the delay value, effects run faster or slower.

(s)tep 0-INF | s5 | Adjusts the steps between colors, mostly for rainbow effects.

(h)hue 0-255 | h180 | Adjusts the hue of effect, mostly for one and two color effects.

sa(t)uration 0-255 | s50 | Adjusts the saturation of effect, mostly for one and two color effects.

Here is the code. (v0.3)

If you have any requests feel free to ask, I’ll see what I can do! I’m more-or-less open for business if you have anything in particular you need tackled. And if you find these very useful, please consider donating a little via. paypal, I’d really appreciate it :)



I’m also grateful for bitcoin donations to: 1K5Yy77ejes2FZrHBG5fns3QAicnwZcduq

Apr 102013
 

I would like to introduce:

Stanley Tweedle – Captain of the Lexx.
Formerly Security Guard Class 4 for His Divine Shadow, and Assistant Deputy Backup Courier for the Austral B Heretics.

2013-04-05_16-43-58_5892013-03-16_16-51-29_671

I have a new project that will have to borrow time from my robot stuff for a bit, so I wanted to go ahead and post what
I’ve done so far, mostly for my own reference when I go to pick this up again.

PARTS:
(1) Arduino Nano
(2) 9g Continuous Rotation Hobby Servo
(1) Ultrasonic Rangefinder
(1) 6DOF Acc/Gyro
(1) USB 5V Battery
(3) WS2811 LEDs
(1) Bluetooth chip

Tweedle is complete hardware wise, but I have a little more coding to do before I’m satisfied with his brains. I ran out
of space in the Nano for anything other than input/output so all the control is done from a remote PC via python over
bluetooth/serial. I also made a wiimote script to control him manually. His brains is just basic obstacle avoidance right
now, still trying to see how much nav/odom info I can derive from a 6DOF sensor. Dead reckoning would result in massive
error accumulation, so for right now it just tells him orientation.
Anyway I’m pretty happy with how he’s turned out so far and he’s been a lot of fun. I’m usually not concerned with
aesthetics of these kind of things but I think he’s kinda cute.

This probably won’t help anyone because if you’re deep enough in your a project to understand my code- you’re deep enough
to write it yourself probably faster than it would take to adapt mine to your project… but here is is anyway.

Tweedle Arduino Sketch
Python Ncurses Control Program
Python WiiMote Teleop Program (NOT WORKING)
DOWNLOAD

And here’s some more pics of the wiring…

z2013-09-14_11-34-50_778 z2013-09-14_11-35-19_156 z2013-09-14_11-35-28_663 z2013-09-14_11-36-24_726 z2013-09-14_11-36-40_360

 

Dec 172012
 

So here’s my review of the Hexbright – Open Source Flashlight

• It’s insanely bright. You really have no idea. Seriously impressive.
• Good and solid, yeah. Perfect fistful of flashlight but still goes in the pocket. It’s not a mace like a big maglight but you would not want to be cranked upside the head with this. You could drop it on a bare foot without fracturing anything, but you’d remember not to do it again.
• Battery life seems good. Haven’t stress tested but no complaints yet.
• Simple, rugged construction. Twist off end pulls all the guts out of the aluminum and you’ve got access to the board, battery and LED, no problem.
• Nice beam! The single LED and lens give a really unexpectedly beautiful spread. A little hot in the center but it is a flashlight…
• Color temperature – 5380K – just shy of daylight. Meter also showed a tiny green spike in high mode but not noticeable with the eye. Easily color corrected with a little gel.
• Programming – easy to get started (but to be fair I’m pretty experienced with Arduino). Just had to load the board file and I was off and running. Loaded a couple of examples and pretty soon I was adding code the factory firmware. This is where having a ‘programmable’ flashlight is really cool. So for instance I didn’t like the fact that I had do cycle from LOW-MED-HIGH to turn the light off. So I added some code to where a long press after LOW or MED will turn the light off. Lots more possibilities here.
• Overalll: It’s an amazing flashlight and it’s open-source! Get one!
Images
Canon EOS 400D
1/4 s | f/4.0 | 28mm | ISO 400 | Daylight (5200K)
OFF | ULTRA-LOW | LOW | MEDIUM | HIGH

Here’s my hack at the firmware. Adds an ‘ULTRA-LOW’ mode, and a ‘DAZZLE’ mode. Also long-press will turn the light off from any mode.

modified hexbright firmware

Oct 262012
 

[EDIT] Please check out the newest version of the FX Code (v0.51) with Android Bluetooth Control App and Chrome Control Extension.

This code has been revised and I made a new post about it – please see updated post HERE

[EDIT] If you end up using this code for a project please send me a link/pics/video! I love seeing what people do with this! If you like I’ll post a link to your project on the FastSPI FX – User Coolness post. Also make sure to thank Daniel Garcia (the genius dev of the FastSPI library) on the G+ FastSPI Community.

[EDIT] If you have any requests for certain types of effects I’d be happy to look into it. Just let me know what you’re looking to do and I’ll take a swing.

If you find this code very useful please consider donating a little via paypal. I’m having some ‘financial instabilities’ right now and any little bit would help. And if you need a certain effect coded, a donation would certainly obligate me to get that working for you! Sorry for this, it sort of feels like panhandling and the real credit should go to the library creator, but we do what we have to… Thanks for understanding.



I’m also grateful for bitcoin donations to: 1K5Yy77ejes2FZrHBG5fns3QAicnwZcduq

fastspijpg

Some LED effects I’ve written for Arduino and FastSPI library.

Mostly written for a circle of LEDs but plenty useful for any configuration.
Code available here… the code

***Here is an update to the FastSPI_2_RC1 - the code

Used WS2811 strip, but have also tested with WS2801.

I’ve only tested this on the duemilanove and nano boards. It’s looking like this does not work on the UNO and I’m not sure about the Leonardo or the new Due.

Several people have indicated problems finding the SerialCommand library – so here’s the version I’m using SerialCommand

Here’s where I found it. Thanks to this guy for the library- Steven Cogswell
http://husks.wordpress.com/2011/05/23/a-minimal-arduino-library-for-processing-serial- commands/

 

Aug 262012
 


This is UgBot: The ugliest electronic mess since Superman III.

UgBot technically isn’t a robot, just a remote controlled thing. It started as a test for my next robot project (to be called Dominar Rygel XVI)

I just had to work through a few simple ideas before I started on a more sophisticated platform and this is what I ended up with.

UgBot’s hardware is:
(1) Arduino Nano
(1) Bluetooth TTL Module
(2) Micro Servos (modified to continuous rotation)
(1) Breadboard (sawed in half)
(1) Battery Pack (4)AAA
Poweraide and Coke Caps for wheels
Lots of jumpers

and the software is:
-Arduino sketch with CmdMessenger, Servo, and SoftwareSerial libraries (software serial is so I don’t have to pull the TX/RX pins for debugging. It’s a big help)
-Android app which I basically stole from this guy Eirik Taylor’s project. I changed the UI and the serial commands but the rest is pretty much his code. I’m so lazy I didn’t even change the name so the app is still called BluCar from his project.

I absolve myself of the theft since he admits that he took most of the code from the BlueTooth Chat example in the Android SDK.

Here’s the Android and Arduino Code

Here’s updated android code (w/ multitouch enabled) Code

Aug 202012
 

I guess I’ve been using Blender for so much for so long that I tend to look for ‘Blender-like’ controls in a/v projects. So inevitably when I started working with LED strips I immediately tried to weasel out of having to think through functions and loops in arduino code to create effects I could do intuitively in Blender.

So after a few bad UI attempts I thought – hey, wish I could just design a light sequence in Blender and run it with ALT-A. So that’s what I did.

On the arduino side it’s using the FastSPI and CmdMessenger libraries for LED and serial communications.

The Blender script just reads the diffuse color in r-g-b from each LED objects material and spits it out to the USB port. Getting the pyserial library hooked up in Blender wasn’t a breeze but the “sys.path.append” line should help anyone having the same issues I did.

Here’s the arduino code and Blender file

(Using Arduino Duemilanove 328 and LED strip with WS2801 chips)

EDIT:

Blendernation article (Thanks Bart!)

I forgot to mention I’m using Ubuntu so the sys.path.append thing wont work for windows, you’ll have to find the pyserial library solution elsewhere (there’s plenty of reference out there)

Also – the script runs on each frame change. Here’s how that works (WARNING: kinda hacky) http://funkboxing.com/wordpress/?p=236

QUESTION: For any API guru’s out there – currently this script opens and closes the serial port on each framechange. I know this is radically inefficient. Any ideas on how to keep the serial port open persistently but to close it when blender closes?

 

 

 

 

Aug 162012
 

Here’s an Arduino LED backlighted sign I made.

Electronics are:
(1) Arduino Nano – $16
(1) Bluetooth TTL- $10
(23) Addressable LED Strip (SMD5050/WS2801) – $20

Then some foamcore, paint, and hot glue.

I’m using a android bluetooth terminal program to send serial commands to the arduino. Right now the program just calls ‘Modes’, which are different effects I hacked together in the arduino IDE. Later I’ll write a more versatile program so you can more directly control the LED’s with an Android app or something.

FYI – The Q is for Quixote Studios.

Dec 272011
 

This is an attempt to merge Blenders Dynamic Paint feature with cellular automata. It started as a python script but then became even more of an educational experience when I realized python wasn’t going to be fast enough to run conway’s life on a 64x grid, let alone a 4Kx one, which was my initial goal. These ended up being 512x grids. I could have gone bigger but I’m using a little netbook for all this so I didn’t go nuts.

After figuring out that python wasn’t going to be fast enough I set out to make a c++ version, not in Blender, just in c++. Long story short it’s an atrocity of loops inside a main function. I didn’t even bother to pass any arguments, just recompiled every time I changed paths. Anyway it ended up being lots faster than the py scripts and I finally had an excuse to write a function I knew very well in a language I’ve been intimidated by for some time (and still very much am).

The c++ code uses the ImageMagick++ library, which made things much easier, but you’ll have to get this lib if you want to compile and use this. Hopefully this whole process has prepared me to get on porting the lighting generator to c++, which really needs to happen if if it’s ever going to be more than a gimmick.

So anyway, here’s the c++ code and here’s the Blender python script that I abandoned in favor of doing it in c++. For the record- this is bad, bad code. Very bad. Also here’s the command line to compile with g++ and imageMagick++, since that took awhile to get past.

conway_cpp_py.zip

user@pc:~$ g++ `Magick++-config –cxxflags –cppflags` conway.cpp -o conway `Magick++-config –ldflags –libs`

Here’s the process for using this to dynamic paint with conways life.

1) dynamically paint a canvas with a brush. This will paint ‘live’ cells onto the canvas
Turn on ‘dissolve’ and set to dissolve in 1-3 frames. Otherwise these become ‘immortal’ cells, which makes for a weird simulation.
I used red channel only for these demos.

2) compile and run the c++ code.
This will run the simulation on the dynamic paint cache images. It runs the simulation from the initial frame, but always includes the red cells from the next dynamic paint frame so they will be used in the next simulation step.

3) use this simulation output as a map in place of the dynamic paint output.
Sounds easy, and it kind of is, and kind of isn’t.
So if you want to do this yourself- if you know c++ it should be easy. If you don’t it will be very hard. If you’re just learning c++ it may be worthwile to try.

Not sure where I’m going with all this, as usual it was just something to do. Hope you dig it.