Simplest way to make an LED flash (part of) the Fibonacci Sequence?

I'm trying to figure out if I can make one (or possibly several) LEDs blink maybe the first 15 Fibonacci numbers. Wonderfully awesome (but unnecessary) would be if I could also have it emit a sound (loaded from my computer) at the same time, in sync.

Would something like a 555 timer work for this, or is that silly? Would that also drive the audio? What is the simplest way to do this? My experience with electronics is very, very basic - nothing beyond playing with LEDs, soldering/unsoldering components, wire splicing, a super-simple Jacob's ladder, etc. Is this project too advanced for the time being?

I'm not asking for the schematic to be built for me, just some direction - I don't know what I'm doing here. Help?

sort by: active | newest | oldest
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144

How ? As discrete LEDS or as numbers on 3, 7 segment displays ?

It would be interesting in these days of microcontrollers to do it "old school", but demanding on someone who hasn't worked with discrete logic, and as soon as you commit to discrete logic, and decide to change something, you are back down in state diagrams and truth tables.

I'd probably aim to use an Arduino, and either my favourite MAX7221 or 74HC595s.

Steve
Lithium Rain (author)  steveastrouk7 years ago
As either one LED or several separate LEDs simultaneously - something on the order of box with either just one on top, or one on each side, blinking.

Sounds like I need a microcontroller, then - but I'm not sure if those models would work for what I describe. I'll investigate arduino along with picaxe, then. Thanks for the information! The only problem is that microcontrollers appear a cost somewhat more than I'm wanting to spend on this...oh well.
As some of the Instructables point out, the microcontrollers themseves can be quite cheap -- the heart of the Arduino is about $3. What costs more is the programming hardware, and the convenient prototyping card.

So if you're willing to do a bit of additional work, you can develop the thing, then rebuild it around a stripped-down stand-alone processor and reuse the development platform for the next project.
Lithium Rain (author)  orksecurity7 years ago
I realize I could JSFI, but since you're here...:D How do I get around buying the programming hardware and prototyping card? Are you saying I need to make my own interface to program it? (Sorry for dumb questions).
5 bucks for the processor, I know you're a poor student and all that, but 5 bucks ?

So, one LED flashing for 1,2,3,5 periods ? Or flashing 1, then 2 times, then 3 times, then 5 etc ?

Easi-peasy.

Steve
Lithium Rain (author)  steveastrouk7 years ago
Oh, I was seeing $20-50 - I guess I wasn't looking hard enough, or looking at the wrong kinds. $3-5 is fine. :D

Yes, one LED flashing once, then once, (1,1...), then twice, then thrice, etc. It'd have to speed up, of course, so you could tell they were grouped...

Thanks. :)
MattTheGeek6 years ago
I would say a PICAXE would be the most cost effective solution, however it requires some setup. Check out COM-09432 from sparkfun.com

A Arduino would be somewhat overkill and is pricey.
Plus the PICAXE is programmed in BASIC, so it's dead easy.
Lithium Rain (author)  MattTheGeek6 years ago
Thanks for the advice! When I have time I'll definitely check into it.
kayakdiver7 years ago
My personal choice to use an Arduino would be a "no-brainer" for me. SparkFun will sell you a DEV-00666 for about $32 and that will literally be ALL you need, as the development system is free, and it plugs into your USB port for power and programming.

Still, as replies to this are intimating, there are way more than one way to skin a cat.

Something I have done in the past is to use a PROM to basically run a linear State Machine. If you can program a PROM, you could create this project in very few parts, and you could easily drive more than one LED with the data ouputs.

You would need a counter I.C. (74LS163) and a slow RC timer circuit (eg. 555) to run the PROM through its addresses, and perhaps a driver chip to drive the LEDs, although some older PROMS could drive them directly.

I'll leave the details for you to ponder.
Lithium Rain (author)  kayakdiver7 years ago
>My personal choice to use an Arduino would be a "no-brainer" for me. SparkFun will sell you a DEV-00666 for about $32 and that will literally be ALL you need, as the development system is free, and it plugs into your USB port for power and programming.

