In this instructable i will explain how to connect 7 segment display, decoder and arduino. It´s pretty easy. At first we have to learn something about decoder. I´m using BCD to 7 segment decoder. My is D147D, this is old chip, but the newer are similar. Documentation about one of them you can find here . Description of D147D you can see on picture two. There are four pins for sending BCD code to the decoder (ABCD). Table of BCD code you can see on third picture. But there is small problem. I thing, that pins are inside of chip connected to VCC source. If you want set logic zero on input, you must connect this input to the ground.
The second think, which you need is display. You need display with common anode (+). There are a lot of displays, you can choose. Pinout of display which i used is on picture four(column A). How to connect decoder with display you can see in next step.
Step 1: Connect it together
Step 2: Add arduino
Code can looks like this:int inputs[4] = {17,14,15,16}; // A,B,C,D inputs
byte BCD[16][4] ={{0,0,0,0},
{1,0,0,0},
{0,1,0,0},
{1,1,0,0},
{0,0,1,0},
{1,0,1,0},
{0,1,1,0},
{1,1,1,0},
{0,0,0,1},
{1,0,0,1},
{0,1,0,1},
{1,1,0,1},
{0,0,1,1},
{1,0,1,1},
{0,1,1,1},
{1,1,1,1}}; //BCD code
int number = 5; //which number in BCD code do you want to send
void setup() {
for(int a = 0; a < 4; a++){
pinMode(inputs[a], OUTPUT);} //set outputs
}
void loop() {
for(int c = 0; c < 4; c++){
digitalWrite(inputs[c], BCD[number][c]);
}
}