glow an led

mtullock

New Member
Making an led chaser. Happy with a basic sequence but would be desirable to have the non lot leds to have a low glow until it is there turn to be fully lit. Is this possible? Thought about pwm but don't know if that can be used on all output pins or if there is a better solution on the 18m2

Cheers
 

hippy

Technical Support
Staff member
There are various hardware tricks which could potentially be used in a circuit. These can allow some current to flow through the LED even when not activated.

A lot depends on what functionality you want - will any ever need to be fully off, or is 'on' and 'dim' good enough ? - and what your LED hardware is -are these 3mm or 5mm board mounted 20mA LEDs driven via a resistor from I/O pins or something more substantial ?
 

mtullock

New Member
There are various hardware tricks which could potentially be used in a circuit. These can allow some current to flow through the LED even when not activated.

A lot depends on what functionality you want - will any ever need to be fully off, or is 'on' and 'dim' good enough ? - and what your LED hardware is -are these 3mm or 5mm board mounted 20mA LEDs driven via a resistor from I/O pins or something more substantial ?
Basically what you said is ideal! Always on and dim tri colour led. 5mm board mounted with a resistor from the I/o pin.

Cheers
 

premelec

Senior Member
You can simply put a resistor to the LED directly from power source that keeps it on slightly and then switch full power from the PICAXE -through a resistor - to the LED. If the driving pin is on and off then the resistor from that pin to the LED becomes part of a voltage divider and must be considered _unless_ you put a diode in series with the output pin to the LED - which also drops the driving voltage some...
 

hippy

Technical Support
Staff member
Always on and dim tri colour led
Being tri-colour LEDs likely adds some complexity to whatever is done because they won't have two states, on and off, which can be converted to on and dim.

What colour should a dim tri-colour LED be, and would that ever change ?

I am also wondering if by tri-colour you mean a red plus green LED combined or perhaps an RGB LED?
 

hippy

Technical Support
Staff member
If the driving pin is on and off then the resistor from that pin to the LED becomes part of a voltage divider and must be considered _unless_ you put a diode in series with the output pin to the LED
Or make the pin an input. That would have the potential for three increasing brightness levels - Output Low, Input, Output High.
 

mtullock

New Member
Or make the pin an input. That would have the potential for three increasing brightness levels - Output Low, Input, Output High.
They are rgb leds. Essentially I have a 4 led chaser, using b.0 to b.3 they will be red, using b.4 to b.7 they will be green and using c.0, c.7, c.6 and c.5 they will be blue. Then an interrupt will determine which pins go high for the chaser. At the same time the non lit pins of the same colour will emit a glow.

This is the final piece of a very elaborate jigsaw! :)
 

hippy

Technical Support
Staff member
There should be some way to jiggle things with a couple of resistors and a diode to get three levels such that each LED can be turned off with Output Low ( or low enough that any glow isn't noticeable ), be dim when Input, and full on when Output High.

Code:
           ___
+V -------|___|---.
                  |
                  }---|>|---.
           ___    |         |
      .---|___|---{   LED  _|_ 0V
      |           |
IO ---{           |
      |           |
      `----|<|----'
Prototype it first, because that's just a rough idea of how it could be, and not tested !
 

mtullock

New Member
so something like thids:

input b.0 : input b.1 : input b.2: input b.3
lookup b0,(b.0,b.1,b.2,b.3),b1
reverse b1
high b1

(assuming this is in a loop)

cheers
 

mtullock

New Member
There should be some way to jiggle things with a couple of resistors and a diode to get three levels such that each LED can be turned off with Output Low ( or low enough that any glow isn't noticeable ), be dim when Input, and full on when Output High.

Code:
           ___
+V -------|___|---.
                  |
                  }---|>|---.
           ___    |         |
      .---|___|---{   LED  _|_ 0V
      |           |
IO ---{           |
      |           |
      `----|<|----'
Prototype it first, because that's just a rough idea of how it could be, and not tested !
also I assume that if the IO pin and the +V are both 5V and the forward V of the LED is say 3V then you would say that the +V resistor will have to be significantly higher than the one from the pins?

sorry for all the questions, I am still learning this
 

inglewoodpete

Senior Member
As a starting point, I would suggest that you try a 1.5k ohm resistor to +V for the "low brightness" setting. If the LED is too bright for you, increase the resistor to 2.2k ohm or more.

The series resistor connecting to the PICAXE I/O pin could be 270 ohms as a starting point. Don't run the diodeLED at it's maximum current, as this risks reducing its working life. I generally run components up to 75% of their maximum values.

The diode connected to the PICAXE I/O pin could be any low-current one like a 1N914 or 1N4148 etc.
 
Last edited:

mtullock

New Member
As a starting point, I would suggest that you try a 1.5k ohm resistor to +V for the "low brightness" setting. If the LED is too bright for you, increase the resistor to 2.2k ohm or more.

The series resistor connecting to the PICAXE I/O pin could be 270 ohms as a starting point. Don't run the diode at it's maximum current, as this risks reducing its working life. I generally run components up to 75% of there maximum values.

The diode connected to the PICAXE I/O pin could be any low-current one like a 1N914 or 1N4148 etc.
Awesome thanks. Still waiting on components to arrive but will let u know if it works :)
 

hippy

Technical Support
Staff member
using b.0 to b.3 they will be red, using b.4 to b.7 they will be green and using c.0, c.7, c.6 and c.5 they will be blue.
Note that C.5 is an input only pin on the 18M2. You will want to move the connection from C.5 to C.1 or C.2.

If C.1 and C.2 are already used, members may be able to help reallocate those. If that's not possible you might have to consider an alternative PICAXE.
 

mtullock

New Member
Note that C.5 is an input only pin on the 18M2. You will want to move the connection from C.5 to C.1 or C.2.

If C.1 and C.2 are already used, members may be able to help reallocate those. If that's not possible you might have to consider an alternative PICAXE.
My mistake it is c.1 and not c.5 which I am using.....trying to be clever and do it from memory lol. Cheers though :)
 
Top