# Seg 6: Experiment and code

Figure 6-8 Experimental circuits

 byte seven_seg_digits[10][8] = { // set the code array by the number and pins { 1,1,1,1,1,1,1,0 }, // = 0 { 0,0,1,1,1,0,0,0 }, // = 1 { 1,1,0,1,1,1,0,1 }, // = 2 { 0,1,1,1,1,1,0,1 }, // = 3 { 0,0,1,1,1,0,1,1 }, // = 4 { 0,1,1,1,0,1,1,1 }, // = 5 { 1,1,1,1,0,1,1,1 }, // = 6 { 0,0,1,1,1,1,0,0 }, // = 7 { 1,1,1,1,1,1,1,1 }, // = 8 { 0,1,1,1,1,1,1,1 } // = 9 }; void setup() { //set 4-11 as OUTPUT pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); } void sevenSegWrite(byte digit) { //set the digital array by the order of the ports 4-11 on arduino byte pin = 4; for (byte segCount = 0; segCount < 8; ++segCount) { digitalWrite(pin, seven_seg_digits[digit][segCount]); ++pin; } } void loop() { //display the digital number by reverse order for (byte count = 10; count > 0; –count) { delay(1000); sevenSegWrite(count – 1); } delay(2000); }

6-5 Key points and summaries

1. Nixie tube can be divided into the common anode and cathode. The judgments may have Arduino used directly and multimeter.
2. We should know the order of the pins by digital number and letter. This can help us to get the code array for each digital number.
3. When encoding, we should connect the pins of nixie tube and the ports on the Arduino. It will be difficult to connect each other with error.

# Seg 5: Experiment and code

6.4 Experiment and code

If we have already understood the principle of nixietube and the encoding method, the experiment is very simple. Its schematic diagram and circuits can be seen in Figure 6-7 and 6-8. Its corresponding code is shown in Program 6.

Figure 6-7 Schematic diagram of nixie tube

# Seg 4: Order of the pins for the nixie tube and coding

1. Order of the pins of the nixie tube

Similarly, why do we know the order the pin? If we do not know the order of the pins, we do not know how to connect to the pins of nixietube. For example, if we want to display the digital number 5, how can we connect the dupon lines from the pins of nixie tube to the ports on the Arduino? To connect to the Arduino board rightly, we must know the connect rules.

1. re-know the nixie tube

We firstly know the pins of nixie tube from the followings in Figure 6-6.

Figure 6-6 Pins connection of nixie tube

1. As shown on the left subfigure of Figure 6-6, the digital number is labeled from the lower left by the counterclockwise, and the number of point is 5. All of the number is 1~10.
2. The letter label is marked from up to down by the clockwise. It is a~h, respectively, where the number of point is “h” as the last location.
3. Digital number 3 and 8 is the common port, which is the common anode or cathode. Figure 6-6 is the common cathode nixie tube; that is, all of the negative pins are connected a common port 3 or 8.
1. Coding of nixie tube

What is coding? To make the nixie tube display the designed digital number, we should let the LED to be conduction. For example, we want to display number 5 in Figure 6-6, how? Firstly, the polarity is must be right. In such experiment, the nixie tube is the common cathode. Thus, the common cathode should be connected to the GND port on the Arduino. Other pins must be corresponding to the ports on the Arduino to display the right digital number. This is coding. For example, in the letter view, if let the pins of a,c,d,f,g set as a high voltage level (or 1), and other pins is set as low level, (or 0), then, the corresponding segments would be light and digital number 5 can be displayed on the nixie tube. Since the decimal point “h” would not affect the display of digital number, it can be conducted or not. In this experiment, the decimal point is conducted. From the digital view, pins 2,4,5,7,9,10 are conducted, and the other remaining ones are not. Therefore, if we use binary code to express this segment, it can be coded as {0,1,1,1,0,1,1,1}. That is, there are two segments dark among of the eight segments in the nixie tube. Then, digital number “5″ can be displayed correctly. By this coding method, we can get other digital number coding, as shown in Table 6-2.

Table 6-2 Digital number coding scheme for the common cathode nixie tube

 Arduino ports Nixietube pins 0 1 2 3 4 5 6 7 8 9 4 1(e) 1 0 1 0 0 0 1 0 1 0 5 2(d) 1 0 1 1 0 1 1 0 1 1 6 4(c) 1 1 0 1 1 1 1 1 1 1 7 5(Dp) 1 1 1 1 1 1 1 1 1 1 8 6(b) 1 1 1 1 1 0 0 1 1 1 9 7(a) 1 0 1 1 0 1 1 1 1 1 10 9(f) 1 0 0 0 1 1 1 0 1 1 11 10(g) 0 0 1 1 1 1 1 0 1 1

Note that, to avoid the error of connection to Arduino, or convenience, we had better encode the digital number by one-defined rule. For example, in this experiment, let the digital ports on Arduino board correspond to the pins of nixietube for small to big (1~10). Certainly, there are many encoding schemes by following different ones’ habits. But the effect of display and the code is the same.

# Seg 3: Ways to judgment of the polarity of the nixie tube

1. The judgment of the polarity of the nixie tube

Before giving the method, we ask ourselves a question. Why do we judge the positive and negative polarity of nixie tube? Since the nixie tube is similar to LED, to make LED bright, the polarity must be right. This can make LED switching into conduction.

Figure 6-3 Schematic diagram of Arduino measures the polarity

There are two general methods to judge the polarity of nixietube shown in the following.

First method: use directly the ports on the Arduino (heuristics)

1. According to the schematic diagram in Figure 6-3, we finish the connection of circuits, as shown in Figure 6-4, where, the voltage is provided by the 5V port on the Arduino. In such experiment, the value of resistor is R=220Ω, and the voltage is 5V.
2. Since we don’t know the COM port in nixietube whether anode or cathode, we don’t know how to connect the polarity of power. But, we can know the common pin of nixietube. So, we can let the negative connect to the COM port (i.e., 3 and 8 pin), then the positive can be connect to the redundant pins randomly. At this time, if the segment is bright, then it shows that the polarity is right. That is, the COM port is negative, and the other pins are positive. Then the segments for the nixie tube can be lightened. Moreover, this is a common cathode nixie tube. Therefore, generally speaking, if the segment is not bright, it shows that this is a common anode tube. However, to make sure it is common anode, we can change the order of the connection of negative and positive till some segment is light. Note that, a current-limited resistor must be connected to avoid the damage of LED. In Figure 6-4, the positive (in hand) is connected to the 5V port on the Arduino board, while the GND is connected to the COM port of nixie tube by a mother dupont line. After connection, the 10th segment is light, which in fact is corresponding to the pin 10 of nixie tube. This shows that the polarity is right, and the LED is conducted. Thus, we know that the negative is com, i.e., common cathode.

Figure 6-4 Using Arduino to measure the polarity of nixietube

Second method: Using the multimeter

In addition, we can also use a multimeter to measure the polarity of nixie tube. Its principle is also can be referred to Figure 6-3. In fact, the main principle is that the multimeter can be viewed as a power for the nixie tube, as shown in Figure 6-5.

Figure 6-5 Using multimeter to measure the polarity of nixietube

The measuring method is very simple. After the simple setting of the multimeter, as shown in the special marked label in Figure 6-5, the multimeter must be turned to the diode. The black pen is connected to the COM port (pin 3 or 8) of nixie tube, and the red pen is touched to the other remaining ports randomly. Then, if the segment is bright, it shows that the polarity is right. So, this is a common cathode nixie tube. In other cases, we changing the connection order of the pen. But, in this experiment, since the voltage is not very high, so the brightness is not enough.

# Seg 2: Introduction of nixietube

6.3 Elements introduction

As for the element, here, it is the nixietube. If we know the principle of nixietube, then the experiment is relative simple. In the next sections, we will focus on the principle of nixie tube.

1. Classification

By the segments, the nixie tube can be divided into seven segments display and eight segments display. And the former is more than one a unite of LED than the latter, i.e., the display of decimal point.

According to the display number of “eight”, it can be divided into one, two, four digital nixietube, and so on, which as shown in 6-1.

Figure 6-1 Classifications of nixie tube

By following the connection of LED, the nixie tube has two types: a common anode and a common cathode. The anode tube means that all of the anodes of LED in nixiebue are connected together to a point, as shown in Figure 6-2(c). If the common anode is connected to a 5V power, the corresponding segment would lighten, when the other end for some segment is low voltage level. But, its cathode is a high level, the corresponding segment would not lighten. The common cathode is that all of the cathodes of segments are connected to a COM port, which is a GND, then, if the other end is connected to a high voltage level, the number segment would be lightened, as shown in Figure 6-2. But if the other end is low, it cannot lighten.

(a) shape and pin (b) common cathodes (c) common anodes

Figure 6-2 Shape and structure of nixietube

1. Principle of nixietube

As stated in the above, each segment is composed of LED. Then, in use, it is the same as LED. A current-limited resistor must be connected additionally to avoid damaging LED. If the common polarity and each pin are right for the positive and negative, the corresponding segment switches into conduction. From Figure 6-2(a), we can get different digital number by the different connection of pins. On the contrary, if the polarity is not right, the segment cannot be conducted. Therefore, if we want to get the designed digital number, two key problems must be solved, i.e., the polarity and the order of pins.

# Seg 1: Arduino an nixie tube

6.1 Problem presentation: how to use Arduino to control nixietube for displaying the digital number 0,1,2,3,4,5,6,7,8,9.

In fact, Arduino is used to control nixie tube to show the digital number, which is the same to the control of many LEDs to display. By the different constitution of display of LEDs, we can get the different digital number. So, the key problem is to understand the polarity of nixietube or LED. This a very important problem in such experiment.

6.2 The required materials

The required materials is very similar to the experiment 5. Only the buzzer is altered into digital display, which can be shown in Figure 6-8.

Table 6-1: Materials

 The required materials Number Name Quality Function Note 1 Arduino software 1 suit Provide ide New ver 1.05 2 Arduino UNO board 1 Control board Many 3 USB data line 1 Connect board distribution 4 Dupont line 2 Connect elements optional 5 Nixie tube 1 display optional 7 Bread board Connection optional