Cool! This is exactly the type of information I was hoping for (not that Steve didn't provide it). I've researched Arduinos, but just got confused as to what, exactly, I needed to buy to get started.

Thanks for the rest of the information, too! Hopefully I'll be able to use it. :)
iectyx3c7 years ago
Very cool question. Electronic Fibonacci Generators (also known as Koken Generators) were used for government cryptography to encode teletype messages automatically.

They took the place of the electromechanical rotors which had been used during World War II.

Very loosely Fibonacci sequences can mean any sequence generated by summing at least some of the previous numbers.

Here is a hint, you can use electronic or even electromechanical "shift registers" with a pulsing clock to drive it all, and read out the successive state of the register by blinking an LED.

It seems pointless to use a microcontroller because you are not getting at the heart of the purpose and mathematical and logical meaning of generating a Fibonacci sequence. You are just trivially simulating the result.

So search for Koken and crypto and linear feedback shift registers (LFSR)and you'll have a cool and meaningful project to work on. Best wishes, bet you will learn a lot - the best kind of hacking.
kokenx.jpg
Lithium Rain (author)  iectyx3c7 years ago
Thanks for the information! It's true that using a microcontroller is "just trivially simulating the result", but that's what I'm after at the moment - I'd love to use it as a learning opportunity, but just don't have time at this point to get into such an involved process.
CLS
x = 0
y = 1
z = 15
CALL fibo(x, y, z)
END


SUB fibo(a, b, n)
PRINT a, b,
REM first two terms are already printed so started from 3
FOR I = 3 to n
s=a+b
PRINT s,
a=b
b=s
NEXT I
END SUB
Lithium Rain (author)  Computothought7 years ago
Thanks very much for the code! :)
Wish I could take credit for it. A simple web search found it, though I did mod a few lines for simplicity's sake.
Goodhart7 years ago
Lith, you weren't thinking of something like this were you?

That one isn't very simple, but then using sequencers or  digital comparitors or, as Kelsey mentions counters, would be a challenge but is an interesting one.....I must think about this a bit :-)
Lithium Rain (author)  Goodhart7 years ago
Well, insofar as it indicates the sequence, sort of! :)

I'd like to build it the "right" (hard) way someday, but I think for now I'll do as others suggest and get a microcontroller. :)
A microcontroller will certainly cut down on the device's footprint, for sure :-)
wat.7 years ago
Buy some led bolt?
kelseymh7 years ago
That's an interesting, and non-trivial, problem (F&R worthy, BTW). Hmmmmm....

Well the obvious solution, nowadays, is to use a microcontroller (PIC or AVR like Arduino). Doing the sequence programmatically is trivial. If you know basic soldering, and can both follow instructions and use your computer, then you could set something like this up in a few hours.

Much more interesting (and more difficult) would be to try to do it with components. Something like a five- or six-bit adder would be sufficient; you'd put two in sequence and alternate which was "active" for triggering a gate to the 555. The other would be there to remember the previous value, before getting the current value added into it and becoming active.

I'm getting a bit out of my own depth, here. I can figure out conceptually how to do it, but I don't have the knowledge of components that the real electronics experts around here have. Let's see if Steve, for example, decides to weigh in...
If one used comparitors and counters (and the trigger of course) one could do it, but it would have a sizable footprint I bet....
Lithium Rain (author)  kelseymh7 years ago
Thank you! :)

The consensus seems to be solidly in favor of a microcontroller being easiest. I keep hearing about Arduino so I'll be looking into that. (I think I can safely rule out doing it with components, at least for the time being - too advanced.) Thanks for the help - hopefully I can build what I have in mind.
rickharris7 years ago
Not sure how cool this would actually be unless you just like counting but anyway this basic programme appears to work for the first 15 numbers 0 to 120. It will run on a picaxe micro controller see

http://www.picaxe.com

for more information

If you download their free programming editor from their web site it has a simulator where you can run this programme without having to buy any hardware.



Start:
B0=1 'sets up initial value
main:
B1=B0+1 ' adds 1 to that value
B2=B0+b1 'adds original number to increased number
gosub flashled ' flashes LED that many times
B0=B2 ' changed value to the new fab value
if B0<121 then goto main 'does it all again.

flashled:

for b3=0 to B0 ' for a count of 0 to the Fab value
high 2 ' turn output 2 on - this could be an LED
pause 100 ' wait for 1/10 os a sec
low 2 ' turn output off
pause 100 ' wait 1/10 sec
next b3 ' continue the loop until the full count is reached.
return ' go back to do it again.

Lithium Rain (author)  rickharris7 years ago
Thank you very much for the information and the program! I will have to investigate picaxe further...
Playing around it's more interesting if you flash 2 LEDs alternately and makes the pause between flashes equal to the reciprocal of the current Fibonacci number

This way for low numbers the flashing is slow and as the number of flashes gets higher the flashes get faster.

Mmm I have far too much time on my hands - It's very cold out side here at present though.