["Fig 7.5 Schematic Code We are going to create two variables that will keep in memory the present and past state of the sensor. We are going to read the digital input and validate its state according to the previous state and an anti-bounce delay. This method can be implemented with the delay() function but the use of the millis() function is cleaner and more adequate. \/\/Parameters const int didPin = 2; \/\/Variables bool didStatus = false; bool oldDidStatus = false; unsigned long lastDebounceTime = 0; unsigned long debounceDelay = 50; void setup() { \/\/Init Serial USB Serial.begin(9600); Serial.println(F(\\\"Initialize System\\\")); \/\/Init digital input pinMode(didPin, INPUT_PULLUP); } void loop() { debounceDid(); } void debounceDid( ) { \/* function debounceDid *\/ \/\/\/\/debounce DigitalDebounce int reading = digitalRead(didPin); if (reading != oldDidStatus) { 151 CU IDOL SELF LEARNING MATERIAL (SLM)","lastDebounceTime = millis(); } if ((millis() - lastDebounceTime) > debounceDelay) { if (reading != didStatus) { didStatus = reading; Serial.print(F(\\\"Sensor state : \\\")); Serial.println(didStatus); } } oldDidStatus = reading; } Result If you vary the debounceDelay parameter, you can see the effect of the anti-bounce logic on the button state. By taking a sufficiently long time, the measurement becomes reliable and there is only one change of state per press. Fig 7.6 Code 7.5 PWM USING ARDUINO UNO WITH PROGRAMMING The concept of Serial Communication and how to transfer data between Arduino UNO and computer by using some predefined functions. In this tutorial, we will discuss about a new 152 CU IDOL SELF LEARNING MATERIAL (SLM)","concept called PWM and how can this concept be used to control different devices like LEDs, motors etc. For the purpose of the tutorial, we need to build a small circuit. The components required for this circuit are listed below. \uf0b7 Arduino UNO \uf0b7 LED \uf0b7 1 K\u03a9 Resistor \uf0b7 100 K\u03a9 Potentiometer \uf0b7 Breadboard (Prototyping board) \uf0b7 Connecting wires In this project, we will control the brightness of an LED connected to the Arduino UNO board with the help of PWM technique. The schematic required for the implementation of the project is shown in the below image. Fig 7.7PWM using Arduino Uno with programming Select the Next Set of Arduino Projects You Want to Learn in Electronicshub: Arduino Projects\u00bb 153 CU IDOL SELF LEARNING MATERIAL (SLM)","In this circuit, the anode of an LED must be connected to any of the PWM pin of the Arduino UNO. Hence, it is connected to pin 11 of the Arduino through a 1 K\u03a9 current limiting resistor. The cathode of the LED is connected to ground on the breadboard. The 5V supply and ground of the Arduino UNO are connected to positive and negative rail of the breadboard. The end terminals of the potentiometer are connected to 5V and ground terminals on the breadboard respectively. The wiper terminal of the potentiometer must be connected to any of the analog input pin of the Arduino UNO. By adjusting the potentiometer in either direction (clockwise or anti clockwise), a variable voltage i.e. between 0 to 5V will be given to the analog input pin of the Arduino. The analog to digital conversion feature of the Arduino UNO is used to convert these voltages to a digital range of 0 to 1023 (as Arduino has a 10 \u2013 bit ADC). With the help of this converted values, we can control the brightness of the LED. Now that we have successfully designed the circuit, the next step is to write a suitable program for the circuit. Before going to the programming part, we need to get an idea about what PWM signal is. Pulse Width Modulation Pulse Width Modulation or simply PWM is a digital technique using which the amount of power delivered to a device can be varied. It provides a means of providing analog results with digital signals. In PWM technique, a square wave is switched between on and off state. By changing the time the signal spend on \u201con\u201d state versus the time the signal spends on \u201coff\u201d state, we can simulate a range of voltages between 0V and 5V. When this switching between on and off state is very fast, then the result is as if the output signal is at a stable voltage level between 0V and 5V. One important term we need to discuss when dealing with PWM is Duty Cycle. It is defined as the ratio of the time for which the signal stays in HIGH state (on time) to that of the total time period of the signal (on time + off time). In Arduino, there are 6 pins that are capable of generating such PWM signals. The following graph shows a comparison of different duty cycles and their corresponding voltage levels. 154 CU IDOL SELF LEARNING MATERIAL (SLM)","7.8 Pulse Width Modulation From the graph, it is clear that when the duty cycle is increased, the output voltage (or power delivered) is also increased. For 100% duty cycle, the voltage available is 5V and for 50% duty cycle, the voltage is 2.5V. Coming to our tutorial, in order to generate a PWM signal, we need to learn about two functions in Arduino library: analogRead and analogWrite. analogRead is a function which is used read the analog values from the analog pins of the Arduino. Arduino UNO board has 6 \u2013 channel, 10 \u2013 bit analog \u2013 to \u2013 digital converter (ADC). This means that the ADC in Arduino UNO will map the input voltages between 0 \u2013 5V in to an integer value between 0 and 1023. Hence, the analogRead function will return any value between 0 and 1023. The syntax of analogRead function is analogRead (analog pin no); Since we are reading the analog voltages from the potentiometer at A0 pin, we need to write analogRead (A0); in the sketch. As it returns an integer value, a temporary variable of integer data type is created with it. The next function is the analogWrite. It is a function which is used to set the duty cycle of the PWM signal for any given PWM pin. The syntax of analogWrite function is analogWrite (PWM pin no, value); 155 CU IDOL SELF LEARNING MATERIAL (SLM)","The value indicates the duty cycle and must be a value between 0 (0V) and 255 (5V). Coming to the actual sketch of the circuit for brightness control of the LED. The final sketch is shown in the following image. Fig 7.9 analogWrite (PWM pin no, value From the above sketch, we can easily understand that the value returned by the analogRead function is stored in the temp variable. This value will be used to control the duty cycle of the PWM signal using analogWrite function. But the range of values accepted by the analogWrite function is between 0 and 255. Hence, we need to perform some mathematical calculations to put suitable value in the analogWrite function. 156 CU IDOL SELF LEARNING MATERIAL (SLM)","Finally, the calculated value is put in the analogWrite function along with the PWM pin to produce a PWM signal. When the circuit is built and sketch is uploaded to the Arduino, we can see that by changing the position of the potentiometer, the brightness of the LED is also varied. 7.6 SUMMARY There are various communication devices like the keyboard, mouse, printer, etc. So, we need to interface the keyboard and other devices with the microprocessor by using latches and buffers. This type of interfacing is known as I\/O interfacing. 7.7 KEYWORDS \uf0b7 DAC A Digital to Analog Converter is a circuit that converts a digital value into an analog voltage. It is used in fields like audio and music to create sounds from digital values. The bit resolution of a DAC expresses its capacity of approximating values with precision. Higer resolution means better approximation. \uf0b7 DMA Direct Memory Access is a technology that allows peripherals to access directly areas of the memory without CPU intervention. This increases the throughput of some transfers on interfaces like SPI or DAC. \uf0b7 Datasheet A techinical document that describes the functionality of a component. Typical information in a datasheet includes the maximum voltage and current a component requires, as well as an explanation of the functionality of the pins. \uf0b7 Datatype A classification system that determines what values a particular constant, variable, or array will hold. Int, float, long and boolean are all types that can be used in the Arduino Software (IDE). \uf0b7 Debugging 157 CU IDOL SELF LEARNING MATERIAL (SLM)","The process of going through a circuit or code, and finding errors (also referred as \u201cbugs\u201d), until the expected behavior is achieved. \uf0b7 Decoupling capacitors Capacitors that are used to regulate spikes and dips in voltage and current, often placed close to the circuit they are referred. \uf0b7 Digital A system that deals with discrete values. \uf0b7 Direct current A type of current which always flows in the same direction. \uf0b7 Drain The pin of a Field Effect Transistor connected to the higher (n channel) or lower (p channel) voltage of i.e load to be controlled. \uf0b7 Dual In-line Package (DIP) A type of packaging for integrated circuits \uf0b7 Duty cycle A ratio indicating the amount of time over a certain period that a component is turned on. When using a PWM value of 127 (out of a total of 256), you have a 50% duty cycle. 7.8 LEARNING ACTIVITY 1. Compare Digital and Analog concept with example 2. Explain Denouncing 7.9UNIT END QUESTIONS 158 A.Descriptive questions Short Questions 1. Compare Port I\/O & Memory Mapped I\/O. 2. Explain CISC vs RISC design philosophy. 3. Compare Harvard vs Von-Neumann memory architectures. CU IDOL SELF LEARNING MATERIAL (SLM)","4. What are the features of MSP430 microcontrollers? 5. Explain the architecture of MSP430 microcontroller. Long Questions 1. Describe the Instruction set of MSP430 microcontroller. 2. Explain the instruction formats of MSP430 microcontroller. 3. Explain the MSP430 microcontroller addressing modes. 4. Explain what is embedded system in a computer system? 5. Mention what are the essential components of embedded system? 6. Mention how I\/O devices are classified for embedded system? 7. Explain what is microcontroller? 8. List out various uses of timers in embedded system? A. Multiple Choice Questions 1. The latch or IC 74LS373 acts as a) good input port b) bad input port c) good output port d) bad output port Answer: c 2. While performing read operation, one must take care that muchcurrent should not be a) sourced from data lines b) sinked from data lines c) sourced or sinked from data lines d) sinked from address lines Answer: c 3. To avoid loading during read operation, the device used is a) latch b) flipflop c) buffer 159 CU IDOL SELF LEARNING MATERIAL (SLM)","d) tristate buffer Answer: d 4. The chip 74LS245 is a) bidirectional buffer b) 8-bit input port c) one that has 8 buffers d) all of the mentioned Answer: d 7.10 REFERENCES Text Books: - 1. Internet of Things (A Hands on Approach), By ArshdeepBahga (Author),VijayMadisetti(Author). Edition: Second Edition, Illustrated, Reprint (2014) Publisher: VPT, 2017 2. \u201cBeginning Arduino\u201d by Michael McRobetrs(Author). Publisher:Technology in Action Reference Books: - 1. Tim Cox, Dr. Steven Lawrence Fernandes, Sai Yamanoor, Srihari Yamanoor, Prof. DiwakarVaish,\u201d Getting Started with Python for the Internet of Things: Leverage the full potential of Python to prototype and build IoT projects using the RaspberryPi Edition: First Edition Publisher:Packt Publisher-2019 160 CU IDOL SELF LEARNING MATERIAL (SLM)","UNIT - 8DIGITAL STRUCTURE 8.0 Learning Objectives 8.1 Introduction 8.2 Interfacing LED 8.3 Switch and debouncing conditions 8.4 Seven segment display 8.5 16x2 LCD with programming 8.6 Summary 8.7 Keywords 8.8 Learning Activity 8.9 Unit End Questions 8.10References 8.0LEARNING OBJECTIVES After studying this unit, you will be able to: \uf0b7 Know about Interfacing LED \uf0b7 Differentiate between Switch and debouncing conditions \uf0b7 Understand Seven segment display \uf0b7 Work on 16x2 LCD with programming 8.1 INTRODUCTION The internet of things, or IoT, is a system of interrelated computing devices, mechanical and digital machines, objects, animals or people that are provided with unique identifiers (UIDs) and the ability to transfer data over a network without requiring human-to-human or human- to-computer interaction. 161 CU IDOL SELF LEARNING MATERIAL (SLM)","8.2 INTERFACING LED Fig 8.1 Interfacing LED Components Required \uf0b7 8051 Microcontroller \u2013 1 \uf0b7 8051 Program Dumper- 1 \uf0b7 LED \u2013 1 \uf0b7 Resistor 10k ohm \u2013 1 \uf0b7 Breadboard \u2013 1 \uf0b7 Jumper wires LED Light Emitting Diode. These are the semiconductor light sources, Commonly used LEDs will have a cut-off voltage of 1.7V and current of 10mA. When an LED is applied with its required voltage and current it glows with full intensity. The Light Emitting Diode is similar to the normal PN diode but it emits energy in the form of light. The colour of light depends on the band gap of the semiconductor. 162 CU IDOL SELF LEARNING MATERIAL (SLM)","Fig 8.2 LED Connecting LED to Micro Controller \uf0b7 Never connect an LED directly to a battery or power supply! \uf0b7 It will be destroyed almost instantly because too much current will pass through and burn it out. \uf0b7 LEDs must have a resistor in series to limit the current to a safe value, for quick testing purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less. Fig 8.3 Connecting LED to Micro Controller 163 CU IDOL SELF LEARNING MATERIAL (SLM)","Calculating Resistance for connecting to LED LEDs cut-off voltage of 1.7V Max current of 10mA. V=I*R R=V\/I R=(Vcc-Vcutoff)\/Imax =(5-1.7)\/10*10^-3 =330 Ohms LEDS Interfacing to Micro Controller Device Mapping: The Device Mapping is the complete Schematic Diagram of the interfacing. In this we will connect the Led\u2019s to our required port and we will write the programming according to the circuit. Fig 8.4 LEDS Interfacing Programming for LED\u2019s interfacing with AT89C51 \uf0b7 Select the LED\u2019s as Output in the programming since these are output devices for Micro controller(initial value 0-Output , 1-input) \uf0b7 Write the logic for Toggling of LEDS Code 1 #include <AT89X51.H> 2 164 CU IDOL SELF LEARNING MATERIAL (SLM)","3 \/* Renaming port2 as LEDS *\/ 165 4 sfr LEDS = 0XA0; 5 6 \/*Delay function to Observe Led blink Clearly*\/ 7 void Delay(unsigned int t) 8{ 9 unsigned int i; 10while(t--) 11for(i=0;i<1257;i++); 12} 13 14main() 15{ 16\/* Selecting LEDS as Output *\/ 17 18LEDS=0X00; 19 20\/*Starting Super Loop *\/ 21 22while(1) 23{ 24LEDS = 0XFF;\/\/ Making Leds high 25Delay(10); 26LEDS = 0X00;\/\/ Making Leds Low 27Delay(10); 28} 29} CU IDOL SELF LEARNING MATERIAL (SLM)","8.3 SWITCH AND DEBOUNCING CONDITIONS In order for a microcontroller to detect when a switch is open or closed, it has to constantly listen to or poll the switch to detect when the signal changes. But when the button is pressed, the metal contacts inside the button don\u2019t make an instant electrical connection. The button might hit one side of the contacts first, then the other side several times before making a reliable connection. Bumps or dirt on the metal contacts can also prevent a good contact right away. This causes the button signal to bounce up and down before settling on a resting state. The bounces usually only last for a few milliseconds, but the Arduino runs so fast that each bounce can be counted as a button press. If we connected the push button\u2019s output to an oscilloscope, this is what a clean non- bouncing signal would look like: Fig 8.5 Switch and debouncing conditions (a) The signal starts low at 0 volts then goes high to 5 volts and stays there. This is what a bouncing signal would look like: 166 CU IDOL SELF LEARNING MATERIAL (SLM)","Fig 8.5 Switch and debouncing conditions(b) The signal starts low but bounces up and down between 0 and 5 volts before settling on 5 volts. The time scale is one millisecond per division, so this is happening very fast. Even though the bouncing only lasts for two milliseconds, each bounce could be interpreted by the Arduino as a button press. HOW TO DEBOUNCE SWITCHES WITH HARDWARE The easiest hardware solution for debouncing switches is to use a Schmitt trigger. Schmitt triggers are usually used to convert analog signals into digital signals, but they can also be used to debounce switches. A Schmitt trigger takes an analog input signal and outputs a digital signal: Fig 8.6 DEBOUNCE SWITCHES WITH HARDWARE (a) When the input to the Schmitt trigger exceeds the upper voltage threshold, the digital output switches to high. The output switches low when the input signal falls below the lower voltage threshold. 167 CU IDOL SELF LEARNING MATERIAL (SLM)","The Schmitt trigger we will use is the SN74HC14N from Texas Instruments: Fig 8.6 DEBOUNCE SWITCHES WITH HARDWARE(b) The SN74HC14N actually has six separate Schmitt triggers. The Schmitt trigger inputs are pins 1A, 2A, 3A, 4A, 5A, and 6A. The Schmitt trigger outputs are pins 1Y, 2Y, 3Y, 4Y, 5Y, and 6Y. Power is connected to the Vcc pin, and ground connects to the GND pin. HOW TO CONNECT A SCHMITT TRIGGER TO THE ARDUINO Let\u2019s see how to use a Schmitt trigger to debounce switches with an example project that increases the count of a counter each time a button is pressed. These are the parts you will need to build this project: \uf0b7 Arduino Uno \uf0b7 Jumper wires \uf0b7 Breadboard \uf0b7 SN74HC14N Schmitt trigger \uf0b7 Tactile push button \uf0b7 10K Ohm resistor \uf0b7 1 uF capacitor To build the button counter project, connect an SN74HC14N Schmitt trigger and a push button to the Arduino like this: 168 CU IDOL SELF LEARNING MATERIAL (SLM)","Fig 8.7A SCHMITT TRIGGER TO THE ARDUINO HOW TO PROGRAM A SCHMITT TRIGGER ON THE ARDUINO The sketch below reads the signal from the Schmitt trigger and increases a counter by one digit with every press of the button. The count is printed to the serial monitor. Once the Schmitt trigger is connected, upload this code to the Arduino: int inputPin = 7; int counter = 0; int buttonState = 0; int lastButtonState = 0; void setup() { 169 pinMode(inputPin, INPUT); Serial.begin(9600); CU IDOL SELF LEARNING MATERIAL (SLM)","} void loop() { buttonState = digitalRead(inputPin); if (buttonState != lastButtonState) { if (buttonState == LOW) { counter++; Serial.println(counter); } } lastButtonState = buttonState; } Once the code is uploaded, open the serial monitor and you should see the numbers count up one at a time with each press of the button. To see how switch bouncing affects the counter, bypass the Schmitt trigger by connecting the output of the push button directly to Arduino pin 7. You\u2019ll see that pressing the button once increases the count by multiple digits at a time. HOW TO DEBOUNCE SWITCHES WITH CODE Using a Schmitt trigger is the most reliable way to debounce a switch, but debouncing with code has the advantage that no extra components are needed. To add switch debouncing to a sketch, we need to start a timer when the first button signal change occurs. If the signal bounces within a certain amount of time, the signal will be ignored. If the button signal change lasts longer than a set amount of time, it will be counted as a button press. For example, if the button signal goes high three times within 50 milliseconds, the sketch will ignore it and only count the signal after 50 milliseconds. Here\u2019s the button counter sketch from above with the software debouncing code added: int inputPin = 7; int counter = 0; int buttonState = 0; int lastButtonState = 0; 170 CU IDOL SELF LEARNING MATERIAL (SLM)","int currentButtonState = 0; unsigned long lastDebounceTime = 0; unsigned long debounceDelay = 50; void setup() { pinMode(inputPin, INPUT); Serial.begin(9600); } void loop() { currentButtonState = digitalRead(inputPin); if (currentButtonState != lastButtonState) { lastDebounceTime = millis(); } if ((millis() - lastDebounceTime) > debounceDelay) { if (currentButtonState != buttonState) { buttonState = currentButtonState; if (buttonState == LOW) { counter++; Serial.println(counter); } } } lastButtonState = currentButtonState; } EXPLANATION OF THE CODE At the top of the sketch, we have the same variables we declared in the previous sketch. We just need a few more variables for debouncing: 171 CU IDOL SELF LEARNING MATERIAL (SLM)","\uf0b7 currentButtonState: Holds the reading from the inputPin. \uf0b7 lastDebounceTime: Stores the time after the initial signal change is detected. \uf0b7 debounceDelay: Sets the length of time in milliseconds that signal bounces should be ignored. The setup() section is the same as the previous sketch. In the loop() section, we take a digital read from the inputPin and store it in the currentButtonState variable. Then we get to an if statement that says \u201cif the currentButtonState is not equal to the lastButtonState, enter the body of the if statement\u201d. In other words, the if statement will be executed if the button signal has changed since the last time through the loop. In the body of the if statement we have lastDebounceTime = millis(). The millis() function outputs the number of milliseconds that have passed since the Arduino was turned on. So this line will store the time of the first button signal change in the lastDebounceTime variable. Then we have another if statement. The second if statement says \u201cif the current time (millis()) minus the lastDebounceTime is greater than the debounceDelay, enter the if statement\u201d. The time value output by the millis() function is constantly increasing. But the lastDebounceTime is the time when the first button signal change occurred. So millis() - lastDebounceTime is equal to the number of milliseconds from the first button signal change to the next one. If this time is greater than the debounceDelay defined at the top of the sketch, the code in the if statement (the code that increments the counter) will be executed. If the time is less than the debounceDelay, the if statement will not be executed and the counter will not be incremented. For example, say we press and hold the push button, which creates a signal bounce that lasts for 5 milliseconds. The value stored in lastButtonState is high, and the value stored in currentButtonState is low. Since currentButtonState and lastButtonState are not equal, the program enters the body of the first if statement where the millis() value is stored in lastDebounceTime. Say that 10,000 milliseconds has passed since the Arduino was turned on. The millis() function outputs a value of 10,000, which is stored in the lastDebounceTime variable. In the condition of the second if statement, millis() is 10,000 and lastDebounceTime is also 10,000, so millis() - lastDebounceTime equals zero. Zero is not greater than the debounceDelay, which was set to 50 at the top of the sketch. So the if statement is not executed and the counter is not incremented. At the end of the loop() section, the lastButtonState variable is set equal to the currentButtonState. The button signal is still low since the Arduino runs much faster than the signal is bouncing. The loop() section cycles through multiple times in one millisecond. 172 CU IDOL SELF LEARNING MATERIAL (SLM)","Continuing the example back at the top of the loop() section, the inputPin is still low, so the currentButtonState is still low. The currentButtonState is equal to the lastButtonState, so the first if statement is skipped. Now say that one millisecond has passed since the button was first pressed. In the second if statement, millis() - lastDebounceTime equals 10,001-10,000 = 1, which is not greater than 50 so the second if statement is skipped as well. This continues looping over and over until the 5 millisecond signal bounce is over. The reading at the inputPin is now high again, so a high value is stored in currentButtonState. Therefore, currentButtonState does not equal lastButtonState, which is low, so the program enters the first if statement and the timer is reset with lastDebounceTime = millis(). It\u2019s only until the inputPin stays low for greater than 50 milliseconds that the program will enter the body of the if statement that has the code to increment the counter. The code is a little hard to understand at first, but if you walk through the loop() section a few times it should become clear. Feel free to leave a comment below if you have questions about anything. 8.4 SEVEN SEGMENT DISPLAY 7-segment display Fig 8.8 7-Segment Display 7-segment displays are made up of 8 LED segments. They are used to display Numbers (0-9) and certain Alphabets (like c, A, H, P, etc.). \uf0b7 7 of these LED segments are in the shape of a line, whereas 1 segment is circular. \uf0b7 Each of the 8 elements has a pin associated with it which can be driven HIGH or LOW. 173 CU IDOL SELF LEARNING MATERIAL (SLM)","\uf0b7 To display a number or alphabet, we need to turn on specific LED segments of the display. 7-segment display module There are various display modules available in the market that make use of ICs like the MAX7219 to drive multiple 7-segment displays using SPI communication. One such module is shown in the image given below. These modules are compact and require few pins and wires compared to using singular 7- segment displays in cascade. Fig 8.9 7-Segment Display Module We will be seeing how to interface both, single 7-segment display as well as 7-segment display module that has eight 7-segment displays on it. Interfacing Diagram Interfacing 7-Segment Display with Arduino UNO 174 CU IDOL SELF LEARNING MATERIAL (SLM)","Fig 8.10 Interfacing 7-Segment Display with Arduino UNO Here, the 7-Segment display is driven directly by Arduino. Resistors need to be connected between the display and the Arduino UNO board. Depending on which number or alphabet is to be displayed, control signals are applied. Note : We have used common anode display, hence the common pin is connected to 5V. If common cathode display is used, the common pin needs to be connected to ground. For common anode display, drive pin LOW to turn on corresponding LED segment. For common cathode display, drive pin HIGH to turn on the corresponding LED segment. Interfacing 7-Segment Display Using SN7446AN Driver with Arduino UNO 175 CU IDOL SELF LEARNING MATERIAL (SLM)","Fig 8.11 Interfacing 7-Segment Display Using SN7446AN Driver with Arduino UNO Here, the 7-segment display is driven by the SN7446AN IC. It is a BCD to 7-segment driver\/decoder IC. This reduces the number of pins required to drive the 7-segment display. Interfacing 7-Segment Display Module with Arduino UNO Fig 8.12 Interfacing 7-Segment Display Module with Arduino UNO 176 CU IDOL SELF LEARNING MATERIAL (SLM)","Here, we will be using the LED Control library by Wayoda from GitHub. Using this library, it is possible to control up to eight SPI based 7-Segment modules (each module can have up to eight 7-segments displays) connected in cascade, using just 3 pins. Extract the library and add it to the libraries folder path of Arduino IDE. There are three example sketches available in the library. We have created simplified sketch using the header file of this library. Sketch for Control Of 7-Segment Display int disp_pin[7]; \/* array for a-g pins of 7-Segment display *\/ void define_segment_pins(int a, int b, int c, int d, int e, int f, int g) \/* Assigns 7-segment display pins to board *\/ { disp_pin[0] = a; disp_pin[1] = b; disp_pin[2] = c; disp_pin[3] = d; disp_pin[4] = e; disp_pin[5] = f; disp_pin[6] = g; } void display_number(int num) \/* Function for displaying number (0-9) *\/ { switch(num) { case 0: 177 CU IDOL SELF LEARNING MATERIAL (SLM)","digitalWrite(disp_pin[0], LOW); \/* Drive disp_pin[0] to LOW *\/ digitalWrite(disp_pin[1], LOW); \/* Driving LOW turns on LED segment for common anode display *\/ digitalWrite(disp_pin[2], LOW); digitalWrite(disp_pin[3], LOW); digitalWrite(disp_pin[4], LOW); digitalWrite(disp_pin[5], LOW); digitalWrite(disp_pin[6], HIGH); break; case 1: digitalWrite(disp_pin[0], HIGH); \/* Drive disp_pin[7] to HIGH *\/ digitalWrite(disp_pin[1], LOW); digitalWrite(disp_pin[2], LOW); digitalWrite(disp_pin[3], HIGH); \/* Driving HIGH turns off LED segment for common anode display *\/ digitalWrite(disp_pin[4], HIGH); digitalWrite(disp_pin[5], HIGH); digitalWrite(disp_pin[6], HIGH); break; case 2: digitalWrite(disp_pin[0], LOW); digitalWrite(disp_pin[1], LOW); digitalWrite(disp_pin[2], HIGH); digitalWrite(disp_pin[3], LOW); digitalWrite(disp_pin[4], LOW); digitalWrite(disp_pin[5], HIGH); digitalWrite(disp_pin[6], LOW); break; case 3: digitalWrite(disp_pin[0], LOW); 178 CU IDOL SELF LEARNING MATERIAL (SLM)","digitalWrite(disp_pin[1], LOW); 179 digitalWrite(disp_pin[2], LOW); digitalWrite(disp_pin[3], LOW); digitalWrite(disp_pin[4], HIGH); digitalWrite(disp_pin[5], HIGH); digitalWrite(disp_pin[6], LOW); break; case 4: digitalWrite(disp_pin[0], HIGH); digitalWrite(disp_pin[1], LOW); digitalWrite(disp_pin[2], LOW); digitalWrite(disp_pin[3], HIGH); digitalWrite(disp_pin[4], HIGH); digitalWrite(disp_pin[5], LOW); digitalWrite(disp_pin[6], LOW); break; case 5: digitalWrite(disp_pin[0], LOW); digitalWrite(disp_pin[1], HIGH); digitalWrite(disp_pin[2], LOW); digitalWrite(disp_pin[3], LOW); digitalWrite(disp_pin[4], HIGH); digitalWrite(disp_pin[5], LOW); digitalWrite(disp_pin[6], LOW); break; case 6: digitalWrite(disp_pin[0], LOW); digitalWrite(disp_pin[1], HIGH); digitalWrite(disp_pin[2], LOW); digitalWrite(disp_pin[3], LOW); CU IDOL SELF LEARNING MATERIAL (SLM)","digitalWrite(disp_pin[4], LOW); 180 digitalWrite(disp_pin[5], LOW); digitalWrite(disp_pin[6], LOW); break; case 7: digitalWrite(disp_pin[0], LOW); digitalWrite(disp_pin[1], LOW); digitalWrite(disp_pin[2], LOW); digitalWrite(disp_pin[3], HIGH); digitalWrite(disp_pin[4], HIGH); digitalWrite(disp_pin[5], HIGH); digitalWrite(disp_pin[6], HIGH); break; case 8: digitalWrite(disp_pin[0], LOW); digitalWrite(disp_pin[1], LOW); digitalWrite(disp_pin[2], LOW); digitalWrite(disp_pin[3], LOW); digitalWrite(disp_pin[4], LOW); digitalWrite(disp_pin[5], LOW); digitalWrite(disp_pin[6], LOW); break; case 9: digitalWrite(disp_pin[0], LOW); digitalWrite(disp_pin[1], LOW); digitalWrite(disp_pin[2], LOW); digitalWrite(disp_pin[3], LOW); digitalWrite(disp_pin[4], HIGH); digitalWrite(disp_pin[5], LOW); digitalWrite(disp_pin[6], LOW); CU IDOL SELF LEARNING MATERIAL (SLM)","break; default: digitalWrite(disp_pin[0], HIGH); digitalWrite(disp_pin[1], LOW); digitalWrite(disp_pin[2], LOW); digitalWrite(disp_pin[3], LOW); digitalWrite(disp_pin[4], LOW); digitalWrite(disp_pin[5], HIGH); digitalWrite(disp_pin[6], LOW); break; } } void setup() { \/* a-g segment pins to Arduino *\/ pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); define_segment_pins(12,11,10,9,8,7,6); } void loop() { int i; for(i = 9; i>=0; i--) { display_number(i); delay(1000); 181 CU IDOL SELF LEARNING MATERIAL (SLM)","} for(i = 0; i<=9; i++) { display_number(i); delay(1000); } } Video Sketch for Control Of 7-Segment Display Using SN7446AN Decoder\/Driver int bcd_pins[4]; \/* array for A-D pins of driver IC *\/ void bcd_control_pins(int a, int b, int c, int d) \/* Assigns A-D pins of deiver IC to Arduino board *\/ { bcd_pins[0] = a; bcd_pins[1] = b; bcd_pins[2] = c; bcd_pins[3] = d; } void display_number(int num) \/* Function for displaying number (0-9) *\/ { switch(num) { case 0: digitalWrite(bcd_pins[0], LOW); \/* Drive bcd_pin[0] to LOW *\/ 182 CU IDOL SELF LEARNING MATERIAL (SLM)","digitalWrite(bcd_pins[1], LOW); \/* Driving LOW turns on LED segment for common anode display *\/ digitalWrite(bcd_pins[2], LOW); digitalWrite(bcd_pins[3], LOW); break; case 1: digitalWrite(bcd_pins[0], HIGH); digitalWrite(bcd_pins[1], LOW); digitalWrite(bcd_pins[2], LOW); digitalWrite(bcd_pins[3], LOW); break; case 2: digitalWrite(bcd_pins[0], LOW); digitalWrite(bcd_pins[1], HIGH); digitalWrite(bcd_pins[2], LOW); digitalWrite(bcd_pins[3], LOW); break; case 3: digitalWrite(bcd_pins[0], HIGH); \/* Drive bcd_pin[3] to HIGH *\/ digitalWrite(bcd_pins[1], HIGH); \/* Driving HIGH turns on LED segment for common anode display *\/ digitalWrite(bcd_pins[2], LOW); digitalWrite(bcd_pins[3], LOW); break; case 4: digitalWrite(bcd_pins[0], LOW); digitalWrite(bcd_pins[1], LOW); digitalWrite(bcd_pins[2], HIGH); digitalWrite(bcd_pins[3], LOW); break; 183 CU IDOL SELF LEARNING MATERIAL (SLM)","case 5: 184 digitalWrite(bcd_pins[0], HIGH); digitalWrite(bcd_pins[1], LOW); digitalWrite(bcd_pins[2], HIGH); digitalWrite(bcd_pins[3], LOW); break; case 6: digitalWrite(bcd_pins[0], LOW); digitalWrite(bcd_pins[1], HIGH); digitalWrite(bcd_pins[2], HIGH); digitalWrite(bcd_pins[3], LOW); break; case 7: digitalWrite(bcd_pins[0], HIGH); digitalWrite(bcd_pins[1], HIGH); digitalWrite(bcd_pins[2], HIGH); digitalWrite(bcd_pins[3], LOW); break; case 8: digitalWrite(bcd_pins[0], LOW); digitalWrite(bcd_pins[1], LOW); digitalWrite(bcd_pins[2], LOW); digitalWrite(bcd_pins[3], HIGH); break; case 9: digitalWrite(bcd_pins[0], HIGH); digitalWrite(bcd_pins[1], LOW); digitalWrite(bcd_pins[2], LOW); digitalWrite(bcd_pins[3], HIGH); break; CU IDOL SELF LEARNING MATERIAL (SLM)","default: digitalWrite(bcd_pins[0], LOW); digitalWrite(bcd_pins[1], LOW); digitalWrite(bcd_pins[2], LOW); digitalWrite(bcd_pins[3], LOW); break; } } void setup() { \/* A-D of driver IC to Arduino *\/ pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); bcd_control_pins(11,10,9,8); } void loop() { int i; for(i = 9; i>=0; i--) { display_number(i); delay(1000); } for(i = 0; i<=9; i++) { display_number(i); delay(1000); } } 185 CU IDOL SELF LEARNING MATERIAL (SLM)","Sketch for Control Of 7-Segment Display Module #include \\\"LedControl.h\\\" LedControl new_disp = LedControl(7,5,6,1); \/* Create an LED control object *\/ void setup() { new_disp.shutdown(0,false); \/* Normal functioning of device device with address 0 *\/ new_disp.setIntensity(0,8); \/* Define medium(8) intensity of display device with address 0 *\/ new_disp.clearDisplay(0); \/* Clear display device with address 0 *\/ } void loop() { \/* Display 0 on the 1st 7-seg display *\/ new_disp.setDigit(0,0,0,false); \/* Display F on the 5 th 7-seg display *\/ delay(1000); new_disp.setDigit(0,1,2,false); delay(1000); new_disp.setDigit(0,2,4,false); delay(1000); new_disp.setDigit(0,3,6,false); delay(1000); new_disp.setChar(0,4,'F',false); delay(1000); new_disp.setChar(0,5,'P',false); delay(1000); new_disp.setChar(0,6,'c',false); delay(1000); new_disp.setChar(0,7,'A',false); 186 CU IDOL SELF LEARNING MATERIAL (SLM)","delay(1000); \/* Clear display device with address 0 *\/ new_disp.clearDisplay(0); delay(1000); } Functions Used in sketch 1. LedControl new_disp = LedControl(dataPin, clkPin, csPin, Devices) \uf0b7 This creates an object of class LEDControl (here, new_disp; user can any other valid name as well) that talks to the MAX7219 on the 7-segment display module. \uf0b7 dataPin is the pin of Arduino that is connected the DataIn pin on the module. This is the pin on the Arduino where data gets shifted out. \uf0b7 clkPin is the pin of Arduino that is connected the CLK pin on the module. This is the pin for the clock. \uf0b7 csPin is the pin of Arduino that is connected the CS\/Load pin on the module.This is the pin for selecting the device when data is to be sent. \uf0b7 Devices define the maximum number of devices that can be controlled. It can be between 1 to 8. It is the number of devices that are connected in cascade. \uf0b7 The device directly connected to the pins defined has address 0. The device immediately next to this in cascade has address 1. The 8 the device (last device in the cascade connection) has address 7. 2. new_disp.shutdown(addr, status) \uf0b7 This function is used for power saving. \uf0b7 If status is true, the device corresponding to addr goes into power down mode. If status is false, the device functions normally. 3. new_disp.setIntensity(addr, intensity) \uf0b7 This function is used to set the brightness of the display whose address is addr. \uf0b7 intensity can be between 1 to 15. 1 being minimum and 15 being maximum. 4. new_disp.setDigit(addr, digit, value, dp) 187 CU IDOL SELF LEARNING MATERIAL (SLM)","\uf0b7 This function is used for displaying a number (value) on the display with address addr. The number is displayed at the position(units, tens, etc.) mentioned by digit (can be 0 to 7).dp sets the decimal point. If dp is false, decimal point is off. 5. new_disp.setChar(addr, digit, value, dp) \uf0b7 This function is used for displaying a character (value) on the display with address addr. The character is displayed at the position(units, tens, etc.) mentioned by digit (can be 0 to 7). dp sets the decimal point. If dp is false, decimal point is off. \uf0b7 Only certain characters can be displayed. 8.5 16X2 LCD WITH PROGRAMMING Fig 8.13 LCD 16x2 LCDs (Liquid Crystal Displays) are used in embedded system applications for displaying various parameters and status of the system. LCD 16x2 is a 16-pin device that has 2 rows that can accommodate 16 characters each. LCD 16x2 can be used in 4-bit mode or 8-bit mode. 188 CU IDOL SELF LEARNING MATERIAL (SLM)","It is also possible to create custom characters. It has 8 data lines and 3 control lines that can be used for control purposes. For more information about LCD 16x2 and how to use it, refer the topic LCD 16x2 module in the sensors and modules section. Interfacing Diagram Fig 8.14 Interfacing 16x2 LCD With Arduino UNO Example Displaying data on 16x2 LCD (Custom characters as well as regular characters) in 8-bit and 4-bit mode. Here, we will be using the built in LiquidCrystal library provided by Arduino along with their IDE for LCDs that are based on Hitachi HD44780 (or compatible) chipset. Sketch For Displaying Data On LCD (Custom Characters And Regular Characters) #include <LiquidCrystal.h> 189 CU IDOL SELF LEARNING MATERIAL (SLM)","\/* Create object named lcd of the class LiquidCrystal *\/ LiquidCrystal lcd(13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3); \/* For 8-bit mode *\/ \/\/LiquidCrystal lcd(13, 12, 11, 6, 5, 4, 3); \/* For 4-bit mode *\/ unsigned char Character1[8] = { 0x04, 0x1F, 0x11, 0x11, 0x1F, 0x1F, 0x1F, 0x1F }; \/* Custom Character 1 *\/ \/* unsigned char Character2[8] = { 0x01, 0x03, 0x07, 0x1F, 0x1F, 0x07, 0x03, 0x01 }; Custom Character 2 *\/ void setup() { lcd.begin(16,2); \/* Initialize 16x2 LCD *\/ lcd.clear(); \/* Clear the LCD *\/ lcd.createChar(0, Character1); \/* Generate custom character *\/ lcd.createChar(1, Character2); } void loop() { lcd.setCursor(0,0); \/* Set cursor to column 0 row 0 *\/ lcd.print(\\\"Hello!!!!\\\"); \/* Print data on display *\/ lcd.setCursor(0,1); lcd.write(byte(0)); \/* Write a character to display *\/ lcd.write(1); } Functions Used 1. LiquidCrystal object_name(rs,rw,en,d0,d1,d2,d3,d4,d5,d6,d7) LiquidCrystal object_name(rs,rw,en,d4,d5,d6,d7) \uf0b7 This function defines an object named object_name of the class LiquidCrystal. \uf0b7 rs, rw and en are the pin numbers of the Arduino board that are connected to rs, rw and en of LCD. 190 CU IDOL SELF LEARNING MATERIAL (SLM)","\uf0b7 d0, d1, d2, d3, d4, d5, d6 and d7 are the pin numbers of the Arduino board that are connected to data pins D1, D2, D3, D4, D5, D6 and D7 of LCD. \uf0b7 Example, LiquidCrystal lcd(13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3). This makes use of LCD in 8-bit mode. \uf0b7 Example, LiquidCrystal lcd(13, 12, 11, 6, 5, 4, 3). This makes use of LCD in 4-bit mode. 2. lcd.begin(cols,rows) \uf0b7 This function is used to define the number of rows and columns the LCD has and to initialize the LCD. \uf0b7 Needs to be called before calling other functions, once the object is defined using the function in point 1. \uf0b7 Example, for 16x2 LCD we write lcd.begin(16,2). lcd is the name of the object of the class LiquidCrystal. 16 is the number of columns and 2 is the number of rows. 3. lcd.setCursor(col,row) \uf0b7 This function positions the cursor of the LCD to a location specified by the row and column parameters. \uf0b7 col is the column number at which the cursor should be at (0 for column 1, 4 for column 5 and so on). \uf0b7 row is the row number at which the cursor should be at (0 for row 1, 1 for row 2). \uf0b7 Example, for setting the cursor at the 5th column in the 2nd row, lcd.setCursor(4,1). lcd is the name of the object of the class LiquidCrystal. 4. lcd.createChar(num,data) \uf0b7 This function is used to create a new custom character for use on the LCD. \uf0b7 num is the CGRAM location (0 to 7) at which the custom character is to be stored. \uf0b7 data is array of eight bytes which represent the custom character. \uf0b7 Custom character can be of 5x8 pixels only. \uf0b7 Each custom character is specified by an array of eight bytes, one for each row. The five least significant bits of each byte determine the pixels in that row. 191 CU IDOL SELF LEARNING MATERIAL (SLM)","\uf0b7 To display a custom character on the screen, write() function needs to be used. CGRAM location number (0 to 7) of the custom character which is to be displayed on LCD is passed as an argument to the write function. \uf0b7 Note : When referencing custom character \\\"0\\\", you need to cast it as a byte, otherwise the compiler throws an error. 8.6 SUMMARY The IoT and its counterpart, the Industrial Internet of Things (IIoT), are bringing sensor usage to a new level. Broadly speaking, sensors are devices that detect and respond to changes in an environment. Inputs can come from a variety of sources such as light, temperature, motion and pressure 8.7 KEYWORDS \uf0b7 Edge Gateway: The connecting factor between device analytics and cloud data processing and analytics \uf0b7 Edge Layer: An architectural shift in IoT that breaks the norm of the traditional client-server model. This is the first layer of connectivity for devices to connect to before going to the server. Responsible for the local connectivity of devices and for managing the data collection and connection to this server. \uf0b7 Embedded Device\/Systems: A computer with a dedicated function within a larger mechanical or electrical system; it is embedded as part of a complete device. \uf0b7 Endpoint Device: An Internet-capable device on a TCP\/IP network. 8.8 LEARNING ACTIVITY 1. What is Sensor? Differentiate between sensors and transducer.What is an IR sensor? 2. Write a program in Arduino IDE with IR sensor for smart home applications 8.9UNIT END QUESTIONS 192 A. Descriptive questions CU IDOL SELF LEARNING MATERIAL (SLM)","Short Questions 1. Explain the Journey to a Circuit Board 2. Explain switch 3. Explain debouncing conditions 4. Give example of seven segment display Long Questions 1. Explain the several factors that need to be considered while choosing your platform. 2. Define the term wiring: Sketching in Hardware. 3. Explain Arduino. What are the things need to be considered for developing on the Arduino? 4. Define the following: \u2022 Microcontrollers \u2022 System-on-chips A. Multiple Choice Questions 1. Which sensor is used for monitor electric distribution and switching equipment temperature? a) LM35 b) ESP8266 c) DHT11 d) RFM3200 Answer: RFM3200 2. Line of sight of wireless sensor tag is ________ 193 a) 750ft b) 700ft c) 500ft d) 550ft CU IDOL SELF LEARNING MATERIAL (SLM)","Answer: 700ft 3. How many pins does temperature sensor have? a) 5 legs b) 2 legs c) 4 legs d) 3 legs Answer: 3 legs 4. Which of the following is the Wireless battery-free sensor? a) LM35 b) RFM3200 c) ESP8266 d) DHT11 Answer: RFM3200 5. Which sensor is linear and low accuracy? a) Thermistor b) Resistance Thermometer c) Thermocouple d) Semiconductor based sensor Answer: Semiconductor based sensor 8.10 REFERENCES Text Books: - 1. Internet of Things (A Hands on Approach), By ArshdeepBahga (Author),VijayMadisetti(Author). Edition: Second Edition, Illustrated, Reprint (2014) Publisher: VPT, 2017 2. \u201cBeginning Arduino\u201d by Michael McRobetrs(Author). 194 CU IDOL SELF LEARNING MATERIAL (SLM)","Publisher:Technology in Action Reference Books: - 1. Tim Cox, Dr. Steven Lawrence Fernandes, Sai Yamanoor, Srihari Yamanoor, Prof. DiwakarVaish,\u201d Getting Started with Python for the Internet of Things: Leverage the full potential of Python to prototype and build IoT projects using the RaspberryPi Edition: First Edition Publisher:Packt Publisher-2019 195 CU IDOL SELF LEARNING MATERIAL (SLM)","UNIT - 9ANALOG STRUCTURE 9.0 Learning Objectives 9.1 Introduction 9.2 Potentiometer 9.3 LM35 (Temperature Sensor) 9.4 LDR 9.5 Speaker with programming 9.6 Summary 9.7 Keywords 9.8 Learning Activity 9.9 Unit End Questions 9.10References 9.0LEARNING OBJECTIVES After studying this unit, you will be able to: \uf0b7 Know about Potentiometer \uf0b7 Understand the working of LM35 (Temperature Sensor) \uf0b7 Understand LDR \uf0b7 Connect Speaker with programming 9.1 INTRODUCTION The potentiometer is an important topic of Physics, and students need to understand the basic concepts related to this topic. The potentiometer is an instrument designed for measuring the unknown voltage by comparing it with the known voltage. In other words, it is the three- terminal device used for measuring the potential differences by manually varying the resistances. The known voltage is drawn by the cell or any other supply source. The name \u201cpotentiometer\u201d is a combination of Potential Difference and Metering, which came from the early days of electronics development. It was thought then that adjusting large 196 CU IDOL SELF LEARNING MATERIAL (SLM)","wire-wound resistive coils metered or measured out a set amount of potential difference, making it a type of voltage-metering device. Students can find all the details related to the potentiometer, including the applications, types and principle of potentiometer, along with the diagram and the symbolic representation in this article. 9.2 POTENTIOMETER Potentiometer Definition The definition of a potentiometer will help students to understand the difficult concepts associated with the topic. A potentiometer is a device used to measure the potential difference in a circuit. The potential difference between two points in a circuit is the amount of work done to bring a charge from the first point to the second. When there is a potential difference in a circuit, the current flows through the circuit. It is a three-terminal resistor that acts as a voltage divider, and if only two terminals are used, it functions like a variable resistor or a rheostat. The potentiometer is an electric instrument that is used to measure the EMF (electromotive force) of a given cell and also the cell\u2019s internal resistance. Furthermore, it is used to compare EMFs of different cells. It can also be used as a variable resistor in most applications. Fig 9.1 Potentiometer Definition The potentiometer uses the comparative method as it is more accurate when compared to the deflection approach. So, it is Majorly used in places where higher accuracy is required or where no current flows from the source under test, unlike voltmeter, which draws some current from the circuit and hence, voltmeter gives less accurate results. Symbolic Representation of Potentiometer There are two symbols that are generally used for the purpose of representing a potentiometer. One is more prevalent in America, and the other is considered an international standard symbol for potentiometers. The American standard contains zigzag lines with three terminals placed between two straight lines. The international standard includes a rectangular box with three terminals placed between two straight lines. 197 CU IDOL SELF LEARNING MATERIAL (SLM)","Fig 9.2Symbolic Representation of Potentiometer Potentiometer Working Principle The working principle of potentiometer is based on the fact that the drop in potential across any piece of a wire is precisely proportional to the wire\u2019s length, assuming the wire has a uniform cross-sectional area and a steady current running through it. Thus, there will be no electric current flow when there is no potential difference between any two nodes. To understand the potentiometer working principle, consider the following case: Fig 9.3 Potentiometer Working Principle Two batteries with the same EMF (E) are connected through a galvanometer. The positive terminals of batteries are connected through a galvanometer, and the negative terminals of the two batteries are connected. Since both the batteries have the same EMF, the galvanometer will show a null deflection, indicating no current flowing through the circuit. This is precisely how a potentiometer works. Potentiometer Circuit Diagram 198 CU IDOL SELF LEARNING MATERIAL (SLM)","Fig 9.4 Potentiometer Circuit Diagram the potentiometer circuit diagram consists of: 1. Galvanometer: The device used for detecting the presence of a small current or for measuring its magnitude. 2. Ammeter: It is an Electronic Device or an Instrument used to measure the electric current flowing through an Electric Circuit. 3. Jockey: This is a pointed metal contact used to provide exact contact on a wire potentiometer or a Wheatstone bridge. 4. Wire: Generally, alloys like constantan or manganin are used as potentiometer wire because they possess high specific resistance and low-temperature coefficient. 5. Rheostat: It is a variable resistor that is used to control current. These can vary the resistance in a circuit without interruption. Construction of Potentiometer The potentiometer consists of a long resistive wire LL made up of magnum or constantan and a battery of known EMF V.V. This voltage is called driver cell voltage. The two ends of the resistive wire LL are connected to the battery terminals as shown below; this is assumed to be the primary circuit arrangement. One of the terminals of another cell (whose EMF EE is to be measured) is at one end of the primary circuit. Another end of the cell terminal is connected to any point on the resistive wire through a galvanometer GG. This arrangement forms the secondary circuit. The arrangement of the potentiometer is shown below: 199 CU IDOL SELF LEARNING MATERIAL (SLM)","Fig 9.5 Construction of Potentiometer The potentiometer wire generally has a high resistivity (\u03c1)(\u03c1) and uniform cross-sectional area. Let it be AA. Thus, resistance would be uniform throughout the wire. This potentiometer terminal is connected to the cell of high EMF VV (neglecting its internal resistance) called the driver cell or the voltage source. So let the current in the primary circuit be and be the total resistance of the potentiometer wire. Derivation of the working condition of a Potentiometer By Ohm\u2019s law V=IRV=IR Resistance of the wire can be given as R=\u03c1LAR=\u03c1LA Thus, from the above two As \u03c1\u03c1 and AA are always constant and current, II is equations, V=I\u03c1LAV=I\u03c1LA This Thus, V=KLV=KL kept constant by a rheostat. gives L\u03c1A=KL\u03c1A=K (constant) Now suppose a cell of lower EMF than the driver cell is put in the circuit, as shown above, say it has EMF EE Then, E=L\u03c1xA=KxE=L\u03c1xA=Kx Where (x)(x) is the length of a part of potentiometer wire. When this cell is put in the circuit as shown above figure with a jokey connected to the corresponding length (x)(x), there will be no current flow through the galvanometer because when the potential difference is equal to zero. So the galvanometer GG shows null detection. The length (x)(x) is called the length of the null point. Now by knowing the constant KK and the length (x)(x), we can find the unknown EMF. Secondly, EMF of two cells may also be compared, let the first cell of EMF E1E1 given a null point at a length L1L1 and the second cell of EMF E2E2 show a null point at length L2L2 Then, E1E2=L1L2E1E2=L1L2 Characteristics of Potentiometer The sensitivity of a potentiometer implies the slightest voltage difference that the given potentiometer can measure. The potential gradient is the decrease in potential per unit length. It is calculated as V\/L,V\/L, where VV is the potential difference between two points and L is the distance between them. The longer the wire, the lesser the potential gradient and the greater the sensitivity of the potentiometer. So, the sensitivity of the potentiometer is inversely proportional to the voltage. Types of Potentiometer Following are the two main types of potentiometer we use in Electronics: 200 CU IDOL SELF LEARNING MATERIAL (SLM)"]
Search
Read the Text Version
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
- 253
- 254
- 255
- 256
- 257
- 258
- 259