# Random LED's

Discussion in 'Beginner Electronics' started by Bill, Jun 30, 2006.

1. ### BillGuest

Does anyone know a good and simple way to have 4 LEDs blink in a random
pattern

2. ### Chris HeadGuest

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

My preference for a simple way would be to use a PIC microcontroller
(pick your own preferred type here), and put something like a linear
congruential generator on it (see Wikipedia - generating a number
requires just a multiply and an add, if you let M be a power of 2).
Once you generate an 8-bit output, use the upper 4 bits for your LEDs
and throw away the lower 4 bits (the lower bits of a linear
congruential generator have awful randomness). With an appropriate
PIC, you can do this with literally nothing but the chip, a power
supply, the LEDs, and the current-limiting resistors. Something like
the 16F627A/16F628A/16F648A have a built-in oscillator and can run
from 3 to 5.5 volts, so 3 AA batteries would power the whole system.
You can also get the 16LF variant (instead of 16F) which can run down
to 2V, so you could use only 2 batteries. I'm not familiar with the
10F series, but you can probably find a 10F series PIC that'll do the
job just as well, and the 10F series have only 8 pins where the
16F648A has 18, so you'd use a lot less space.

On the other hand, if you've never done any microcontroller work, it's
a big job to get started.

Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEpV5U6ZGQ8LKA8nwRAsImAKCW85gdinFiqOYMKAY5EhWi79aFSQCg2hmQ
lJudkoQiFCsaV/+3sVF81cQ=
=7fyc
-----END PGP SIGNATURE-----

3. ### BillGuest

I have never used a PIC, do you have a Schematic?

4. ### Chris HeadGuest

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Unfortunately a schematic won't help. A PIC is a type of
microcontroller, so you have to write code and then burn it into the
chip. Writing the code requires a computer and programming knowledge,
and burning it into the chip requires specialized hardware (a
programmer). If you HAD these resources already available, a PIC would
be both easy and cheap. If you have to acquire any of the above, it
will be either difficult, expensive, or both, and I would suggest a
different approach (at this point I stop being able to help you, since
I don't know off-hand another way to solve your problem).

Chris

Bill wrote:
[snip]-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEpY8W6ZGQ8LKA8nwRAvvLAJ4sq1XVWn3Q9Phcq7oI21ljWLW7TwCfUxnR
TSJ8ifdPee+umeAY0XWMxC4=
=ErIR
-----END PGP SIGNATURE-----

5. ### Tater SchuldGuest

cripes, why have the guys spend hundreds of dollars in development tools for
a single application.

simple solution, get 4 blinking LEDs, wire them in parallel. after an hour
they'll be random enough.

6. ### Chris HeadGuest

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Heh... because if you already HAVE the tools, because you do OTHER
things with microcontrollers, then it's only a few dollars, and the
solution is very small in terms of space taken up. I did say that if
you don't already have the tools and knowledge this probably isn't a
good idea.

Chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFErI8q6ZGQ8LKA8nwRAgM7AKCE/zcMkvmCTj76XMDPCk2cButDEACgnlMi
rKrXvFCsQVp+S0/9UQv3rR4=
=MWp9
-----END PGP SIGNATURE-----

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Continue to site