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 }

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>