Arduino 7 Segment (5011BS, Common Anode or Cathode) Tutorial

We are going to make this thing work! Common cathode or Anode.

Step 1: Connect That Sucker.

Step 2: Connect Pins 3 & 8 to Power (common Anode) or Ground (common Cathode)

Use a 330 resistor, 1k makes the led's too dim. Scream 'power' in the vein of Clarkson while completing this step. (Important)

Pins 3 and 8 are the center pins top and bottom.

Step 3: Flash the Arduino for Calibration.

Download the Seven Segment library and install to the Arduino IDE.

To install it, open the Arduino IDE, go to Sketch > Include Library > Add .ZIP Library, then select the SevSeg ZIP file that you downloaded.

Now we need to flash the Arduino to print the number 8 with a dot so that we can connect her up.


#include "SevSeg.h"
SevSeg sevseg;

void setup(){ byte numDigits = 1; //we are using a single digit display byte digitPins[] = {}; //leave empty for a single digit display byte segmentPins[] = {1, 2, 3, 4, 5, 6, 7, 8}; //choose any 8 pins bool resistorsOnSegments = true; byte hardwareConfig = COMMON_ANODE; sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments); }

void loop(){ sevseg.setNumber(8, 0); //Print 8, 0 means Decimal point is active, 1 turns it off. sevseg.refreshDisplay(); //Needed to continue displaying the number }

Step 4: Now Let's Start Calibrating. (Segment A, Arduino Pin 1, LED Pin 7)

Now, we are going to calibrate from A-DC in order, one by one.

Look at this code, it's alphabetical from A-DC.

We are telling the Arduino that:

pin1 = A,

pin2 = B,

pin3 = C


pin8 = DC.

So now, connect segment A to pin 1. (pin 7 on the LED )

byte segmentPins[] = {1, 2, 3, 4, 5, 6, 7, 8}; //choose any 8 pins

Step 5: Connect Segment B (Arduino Pin 2, LED Pin 6)

Step 6: Connect Segment C (Arduino Pin 3, LED Pin 4)

Step 7: Connect Segment D (Arduino Pin 4, LED Pin 2)

Step 8: Connect Segment E (Arduino Pin 5, LED Pin 1)

Step 9: Connect Segment F (Arduino Pin 6, LED Pin 9)

Step 10: Connect Segment G (Arduino Pin 7, LED Pin 10)

Step 11: Connect Segment DC (Arduino Pin 8, LED Pin 5)

Step 12: Tidy Up and Say, 'cleanliness Is Next to Godliness' and Smile Because Your 8 Is Looking Sexy As Heck.

Step 13: Make a Counter to Show Off Your Technical Prowess.

Copy & paste like it's hot, we are just tweaking the main loop.

void loop(){
for (int i = 0; i<10; i++){ sevseg.setNumber(i, 0); sevseg.refreshDisplay(); //Needed to continue displaying the number delay(1000); } }



    • Backyard Contest

      Backyard Contest
    • Sensors Contest

      Sensors Contest
    • Frozen Treats Challenge

      Frozen Treats Challenge



    4 weeks ago

    Thanks for sharing your setup guide!