3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

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?

26 answers
sort by: active | newest | oldest
Nov 16, 2010. 1:38 AMsteveastrouk says:
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
Nov 16, 2010. 9:38 AMorksecurity says:
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.
Nov 16, 2010. 10:27 AMsteveastrouk says:
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
Feb 19, 2011. 6:40 PMMattTheGeek says:
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.
Feb 19, 2011. 6:41 PMMattTheGeek says:
Plus the PICAXE is programmed in BASIC, so it's dead easy.
Dec 3, 2010. 1:42 PMkayakdiver says:
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.
Nov 23, 2010. 6:51 PMiectyx3c says:
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.
Nov 21, 2010. 12:52 AMComputothought says:
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
Nov 21, 2010. 12:40 PMComputothought says:
Wish I could take credit for it. A simple web search found it, though I did mod a few lines for simplicity's sake.
Nov 16, 2010. 8:34 PMGoodhart says:
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 :-)
Nov 17, 2010. 2:38 PMGoodhart says:
A microcontroller will certainly cut down on the device's footprint, for sure :-)
Nov 17, 2010. 12:05 AMwat. says:
Buy some led bolt?
Nov 15, 2010. 8:59 PMkelseymh says:
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...
Nov 16, 2010. 8:36 PMGoodhart says:
If one used comparitors and counters (and the trigger of course) one could do it, but it would have a sizable footprint I bet....
Nov 16, 2010. 1:42 AMrickharris says:
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.

Nov 16, 2010. 1:48 AMrickharris says:
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.


Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!