Tag Archives: hardware

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 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 }