Driving a LED directly with outputs

system11

Member
A project I'm working on needs really small LEDs and I noticed they are listed as 2.2v while the ones I've previously used were 5v, is the ouput from a picaxe output pin just going to fry them without a series resistor?
 
is the output from a picaxe output pin just going to fry them without a series resistor?
Yes, you should use a series resistor to limit the current or you risk frying the electronics in either the LED or, worse, the output transistors for that PICAXE pin (which would then stop working).

FYI. There are "5V" LEDs sold that have the series resistor built-in to make using them more convenient to use.
 
Hi,

Yes, most LEDs are by their nature Diodes which have a reasonably Constant Forward Voltage Drop, so are required to use a series resistor. Their voltage drop is usually around 1 volt for Red up to about 3 volts for Blue, White and Ultra Violet LEDs; UV is significant because many "High Brightness" LEDs generate UV which is converted to visible light (of potentially any colour) by the use of phosphors.

However, there are a few tricks which can allow some PICaxes to drive some LEDs with reasonable safety, without a series resistor. First, connect the LED (cathode) to ground (0 volts) not (the Anode) to the supply rail; generally most PICaxes (particularly the M2s) have "weaker" Pull-Up output transistors (compared with their complementary Pull-Down) so there is less risk of "frying" the output stages and/or the LED. In particular, at lower supply voltages (Vdd), the (maximum available) output current can be significantly lower, even into a "short circuit", so that below about 4 or 3 volts, there is little risk of damaging an M2 PICaxe or a resistor-less LED. Additionally, you could use a PWM output pin (driven at a reasonably high frequency and low duty cycle) which will of course dim the LED and reduce the thermal heating of the PICaxe and the LED.

If the LED doesn't need to be very bright, then a completely safe method to drive it directly from a PICaxe pin is to employ the internal "Weak Pullup" resistors with the PULLUP instruction. This is easy to use for just one LED, but if you want to drive multiple LEDs independently on several pins, then the program needs to keep track of which LEDs are required to be ON for each separate command.

Cheers, Alan.
 
It's a whole row of LEDs, in the past I just connected the cathode to ground and used high/low commands to toggle it - blue ones advertised as 5v. This time I need to use those really small ones. it's going to be a real problem making space for 13 more resistors on the PCB I'm designing - and a project I just released will need modifying - I saw one site say 330 ohm - is that in general going to do the job?
 
Hi,

It potentially depends on which PICaxe you're using, how many LEDs may be lit at the same time (max and min), their colour, how bright they are required to be, perhaps whether you're using SMD or through-hole components and the type of power supply, etc.. Generally, the X2 chips have a higher current rating, but if all the LEDs are lit at the same time, then the maximum current rating may be of the chip's power supply pins/rails, not of the individual LED/driver outputs/pins. Specific data for the PICaxe chips can be found in the "Advanced Technical Details" HERE, typically in sections 30 and 31.

If only a single LED, or a reasonably constant number are lit at the same time, then the LEDs might share one or a small number of resistors. Or if all the LEDs are the same colour, then an M2 with a regulated supply around 3 volts may well safely drive the LEDs without any series resistors. Yes, with a 5 volt supply rail, 330 ohms is a reasonable series resistor value to drive blue LEDs quite brightly (say 5 mA each). Individual pins are rated up to 25 mA (for M2s), so lower resistor values may be acceptable if really bright LEDs are required. But the M2 supply rail/pins have a maximum rating of around 80 mA, so if all LEDS are illuminated at the same time and have a lower voltage drop (e.g. Red-Yellow) then 330 ohms might be too low a value.

Cheers, Alan.
 
It's always 2 at once and I'm using the 40X2 surface mount chip, I've made space on the PCB for a couple of surface mount resistor packs. I really don't like surface mount projects at all because they're harder for other people to build, but there was just no other way to fit everything on the PCB and also keep it shallow enough to fit into the small enclosure. The below will hopefully fit inside a 3D printed version of those memotech zx81 keyboard interface units.

1771731112984.png
 
Hi,

If it's only "one-of-five" and "one-of-eight" LEDs lit at the same time (as appears from the diagram), then you need only two series resistors, for example in series with the "common ground" connections to the two groups of LEDs. Another method is to mount through-hole resistors vertically, so that each consumes only around 0.02 square inches of PCB space (i.e. two "holes" on standard 0.1 inch pitch prototyping board). ;)

A nice-looking project, and your PCB looks quite generous; on my "drawing board" I have a through-hole PCB design the size of an AA cell (i.e. 14 mm x 50 mm) which carries:
A (socketed) DIP PICaxe (08M2),
A Programming Socket (3.5 mm or the Legacy "pins"),
A Real-Time Clock module (with battery),
An I2C EEPROM (up to 512 Mb),
A 32 x 128 pixels graphic OLED display,
A LED or LDR for ambient light monitoring,
and the required "interface components and connections". All in a height only slightly larger than the diameter of an AA cell. Thus it can use a standard "AA Battery Box" (with a "window" cut for the Display), for both its "enclosure" and power supply. :)

Cheers, Alan.
 
Back
Top