Kaleidoscope - Easy way to generate random turn on from LED's?

Cillakin

Member
Hello all! Thank you for taking the time to read/reply my thread.

This weekend I came up with (what I hope to be) a fun toy-ish type of project for my kids. What I aim to do is use PVC pipe, two total pieces with one smaller in diameter than the other; three long & wide pieces of glass to make a triangle within the smaller PVC pipe; use a small grid of LEDs (diffused obviously) to create interesting patterns; use a servo/small motor to rotate the grid of LEDs.

However the problem exist in how to randomly come up with LEDs shifts. Is there a way to create a semi-random (by semi I mean a long program, maybe 5 minutes, before it resets) switching on/off or delay for the LEDs? It is possible to just write up turn x LED on for this long, then this one, and so on. However this is very tedious and I forsee a lot of debugging with the code.

Any ideas are most welcomed, and appreciated. :D



***NOTES***

- The two PVC pipes are so I can mount circuitry on back and pull wires to the top connecting to an On/Off switch for the LEDs.
- Using two PVC pipes also allows room to store a battery pack (3xAAA) assuming the gap in diameters is large thick enough.
- Diffused LEDs must be used so as to not blind the viewer when looking through the kaleidoscope. DO NOT use regular or high power LEDs.
- Three bolt/nut combos will be used, 3 down each side, by 3 long, so 9 total individual bolts/nuts. This secures the two PVC pipes together.
 

sedeap

Senior Member
Im not sure if you can achieve that... with leds
and also you need mirrors, not only glass to do the triangular tube.
but... you can put a led behind a diffuser paper and get retro-luminance.
and cut a small pieces of color translucid plastic and fill the gap with them.
that give you an infinite patterns every turn.
[video]http://upload.wikimedia.org/wikipedia/commons/4/48/Teleidoscope_animation.gif[/video]
 

Bill.b

Senior Member
Hi This is a part a a LED sequence program for christmas lights. I am controlling 16 groups of LED using port B and C of the 28x2.

This routine generates random sequenses for the LEDs.

Hope this may be of some help

Code:
#picaxe 28X2
#No_Data
#No_Table

setfreq m8
symbol delay 	= w2
symbol looptme 	= w10
symbol loop2	= b8
symbol muxdelay	= b9
symbol delay1	= b10
symbol delay2	= b11
symbol delay3	= b12
symbol delay4	= b13
symbol outputb	= b7
symbol outputc	= b6


delay  = 100  'preset delay range 0 - 1023
delay1 = 5
delay2 = 50
delay3 = 80
delay4 = 120

dirsb= %11111111
dirsc= %11111111
dirsa= %00001111


outputc = 0
outputb = 0
pinsb = outputc
pinsc = outputb

main:

              gosub randompattern

              goto main


randompattern:

                for b8 = 1 to delay3
                        random w3
                        for looptme = 1 to 10
                              pinsb = outputc
                              pinsc = outputb
                              pause 5
                        next looptme
                        random w3
                        for looptme = 1 to 10
                               pinsb = output
                               pinsc = outputb
                        next looptme
                        pause 5
                        random w3
                        for looptme = 1 to 10
                                 pinsb = outputb
                                 pinsc = outputc
                       next looptme
                       pause 5
                       random w3
                       for looptme = 1 to 10
                             pinsb = outputc
                             pinsc = outputb
                         next looptme
                         pause 5
                 next b8
                 return

Bill
 

Cillakin

Member
Hi This is a part a a LED sequence program for christmas lights. I am controlling 16 groups of LED using port B and C of the 28x2.

This routine generates random sequenses for the LEDs.

Hope this may be of some help

Code:
#picaxe 28X2
#No_Data
#No_Table

setfreq m8
symbol delay 	= w2
symbol looptme 	= w10
symbol loop2	= b8
symbol muxdelay	= b9
symbol delay1	= b10
symbol delay2	= b11
symbol delay3	= b12
symbol delay4	= b13
symbol outputb	= b7
symbol outputc	= b6


delay  = 100  'preset delay range 0 - 1023
delay1 = 5
delay2 = 50
delay3 = 80
delay4 = 120

dirsb= %11111111
dirsc= %11111111
dirsa= %00001111


outputc = 0
outputb = 0
pinsb = outputc
pinsc = outputb

main:

              gosub randompattern

              goto main


randompattern:

                for b8 = 1 to delay3
                        random w3
                        for looptme = 1 to 10
                              pinsb = outputc
                              pinsc = outputb
                              pause 5
                        next looptme
                        random w3
                        for looptme = 1 to 10
                               pinsb = output
                               pinsc = outputb
                        next looptme
                        pause 5
                        random w3
                        for looptme = 1 to 10
                                 pinsb = outputb
                                 pinsc = outputc
                       next looptme
                       pause 5
                       random w3
                       for looptme = 1 to 10
                             pinsb = outputc
                             pinsc = outputb
                         next looptme
                         pause 5
                 next b8
                 return

Bill
Awesome thanks! I plan on using an 18M2 but I have a 40X2 in transit so I should be able to just take the code and copy+paste; no conversion to X2. :)

