Now I would like to show you how to make a counter using common anode. no shift register no transistor needed for small leds. If you have common cathode, no problem just change the LV to HV and vice versa.
The beauty of micro controller is that we can cost down our project by eliminating some component by changing the logic or code in the micro controller. I am referencing on
What makes this project tricky is to make some pin (D2-D8) as ACTIVE LOW and (D9-D12) as ACTIVE HIGH.
Some reset is needed before setting the data out to 7 segment since we are mixing ACTIVE Low and active HIGH.
Step 1: Assemble Your Breadboard
You only need a cristal, 2 20pf cap, 1 nf ceramic or 0.1uF elco can do. The pull down resistor is optional.
You can use any USBTTL that has 5V GND RX TX DTR. All of these pins is needed to program your ATMEGA328P-PU. The best is FTDI one or CH340 as long as all pins above exist.
To minimize hassle, please use ATMEGA328P-PU.with arduino boot loader. Put a led serial with resistor 330 ohms into pin 19 (D13) if you want to try your assemble was fine by running blink test.
After all ok you can continue to next step.
Step 2: Add 7 Segment and Hook Em Up.
Hook up the the 7 segment (Iam using 3461BS from ebay) like the image above. I also uploaded ATMEGA pinout for your convenience of using breadboard.
Step 3: Write Code
Once everything is ok, you can add this code into arduino sotware and click run (->) to upload.
You can see in the code at initilization time a 7 Segment LED test (like in altera boards) so you can be sure if all the wiring was ok.
Step 4: Other Popular 7 Segment: 5463bh
Just in case you ran accross 14 pins 7 segment 5463BH like in Arda Fruit the pin out is:
D2 -> 13
D3 -> 9
D4 -> 4
D5 -> 2
D6 -> 1
D7 -> 12
D8 -> 5
D9 -> R100 ohms-> 6
D10-> R100 ohms-> 10
D11-> R100 ohms-> 11
D12-> R100 ohms -> 14
Lower resistor value is needed I used 100 ohms to add some brightness for larger leds to let it shine brighter.