I'm using a HEF4017BP connected to LEDs and a pusbutton to control some LEDs.

Here's the schematic:

enter image description here

So I'm using the pushbutton to drive the clock, the capacitor is there to help with debouncing and since the actual light level of the LEDs isn't important for me, I'm using one resistor for all on them. Not shown on the schematic is the decoupling capacitor, also 100 nF.

I'm expecting the counter to go through the LEDs as described in this diagram from the datasheet:

enter image description here Instead of that happening, Q2 is always on, except when it should be on. In those cases, it's off. The other outputs are behaving normally.

So am I missing something or is the part damaged? It came in stuck to a conductive "sponge" in an antistatic bag and I took the time to touch a grounded object before actually doing anything with it, so it shouldn't be damaged by ESD.

  • \$\begingroup\$ Is Q2 the only one out of place? Do all of the other channels behave as expected? \$\endgroup\$ – Kris Bahnsen Apr 19 '12 at 22:38
  • \$\begingroup\$ @Kris Bahnsen Only Q2 seems problematic. The rest are working as expected. \$\endgroup\$ – AndrejaKo Apr 19 '12 at 22:38
  • \$\begingroup\$ Although a 4017 only cycles through ten states, there are 32 states in which it might power up if reset is grounded. The design of the chip is such that if it's in one of the 22 weird states it will progress to a "legitimate" state within 11 clock pulses. One should not be surprised if a 4017 acts strangely on startup, though it should start acting normally within 11 clocks, or if a reset pulse is received. \$\endgroup\$ – supercat Apr 19 '12 at 23:09
  • \$\begingroup\$ @supercat I'm aware of that and after every power-up, I manually reset the counter. \$\endgroup\$ – AndrejaKo Apr 19 '12 at 23:13

TANSTAAFL effect, quite probably.

(1) Remove the LED from pin 12 and see if it works OK. Pin 12 is not meant to be LED loaded and has complex feedback connections inside the IC. Yes, it is shown as buffered, but ...

4017 datasheet here

enter image description here

(2) This does not appear to be the problem in your case, but if using a switch as a clock it is a very very very good idea to use the A version which has a Scmitt trigger input. My reasonably xtensive experienc with this IC using a switch as a clock source is that the Schmitt version is needed. YMMV but may not. The downside is that, LED drive wise, the Schmitt version can not pull the skin off a rice pudding. A look at the data sheet shows that the one you have is as bad or worse. Guaranteed low drive at Vcc=5V is about 1.4 mA at 2.5V. Not impressive.

  • \$\begingroup\$ I removed the pin 12 LED and there were no changes to behavior. I'm actually planning to use this to drive some transistors, so the current I'm getting right now is more than enough. I picked LEDs just to play a little bit with the device and this seems to be the Hello World project for 4017. In the end, I'll be driving the pin from a microcontroller. Would a Schmitt trigger be needed even then? \$\endgroup\$ – AndrejaKo Apr 19 '12 at 23:18
  • 3
    \$\begingroup\$ A microcontroller driven clock will not bounce, so no Scmitt needed. It sounds as though your specific IC may be damaged. \$\endgroup\$ – Russell McMahon Apr 19 '12 at 23:23
  • \$\begingroup\$ Looks like that could be the result. \$\endgroup\$ – AndrejaKo Apr 19 '12 at 23:24

I guess the polarity of the LED at Q2 is wrong.
So LED at Q2 always is ON when Q2 is LOW (and any of Q0, Q3-Q9 is high which is the case if Q2 is low).

enter image description here

The picture shows how current would flow if e.g. Q7 is high. It would explain exactly the behavior you describe.

  • \$\begingroup\$ +1 for detective work. I replaced the 4017 circuit and it works fine now, but I tested your idea and with it, I get the described behavior. \$\endgroup\$ – AndrejaKo Apr 20 '12 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.