Tag Archives: LED

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 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 3: hardware and software for removing jitters

The first method: remove jitter from hardware

Firstly, we should get a thorough understanding of the reasons of generating jitters. From Figure 3-5, 3-6, we know that, even if the analog port A0 is cut, there exists voltage to trigger LED light. This shows that there exists some interference around us. If the interference is expressed as voltage, its value may be bigger than 512. Therefore, according to Figure 3-3, a bias resistor can be paralleled between ports 1, 2 and 3, 4. In this way, if the button doesn’t be pressed down, and if there are some interference existing as a voltage level, the voltage will be consumed on the bias resistor. Thus, the LED does not light, if the button doesn’t be push down. By adding a bias resistor (i.e., pulldown resistor), the circuit is changed, as shown in Figure 3-8. Evidently, from this Figure, the extra voltage has been already consumed on the bias resistor. Equivently, the extra voltage is already masked. At this time, if the button doesn’t be pressed down, the LED light doesn’t light. When the circuit is prepared by Figure 3-9, the LED light would light after the code in Program 3 is burn into the Arduino board. Everything is the same as expected.


Figure 3-9 Circuit after adding a bias resistor

Appendix: pulldown resistor (bias resistor)

As shown in Figure 3-10, the bias resistor is connected to GND in the above, so its name is called as pulldown resistor, which means the voltage in location A is pulled down to a low voltage level (GND). Its main function is to make the circuit generate a stable voltage with other resistors and driven circuit.


Figure 3-10 Pulldown resistor

The second method: remove jitter from software

Principle: as the above-mentioned description, once the button is pressed down, there is a delay 5~10ms because of the jitter. So, we can let the trigger delay 5~10ms to make the jitter disappeared in this time. Then, we can make a decision by the voltage after this time. This way better fits for many buttons, since many pulldown resistors are very complex to be arranged. However, during our experiment, if the pulldown resistor doesn’t be connected to the circuit, the LED is still lighting for any long time. Generally, we can combine software and hardware to remove the jitters. In the following appendix is attached here.

Appendix: the code removed jitters by software

01 /*
02 Program 3.1: Remove the jitters by software and hardware
03  */
04  
05 int Button=3; 
06 int LED=13; 
07 boolean onoff=LOW; 
08 void setup()
09 {
10   pinMode(Button,INPUT); 
11   pinMode(LED,OUTPUT); 
12 }
13 void loop(){
14   if(digitalRead(Button)==LOW
15   {
16     delay(10); 
17     if(digitalRead(Button)==HIGH
18     {
19       digitalWrite(LED,onoff);  
20       onoff=(!onoff); 
21       delay(10);  
22       while(digitalRead(Button)==HIGH
23       {
24         delay(1);
25       }
26     }
27   }
28 }

Seg 1: How to use Arduino controller and button to control the blink of LED

3.1 Problem description: How to use Arduino controller and button to control the blink of LED

The previous two examples are relatively simple. When the corresponding codes are burn into the Arduino board, then the LED could blink. But it cannot interact with people. So, in our such experiment, by adding a new material, button, to control the blink of LED.

3.2 The required material

Table 3-1 the required material

Num

Name Qua Function Note

1

Arduino software 1 IDE Version 1.05

2

Arduino UNO board 1 board

3

USB line 1 burn

4

Dupont lines many Connection elements

5

LED 1 LED

6

Resistor (10, 200Ω) 2 Current limited

7

Breadboard board 1 connection

8

button 1 onoff

Before doing this experiment, we firstly introduce the relevant properties of botton.

Button

Button is an usual device in the design embedded system. By button, some instructions and data can be utilized to control the on/off states, which can control the run states of some devices. For example, in this experiment, by button, the high/low level is generated to control the blink of LED. But, there are many kinds of switches, such as a single switch in kitchen, double switches in bedroom, voice control switch in corridor, and so on. In our such experiment, we mainly use small/or miniature switches, as shown in Figure 3-1.


Figure 3-1 Miniature buttons

And the size of the miniature switch in this experiment is about 6*6*5mm and has four legs, which is shown in Figure 3-2.


Figure 3-2 Miniature button in this experiment

Note that, the two logs divided by a deep ditch is the same side. Its principle is also given out in Figure 3-2. If the button is pushed down, the four logs 1,2,3,4 would connected each other. Then this can trigger a high level to light the LED. But if you relax the button, 1,2,3,4 would be off


Figure 3-3 Schematics of button

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.