4
\$\begingroup\$

In reference to this question

Is it possible to program the LEDs each to flash on consecutively each with its own activation speed in the sequence chase then add some sort of a randomizer programming to choose to speed up the chase by 1 second or slow down by 1 second at random intervals which is also shown by a LED as a visual notification. Can this be done through the Atmel AT89C2051 microcontroller?

\$\endgroup\$
10
  • 2
    \$\begingroup\$ Yes, that is all possible. What have you tried so far? \$\endgroup\$ Aug 1, 2012 at 16:51
  • \$\begingroup\$ Great (: so I can program a randomiser, awesome. I havent started yet Im just finding what components I will need (: \$\endgroup\$
    – Mr Men
    Aug 1, 2012 at 16:57
  • 2
    \$\begingroup\$ Of course it's possible, even though it's not really clear what "chase" means and what exactly you are trying to display. How many LEDs? The biggest issue might controlling a large number of LEDs via multiplexing or other means. \$\endgroup\$ Aug 1, 2012 at 17:14
  • \$\begingroup\$ A chase of LEDs is the lights go around in a circuit start with first then the last. Theres only 17 LEDS in total. (: It can be done Thanks \$\endgroup\$
    – Mr Men
    Aug 1, 2012 at 17:41
  • 1
    \$\begingroup\$ With only 17 LEDs I'd get a microcontroller with enough I/O pins to drive each individually. Fortunately there are plenty of those. \$\endgroup\$ Aug 1, 2012 at 18:18

3 Answers 3

3
\$\begingroup\$

If you want to take a stab at multiplexing or using shift registers, I would recommend visiting these links:

The Arduino is used in both those tutorials, but it should be relatively easy to apply the same concepts to your microcontroller.

\$\endgroup\$
3
  • \$\begingroup\$ @capcom, can you bring over some of the information yourself so that we are not going to suffer from link rot. We have already seen many links die since we first started our site 3 years ago. \$\endgroup\$
    – Kortuk
    Aug 5, 2012 at 21:47
  • \$\begingroup\$ @Kortuk Okay, that's fine. Am I allowed to copy/paste to save time? Thanks. \$\endgroup\$
    – capcom
    Aug 5, 2012 at 23:01
  • \$\begingroup\$ @capcom Depends on what copy protection they have used. Wikipedia is fine that way because they just require attribution. I would suggest mostly summarizing. \$\endgroup\$
    – Kortuk
    Aug 6, 2012 at 11:52
5
\$\begingroup\$

The easiest way is to multiplex the LEDs - there's an schematic on this page. It's really easy: enter image description here

Basically you light one bank at a time. Switching at 20+ Hz, the eye won't notice. Then you can program them to light in whichever way you wish.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ +1 I'm pretty sure there are people who will be annoyed by the flicker at 20hz. I would shoot for much higher, I've met a few people annoyed by 30hz flicker even. 60hz, is where I'd start. \$\endgroup\$
    – kenny
    Aug 2, 2012 at 10:43
1
\$\begingroup\$

Yes, what you wish to do is pretty easy. But ...

No, you can't do it with the AT89C2051 microcontroller. Take a look at its datasheet. (You did look at the datasheet didn't you?) In the description on the first page it says "15 I/O lines". This means you can have a maximum of 15 LEDs/Buttons/etc.

You will need to choose a microcontroller with at least 19 I/O lines (17 LEDs + 1 switch + 1 piezo). How about the AT89C51RC, it's got 32 I/O lines.

\$\endgroup\$
8
  • 2
    \$\begingroup\$ Why not use a shift register like the 74HC595? Wouldn't that work? \$\endgroup\$
    – capcom
    Aug 1, 2012 at 22:38
  • \$\begingroup\$ That answer shows a clear lack of imagination. You can multiplex the leds, use a shift-register, an io-expander, latches... i could go on. \$\endgroup\$
    – Kristoffon
    Aug 1, 2012 at 22:40
  • 3
    \$\begingroup\$ @Kristoffon Maybe Rocketmagnet took into account the fact that the OP is a beginner in electronics and didn't want to introduce additional ICs that might confuse the OP. \$\endgroup\$
    – m.Alin
    Aug 1, 2012 at 22:47
  • \$\begingroup\$ @m.Alin I think if the OP is using a standalone AT89C2051, he wouldn't be too fearful of multiplexing or using a shift register. Considering there are quite a large number of beginner tutorials out there too. \$\endgroup\$
    – capcom
    Aug 1, 2012 at 23:09
  • \$\begingroup\$ Yes sorry I added a few more LEDs Rocketmagnet, thanks for the information. The power supply is only 3v power. You see the problem is cost and working space. I need to do it the least possible components in a very flat small enclosure space and for about £1 which is about 1.50 USD. I will be buying in bulk of 1000s so I get a bit cheaper. I think a multiplexer or the shift register like will work best for me(: And yes Kristoffon I see there is loads of options cheers. \$\endgroup\$
    – Mr Men
    Aug 2, 2012 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.