4-bit Nixie tube

From SainSmart Wiki
Jump to: navigation, search

4-bit Nixie tube

What’s digital tube?

Digital tube is one kind semiconductor light emitting device. Their basic unit is light emitting diode. Digital tube is divided into 7 segment digital tube and 8 digital tube by the number of segments, 8 digital tube has one more light-emitting diode unit (a decimal point display) than 7 segment digital tube; Digital tube has be divided into 1, 2, 4, and so on digital tube depend on how many “8” it can show.

QQ图片20130717150109.jpg

Digital tube is divided into common anode digital tube and common cathode digital tube by the connection of the light-emitting diode unit. The common anode digital tube is that connect light-emitting diode anode together to form a common anode (COM).Common anode digital tube public pole COM to +5 V, should be applied in light-emitting diode cathode when a field is low, the corresponding field lit. When a field of the cathode is high, the corresponding field is not bright.

QQ图片20130717150122.jpg

QQ图片20130717150139.jpg

QQ图片20130717150149.jpg

Working principle

Each segment of the digital tube is make up of the light emitting diode, and so when used with the light emitting diode, it should connect with the current-limiting resistor as well, if not the excessive current may burn light emitting diode. The digital tube used in this experiment is a common anode common anode, The public pole COM received +5 V when the common anode Digital tube be applied. The corresponding fields are alight when a field emitting cathode of the diode is low, which are not bright when a field of the cathode is high.

Connection

One end of the current limiting resistor plugged into the digital I / O pin is connected to the other end of the not digitally tube field, the six remaining field and a decimal point followed by the return Ways to access. If public COM is common anode received a +5 V, else received a GND. There are a total 12 pin in one 4-bit digital tube.The decimal point downward when being placed in front of, lower left corner has 1-bit. The other pins’ sequences are rotated counterclockwise. Upper left corner is the largest 12th pin.

QQ图片20130717150431.jpg

Digital tube display number

Experiment component

  • 4-bit digital tube x1
  • 220 Ω resistance x4
  • Breadboard & jumper wire

Connection

Driven digital tube current limiting resistor is certainly indispensable, there are 2 ways of limiting resistor connection. The first one is connected with D1-d4 anode, totally connect four. This connection method’s benefit is needs of relatively less resistance, but generates different the digital brightness. The brightest is 1, 8 is the darkest. Another connection is use the other eight pins. The digital brightness of this method will be more like, but need more resistance. The experiments use eight 220Ω resistances.

Refer to figure below wiring for the 5643A

QQ图片20130717150440.jpg

Refer to figure below wiring for the 5643S

QQ图片20130717150456.jpg

Example code This is a simple stopwatch. Its accuracy is not very high. You need to fine-tune the parameters. //set anode interface int a = 1; int b = 2; int c = 3; int d = 4; int e = 5; int f = 6; int g = 7; int p = 8; //set cathode interface int d4 = 9; int d3 = 10; int d2 = 11; int d1 = 12; // Set variables long n = 0; int x = 100; int del = 55; // This number is fine-tuning of the clock void setup() {

 pinMode(d1, OUTPUT); 
 pinMode(d2, OUTPUT); 
 pinMode(d3, OUTPUT); 
 pinMode(d4, OUTPUT); 
 pinMode(a, OUTPUT); 
 pinMode(b, OUTPUT); 
 pinMode(c, OUTPUT); 
 pinMode(d, OUTPUT); 
 pinMode(e, OUTPUT); 
 pinMode(f, OUTPUT); 
 pinMode(g, OUTPUT); 
 pinMode(p, OUTPUT); 

}

void loop() {

 clearLEDs();
 pickDigit(1);
 pickNumber((n/x/1000)%10);
 delayMicroseconds(del);
 clearLEDs();
 pickDigit(2);
 pickNumber((n/x/100)%10);
 delayMicroseconds(del);
 clearLEDs();
 pickDigit(3);
 dispDec(3); 
 pickNumber((n/x/10)%10);
 delayMicroseconds(del);
 clearLEDs();
 pickDigit(4);
 pickNumber(n/x%10);
 delayMicroseconds(del);
 n++;
   if (digitalRead(13) == LOW)
   { 
   n = 0;
   } 

}

