Exact match. Not showing close matches.
'[PIC] Connect4 : Got rid of the drivers'
Tomás Ó hÉilidhe
Previously, my display multiplexer flashed one column at a time, where
one column consisted of 7 LED's. Each LED would have had about 20 mA
going through it, which comes to a total of 140 mA flowing at a time.
140 mA is too much current to draw from the PIC16F887 overall, which is
why I had highside drivers for the rows. The column took the current of
all 7 LED's so naturally I had a lowside driver to sink the 140 mA.
In order to get rid of the highside drivers for the rows and also the
lowside driver for the columns, I've decided to flash each LED one at a
Altogether I have one hundred LED's on my board, but even when the game
is maxed out there'll be a maximum of 57 LED's lit at a time.
So here's my latest schematic:
(It's high resolution, you can zoom in)
And here's some points about it:
* 100 nF capacitors across the Vdd and Gnd pins of the 887. Do I need a
cap across the battery?
* 100 ohm resistor in series with the piezo speaker; will this be enough
to protect from "kick back"?
* I've got 7 push buttons, but 6 of them don't have pull-up resistors
because Port B has internal pull-up's. The last button, PB6, has a
pull-up resistor because it goes to a pin on Port C which hasn't got an
internal pull-up. I'm using a 1 kilohm resistor for the pull-up; is this
a good value? Is it good enough for the pull-up resistor to go to 3 V
instead of 5 V?
* The resistor pack for the LED's consists of 50 ohm resistors in order
to put 20 mA through a 2 V LED when the supply voltage is 3 V.
* I haven't got an RC circuit on Vpp; I'm going to use the PIC's
internal pull-up instead. Will this be OK for normal usage of the device
and also for when I'm debugging it?
I'm using the internal oscillators on the 887, which means I'll be
running it at either 4 MHz or 8 MHz. In the datasheet for the 887,
there's a graph of permissible values for Vdd versus clock speeds. It
seems that Vdd can be brought as low as 2 V if the clock speed is below
8 MHz, so I shouldn't have a problem with a 3 V supply, and also
hopefully I won't have a problem as the battery voltages drop as they
One thing I've just been wondering about though... as the batteries
deplete and as the supply voltage drops from 3 V, will this have a major
effect on my LED's? It seems to me that so long as the supply voltage
doesn't drop below the forward voltage of the LED's, I won't see a
*major* drop in LED brightness. Using 50 ohm current-limiting resistors
for the LED's, I'll have 20 mA flowing when the batteries are 3 V, and
if the batteries were 2.5 volts, I'd have 10 mA flowing.
When maxed out, my display multiplexer will consist of 57 separate
stages. I had my doubts on whether the 887 would be fast enough to pull
off 57 stages without flicker, but I've been assured that it's up for
the task. What I'm concerned about though is the brightness of the
display... so I'm thinking I should get "high intensity" LED's or
whatever they're called.
So basically I'm looking for a three-pin, bi-colour/tri-colour LED with
the following characteristics:
* High intensity, very bright
* Neither of the internal LEDs' forward voltages is greater than
about 2 V.
* The current through them for highly luminous light is less than 25 mA.
* Common cathode
My supplier is Farnell here in Ireland, but I'm having trouble using
their finder yokie for finding the right LED's. Anyone know a good site
where I can easily enter the above data and narrow the search down?
(I've tried Digikey but didn't have much luck)
And now just a couple of questions about running the PIC at less than 5 V:
* If I'm running the PIC at 3 V, then what value must I have on an
input pin for it to be read as HIGH? Is 3 V enough?
* If I'm running the PIC at 3 V, will kind of voltage will I get on
an output pin when it's high? Will I get near enough 3 V? Or will I get
more like 3 V - diode drop, i.e. about 2.3 V?
It's looking a heap more cost-effective !! The truth is, this is
what happens in a review. Sometimes a design starts with
great hopes, but after a few rounds of brain-storming *** or
modifications, you realise you've come full circle back to a
You can eliminate half of the resistors. Each pair of LEDs are
commoned at their cathodes, so you put the resistor there (as
Olin mentioned the other day), rather than one per anode
*** the term 'brain-storming' is now considered offensive by
some bleeding-heart PC liberal do-gooding we-know-what's-
The term "brainstorming" has been accused of being politically
incorrect and offensive to people with epilepsy. There appears to
be little truth to this criticism. A survey in 2005 by the UK charity
National Society for Epilepsy found that 93% of people with the
condition surveyed do not find the word offensive
Tomás Ó hÉilidhe
> You can eliminate half of the resistors. Each pair of LEDs are
> commoned at their cathodes, so you put the resistor there (as
> Olin mentioned the other day), rather than one per anode
I'll have 5 times as many resistors if I put them on the cathodes,
reason being that I'll need to put them on the cathode for every column.
Think about it:
Quantity LED's if they go on anodes = quantity LED's per row = 14 resistors
Quantity LED's if the go on cathode = (quantity LED's per row / 2) *
quantity columns = 14 / 2 * 9 = 7 * 9 = 63
Unless I'm missing something.. ?
> * 100 nF capacitors across the Vdd and Gnd pins of the 887. Do
> I need a cap across the battery?
It probably wouldn't hurt to have an electrolytic, say 100uF. This will
help with peak demand as the batteries internal resistance goes up as
they drain. Although with constant strobing it's debatable whether the
cap would have time to store enough charge to make a difference
> * The last button, PB6, has a pull-up resistor... 1 kilohm
Anything up to 100k would probably do. PIC inputs are pretty high
Z and don't need much current to hold them at a'1' state. I believe the
weak pullups on PortB are something like 25k (you can work that
out from the current drain in the specs)
> Is it good enough for the pull-up resistor to go to 3 V instead of 5 V?
State switching is related to Vdd, not always absolute voltages
> I'm using the internal oscillators on the 887, which means I'll be
> running it at either 4 MHz or 8 MHz
4MHz will use less power, and WDT period is the same at any Vdd
if that's what you choose for the strobe timing. As I indicated in the
other post, the really important frequency is the refresh rate, and that
is just so much slower than the PIC
> hopefully I won't have a problem as the battery voltages drop as
> they deplete
You might also look at paralleling batteries to double capacity. 4xAA
in two parallel series-pairs. Packs of 4 x AA are cheap and common
> One thing I've just been wondering about though... as the batteries
> deplete and as the supply voltage drops from 3 V, will this have a
> major effect on my LED's?
This is where there could be a conflict in design. Choose fixed values
and you have to live with both the limitations and simplicity. Or a very-
slightly more complicated system for flexibility, eg monitoring Vbatt for
dynamic alterations to drive
Undoubtedly the brightness of LEDs will decrease as Vdd goes down
using fixed timing and fixed components. You can't easily change the
value of components, but you can do a lot with the timing
A feasible solution would be to not drive each column for 100/6 of
the time, ie a total of 166ms 'on' time per second. Instead, figures out
of thin air, choose components that will give sufficient brightness at
100ms 'on' time per second at new battery Vdd
So, say you refreshed at (1000/6)Hz. Each 16.6ms a new column
is enabled, but instead of leaving it on for the full 16.6ms until it's
turned off and the next column is enabled, enable it for just 10ms,
leaving a 6.6ms blank period before it's disabled and the next column
enabled. As Vbatt goes down, you increase the 'on' time, thereby
decreasing the blank period. With the timing suitably linked to Vbatt,
the perceived brightness, from a persistence of vision POV, will stay
the same as Vbatt goes down
This is, IOW, adaptive PWM drive
> I'll have 5 times as many resistors if I put them on the cathodes,
> reason being that I'll need to put them on the cathode for every
Oh, yes, I see that now. Teach me to look to the right more often
But you could instead put 7 on the low side ? Each resistor is then
effective for a column, not a row. Compare yours with
Instead of R20 - 27, resistors could be on the collectors of Q1 - Q4
(You should adjust my column count in other posts from 6 to 7 BTW)
Tomás Ó hÉilidhe
> But you could instead put 7 on the low side ? Each resistor is then
> effective for a column, not a row.
But there'll be different amounts of LED's on at a time in a column, so
the fewer LED's that are lit, the brighter they'll be.
> > But you could instead put 7 on the low side ? Each resistor is
> > then effective for a column, not a row
> But there'll be different amounts of LED's on at a time in a column,
> so the fewer LED's that are lit, the brighter they'll be
If you were using fixed timing, yes. But your s/w knows how many
LEDs should be on (it does doesn't it ? It checks for a win ?) so it
can adjust the 'on' time to suit
> -----Original Message-----
> From: mit.edu [ piclist-bouncesmit.edu] On Behalf piclist-bounces
> Of Tomás Ó hÉilidhe
> Sent: 29 June 2008 01:57
> To: Microcontroller discussion list - Public.
> Subject: [PIC] Connect4 : Got rid of the drivers
> Previously, my display multiplexer flashed one column at a time, where
> one column consisted of 7 LED's. Each LED would have had about 20 mA
> going through it, which comes to a total of 140 mA flowing at a time.
> 140 mA is too much current to draw from the PIC16F887 overall, which is
> why I had highside drivers for the rows. The column took the current of
> all 7 LED's so naturally I had a lowside driver to sink the 140 mA.
> In order to get rid of the highside drivers for the rows and also the
> lowside driver for the columns, I've decided to flash each LED one at a
This is likely to give very poor brightness since you are going from a 7:1 multiplex to 42:1, i.e. each LED will now be on for only 1/42nd of the total display time. You will not be able to increase the current to compensate because you are driving the LED's directly from the PIC's output pins so are limited to 20mA.
Why did you feel the need to get rid of the drivers? A simple and cheap NPN transistor with reasonable gain would have sufficed for the column driver, or a small MOSFET with low RDSon if you want the lowest voltage drop.
>One thing I've just been wondering about though... as the batteries deplete >and as the supply voltage drops from 3 V, will this have a major effect on >my LED's? It seems to me that so long as the supply voltage doesn't drop >below the forward voltage of the LED's, I won't see a
>*major* drop in LED brightness. Using 50 ohm current-limiting resistors for >the LED's, I'll have 20 mA flowing when the batteries are 3 V, and if the >batteries were 2.5 volts, I'd have 10 mA flowing.
Right, so you'd have a noticeable drop in brightness as the battery depletes. This is inevitable if the Vf of the LED's is close the the battery voltage, and therefore a low value current limiting resistor is required.
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
More... (looser matching)
- Last day of these posts
- In 2008
, 2009 only
- New search...