Greetings,
I recently completed a project involving reading temperatures with an Arduino that uses 4x seven segment LED displays. Currently, I am attempting to develop a similar system which uses a single segment decimal display likened to the function of a nixie (without the high voltage) or an edge-lit numerik display where the display digit consists of a column of 10 LED's (0-9), a decimal point LED and an LED that indicate a negative sign for a given digit in the display.
I attempted to build this from a previous project which can be found at the following:
https://forum.allaboutcircuits.com/...x-seven-segment-displays.133589/#post-1119000
For now, the circuit is only built to simply display a number set in a variable in the code only in order to minimize troubleshooting but I've run into an issue that I'm having trouble resolving. The circuit was changed to suit two 74HC595's to drive 12 LED's per column. Each column is then multiplexed. The circuit schematic is pasted below:
This is the circuit. It is run by an Arduino Nano driving two 74HC595's cascaded. The lower bit 595 is on the right closest to the Arduino. The higher bit to the left in the image below:
To view the output in decimal format, a temporary display head was built on a perfboard. There are four columns, one for each digit with the MSD on the left, LSD to the right:
On each digit, a column of 10 LED's are used counting 0-9 with a decimal point at the bottom and a negative indicator to the left of each digit column:
Once in operation, the display indicates the number almost correctly (haven't worked on the decimal point portion of the code yet) - in this case the number 123.4 . The first 595 is working correctly. It is handling the first 8 of 16 bits for the digit LED's 0-7. The second 595 on the other hand is not. It is handling the second 8 of 16 bits for the digit LED's 8-9 , decimal point and negative indicator. The second 595 dimly lights it's LED's. It does however brightly activate it corresponding LED's if I give the number an 8 or a 9. I am having the issue of the second 595 deactivate the LED's when not in use. I have been looking around the interwebs trying to find what is going on with it. I've changed the 595 with different one and rewired with new wire. I've added .1uF capacitors to decouple the power and ground pins of the 595's with no change. I've poked and prodded about the circuit thinking that it might be radio noise but no changes of any kind occur. So I looked at the code. I'm having trouble knowing what to appropriately search for as I have an inclination that the problem lies with the code in the 'void refreshDisplay()' routine. I haven't worked with cascaded 595 before. Poking around the code in this area have given (albeit unpredictable and strange) changes. The current operation of the display is in the image below:
There are many articles on how to use the 595's in this fashion but I must have missed or misunderstood something. I'm fairly certain that I'm doing something wrong. Does anyone know of a proper solution to this or may know the correct way to operate this? Any help would be greatly appreciated. The current code for this circuit is pasted below:
I recently completed a project involving reading temperatures with an Arduino that uses 4x seven segment LED displays. Currently, I am attempting to develop a similar system which uses a single segment decimal display likened to the function of a nixie (without the high voltage) or an edge-lit numerik display where the display digit consists of a column of 10 LED's (0-9), a decimal point LED and an LED that indicate a negative sign for a given digit in the display.
I attempted to build this from a previous project which can be found at the following:
https://forum.allaboutcircuits.com/...x-seven-segment-displays.133589/#post-1119000
For now, the circuit is only built to simply display a number set in a variable in the code only in order to minimize troubleshooting but I've run into an issue that I'm having trouble resolving. The circuit was changed to suit two 74HC595's to drive 12 LED's per column. Each column is then multiplexed. The circuit schematic is pasted below:
This is the circuit. It is run by an Arduino Nano driving two 74HC595's cascaded. The lower bit 595 is on the right closest to the Arduino. The higher bit to the left in the image below:
To view the output in decimal format, a temporary display head was built on a perfboard. There are four columns, one for each digit with the MSD on the left, LSD to the right:
On each digit, a column of 10 LED's are used counting 0-9 with a decimal point at the bottom and a negative indicator to the left of each digit column:
Once in operation, the display indicates the number almost correctly (haven't worked on the decimal point portion of the code yet) - in this case the number 123.4 . The first 595 is working correctly. It is handling the first 8 of 16 bits for the digit LED's 0-7. The second 595 on the other hand is not. It is handling the second 8 of 16 bits for the digit LED's 8-9 , decimal point and negative indicator. The second 595 dimly lights it's LED's. It does however brightly activate it corresponding LED's if I give the number an 8 or a 9. I am having the issue of the second 595 deactivate the LED's when not in use. I have been looking around the interwebs trying to find what is going on with it. I've changed the 595 with different one and rewired with new wire. I've added .1uF capacitors to decouple the power and ground pins of the 595's with no change. I've poked and prodded about the circuit thinking that it might be radio noise but no changes of any kind occur. So I looked at the code. I'm having trouble knowing what to appropriately search for as I have an inclination that the problem lies with the code in the 'void refreshDisplay()' routine. I haven't worked with cascaded 595 before. Poking around the code in this area have given (albeit unpredictable and strange) changes. The current operation of the display is in the image below:
There are many articles on how to use the 595's in this fashion but I must have missed or misunderstood something. I'm fairly certain that I'm doing something wrong. Does anyone know of a proper solution to this or may know the correct way to operate this? Any help would be greatly appreciated. The current code for this circuit is pasted below:
C:
/*Original code by:
* http://www.pial.net/arduino-controlling-a-4-digit-seven-segment-display/ ( but modified somewhat)
*/
//#include <OneWire.h>
//#include <DallasTemperature.h>
//#define ONE_WIRE_BUS 2
//OneWire oneWire(ONE_WIRE_BUS);
//DallasTemperature sensors(&oneWire);
//DeviceAddress insideThermometer;
const int ledPin = 13;// LED connected to digital pin 13
const int latchPin = 8;//Pin connected to ST_CP of 74HC595
const int clockPin = 9;//Pin connected to SH_CP of 74HC595
const int dataPin = 10;//Pin connected to DS of 74HC595
const int digitPins[4] = {
3,4,5,6}; //pins to control the 4 common anode pins of the display
const byte COL_COUNT = 12;
unsigned int digit[COL_COUNT] = //single decimal digit bits + blank + minus
{
0B0000000000000001, // 0
0B0000000000000010, // 1
0B0000000000000100, // 2
0B0000000000001000, // 3
0B0000000000010000, // 4
0B0000000000100000, // 5
0B0000000001000000, // 6
0B0000000010000000, // 7
0B0000000100000000, // 8
0B0000001000000000, // 9
0B0000000000000000, // all segments off
0B0000010000000000, // -
// 0B0000100000000000, // .
};
int digitBuffer[4] = {
1};
int digitScan = 0;
int soft_scaler = 0;
float tempC, tempF;
int tmp;
boolean sign = false;
void setup() {
TCCR2A = 0;
TCCR2B = (1<<CS21);
TIMSK2 = (1<<TOIE2);
TCNT2 = 0;
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
for(int i=0;i<4;i++)
{
pinMode(digitPins[i],OUTPUT);
}
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
// sensors.begin();
// sensors.getAddress(insideThermometer, 0);
}
ISR(TIMER2_OVF_vect) {
soft_scaler++;
if(soft_scaler==15)
{
refreshDisplay();
soft_scaler = 0;
}
};
void refreshDisplay()
{
for(byte k=0;k<4;k++)
// word digitData = digit[byte];
{
digitalWrite(digitPins[k], LOW);
}
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, B11111111 >> 8);
shiftOut(dataPin, clockPin, MSBFIRST, B11111111);
digitalWrite(latchPin, HIGH);
delayMicroseconds(50);
digitalWrite(digitPins[digitScan], HIGH);
digitalWrite(latchPin, LOW);
if(digitScan==1)
{
shiftOut(dataPin, clockPin, MSBFIRST, ~(digit[digitBuffer[digitScan]] | B00000100) >> 8); //inserting the dot -byte 1
shiftOut(dataPin, clockPin, MSBFIRST, ~(digit[digitBuffer[digitScan]] | B00000000)); //inserting the dot -byte 2
}
else
{
shiftOut(dataPin, clockPin, MSBFIRST, ~(digit[digitBuffer[digitScan]]) >> 8);
shiftOut(dataPin, clockPin, MSBFIRST, ~(digit[digitBuffer[digitScan]]));
}
digitalWrite(latchPin, HIGH);
digitScan++;
if(digitScan>3) digitScan=0;
}
void loop()
{
// digitalWrite(ledPin, HIGH);
//sensors.requestTemperatures();
//tempC = sensors.getTempC(insideThermometer);
//tempF = DallasTemperature::toFahrenheit(tempC);
//tmp = int(tempF*100);
tempF = 123.4;
tmp = int(tempF*10);
if (tempF < 0){
sign = true;
tmp = abs(tmp);
}
if (int(tmp)/1000 == 0){
digitBuffer[3] = 10;
if (sign){
digitBuffer[3] = 11;
}
}
else{
digitBuffer[3] = int(tmp)/1000;
}
if (int(tmp)/1000 == 0 && (int(tmp)%1000)/100 == 0) {
digitBuffer[2] = 10;
if (sign){
digitBuffer[2] = 11;
digitBuffer[3] = 10;
}
}
else{
digitBuffer[2] = (int(tmp)%1000)/100;
}
digitBuffer[1] = (int(tmp)%100)/10;
digitBuffer[0] = (int(tmp)%100)%10;
Serial.print("number assigned to the variable 'tmp' = ");
Serial.println(tmp);
Serial.print("number assigned to the variable 'tempF' = ");
Serial.println(tempF);
// digitalWrite(ledPin, LOW);
delay(500);
}
Last edited: