Using diodes

Semiconductor diodes are of many types and are a separate topic beyond the scope of this book, hence we will proceed with the basic understanding and build upon it as we proceed. We will focus on rectifier diodes for the scope of this book.

The primary function of a rectifier diode is to act just like a check valve allowing current to flow in one direction and resisting (up to a limit) current from flowing in from the opposite direction.

In practical situations, sometimes under certain situations a reverse current is generated--such as when a motor armature is stopped, it continues to spin (due to inertia) inside the motor case until it comes to a halt.

This reverse current has the potential to flow back into other electronic components. This reverse current might lead to damage of delicate electronic parts. In order to stop this reverse current from flowing back, a diode is placed in an appropriate manner in the circuit. Let us try to understand what a diode does exactly by going through the following hands-on exercise.

We will require the following parts for conducting this exercise:

  • Arduino Uno board
  • USB A to USB B cable
  • 1 red LED
  • 1 pc. 220 ohms resistor
  • 1 pc. IN4007 diode (other IN400x version diodes may also be used)
  • Breadboard
  • Some male-to-male jumper wires

After all the components have been assembled, the next step would be to follow the breadboard setup shown next and build the two prototypes, one by one. There are actually two separate breadboard setups as shown in the following diagram:

The circuit on the left-hand side demonstrates how a rectifier diode can be placed to allow current to flow, while the circuit on the right-hand side demonstrates how to use a rectifier diode to block the flow of current.

Notice how the banded or striped edge of the rectifier diode has been placed in the two circuits. The placement of this banded or striped edge makes all the difference in either allowing or not allowing the incoming current to flow through:

Figure 6: Using rectifier diodes

Let us begin with the circuit on the left-hand side. After assembling the circuit on the left-hand side, load the following sketch into the Arduino board. Remember not to keep any jumper wires connected to the Rx and Tx pins while loading a sketch into the Arduino board:

//**********************************************************/ 
// Step-1: Variables used in this sketch
//**********************************************************/
int LEDPin = 2; // specify the digital pin number

//**********************************************************/
// Step-2: INITIALIZE I/O PARAMETERS
//**********************************************************/
void setup()
{
// initialize digital pins as an output.
pinMode(LEDPin, OUTPUT);
}

//**********************************************************/
// Step-3: MAIN PROGRAM
//**********************************************************/
// the loop function runs over and over again forever
void loop()
{
digitalWrite(LEDPin, HIGH); // turn LED 1 ON
delay(1000); // wait for a second
digitalWrite(LEDPin, LOW); // turn LED 1 OFF
delay(1000); // wait for a second
}

After the program is loaded and starts executing, you will notice that the LED starts blinking. This is because in the circuit setup, the banded or striped edge of the rectifier diode has been placed away from the positive voltage terminal (which is the digital pin number 2 in this setup). The current is allowed to flow through the diode in this case.

Now let us inspect the circuit that has been shown on the right-hand side. All you need to do in this circuit setup is to reverse the direction of placing the diode. In the right-hand side circuit setup, the rectifier diode has been placed in such a way that it will not allow current to flow through it.

In this setup, the banded or striped edge of the rectifier diode faces the incoming current from digital pin number 2. The banded or striped edge acts as a check valve, it does not allow current to enter. Thus, in this circuit setup, you will notice that the LED does not blink any longer. Just try to quickly reverse the diode the other way around and see how the LED starts blinking again. With this example, we conclude our quick study of using rectifier diodes.

In the previous sections, we covered two very important electronic components that are very commonly used in Arduino device prototyping circuits. The use of transistors and diodes will be further demonstrated for controlling a DC motor from an external power source, later in the book, specifically in Chapter 7, Day 5 - Using Actuators where we will learn how to use actuators.

In the last section of this chapter, we will see how to use simple push buttons in our circuits with the Arduino board. The next example that we will learn is to blink an LED when a button is pushed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.200.180