Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LEDs counting in binary

2 views
Skip to first unread message

Kirk Is

unread,
Jun 22, 2003, 6:34:24 PM6/22/03
to
ObSomeoneElse'sHack: So we went over to a friend of my wife's house, he's
a pretty hardcore sysadmin type w/ an interest in legacy hardware, and his
house is littered with everything from old DEC teletypes to
Altair-knockoffs to Apple IIs to Mac 128ks to Next cubes and SGI
Indigos...pretty amazing. One of the most fascinating pieces is a
salvaged front panel from a PDP--er, 10 or 11 or thereabouts. Some guy
(before he got a hold of it I think) wired it up so the front lights, 18
of 'em, were counting in Binary. It was a surprisingly interesting and
hypnotizing display, actually... it reminded me of those old Rolling Ball
clocks for some reason, even though there was no way of mapping it to the
current time.

How hard would it be to set up a display like that with like 18 LEDs?
Would you need chips, or how many transisters would it take? Seems like a
nice technofolkart project. (I was recently at a Jackal Art Group
workshop, where we made cute little LED light sculptures with a 9V, wire,
and 3-6 LEDs... http://kisrael.com/viewblog.cgi?date=2003.04.28 )

Dang, sometimes I think I got that Radio Shack "100-in-1" electronic kits
too early...late enough so I could put the right wires in the right
springs and make the stuff in the manual, but not enough so I was able to
realistically experiment.

Hmm, though now that I'm a software guy, maybe this would be a nice little
Java project. (Or javascript as well, come to think of it...maybe I'll
make it a gamebutton: http://www.kisrael.com/features/gb.html )

--
QUOTEBLOG: http://kisrael.com SKEPTIC MORTALITY: http://kisrael.com/mortal
MISTAKES "It could be that the purpose of your life is only to serve
as a warning to others." --Demotivators, http://despair.com

Kirk Is

unread,
Jun 22, 2003, 8:29:03 PM6/22/03
to

So I went a head and built it in Java and that's my
ObHack:
http://www.kisrael.com/viewblog.cgi?date=2003.06.23
Source code there...I'm not sure if I got the applet runnable
paint stuff quite right, but I tried to get decent double
buffering.

--
QUOTEBLOG: http://kisrael.com SKEPTIC MORTALITY: http://kisrael.com/mortal
"Sisyphus has a sense of playfulness [...]
you have to look at it from the rock's point of view."
--Pointy Haired Boss, Dilbert (TV)

Ilmari Karonen

unread,
Jun 23, 2003, 1:47:49 AM6/23/03
to
In article <Q9qJa.75$X2....@news.tufts.edu>, Kirk Is wrote:
>
>How hard would it be to set up a display like that with like 18 LEDs?
>Would you need chips, or how many transisters would it take? Seems like a

You can cheat a lot: In particular, there's no real requirement that the
LEDs be connected to each other in any way (though I suppose it helps
with the synchronization). If you can make a circuit that blinks a LED
on and off, you can make 18 of them with different (power of 2) periods
and just start them in parallel.

Implementation details left as an exercise, I just wanted to point out
this property of binary numbers.

Or you could go really low tech and use gears. I'm sure you could find
some small gears with a 2:1 ratio. Paint half of each with conductive
paint or whatever, so that you can use them to switch the LEDs on and
off, and drive them with a cheap clock motor or something. Now that
would be a hack. (For maximum coolness, you'd want to make the whole
assembly look like a model of something designed by Charles Babbage...)

--
Ilmari Karonen

Aaron Denney

unread,
Jun 23, 2003, 2:25:31 AM6/23/03
to
In article <Q9qJa.75$X2....@news.tufts.edu>, Kirk Is wrote:
> How hard would it be to set up a display like that with like 18 LEDs?
> Would you need chips, or how many transisters would it take? Seems like a
> nice technofolkart project.

You should be able to do it with a timer, and 18 (clocked) flip-flops,
each inventing itself, and feeding into the clock of the next higher.

You'll also need some reset cicuitry, if you want it to start at 0
instead of at some random place.

You might want to look at _The Art of Electronics_, if you're interested
in doing more hacks like this.

--
Aaron Denney
-><-

Kirk Is

unread,
Jun 23, 2003, 8:04:00 AM6/23/03
to
Aaron Denney <wno...@ugcs.caltech.edu> wrote:
> In article <Q9qJa.75$X2....@news.tufts.edu>, Kirk Is wrote:
>> How hard would it be to set up a display like that with like 18 LEDs?
>> Would you need chips, or how many transisters would it take? Seems like a
>> nice technofolkart project.

> You should be able to do it with a timer, and 18 (clocked) flip-flops,
> each inventing itself, and feeding into the clock of the next higher.

Yeah, I was dredging up the old memory banks, for my memory of the
electronics course I took in fourth or fifth grade (didn't get too too
far) and I remembered the "flip-flop". I guess doing that for 16 or so
lights would be a fair number of little components, assuming I
breadboarded it or whatever, interesting to think of how I could keep
things petite.

Wonder how hard/expensive it is to get like a chip burnt to handle that?
Or does that take away the simplistic charm?

> You might want to look at _The Art of Electronics_, if you're interested
> in doing more hacks like this.

Thanks for the recommendation, I was also thinking of digging up one of
those Radio Shack 100-in-1s. (though that wouldn't have enough parts to do
that much along those lines I think.)

Anyway, "Jeff" posted on the comments board for that day,
http://kisrael.com/viewblog.cgi?date=2003.06.23
I think describing a "newton's cradle" and wondering if I was up for doing
something like that...oddly enough I was considering doing the binary
counter as a "gamebutton" (i.e. in javascript, using the caption of a
pushbutton for display) and I'd already done a newton's cradle in that
format: http://kisrael.com/features/gb.html , near the bottom.


--
QUOTEBLOG: http://kisrael.com SKEPTIC MORTALITY: http://kisrael.com/mortal

"God or somebody save us from any society founded on Darwinian principles."
--Richard Dawkins

Stuart Levy

unread,
Jun 23, 2003, 8:48:19 PM6/23/03
to
In article <Q9qJa.75$X2....@news.tufts.edu>, Kirk Is wrote:
[... string of LEDs counting in binary on an old DEC front-panel ...]

>How hard would it be to set up a display like that with like 18 LEDs?
>Would you need chips, or how many transisters would it take?

There are some nice CMOS binary counter ICs with a chain of 14 flip-flops,
so two of these would drive more LEDs than you'd want to look at.

E.g. the CD4020 (which takes a clock input) and CD4060 (which has
a built-in oscillator, which just needs two resistors and one capactior).
A web search for the 4060 showed this example project:
http://www.doctronics.co.uk/owncap.htm
then just take the 4060's slowest output and make it the 4020's clock input.

I think then all you'd need would be an array of LEDs, each with its own
resistor, connected one per counter-pin. You can even get
arrays of say 8 LEDs and 8 resistors in DIP packages.

Could be fun to watch, and probably more fun to build than to watch.

You could also make one of those linear-feedback shift registers,
with a couple of well-chosen outputs XORed to feed the input,
and hook up its outputs to LEDs the same way. (A few 4015's
would do, with 8 bits per chip.) It'd be sort of like
a binary tickertape, with meaningless bits streaming across the LEDs
in endlessly changing patterns. That might be fun to watch too.

ObElectronicToyHack:

As a teenager I once made an electronic draedle, a little top with four
Hebrew letters (hay, gimmel, shin, nun) that's used in a
Hanukkah game. It used a dual flip-flop, a quad NAND gate,
a resistor & capacitor or two to make an oscillator out of two
of the gates, one 7-segment LED display, and a button.
You'd hold the button down, the oscillator would drive the counter
'way too fast to watch, then release the button and find one of the four
letters on the 7-segment display. You had to turn your head to the
side to read the shin, which looks like an E resting on its back.

I think I needed one or two of the other gates to get the right
sets of segments to light up.

Stuart Levy

SG

unread,
Jun 23, 2003, 9:48:40 PM6/23/03
to
In article <slrnbff84l...@ilia.ncsa.uiuc.edu>, Stuart Levy wrote:
>
>Could be fun to watch, and probably more fun to build than to watch.

The front panel on my old PC had 2 seven segment displays. By mucking
about with a pile of jumpers you could set the display to a two digit
number for the clock speed. I quickly became bored at looking at a
meaningless number (the machine was a P120).

I wired up a simple circuit with parts at hand to drive the
leds and move them in a funky pattern. A 555 timer was the oscilator,
and an edge triggered 8 bit j/k (74 type) with set/reset held the
pattern. The output from one bit was mapped into the input of the
next. An RC ciruit cleared the register. I can't remember how I set
the first bit to start the whole thing moveing. It was not another
RC. It may have been a nand/and/or type circuit hanging off of the RC
clear circuit. I may also have gone the expensive route and used
another 555. The j/k could not sink enough current to drive two leds
(one per seven segment) at a time. A mess of BJTs were used as
switches to drive the LEDs. The turbo switch was in parrallel with a
resitor in the 555's timing network. Pressing the turbo button
(remember those) sped up the blinken lights.

An attempt was made to tie the HD led output into the whole mess. The
idea being that HD activity would speed up or somehow change the
pattern. Nothing usefull was produced. Later a co-conspirator designed
a circuit useing a MicroPic. It was never built as a MircoPic
was outside the design requirements: "Parts were to be parts-at-hand."


--
sg

Charles Bryant

unread,
Jun 24, 2003, 6:53:54 PM6/24/03
to
In article <1056346...@itz.pp.sci.fi>,

Ilmari Karonen <usene...@itz.pp.sci.fi> wrote:
>In article <Q9qJa.75$X2....@news.tufts.edu>, Kirk Is wrote:
>>
>>How hard would it be to set up a display like that with like 18 LEDs?
>>Would you need chips, or how many transisters would it take? Seems like a
>
>You can cheat a lot: In particular, there's no real requirement that the
>LEDs be connected to each other in any way (though I suppose it helps
>with the synchronization). If you can make a circuit that blinks a LED
>on and off, you can make 18 of them with different (power of 2) periods
>and just start them in parallel.
>
>Implementation details left as an exercise, I just wanted to point out
>this property of binary numbers.

Eh? You mean:

*.* 5
**. 6
*** 7 (looks ok, doesn't it)
*.. 4 (oops!)
..* 1
.*. 2
.** 3
... 0

To count in conventional binary, when LEDs 0..N-1 go from all on to
all off, LED N must toggle.

--
Eppur si muove

Keith Wansbrough

unread,
Jun 25, 2003, 9:03:52 AM6/25/03
to kw217
Charles Bryant <n114446...@chch.demon.co.uk> writes:

> In article <1056346...@itz.pp.sci.fi>,
> Ilmari Karonen <usene...@itz.pp.sci.fi> wrote:
> >You can cheat a lot: In particular, there's no real requirement that the
> >LEDs be connected to each other in any way (though I suppose it helps
> >with the synchronization). If you can make a circuit that blinks a LED
> >on and off, you can make 18 of them with different (power of 2) periods
> >and just start them in parallel.
>

> Eh? You mean:
>
> *.* 5
> **. 6
> *** 7 (looks ok, doesn't it)
> *.. 4 (oops!)
> ..* 1
> .*. 2
> .** 3
> ... 0
>
> To count in conventional binary, when LEDs 0..N-1 go from all on to
> all off, LED N must toggle.

Ilmari is right:

... 0


..* 1
.*. 2
.** 3

*.. 4


*.* 5
**. 6
*** 7

But Charles is right too... how on earth will you manage to keep all
those oscillators in phase? Much better to use a few counter chips,
say 7493 (I grew up on TTL, not CMOS). But you need a transistor for
each LED as well, as a driver. The chip does 4 bits, so you'd need 5
chips plus an oscillator plus 18 driver transistors.

ObHack: New DECT phones came with a clock/radio/charger, which SO
appropriated for her bedside table (to replace historic appliance
which had done its day). Very nice, but there's a problem: the clock
display is fine during the day, but rather bright at night, and SO
can't tolerate any light at night - even a single standard LED is too
much. Normally, there's a dimmer switch on a clock/radio, which dims
the display to something invisible by day and just visible at night.
However, this device being primarily a phone charger stand, with the
clock/radio an afterthought, this important feature was missing.

Solution: after testing for a week to be sure it wasn't going to fail,
voided the warranty as follows. Opened the case, poked away at the
display PCB with a few volts from the ohms range of multimeter to
discover wiring of the segments. Curiously, there are *two* common
wires, each driving roughly half the segments (seemingly at random);
from the power wiring it looked like they were driven in antiphase off
the power line frequency (50Hz), presumably to reduce flicker.

Anyway, no matter - the only nice metal toggle switch I have up in the
loft is double-pole anyway. Cut the traces, start trying different
resistors across the break to determine what gives the right
brightness (turned out to be surprisingly high, like 33k or something
- guess the driver power wasn't very regulated). Solder a resistor
across each break. Now we have a clock/radio with a display that's
just right at night, but invisible in the daytime.

Final step: wire the switch across the breaks, each break individually
switched short or open. Annoyingly, the switch is DPDT plus centre
off, but maybe one day I'll replace with with a DPST or DPDT. Result:
switch to closed, and the display is as bright as ever (daytime);
switch to open, and the display is beautifully dim (nighttime). And
one happy and impressed SO!

Oh - forgot to mention - the moulded plastic case is made of something
*very* hard, not the usual flimsy stuff, so it takes quite a while to
drill. Must drill the locating hole one day too...

--KW 8-)
--
Keith Wansbrough <kw...@cl.cam.ac.uk>
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.

Wim Lewis

unread,
Jun 25, 2003, 6:59:16 PM6/25/03
to
In article <Q0CJa.77$X2....@news.tufts.edu>,

Kirk Is <kirk...@alienbill.com> wrote:
>Aaron Denney <wno...@ugcs.caltech.edu> wrote:
>> In article <Q9qJa.75$X2....@news.tufts.edu>, Kirk Is wrote:
>>> How hard would it be to set up a display like that with like 18 LEDs?
>>> Would you need chips, or how many transisters would it take? Seems like a
>>> nice technofolkart project.

You can buy a binary digital clock which uses a column of 4 LEDs
for each digit (so it's a BCD clock, really). Thinkgeek probably
carries it.

>Yeah, I was dredging up the old memory banks, for my memory of the
>electronics course I took in fourth or fifth grade (didn't get too too
>far) and I remembered the "flip-flop". I guess doing that for 16 or so
>lights would be a fair number of little components, assuming I
>breadboarded it or whatever, interesting to think of how I could keep
>things petite.

The 74xx logic chips are cheap and common (you can often get them at radio
shack, even --- IIRC, my "200-or-so-in-1" box had a 7400 and a
7472 or something) and include a number of dual-flip-flop chips. So that'd
be 9 chips for the flipflops, plus something like a 555 to generate
a clock, and maybe a transistor per LED if the logic chips don't have the
current capability to drive them directly.

The CD4xxx series is the other really common "jellybean" logic series,
but I'm not as familiar with it. The CD4020 that Stuart Levy mentions
sounds like it's be easier than chaining together a bunch of dual FFs.

They're all available from multiple manufacturers. For data sheets,
I'd try the website of a mfr like Texas Instruments; for buying
small quantities, in the US, I'd try DigiKey or Mouser (at the
obvious .com addresses).

>Wonder how hard/expensive it is to get like a chip burnt to handle that?

Amazingly easy. There are lots of cheap in-system-serial-reprogrammable
microcontrollers on the market these days, and you can cobble up a
programmer out of junk parts that attaches to a parallel or serial
port. If you want 18 output pins, you need to use a relatively large
chip like the Atmel ATmega8 or PIC 18F2539; they'll cost you $5-$10.
Alternatively, you could wire up the LEDs in a 5x4 matrix, needing
only 9 output pins, and then you could use a $3 chip like the
ATtiny26, AT90S1200, or PIC 16Fsomething. These all have on-chip
clock oscillators. There's a gcc toolchain for the Atmels at least,
but assembly language might be easier for this. They're Flash-based,
so if you make a mistake you can reprogram them instead of having
to throw them away and burn a new one.

>Or does that take away the simplistic charm?

Yeah, probably. :-) For charm perhaps you need to wire-wrap the
thing out of discrete transistors, or maybe adapt one of those nifty
1940's designs that use gas discharge tubes as memory elements ---
as a bonus you could use the neon tubes for the display as well ...
or how about a bunch of latching relays, clicking away?

BTW, I second the recommendation of _The Art of Electronics_; it's
an excellent book. Also, the sci.electronics.* newsgroups are active
and helpful (and Win Hill, one of the authors of AoE, posts there
frequently).

--
Wim Lewis <wi...@hhhh.org>, Seattle, WA, USA. PGP keyID 27F772C1

William Grainger

unread,
Jun 27, 2003, 8:37:22 AM6/27/03
to
Wim Lewis <wi...@underhill.hhhh.org> wrote:
>
>They're all available from multiple manufacturers. For data sheets,
>I'd try the website of a mfr like Texas Instruments;

trouble is, you'll only get one mfr then. I'd suggest registering
for an id at RS (www.rswww.com), and then looking at the datasheets
from there. They've got loads of mfrs. Just my personal preference...

ObHack:
Well, it's in the thought-stage at the minute; inspired by this
discussion, a LED matrix driven by an EPROM that is being addressed by
two clocks running at different speeds to display little stylized fish
swimming about...

Kirk Is

unread,
Jun 27, 2003, 6:25:52 PM6/27/03
to
William Grainger <wfg...@mrao.cam.ac.uk> wrote:
> ObHack:
> Well, it's in the thought-stage at the minute; inspired by this
> discussion, a LED matrix driven by an EPROM that is being addressed by
> two clocks running at different speeds to display little stylized fish
> swimming about...

So by LED matrix, you mean like a grid? How many dots were you thinking?

I have a very "easy" formula for very satisfying fish like motion (well,
maybe not easy enough; you seem to have some very specific thoughts about
clock speeds that I don't quite follow) whenever I learn a new graphical
environment, I tend to write a fishtank app; I think I got the original
formula as a throwaway line in a magazine article on writing games.

Each fish has an "X"-axis speed component, positive or negative
(if it's negative, use the "left" graphic for the fish, if it's positive
use the "right" graphic)
Every tick of the clock, add the X speed to the horizontal position.
Every tick of the clock, subtract one from the absolute value of the X
speed if it's not zero (simulating water drag.)
If X-speed is zero and RND(n) == 0, set the X speed to a constant value K.
(simulating the fish "pushing off" with a certain Kick)

You also have to be aware of reversing the fish's motion at the aquarium
boundary. Also I tend to fudge the vertical position a bit, I think
something like
if RND(m) == 0 then Ypos = Ypos + RND(3)-1 //i.e. pos = pos +1 or -1 or 0

An example of this in action in Java can be seen at
http://alienbill.com/abp/java/fishtank.html

Also, I made a javascript pushbutton "gamebutton" of it:
See the bottom of
http://www.kisrael.com/features/gb.html
(that's a very simple version, but shows how the general idea scales down
pretty well.)

Let us know more details of what you were thinking of!

--
QUOTEBLOG: http://kisrael.com SKEPTIC MORTALITY: http://kisrael.com/mortal

"Ohhho, your inner child pretty much runs the place, huh?"
--Tracy (The Drew Carey Show)

Sam Trenholme

unread,
Jul 2, 2003, 3:42:03 PM7/2/03
to
>The front panel on my old PC had 2 seven segment displays. By mucking
>about with a pile of jumpers you could set the display to a two digit
>number for the clock speed. I quickly became bored at looking at a
>meaningless number (the machine was a P120).

I used to set up those things to output the number "69" myself. At one
point, I gave one of my old computers to one of my female friends; I made
sure to change the display to say something else (I think I just turned
the ¡*ñ$ thing off) before giving it to her.

ObHack:

I had a homework assignment to write assembly code to sum the squares
from 1 to n (where n was in %r1 for a SPARC-like assembly language).
Instead of doing the simple "decrement %r1 while adding %r1 * %r1 to
a sum" solution, I decided to do a more efficient O(Log n) solution,
which consists of calculating:

(n * (n + 1) * (2n + 1)) / 6

Unfortunatly, the SPARC-variant assembly language we were to write this in
has no divide operation. Dividing by two is a simple shift; dividing by
three, however, was a little more tricky. After some thought, I realized
that a number multiplied by three always has the same least significant
bit as the unmultiplied number; this fact allowed me to divide by three
with the following:

divive_by_three(int multiple_of_three) {
int result, or_mask;
result = 0;
or_mask = 1;
while(multiple_of_three > 0) {
if(multiple_of_three & 0x01 == 1) {
result |= or_mask;
multiple_of_three -= 3;
}
or_mask <<= 1;
multiple_of_three >>= 1;
}
return result;
}

Note that this algorithm only works if we know the number is an even
multiple of three.

- Sam

--
My email address may be obtained at http://www.samiam.org/ssi/mailme.shtml

0 new messages