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.

Random Arduino LED Fader.

Random Arduino LED Fader.
«
  • PC121965.JPG
  • PC121962.JPG
Randomness. It is so easy in the real world. In the electronics world, well...it is really hard. Sure it is possible to create "pseudo-random" effects but not truly random. The only way to actually create randomness is to  ise programming. Even then, randomness will eventually repeat itself.

Fading. It is also hard.Without programming, it is possible but it is not efficient. The circuits aren't small. In fact, most fading circuits use large capacitors that take up space. Not pleasing.

Put these two together and it is extremely tough

In the end, I must subject to programming.

To be specific,

Open source Arduino programming. 

By building this project, pupils will learn how Pulse Width Modulation works by correctly using an Arduino, a computer and a breadboard with LEDs. They will also learn how inversion is caused when sinking and sourcing is switched.


Update: I changed the code a bit. It now fades a bit faster and a bit better and smoother to view. If you downloaded the code look again at the code.
 
Remove these adsRemove these ads by Signing Up
 

Step 1What You Need.

You will need:
An Arduino
6 LEDs (possibly more.)
Jumper Wires
Breadboard and/or protoboard
 
« Previous StepDownload PDFView All StepsNext Step »
15 comments
Jan 16, 2012. 1:29 PMHiggs Boson says:
This works well, but the LEDs repeat a pattern.
Jan 16, 2012. 2:35 PMHiggs Boson says:
Yeah. I did sink and source, and I used your code. It starts out seeming random, but after a while a pattern emerges.
Jan 16, 2012. 3:13 PMHiggs Boson says:
You've heard of the random function on the arduino right? have you tried using it in the code? I'm trying to use
int x = random(1, 7)
to get a random number, and list all of the combinations the lights could be, and use the number gotten from the result of the random function to randomly select one of the combinations (and yes I know that that would only be capable of choosing only 6 possible combination of something like 30 to 36.)
Jan 16, 2012. 3:24 PMHiggs Boson says:
that's something I just learned today. I'm trying it now, so if I get it to work I'll post it here.
Jan 16, 2012. 7:50 PMHiggs Boson says:
that's weird, what was the baud rate that you used?
are you going to order another atmega, or get a new arduino?
Jan 16, 2012. 8:42 PMHiggs Boson says:
Okay well I hope you get it working. I will continue experimenting with the code. I might try using radomSeed, and use an analog pin with nothing attached.
Dec 19, 2011. 5:40 AMBrunoG says:
Yay I´m the first to write a cament.
Very cool I did it and it works!!!!
Thanks!

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!
46
Followers
35
Author:blinkyblinky
If you want me to build something...I'm open to ideas. I like to hack with electronics, mix with chemicals and play with ideas. My motto? "If you want something to be done in this world, you must do i...
more »