Arduino LED Bar Graph Driven by a 4017 Counter

In this tutorial, my primary objective is to show you how to make a simple LED animation using a LED bar graph and an Arduino. My secondary objective is to share with you a trick to save pins of the Arduino using a 4017 decade counter circuit. The video below shows what we will be making.


If you are able to reproduce this project, have any doubt, correction, or suggestion, please, let me know by leaving a comment.

Hardware Required

  • Arduino board.
  • (1) LED bar graph (or alternatively 10 LEDs)
  • (1) 4017 Decade Counter IC
  • Some wires
  • Breadboard


Arduino LED Bar Graph with a 4017 Counter

(Click the image to enlarge)

As you can see, using the 4017 counter we just need one digital pin from the arduino. Otherwise, we would need 10 pins from the arduino.

This is how it works: the LEDs of the bar graph are wired to the 10 outputs of the 4017 counter. The clock pin from the counter is wired to the arduino. When the arduino is running, it sends clock pulses to the counter making it advance. When the counter advances, the current LED is turned OFF, and the next one is turned ON. See below the picture of the circuit in real life.

Arduino LED Bar graph driven by a 4017 counter

(Click the image to enlarge)


 * Simple LED Bar graph animation using a 4017 counter.
 * The 4017 is used to save pins on the arduino.
 * Developed by Leonel Machava
 * This code is release under the "MIT License" available at

/* PIN used to send clock pulses to the counter. */
int clockPin = 2;

void setup() {

 * Sends a clock pulse to the counter making it advance.
void clock() {

void loop() {
  /* Send a clock pulse to the counter. It makes the counter advance
     causing the current LED to be turned off, and the next one to be
     turned ON */
  /* Wait for 300 ms. */

Click here to download the source (arduino_led_bar_graph_4017.pde / 1KB)

NOTE: This animation can also be made using just a LED bar graph, a 555 timer, and a counter. My main aim in this tutorial was to share with the arduino fans how to make it using an arduino. Additionally, as said in the beginning, my secondary objective was to show a method of saving pins on the arduino, and I did it using a 4017 counter. An alternative way of saving pins would be through the use of 595 shift registers, but for this case it would not be better than using a 4017 counter because we would need 3 pins from the arduino and 2 shift registers.

If you like this article please share it by clicking one of the buttons below, follow me on twitter, or register on my RSS to receive article updates. Thanks!

Leave a comment ?


  1. Thank you for this! It was very helpful to me, as a rank Arduino beginner. Might you someday do a similar tutorial showing the use of shift-registers? Please?

  2. I couldn’t make it work. I used 2 LEDs only and wired the 3rd pin to the reset. Only 1 LED was on.
    One question I have: if I’m using 2 LEDs, should I wire them in pins “0″ and “1″ or 3 and 2 (matching IC’s pinout sequence)?

    • It’s ok, I forgot to put a resistor between the 3rd/Rst pin.
      About my question, you have to match IC’s pinout sequence.

  3. I must project to produce 10 Leds(many colours)with 555Timer and 4017Counter.I must try to do.

  4. Thanks a lot for sharing this with all people you really understand what you are talking about!
    Bookmarked. Kindly additionally consult with my web site =).
    We could have a hyperlink exchange agreement among

  5. Was able to reproduce it using 10 LED.

  6. You need a resistor on the LEDs to limit the current. The 5v output of the arduino is too high and will burn out the LEDs without a current limiting resistor.

    • I realize the power for the LEDs isn’t coming directly from the arduino now, but it is still a very bad idea to not have a current limiting resistor on an LED regardless of the voltage they’re being supplied with.

  7. straight from the source
    It’s amazing in support of me to have a site, which is valuable
    in support of my know-how. thanks admin

  8. The Arduino is only serving to provide a clock signal. It does nothing more. Why not omit the 4017 chip and program 10 Arduino pins to count to 1024? It would be much cooler.

  9. Check out this website for a 4-bit counter. Easy to take it up to 10-bit counter.

  10. – Consume adequate level of nutrients,
    including fibers that reduce cholesterol levels, heart-healthy nuts, fishes, and low-fat dairy rich
    in calcium. Everybody needs some pointers once and even though,
    when your health are at risk then a stakes go higher.
    When we travel as being a family we always have a kitchenette inside accommodation so that we can increase the risk for
    most of our meals with food we all know after which have
    one meal out every day.

  11. heart health tips – – Biking is an excellent means
    of workout that will strengthen your quads, improve blood
    circulation and improve your stamina. Everything
    in everyday life requires effort and sometimes these challenges could possibly be tough to
    overcome. However, a toothache or any other dental problem doesn’t develop

  12. Consume adequate volume of nutrients, including
    fibers that reduce cholesterol, heart-healthy nuts,
    fishes, and low-fat dairy abundant with calcium.
    It is significant that you just oversee the youngsters when they are brushing their teeth.

    So far, exercise and balanced diets are believed as two of the most crucial factors conducive to strong and healthy body.

    website –

  13. – Prevent ill
    health – Modern medicine only focuses on treating us
    if we are ill. Taking care of your teeth is surely an ongoing process and regular check-ups and cleaning with the dentist
    prevents any long-term problems. Make jam and jellies using high sugar
    concentration to preserve fruit.

  14. Once your body actually starts to feel great, your cravings will naturally
    subside and you’ll be reaping the advantages of decreasing the
    sugar within your diet. Everybody needs some tips once and even though,
    however when your wellbeing is a risk then the stakes go higher.
    Make jam and jellies using high sugar concentration to preserve fruit.

    my latest blog post –

  15. Southerly Korea: A whole new international gambling house hotspot

    - yescasino

    What’s up mates, nice paragraph and pleasant urging commented
    at this place, I am really enjoying by these.

  16. At the end for the day, either investment strategy will work, it just
    depends on just how much work you want to do and just how many cash
    producing properties you would like to own while using least level of
    phone calls. The Patient Protection and Affordable Healthcare Act, often called “Obama – Care” has produced a
    substantial effect on the company tips for healthcare providers, payers, suppliers and others.
    Foreclosures Rising – July brought many negative data points to Detroit beginning with foreclosure notices.

  17. It is that will better structure a consultant’s thoughts and
    represent it. To avoid getting yourself into such a situation, these actors should find other reasons for income.
    Every day people dream of a job they can work from other
    own home so that they’ve got more time for you to spend with their family
    and create a good living with the same time.

  18. Спасибо за информацию!!!!!

  19. Hurrah! In the end I got a web site from where I be able to truly take helpful information concerning my study and knowledge.
    Neue Wolfsburg trikot

  20. hello!,I really like your writing very much!
    proportion we communicate extra approximately your post on AOL?
    I require an expert in this space to solve my problem.
    Maybe that is you! Taking a look forward to
    peer you.

  21. Thanks dear for this valuable information sharing with us. Visit Ogen Infosystem for the best Web Design Company and SEO Service.

  22. Jeffrey

    The dye from the eclipta alba plant could be formed into an oil and massaged into the greying hair.

    The microwave is totally off limits in Ayurveda so I prepare everything in my pressure cooker or on the
    stove. Why can we keep spending much cash
    pills, books, and diets and zip appears to work to the long term.

Reply to Jeffrey ¬
Cancel reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.