'Sinking' an LED - 2 power rails involved

Jstosic

New Member
Beginner here.... I have a simple question, yet, may sound like a dumb question so please bare with me…

When using an output pin to SINK, does it matter what voltage is applied to the other end of the device? Like, can it be higher? In my case, the device is a simple LED.

The reason I ask this is because another section of my circuit is a 555 astable (clock) running off 12-volts, and the clock output is connected to the anode of the LED with a 560-ohm resistor connected in series, and then the cathode of the LED is connected to the Picaxe output pin. So the result would be the LED would only flash when the Picaxe output pin is low (assuming the clock is operating).

N.B. Both 5 and 12 volt supplies share common ground and the Picaxe is connected to the 5 volts, of course.

So would this be allowed in this scenario, or must I use a transistor to do this because of the voltage difference?

Thanks.
 

westaust55

Moderator
Welcome to the PICAXE forum.

The answers is YES, it does matter.

In more detail, you do not say which PICAXE you have but to be safe . . .

the reason is that when the Output is chnaged to an input which can be done to some pins on some PICAXE chips, the input would see the entire voltage on the other side of the LED and fry the PICAXE IO.

Likewise when the output was made high to turn the LED off, the higher voltage to the LED would still impress a current through the LED and into the PICAXE IO and again could (ie likely to) fry it.

So all bad news.

As you say the option is to use a transistor as a switch between the PICAXE and the LED. Have a look at PICAXE Manual 3 page 9 for the basic circuit.


Then the question arises, why are you using a 555 at all? :confused:
The PICAXE could control the LED entirely unless you need the 555 and high voltage for some other undisclosed circuit
 
Last edited:

Jstosic

New Member
Welcome to the PICAXE forum.

The answers is YES, it does matter.

In more detail, you do not say which PICAXE you have but to be safe . . .

the reason is that when the Output is chnaged to an input which can be done to some pins on some PICAXE chips, the input would see the entire voltage on the other side of the LED and fry the PICAXE IO.

Likewise when the output was made high to turn the LED off, the higher voltage to the LED would still impress a current through the LED and into the PICAXE IO and again could (ie likely to) fry it.

So all bad news.

As you say the option is to use a transistor as a switch between the PICAXE and the LED. Have a look at PICAXE Manual 3 page 9 for the basic circuit.


Then the question arises, why are you using a 555 at all? :confused:
The PICAXE could control the LED entirely unless you need the 555 and high voltage for some other undisclosed circuit
Thank you .

Bugger! I just wanted to check, because I don't know how the internals are done in the chips. I was trying to avoid using transistor/resistor setup (several LED's will be connected this way, not just one, that's why), but anyway, got no choice.
Unless I reduce the input power voltage to the 555 from 12 down to 5V... might be quickest solution, [hmmmm].

Sorry I didn't mention what Picaxe... for this project, Picaxe-28X, but only standard 'Output' pins.

I am using the 555 as a standalone clock, not only for LED flashing, but for other purposes (more significant than LED). I thought it'd be less work for the Picaxe because I'm going to keep the Picaxe busy with other tasks (can't get into too much detail, sorry).

As with the higher voltage (12V) in the circuit, I will be running some 12-volt devices. Originally the 555 was going to be powered by 12 volts, but I am considering 5 volts now to make the LED connections simpler.

Thanks for your help.
 
Last edited:

westaust55

Moderator
With the 28X and many other PICAXE chips, even though Rev Ed has defined some pins to be only as outputs, as a PIC chip each pin is capable of being an input or output.

The 28X outputs still have input circuitry associated with them. See the attached diagram from the PIC datasheet.

The protection diodes mentioned in the datasheet may jsust save you in a once off instance, but I certainly would not be banking upon that as protection.
 

Attachments

Jstosic

New Member
With the 28X and many other PICAXE chips, even though Rev Ed has defined some pins to be only as outputs, as a PIC chip each pin is capable of being an input or output.

The 28X outputs still have input circuitry associated with them. See the attached diagram from the PIC datasheet.

The protection diodes mentioned in the datasheet may jsust save you in a once off instance, but I certainly would not be banking upon that as protection.
OK, I get you, but I'm still a little confused though.
What if I change the power input voltage for the 555 to 5V instead of 12V (which would effectively reduce voltage down to around 5V to the LED)? Would that still potentially damage the chip? Or do I still need to use transistors and that's it?

Thanks. Hopefully no more questions :)
 

sleazyd

New Member
Really depends on the circuit. If the 555 is the only thing driving the Anode + resistor of the LEDs at +5V and the PICAXE is the only thing driving the cathode, then it should work fine (assuming you don't draw too much power).

Typically, level shifting in a mixed-mode circuits like this use open collector ouputs to only sink current, do it by using a diode + BJT to fake an OC output, or use a low-side MOSFET. I'd shoot for the MOSFET, as it's the easiest.
 

hippy

Ex-Staff (retired)
It's also a little more complicated because higher voltages can be fed into a PICAXE pin providing they are current limited. The maximum injection rating for most pins seems to be +/-20mA ( but check the datasheet ) in which case, a LED passing less than 20mA through it from +12V should, if I've read it right, be able to connect directly to a PICAXE output.

The real problem is that a PICAXE output is either +V or 0V, so whether the LED is between 12V/+V or +12V/0V there will probably be enough of a volatge drop to light the LED. The PICAXE may change its brightness but not turn the LED off.
 
Top