LED flickering

lauriet

Member
Hi.
I have had two simple projects now where I observe that a LED output that should be off is actually flickering at a low level. Both projects are very basic, switch or serial inputs and LED outputs, and the effect sometimes disappears again as the code is developed in seemingly unrelated areas. I am baffled.
Could any of you good folk with an idea of how this can happen throw names of some topics for me to study to understand and resolve this situation.
 

nick12ab

Senior Member
You're not accidentally activating internal pull-ups are you?

Are the LEDs driven directly by the pins (through resistors I hope) or via a transistor? Only a very miniscule leakage current is required for the LED to light up dimly.

Is the flickering at mains frequency? Does it get brighter if you touch the circuit either side of the LED?

Are you able to post your code, schematic and photos of your circuit?
 

hippy

Technical Support
Staff member
It could be that the inputs are floating causing inconsistent readings leading to LED flickering, or perhaps code is inadvertently affecting outputs it should not.

If you download a simple LED toggling program along the lies of that below ( replace X.Y with your pin identifier ), does that exhibit LED flickering ... ?

Code:
Do
  Toggle [i]X.Y[/i]
  Pause 1000
Loop
 

westaust55

Moderator
As mentioned above, the inputs should not be floating.
Switches connected to pins assigned as inputs should have a pull-up or pull down resistor (typically 10 Kohm in value).
See page 26 in PICAXE manual 3: http://www.picaxe.com/docs/picaxe_manual3.pdf
The 1 Kohm resistors into the input pins in those diagrams are not mandatory but good practice particularly for new comers - in case a bi-directional pin is accidentally made an output.
 

lauriet

Member
As mentioned above, the inputs should not be floating.
Switches connected to pins assigned as inputs should have a pull-up or pull down resistor (typically 10 Kohm in value).
See page 26 in PICAXE manual 3: http://www.picaxe.com/docs/picaxe_manual3.pdf
The 1 Kohm resistors into the input pins in those diagrams are not mandatory but good practice particularly for new comers - in case a bi-directional pin is accidentally made an output.
Thanks for your replies; I am using a picaxe project board on the main project that has this problem (the other one I cannot reroduce any more; there was something in the code causing it, I think), so have the pull-down situation covered.

I have currently put this problem on the back-burner, but may return later. Imagine this :-
I have two connected boards (one containing the Picaxe circuit) with three switches and three LEDs on each. During the test procedure each switch lights an LED on its own board. When running, each switch will lluminate LEDs on its own and on the other board. (it's a signalling system)

The prototype works utterly correctly, even when the two boards are connected the required distance apart (several hundred feet).
I sent it to my brother who installed it at the required location, and it works correctly at all times EXCEPT that a particular switch at the remote end does not illuminate the correct LED during the test sequence, but another LED at that end flickers dimly (the code for that bit is identical to all the others). This does not occur during the running procedure, everything is fine.

I shall have to wait till I visit the installation to explore this situation further, as I've not a clue currently. Though I suspect it might involve tinkering with ferrite beads, etc., about which I know nothing.

In the mean time, I'll give it an occassional think, and if anyone has any bright thoughts, I'd be grateful.
Cheers.
 

SAborn

Senior Member
the code for that bit is identical to all the others
Did you copy paste the code for each function, if so perhaps you missed making a change to one pin somewhere.
Something i have done many times and takes a bit of looking to find the problem.
 
Top