L.E.D. pattern programming

I am building a fiber optic hand fan that I want to program to create Pat terns and shapes when waved at a certain speed. So far it will consist of four rgb led sources with 28 fiber strands, 7 to each led. How would I go about programming patterns when waved at say 10hz? I know with only four leds, it won't be able to make complex shapes but even basic geometry seems like it would be a lot of random coding and experiments to make it transition properly? Is there a program for this? Maybe something like a led hula hoop program? Attached is a picture of example patterns on a Hola hoop that I would like to replicate

It is a matter of receiving a synchronising pulse and then spitting out the pattern in a fixed time. This is normally stored in a buffer and when you want to change the pattern you change the bytes in the buffer. In that way you decouple he driving software from the pattern making software.
There are lots of graphics programs that will help you make a matrix pattern or anamation, maybe you could modify one.

The "fixed time" would set the speed at which the patterns form when waved? And the "buffer" is a program or would that require a shield or second controller? What would I type to find an open source program? Led graphic keeps coming up with graphic equalizer programs.

And the "buffer" is a program

No a buffer is some storage memory in the Arduino, normally accessed as an array.

he "fixed time" would set the speed at which the patterns form when waved?

Yes. Which in turn would translate to the length of the pattern.

I did this one for the Raspberry Pi and the code is written in C. So everything but the bits that actually turn the LEDs on and off would be the same:-
http://www.thebox.myzen.co.uk/Raspberry/Magic_Wand.html

Other things to google would be POV ( persistence of vision ), and pov clock.

That magic wand is basically exactly what I'm trying to do. Thank you I will defiantly try poking around with that code. I'm relatively new to non-rc arduino, does the fact that arduino isn't real time like raspberry pi make any problems? Or once in the buffer, as long as the output speed matches the wave speed it shouldn't matter? Also I noticed you used a mercury switch which would let me wave it at any speed, but in this case would a small accelerometer work?

does the fact that arduino isn't real time like raspberry pi make any problems?

Wrong way round. The Arduino is real time but the Pi is not. So what happens with the Pi is that you occasionally get an elongated line, you can see that in the web page with the image third from the bottom ( counting the video ). You would not get this problem on the Arduino.

as long as the output speed matches the wave speed it shouldn't matter?

As the wave speed increases the pattern elongates. You might notice in the video some vigorous stick waving, I put my shoulder out making that as I did with the original 1989 project. It is simple enough to experiment with the output speed to get it right for your system.

I've also been looking at led bike wheel builds. Would a simple accelerometer provide enough data or is a IMU required?

For fixed assemblies like wheels, rotating discs, etc. you could often use a hall switch.

But for the fan the hall switch wouldn't work so then just an accelerometer?

But for the fan the hall switch wouldn't work

Why not?

so then just an accelerometer?

That is the one that will not work.

But for the fan the hall switch wouldn't work so then just an accelerometer?

Wait a minute. What "knows" the hand is moving, to synchronize the LED pattern?

If it's like a human "waving your hand" then you need an accelerometer. Hall effect switch is activated when it comes near a magnet.

Some example Accelerometer / Arduino Code HERE:

Ya a accelerometer could easily be programmed to count every stop and adjust the output speed accordingly. I don't know how a hall sensor could be set up to pass the magnet. The next thing I'm having trouble with is the light source, currently I'm thinking using coated optical strands that run up the fan and light at the end. But this will require a led for each strand, so to get decent resolution I'm gonna need alot of leds. Is there any way to have a individual control light source that can also fold/bend when you fold the fan? Other idea was to put tiny leds at the end but even with the smallest ones I've found it wouldn't fold right.

Now you had me confused, I was thinking a fan was a rotary device, so scrub what I said about the hall switch and accelerometer.

Why not use a tilt switch like I did? If you can't get a Mercury one then there are alternitave ones with metal balls in them.

What sort of LED is too big, I am sure you can get them way too small for you to cope with, look for surface mount LEDs.

Sorry about that, i dont know the proper name for them but its a Japanese folding hand fan type deal.

Because of small range of motion and speed of back and fourth I feel like an accelerometer would give me more data to work with. for instance if the fan is waved in a tilting motion where one side goes forward first, the accelerometer could use that data to do cool waving animations.

Well I defiantly want RGB so i believe 5mm is the smallest made for RGB. As far as surface mount I thought of that but because I want the POV effect to be visible when the fan is waving toward you I couldnt think of how a surface mount would look because it would be facing parallel to the motion instead of perpendicular.

So if i scrap the folding of the fan and just attach an addressable strip, is there a way to tell sketch to speed up/shrink the image on the outer lights? as you wave the fan the middle 90 degrees have a large motion, where the outside only moves a few inches.

Sorry for all the questions but you guys are so helpful!

Grumpy_Mike:
Now you had me confused, I was thinking a fan was a rotary device...

Me too. :o

And controlling a rotary fan (like a propellor) is easier than waving a hand-controlled fan. There are plenty of kits and modules out there that do just this (with a propellor) which may be a good starting point for you. Crack that and I suspect you will then know how to do it with a hand fan.

Attached is an image of the Fan with lines drawn on it for the placement of either a strip or bare led/fiber optic strand. the fan opens a full 180 degrees and measures 24" across and 13" high. The green and red lines are how a strip would be mounted, green being the area that gets large motion and red small amount of motion. The blue lines are where I would put LEDs and wires, or open end fiber optic strand.

So far there are big trade offs for each choice:
led strip had high resolution, quick connector with less wires, but means the fan cant fold without removing the strip.

Bare leds would allow the fan to fold, but would have lower resolution, more wires, might require shift registers to be implanted into the fan supports

fiber optic would require each strand to have its own led so the strand would have to run down the fan and into the external control box which would then have a bunch of leds attached, but would allow for folding

Further to my previous message:

There is an instructable for the rotary fan type (just don't let Grumpy Mike see this as he has a low opinion of that site) but I mention it only for some background reading that may give you ideas.

Link: http://www.instructables.com/id/Arduino-LEDs-fan-POV-APPLAUSE-sign/

Edit: Actually I think that instructables is from this kit: Banggood Kit

Yes Ive been reading a lot on all types of pov, and yesterday I went into the engineering shop at my school and asked about POV and it turns out we have a POV bike that i can tinker with. Its a basic single color 30led/meter POV setup to only do text. So i can get some practice with that, but the hand fan is my end goal, it just presents some unique challenges such as limited size, Preserving the folding feature, and learning to use a more advanced sketch to do more complex RGB Patterns such as the American flag or the Mario one-up Star.

I remember some (cough) years ago, when I was but knee-high to a grasshopper, making a single LED (7-segment) display that displayed various numbers quickly and the object was to wave that in the air (taped to a standard 12" ruler) and read the entire 'magic number'.

It was fairly straightforward and taught me all about persistence of vision (I was trying to understand 7-segment multiplexing at the time) and frequency of display. Oh those were the halcyon days of my youth...

Could be a starting point for you too. Let's you learn more too. Makes you learn more!

Just suggestin' :slight_smile:

Because of small range of motion and speed of back and fourth I feel like an accelerometer would give me more data to work with. for instance if the fan is waved in a tilting motion where one side goes forward first, the accelerometer could use that data to do cool waving animations.

I don't think you will get any useful data at all with an accelerometer. These things take time to read and that delay will mess things up. They are noisy as well and the noise will affect the timing.

Well I defiantly want RGB so i believe 5mm is the smallest made for RGB.

There is the 5050 surface mount RGB LED, you can mount them perpendicular or face on.
Exactly how are you wanting the LEDs to go? Just on the tip on the fan or along the length of the folds?