This afternoon I went to Home Depot and got the PVC pipe. However they did not have any mirrors so I'm doing kind of a jimmy-rig approach to solve this issue. Using foiled duct tape (fairly reflective) I plan on covering a sheet of construction paper; then using light cloth/cotton pads to buff out the irregularities on the surface of the tape (it is surprisingly smooth, like a very, very thin piece of aluminum foil) then I will apply some clear-coat polyurethane to give it an extra shine. Next I can either do one of two methods that seem the most appropriate: Fold the construction paper into a cone leaving a circle at the bottom big enough for a circular PCB (get a set of 5, each different size, from RadioShack for about $4). Imagine a waffle-cone or one of those dog anti-itch/scratch things; same principle. Or the second method, cut the construction paper into strips and make a triangle that meets at the end. I don't know what to compare this too IRL so just try to imagine as best as possible I suppose. In either case the LEDs on the PCB will be at the end. I am so far in favor of the cone method because I can get it to the exact size of the circular PCB.

Im not sure if you can achieve that... with leds
and also you need mirrors, not only glass to do the triangular tube.
but... you can put a led behind a diffuser paper and get retro-luminance.
and cut a small pieces of color translucid plastic and fill the gap with them.
that give you an infinite patterns every turn.
[video]http://upload.wikimedia.org/wikipedia/commons/4/48/Teleidoscope_animation.gif[/video]
Do you think using a motor/servo at the end, connected to the PCB will enhance that effect? The PVC pipes are kind of big, and well, my kids are not. lol. So I wanted to minimize them having to rotate the pipes to get an effect similar to the one you mentioned.
In any case, I really appreciate the replies and help suggested/offered. :)
 

Buzby

Senior Member
Hi Cillakin,

While I admire your efforts to design the Picaliadoscope, I do think the results will not be as spectacular as you expect.

A conical mirror will not give the same effect as the mirrors in a real kaleidoscope.
The real kaleidoscope uses three long thin mirrors arranged as a tube, with the coloured beads at one end, and the viewer at the other.
The beads are in a disk than can rotate. The 'effect' comes from the multiple reflections across the mirrors as the beads move in their disk.

This is both easier to build and more effective. There is no need to have a 'tube in tube' arrangement.
You just need one tube with mirrors inside, and the 'rotation' is done by lighting the LEDs on a fixed PCB at one end of the tube.

There are many software solutions to 'flash the lights', but until you have the mirror unit built you will not be able to see what the result looks like.
Maybe the easiest solution is to buy a kaleidoscope, remove the 'disk of beads', and replace with a 'PCB of LEDs'.

This would be a really cool idea to get working, and would make a good entry in the 'Finished Projects' section of the forum.

Good Luck,

Buzby
 

Cillakin

Member
Hi Cillakin,

While I admire your efforts to design the Picaliadoscope, I do think the results will not be as spectacular as you expect.

A conical mirror will not give the same effect as the mirrors in a real kaleidoscope.
The real kaleidoscope uses three long thin mirrors arranged as a tube, with the coloured beads at one end, and the viewer at the other.
The beads are in a disk than can rotate. The 'effect' comes from the multiple reflections across the mirrors as the beads move in their disk.

This is both easier to build and more effective. There is no need to have a 'tube in tube' arrangement.
You just need one tube with mirrors inside, and the 'rotation' is done by lighting the LEDs on a fixed PCB at one end of the tube.

There are many software solutions to 'flash the lights', but until you have the mirror unit built you will not be able to see what the result looks like.
Maybe the easiest solution is to buy a kaleidoscope, remove the 'disk of beads', and replace with a 'PCB of LEDs'.

This would be a really cool idea to get working, and would make a good entry in the 'Finished Projects' section of the forum.

Good Luck,

Buzby
Thanks for the advice I appreciate it.
The concept of the two tubes was so I could route wire up it (the first tube containing everything) which is connected to a switch, mounted onto the second tube. The second tube is also there as a "force" stopper of sorts. My kids are small and like to break shit, so, I try to make my projects fairly rugged. However a one tube design as you mentioned would more more practical.
I'm also pretty pumped to try and get this thing made over my vacation for the next couple of weeks. It should be fun and I hope the added size of the tubes enhances the effect of the product. I will be in the hunt for mirrors, but for a prototype, just to see how it goes, I think the foil/reflective tape will still have a result, albeit much less spectacular. So long as I can get a really good model by the 3rd go I'll be content. And hopefully implemented all of the advice!
Thanks again guys, much appreciated.
 

techElder

Well-known member
Also, remember that the visual effect from a Kaleidoscope is from the "edges" of the "beads" that contrast with each other as they slide around.

Perhaps adding a "grid" that has some depth (like a honeycomb) in front of the LEDs will add some contrast.

Interesting project. Be prepared to post a video!
 

Buzby

Senior Member
How about hacking a cheap pair of plastic binoculars, putting mirrors and LEDs in each tube ?
Clever software and LED positions will give 3D effects.

This would give a very 'easy to hold' device, and little kids always seem to struggle shutting one eye only !.

The Bino-Picalaidoscope !.
 
Top