# Seg 4: Hardware connection

2.3 Hardware debug

Generally speaking, a new wifi module is no problem in use. But for ensure to use, we can debug the new wifi hardware from the following.

1. Hardware connection

Fistly, wifi module is inserted into the Arduino shield board. Note that the insertion direction. A way for the judgment of direction is by the power. When power on, if the insertion direction is not right, then only one red LED light is lightened for the wifi module, and the remaining LED lights cannot be lightened (in fact, the remaining two LED lights is weakly shinning if you see them detailedly, since there exists interface around the two LED lights). Vice visa, if the insertion direction is right, then LED light is lightened and red at first. After a while, the other two LED lights can be lightened, where one LED light would be shining regularly.

Figure 2-4 Description of LED lights for wifi module

# 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 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: How to control LED from bright to dim by Arduino

4.1 Problem presentation: how to control LED from bright to dim by Arduino

In the previous examples, Arduino is just used to control the brightness and/or dark for LED. That is, there are only two voltage levels: high and/or low from the voltage level, and there are only two digital value: 0 and/or 1 from the digital signal. But, Arduino doesn’t control the continuous variation from bright to dim, or visa. Moreover, the applied requirements exist in our usual lives, such as dancing hall, or concern. For the lighting effects, sometimes, we need a gradual change for the LED lights from bright to dim. This can be realized by giving a continuous voltage to a LED light. Therefore, in our such experiment, by utilizing the PWM (Pulse Width Modulation) technique, Arduino can transmit a continuous voltage signal to control LED, and the PWM technique is also widely used in the continuous operation of steering gear, music play, and power control in the communication.

4.2 The required materials

The required materials are very simple in this sample, which is similar to the experiment one. It is different from the connected port on the Arduino, as shown in Figure 4-1.

Table 4-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 Light-emitting diode (led) 1 LED blink optional 6 Resistance 220Ω Current limiting optional 7 Bread board Connection optional

The required materials can be referred in the following Figure 4-5.

# Seg 2: Arduino controls many LEDs

2.4 Experimental platform

According to Figure 2-2, we start to set up the experimental platform, as shown Figure 2-2. Oh, my god, there are so much LEDs, dupont lines, and resistors, that we are confused by the complex connection. But can we rightly connect the electrical elements? In fact, it is not difficult if we can find a technique. Then, it will be very simple to set up our such experiment.

1. As for one LED, the long les is located left side for positive, and the other is located right side for negative. if all of these LEDs are connected by this method, it is not a problem.
2. One end of dupont line is connected to negative polarity (by the equal voltage for each column in the brandboard). Another end is connected to GND. All of these ends are connected the same line in the narrow band (the equal voltage for each row in the narrow band).
3. The current-limited resistors are connected to the polarities of LEDs. Similarly, they are located randomly in the same column. But for the good-looking, they had better be connected unifiedly the different columns at the same line in the brandband. It will look like neat, as shown in Figure 2-2.
4. One end is connected to resistor at the same column, and the other is connected to the pins on the Arduino board, as shown in Figure 2-2.

OK, when you have a few techniques to connect these electronic elements on the Arduino board, you may finish this connection of this experiment successfully at a time. The circuit is not complex, but it needs your carefulness.

Wow, when we insert USB line into computer and Arduino board, the LED is blinking repeatedly at pin 8 on the Arduino board. But other LEDs are honest, and not blinking. Why? Yes, maybe, you have got it. Do you remember the previous experiment? We let LED blink located at pin 8 on the Arduino board. When the code has been burnt into the Arduino board, it can be saved in the board forever. It does not disappear with the power off of Arduino board. If we repower on the Arduino board, the LED will blink at pin 8. But, if we burn a new program into the Arduino board, the board will execute the new code.

Figure 2-3 Start to write the letter V

Figure 2-4 The letter V

2.5 Solution for code

On the basis of the last experiment on the Arduino IDE, we can give out the code in this experiment, which is exhibited in Program 2.

 01 //Program 2: Arduino controls many LEDs 02 //define 9 pins for LEDs 03 int led4 = 4; 04 int led5 = 5; 05 int led6 = 6; 06 int led7 = 7; 07 int led8 = 8; 08 int led9 = 9; 09 int led10 = 10; 10 int led11 = 11; 11 int led12 = 12; 12 13 //initialize the 9 pins as OUTPUT 14 void setup() 15 { 16    for(int i=4;i<=12;i++)//define 4-12 as OUTPUT 17    pinMode(i,OUTPUT);//set i as OUTPUT 18 } 19 20 void loop() 21 { 22  mode();//display of 9 LEDs 23 24 } 25 //subfunction for mode() 26 void mode() 27 { 28  unsigned char j; 29  //let 4-12 LEDs blink one by one 30  for(j=12;j>=4;j–) 31  { 32    digitalWrite(j,HIGH); 33    delay(500); 34  } 35  //let 4-12 LEDs go out 36  for(j=12;j>=4;j–) 37  { 38    digitalWrite(j,LOW); 39  //delay(500); 40  } 41  //let 4-12 LEDs bright 42  for(j=4;j<=12;j++) 43  { 44    digitalWrite(j,HIGH); 45  } 46 }

2.6 Key points

1) Be familiar with the polarity of LED and the features of breadboard.

2) After finishing a experiment, we should summarize some experiences from the process of experiment.

3) Arduino can realize your idea. Do it yourself.

# Seg 1: Arduino Controls Many LEDs

2.1 Problem presentation: Arduino writes the letter V

In this part, let Arduino board controls many LEDs to blink, and we will let it teach us write the letter V. Certainly, this is also a very simple experiment. Its main goal is to be familiar with the usage of Arduino IDE, LED polarity, breadboard, and Arduino board. By this experiment, we can let LED express arbitrary symbols by the control of Arduino. For example, you can finish a love heart to your lover, and so on.

2.2 The required materials

The required materials are almost the same as the first experiment, as shown in Table 2-1.

 Table 2-1: the required materials Num Name Quality Function Note 1 Arduino software 1 IDE Version 1.05 2 Arduino UNO development 1 Control board many 3 USB line 1 Burn into program free 4 Dupont lines 19 connection 5 LED 9 LED blink 6 Resistor 220Ω 9 Current-limited 7 Bread board 1 connect

All of the above-mentioned materials are introduced in the first experiment, and can be referred to the first experiment.

Figure 2-1 The required materials

2.3 Experimental schematics

Similarly, before doing the experiment, we should analyze and design the circuits by your own idea, and then draw the schematics by the software Fritzing, which can be seen in Figure 2-1, where the blue lines are denoted by positive polarity (GND), and the red lines for positive. In the next experiments, we will get the reverent schematics.

Figure 2-2 Schematics for Arduino writing the letter V

# Seg 1: How to control the Blink of LED by Arduino board?

In this simple experiment, we will master a general understanding the IDE (Integrated Development Environment) and language based on the Arduino platform. Certainly, since this is the first experimental sample, so its principle is very simple. That is, how to make the 13 led blink on the Arduino board. Naturally, we can also utilize some other materials to make the self-defined LED blink.