7-Segment Display Counter with Arduino

Recently I’ve published a basic Binary to Hexadecimal converter design based on Atmega 2560 chip. The same set up can be used for building a simple UP/Down counter with Arduino compatible Iduino Mega R3 board. 7-Segment display and its I/O stayed the same but now only 1 input (Pin 9) is used to select the counter direction.”0”- UP,”1” – Down. Design schematic diagram is available in the next figure.
7-Segment Display Counter with Arduino Schematic
Now let’s talk about the code. If you look at the attached code you’ll see that except for standard Arduino functions only one new called Display7SegmentDigit(int digit) was added. This function does not return any value and just turns ON/OFF the relevant display segments according to a variable it receives in digit. The loop() just goes from 0 to 9 each time sending the new value to the 7-Segment display. Delay(1000) creates 1 sec intervals between each counter increment/decrements. There are some additional bits of code for maintaining the correct count when switching from counting UP/Down and clearing the counter at 10. Next is a short video showing circuit operation.

For anyone who wants to experiment with this circuit I’d like to suggest a few simple modifications like adding a RESET input, external clock and the ability to load the initial counter value.

Posted in Iduino Mega R3

Leave a Reply

Your email address will not be published. Required fields are marked *