void pickDigit(int x) //defing pickDigit(x), its role is turn on the dx port {

 digitalWrite(d1, HIGH);
 digitalWrite(d2, HIGH);
 digitalWrite(d3, HIGH);
 digitalWrite(d4, HIGH);
 switch(x)
   { 
   case 1:   
   digitalWrite(d1, LOW); 
   break;
   case 2:   
   digitalWrite(d2, LOW); 
   break;
   case 3:   
   digitalWrite(d3, LOW); 
   break;
 default: 
   digitalWrite(d4, LOW); 
   break;
   } 

}

void pickNumber(int x) //define pickNumber(x), Its role is to show digital x {

 switch(x)
   { 
 default: 
   zero();  
   break;
   case 1:   
   one(); 
   break;
   case 2:   
       two();   
   break;
   case 3:   
   three();  
   break;
   case 4:   

four();

   break;
   case 5:   
   five();  
   break;
   case 6:   
       six();   
   break;
   case 7:   
       seven();   
   break;
   case 8:   
       eight();   
   break;
   case 9:   
   nine();  
   break;
   } 

}

void dispDec(int x) // Set to open the decimal point {

 digitalWrite(p, LOW);

}

void clearLEDs() //clear the screen {

 digitalWrite(a, LOW);
 digitalWrite(b, LOW);
 digitalWrite(c, LOW);
 digitalWrite(d, LOW);
 digitalWrite(e, LOW);
 digitalWrite(f, LOW);
 digitalWrite(g, LOW);
 digitalWrite(p, LOW);

}

void zero() // Define the number 0 cathode pin switch {

 digitalWrite(a, HIGH);
 digitalWrite(b, HIGH);
 digitalWrite(c, HIGH);
 digitalWrite(d, HIGH);
 digitalWrite(e, HIGH);

digitalWrite(f, HIGH);

 digitalWrite(g, LOW);

}

void one() {

 digitalWrite(a, LOW);
 digitalWrite(b, HIGH);
 digitalWrite(c, HIGH);
 digitalWrite(d, LOW);
 digitalWrite(e, LOW);
 digitalWrite(f, LOW);
 digitalWrite(g, LOW);

}

void two() {

 digitalWrite(a, HIGH);
 digitalWrite(b, HIGH);
 digitalWrite(c, LOW);
 digitalWrite(d, HIGH);
 digitalWrite(e, HIGH);
 digitalWrite(f, LOW);
 digitalWrite(g, HIGH);

}

void three() {

 digitalWrite(a, HIGH);
 digitalWrite(b, HIGH);
 digitalWrite(c, HIGH);
 digitalWrite(d, HIGH);
 digitalWrite(e, LOW);
 digitalWrite(f, LOW);
 digitalWrite(g, HIGH);

}

void four() {

 digitalWrite(a, LOW);
 digitalWrite(b, HIGH);
 digitalWrite(c, HIGH);
 digitalWrite(d, LOW);
 digitalWrite(e, LOW);
 digitalWrite(f, HIGH);
 digitalWrite(g, HIGH);

}

void five() {

 digitalWrite(a, HIGH);
 digitalWrite(b, LOW);
 digitalWrite(c, HIGH);
 digitalWrite(d, HIGH);
 digitalWrite(e, LOW);
 digitalWrite(f, HIGH);
 digitalWrite(g, HIGH);

}

void six() {

 digitalWrite(a, HIGH);
 digitalWrite(b, LOW);
 digitalWrite(c, HIGH);
 digitalWrite(d, HIGH);
 digitalWrite(e, HIGH);
 digitalWrite(f, HIGH);
 digitalWrite(g, HIGH);

}

void seven() {

 digitalWrite(a, HIGH);
 digitalWrite(b, HIGH);
 digitalWrite(c, HIGH);
 digitalWrite(d, LOW);
 digitalWrite(e, LOW);
 digitalWrite(f, LOW);
 digitalWrite(g, LOW);

}

void eight() {

 digitalWrite(a, HIGH);
 digitalWrite(b, HIGH);
 digitalWrite(c, HIGH);
 digitalWrite(d, HIGH);
 digitalWrite(e, HIGH);

digitalWrite(f, HIGH);

 digitalWrite(g, HIGH);

}

void nine() {

 digitalWrite(a, HIGH);
 digitalWrite(b, HIGH);
 digitalWrite(c, HIGH);
 digitalWrite(d, HIGH);
 digitalWrite(e, LOW);
 digitalWrite(f, HIGH);
 digitalWrite(g, HIGH);

} In front of setup () defined range of digital display routines, the definition of these subroutines can be easy to use in the loop (), just write the name of the subroutine and it will.

Program function

QQ图片20130717150518.jpg