What is Analog and Digital data transmission

basic analog and digital electronics pdf and how analog and digital recording works, what is the basic difference between analog and digital systems
Dr.MattWood Profile Pic
Dr.MattWood,United States,Teacher
Published Date:25-07-2017
Your Website URL(Optional)
Basic Analog and Digital Student Guide VERSION 1.4 Chapter 1: Analog Voltage and Binary States · Page 1 Chapter 1: Analog Voltage and Binary States This series of experiments introduces analog and digital electronics. What does that mean? In What’s a Microcontroller? we learned that analog is a “continuously variable value”. Another way to think about it is that analog electronics is analogous to nature. There are lots of continuously variable values in nature, such as motion, light level, and sound. The position of a door as it swings open is a good example of a continuously variable value. As a door swings from all the way closed to all the way open, it visits every value in between. At one instant during its travel, it is 1/3 of the way open. At another instant, it is 1/2 way open, and so on. INTRODUCTION TO ANALOG AND DIGITAL Digital simply means represented by digits. Think about how many times each day you encounter analog values that are represented with digits. The temperature is 79.8 degrees. The speed limit is 45 miles per hour, etc. Not surprisingly, digital electronics represents values with digits. The term digital is also used when referring to binary devices such as the circuitry that makes a calculator work, the microprocessor in a computer, and the BASIC Stamp microcontroller. It's true - they are all digital devices. Binary devices are digital devices using two digits, 0 and 1. The experiments in What’s a Microcontroller? introduced a variety of techniques for interfacing with the outside world and other devices. These interfaces were mostly binary. This series of experiments extends the capabilities of interfacing by introducing several analog component interfaces and more component interface techniques. In this first experiment, we'll build a circuit that produces an analog voltage at its output. Remember that analog voltage is continuously variable. The circuit will be adjustable so that it can produce an output anywhere between 0 and 5 volts. We'll also build a circuit called a voltage follower that uses this analog voltage to drive an LED circuit. Page 2 · Basic Analog and Digital Volt/Voltage: The volt is a fundamental unit of electrical measurement named after 18th century physicist Allesandro Volta, and a measurement in volts is referred to as voltage. Most of us encounter this unit of measurement when buying batteries such as the 9 volt (DC) battery that can be used to power the Board of Education or BASIC Stamp HomeWork Board. Inside a battery there are two chemical reactions, which are separated from each other by a barrier. One of the reactions creates a surplus or electrons and the other creates a shortage of them. The electron surplus and shortage sides of the barrier are connected to the negative and positive terminals of the battery respectively. If given a pathway around the barrier, the electrons have the potential to do work to get from the negative to the positive terminal. The volt is a measure of this potential to do work. The volt is also referred to as a unit of electric potential. The analog voltage will also be connected to one of the BASIC Stamp I/O pins set to input mode. This binary input can actually be used to measure small variations in the analog voltage. PBASIC will be used to program the BASIC Stamp to drive a binary LED circuit, which will indicate when these variations have been detected. The Debug Terminal is also a useful tool for displaying data the BASIC Stamp collects and sends. It will be used to monitor the binary value that the input pin receives as the analog voltage is varied. Parts Required For each experiment you will need a BASIC Stamp 2 microcontroller module on a Board of Education platform or a BASIC Stamp HomeWork Board. Your board needs to be connected to an IBM-compatible PC with Windows 2K/XP/Vista. You will need to install the BASIC Stamp Editor v 2.4 or higher, which is available for free download from www.parallax.com. (If you are using a USB board or a Parallax USB to Serial Adapter, you will need the FTDI USB VCP driver software installed; it installs automatically with the BASIC Stamp Editor v 2.4 or higher.) In addition, you'll need the following parts for this experiment: (2) 470 Ω resistors (2) Red LEDs (1) 10 kΩ potentiometer (6) Jumper wires (1) LM358 op-amp Chapter 1: Analog Voltage and Binary States · Page 3 Throughout this series of experiments, we will build circuits from circuit schematics. One of the keys to learning how to read circuit schematics is learning what each symbol on the schematic means. It's also important to learn how to connect a part from the Analog and Digital Parts Kit to the prototyping area (also called a breadboard) of your Board of Education or HomeWork Board based on its circuit symbol in a schematic. Circuit Schematic: Often referred to as a schematic, a circuit schematic is a map that uses symbols to show the components in a circuit and how they are connected. The components are represented by symbols such as the one that represents the LED in Figure 1-1. Figure 1-1 shows the circuit symbol for an LED on the left and a drawing of an LED from the parts kit on the right. It also shows how the pins on an LED correspond to the terminals on the circuit symbol. Flat spot on plastic part of LED indicating the cathode. Figure 1-1 LED Circuit Symbol Compared to the _ Component + LED Figure 1-2 shows a drawing of a resistor below its circuit symbol. The circuit symbol typically has the resistance value written below or next to it. The colored stripes on the part drawn below the symbol indicate its value, which is measured in ohms. The omega symbol (Ω) is used to denote the ohm. You can use Appendix B to convert the color codes on the resistor to resistance values. Figure 1-2 470 Ω Resistor Circuit Symbol and Corresponding Component Page 4 · Basic Analog and Digital Current/Amp: Current happens when electrons travel from point A to point B. Direct current is what happens when you give the surplus electrons in the negative terminal of a battery a pathway to get to the positive terminal. The amp is the measurement of how many electrons per second are traveling through the pathway. Resistance/Ohm: Resistance is a property of a material in the pathway the electrons travel through. The more difficult it is for the electrons to get from one end of the pathway to the other, the higher the resistance. A resistor is just such a pathway, and its resistance is measured in ohms (Ω). Ohm's Law: When a resistor is used to provide a pathway between the negative and positive terminals of a battery, you have an electric circuit with voltage, resistance, and current. Ohm's Law relates the three quantities as follows: V = I x R V is the voltage measured in volts, I is the current measured in amps, and R is the resistance measured in ohms. The Other Guys: Ever wonder where the words volt, amp, and ohm come from? They are all named after some of the people who made significant discoveries about electricity. We already know who the volt is named for; what about the other guys? The amp, also called the ampere, is named after 18th century physicist André Marie Ampère. The ohm is named after 19th century physicist Georg Simon Ohm. The Potentiometer - A Source of Variable Voltage The potentiometer (pot) has 3 pins on its underside that get plugged into the breadboard. On the topside, it has a knob you can twist to adjust it. In this experiment, we will use variable resistance to get a variable voltage output. Figure 1-3 shows how the pins on the underside of the pot from the parts kit correspond to the circuit symbol. Figure 1-3 Potentiometer Circuit Symbol and Component Pot Chapter 1: Analog Voltage and Binary States · Page 5 Figure 1-4 shows what happens inside the pot as it is adjusted. The jagged line represents a resistive element, typically made of carbon. One end of the resistive element is wired to Vdd on your board, and the other end is wired to Vss. The middle of the three terminals is connected to the “wiper”, and it’s where the variable output voltage is measured. The wiper stays in contact with the carbon element as it moves. As the wiper gets closer to Vdd, the voltage measured at the wiper terminal will approach the value of Vdd, which is 5 volts. Likewise, when the wiper is closer to Vss, the voltage at the wiper terminal will be closer to Vss, which is 0 volts. As the wiper terminal travels between Vdd and Vss, the output measured at the wiper terminal varies between these two values in a manner analogous to a door as it opens and closes. Figure 1-4 Potentiometer Wiper Showing how the wiper in a potentiometer travels along the surface of the resistive element as it’s adjusted. The LM358 Op-amp An op-amp (operational amplifier) is a building block commonly used in analog circuits. Figure 1-5 shows the circuit symbol and block diagram for the LM358 op-amp used in this experiment. The op-amp circuit used in this experiment is called a voltage follower because the same voltage comes out as goes in. In other words, the voltage at the output "follows" the voltage at the input. The reason it's used in the circuit in this experiment is to electrically separate a potentiometer circuit from an LED circuit. We'll learn more about the usefulness of a voltage follower in Chapter 4. Page 6 · Basic Analog and Digital Figure 1-5 LM358 op-amp The circuit symbol has numbers on each of its terminals that correspond to the numbers on the block diagram. The block diagram is a top-view of the part from your parts kit with the circuit symbols for the two op-amps in the part drawn in. Make sure to note the location of pin 1 (top left) and the index mark when you place the LM358 on the breadboard. Improper wiring can damage an op-amp. IMPORTANT: Always disconnect your board’s power source while you build or modify circuits. The Board of Education and HomeWork Board Prototyping Area Figure 1-6 shows the remaining circuit symbols used in the first experiment and where to find them on your board’s prototyping area. The symbol for Vdd is the positive 5 volt supply for the BASIC Stamp and board. There are 4 sockets along the top side of the breadboard to the left for making connections to Vdd. Three sockets are for Vin, which is the direct voltage from your battery or power supply. Next, the ground symbol is used for Vss. This is the reference terminal for taking measurements, and it's considered to be 0 volts compared to all other voltages on your board. The four sockets for connecting jumper wires to Vss are along the top of the breadboard to the right. There is a row of sixteen sockets along the left side of the breadboard for connecting to the BASIC Stamp I/O pins. Each I/O pin has a label. I/O pin P0 is connected to the bottom left socket. Pin P1 is the next socket up, and above that socket is the connection to pin P2, and so on through pin P15 at the top left. Chapter 1: Analog Voltage and Binary States · Page 7 X3 Figure 1-6 X4 Prototyping Area on the Board of P15 Education and HomeWork Board P14 P13 P12 Note the power header X3 provides P11 P10 connections to Vdd (+5V), Vin (direct P9 battery or power supply voltage) and P8 P7 Vss (0 V, ground.) Also shown is P6 how each row of 5 sockets on the P5 P4 breadboard is electrically connected P3 underneath. BASIC Stamp I/O pins P2 are accessed via the X4 header. P1 P0 Figure 1-6 also shows some samples of 5-socket-wide rows that are electrically connected underneath the breadboard. There are 34 of these 5-socket-wide rows arranged in the two columns on the breadboard. If you want to connect two jumper wires to each other, you can just plug them into the same row of 5. Then the wires are electrically connected. Likewise, if you want to connect one or more wires to the terminal of a part, just plug them into the same row on the breadboard and they'll be connected. Building the Analog and Digital Comparator Build the circuit according to the schematic in Figure 1-7. This schematic is like a list of connections between circuit symbols. Try to use this list to build the circuit. Here is a partial list of the connections shown in the schematic: √ The wiper terminal of the 10 kΩ pot is connected to pin 3 of the LM358 op-amp. √ Pin 2 of the LM358 is connected to pin 1 of the LM358. √ Pin P7 of the BASIC Stamp is connected to the wiper terminal of the pot. √ Pin 8 of the LM358 is connected to Vdd on your board. √ Pin 4 of the LM358 is connected to Vss on your board. Keep following the schematic like a list and you'll have the circuit built in no time. Page 8 · Basic Analog and Digital Figure 1-7 Pot with Circuit Schematic. analog Op-Amp Binary Analog LED output from voltage LED output Remember to treat wiper follower circuit output. this schematic like terminal a list of connections for building your circuit. Although this circuit only has a few parts, it actually has 4 separate sub circuits, and each has a different function as shown The potentiometer is what makes the analog output. The op-amp is wired to function as a voltage follower. The voltage follower drives the analog LED output. Then there's a separate circuit that uses a BASIC Stamp I/O pin to drive an LED. Figure 1-8 shows a breadboard example of the schematic from Figure 1-7. For extra tips on building circuits on the breadboard, consult What’s a Microcontroller? LM358 Chapter 1: Analog Voltage and Binary States · Page 9 Figure 1-8 Breadboard Example X3 Compare this breadboard example to the schematic from Figure 1-7. Is the LM358 P15 connected right? Does Vdd go to pin 8 and P14 P13 does Vss go to pin 4? P12 P11 P10 It turns out that the answer to both questions is P9 yes. Vss is connected by a wire to the lower P8 right terminal on the pot. Then another wire P7 P6 connects from that pot terminal to pin 4 on the P5 LM358. P4 P3 P2 Since you can follow a wire all the way from pin P1 P0 4 on the LM358 to the Vss terminal, that means X2 it is in fact connected directly to Vss. IMPORTANT: Pay careful attention to placing the LM358 so that the index mark (half-circle notch) is to the top, as shown on this breadboard example. If you place it in reverse, the op- amp will be ruined after the battery or power supply is connected to your board. Programming the Project The program State_of_P7.bs2 below shows how PBASIC can be used to instruct the BASIC Stamp to do several tasks. First, the BASIC Stamp monitors the state its I/O pin P7, which is set to function as an input. Remember, P7 is connected to the wiper terminal of the pot. Depending on the analog voltage level at pin P7, the BASIC Stamp interprets the input as low or high (binary 0 or 1). As soon as the input to P7 receives the high signal, the BASIC Stamp sends a high signal to the LED circuit via pin P12. When the input is low, a low signal is sent to P12. The Debug Terminal is also used to monitor the state of pin P7. Enter Program State_of_P7.bs2 into the BASIC Stamp Editor, and save it under a convenient name, such as State_of_P7_1_1R0.bs2. This stands for Program Listing 1.1 Revision 0. Make sure the programming cable is properly connected to your board, and to the serial or USB port on your computer. Also make sure that a battery or power supply is properly connected, then run the program by clicking the BASIC Stamp Editor’s Run button “►”, or Ctrl-R. Page 10 · Basic Analog and Digital ' Basic Analog and Digital - State_of_P7.bs2 ' Check the state of P7 and show it on the Debug Terminal. ' STAMP BS2 ' PBASIC 2.5 DEBUG CLS INPUT 7 OUTPUT 12 DO OUT12 = IN7 DEBUG HOME, "The state of P7 is ", BIN IN7 LOOP About the Code The first lines start with an apostrophe. This means that they’re comments and not PBASIC commands. The first line reminds you of the book and file name, for future reference. ' Basic Analog and Digital - State_of_P7.bs2 The second comment is a description of the program. What does the program do? ' Check the state of P7 and show it on the Debug Terminal. The next two lines are special comments. We call them compiler directives and they are intended to identify the BASIC Stamp and the PBASIC version we are using. For example if you’re following this manual with a BASIC Stamp 2 SX, you might replace the compiler directive “'STAMP BS2” with “'STAMP BS2SX”. (Hint: use the toolbar buttons to insert these compiler directives.) ' STAMP BS2 ' PBASIC 2.5 It's good to start the Debug Terminal and clear it before using it to display data. This way you will avoid inadvertently displaying outputs from previous programs that were in the BASIC Stamp module's memory. The Debug Terminal starts automatically the first time it encounters the DEBUG command in a PBASIC program. This DEBUG command clears the Debug Terminal after it is opened: DEBUG CLS The BASIC Stamp needs to be told how to treat the I/O pins connected to the circuit. They can either be set to function as inputs or outputs. Chapter 1: Analog Voltage and Binary States · Page 11 This PBASIC command sets BASIC Stamp I/O pin P7 to function as an input pin: INPUT 7 Likewise, I/O pin P12 functions as output with this command: OUTPUT 12 The rest of the program should be done over and over again, so this is a good place to put a DO…LOOP loop. So, at the point we want to start to repeat the code we put: DO Later in the program, the command LOOP is entered. Each time the program gets to the LOOP command, it returns to DO and starts executing instructions all over again. The next task is to make the LED connected to pin P12 light up when the voltage at P7 is high enough to qualify as a binary high signal. In other words, if the input value measured at P7 is a binary-1, then the output at P12 should be set to binary-1. Although there are several ways to accomplish this, the easiest way is to set the binary output value of pin P12 equal to the binary input value of pin P7. OUT12 = IN7 The DEBUG command can be used to display the signal levels received by an I/O pin functioning as an input in the Debug Terminal. The DEBUG command below prints three different items. When printing more than one item with a DEBUG command, always separate each of the items with commas. DEBUG HOME, "The state of P7 is ", BIN IN7 The first item listed using the DEBUG command is HOME, and it sends the cursor to the top- left "home" position in the Debug Terminal. Note how HOME is followed by a comma to separate it from the next item. The next item is a message in quotes: "The state of pin P7 is ". Whenever you want to display a text message in the Debug Terminal, use quotes. The third item is BIN IN7, which tells the Debug Terminal to display the binary input value measured at pin P7. We want the BASIC Stamp keep checking the voltage at P7 over and over again. We also want the BASIC Stamp to automatically update the LED and the Debug Terminal with the latest information from P7. This is accomplished by repeatedly sending the program back to the DO command we created earlier. Page 12 · Basic Analog and Digital To send the program back to the DO statement to start the process all over again, use the command: LOOP Troubleshooting Here are a few tips on things to check if your program doesn't work as expected. • It often takes a few tries to catch all of the wiring mistakes and programming errors. • The most common mistake is a program entry error. In some cases the BASIC Stamp Editor will tell you there is a mistake. For example if you misspelled a command, the BASIC Stamp Editor will not understand it, and it will tell you which term it didn't understand by highlighting it and displaying a brief message. • In other cases the program will run even though a line of code was typed incorrectly. For example you might have typed 13 when you meant to type 12. With a mistake like this, when you try to run the program, the LED connected to pin P12 won't light up when you expect it to because the high signal gets sent to pin P13 instead. • Another common mistake is to plug a wire into the wrong socket on the breadboard. If an LED is not turning on and off the way it should, and there are no programming errors, check the wiring. Also check to make sure the cathode and anode of the LED are connected to the proper places. When an LED is hooked up backwards it won't emit light. • If the information in the Debug Terminal appears garbled or nonsensical, try closing the Debug Terminal and running the program again. Chapter 1: Analog Voltage and Binary States · Page 13 The Output As you adjust the potentiometer knob, note how the LED at the voltage follower's analog output varies in brightness. Meanwhile the LED circuit driven by P12 either turns on or off. This characterizes the difference between analog voltage and digital (binary) voltage. The output displayed in the Debug Terminal should resemble the output shown in Figure 1-9. The state of P7 will either be 0 or 1. Correspondingly, the LED circuit driven by P12 will either be off or on. Figure 1-9 Debug Terminal Output for Program Adjust the potentiometer until you have found the threshold voltage. You will know when you've found it because the Debug Terminal will indicate that the state of P7 skips back and forth between 0 and 1 with just the slightest adjustment of the pot. Note the position of the potentiometer. After we build a DC voltmeter in Chapter 3, we can find out how close we are to 1.4 volts, which is the actual threshold voltage of a BASIC Stamp I/O pin when it's functioning as an input. Page 14 · Basic Analog and Digital About the Comparator Using PBASIC, we programmed the BASIC Stamp to function as a comparator. A comparator is so named because it's a circuit that compares its input voltage to a particular voltage, also called the threshold voltage. If the input voltage is higher than the threshold voltage, the comparator sends a high signal at its output. If the input to the comparator is below the threshold voltage, it sends a low signal. In the case of our circuit and program, when the analog voltage at pin P7 is below 1.4 volts, the BASIC Stamp sends a low signal (0 volts) at pin P12. When the analog voltage at pin P7 is above 1.4 volts a high signal (5 volts) is sent from pin P12. As you can see in the Debug Terminal, the BASIC Stamp interprets analog input below 1.4 volts as low (binary 0) and input above 1.4 volts as high (binary 1). Operating a comparator near the threshold voltage is interesting because you can make a small change in voltage at a BASIC Stamp input pin, say from 1.3 to 1.5 volts, and it results in a fairly large change, from 0 to 5 volts at the output. Chapter 1: Analog Voltage and Binary States · Page 15 What have I learned? On the lines below, insert the appropriate words from the list on the left. A __________ shows circuit symbols connected to each other by lines. Each circuit symbol corresponds to a component and the lines connecting carbon the symbols work like a list of connections that can be used to guide the construction of a working circuit on a __________. op-amp An __________ is an analog building block that was used in this analog experiment as a voltage follower. threshold In this experiment, the potentiometer was used as a source of __________ voltage. output The voltage at the wiper terminal of the potentiometer can be made to vary depending on where the wiper is in contact with the __________ element. schematic A comparator is a device that sends a binary output that depends on breadboard whether its analog input is above or below a certain __________ voltage. A comparator can react to a small change in input voltage with a comparatively large change in __________ voltage. Page 16 · Basic Analog and Digital Questions 1. Circle the word that makes the sentence true: The input for a voltage follower is at the ( inverting / non-inverting ) terminal of the op-amp in this experiment. 2. How do you tell the difference between the cathode and the anode on an LED from your parts kit? 3. If the threshold for a comparator is 2.5 volts, and the input is at 1.5 volts, what's the output going to be? 4. Explain what the command DEBUG HOME does. What has to be done to display more than one item using a single DEBUG command? 5. What command would you use to set pin P8 to function as an input? Challenge 1. Add another LED to the circuit to your board and use pin P11 to drive it in an inverted state. In other words, when one LED is on, the other off. Hint: Add 1 to the output value at P11 to invert it. 2. Modify the code from Program State_of_P7.bs2 so that the LED output flashes on and off when the potentiometer output is above the threshold voltage of the BASIC Stamp input pin. Hint: You can use the command pause 500 to make the program pause for half a second. 3. Modify State_of_P7.bs2 to cause one LED to light up when the input voltage at pin P7 is above the threshold voltage and the other LED to light up when the voltage at pin P7 is below threshold voltage. Chapter 1: Analog Voltage and Binary States · Page 17 Why did I learn it? In this experiment, we compared a binary LED output to an analog LED output. Aside from knowing that the voltage at the wiper terminal had just crossed the threshold voltage, there was no way of indicating the potentiometer's position or the LEDs brightness. On the other hand, in the neighborhood of the threshold voltage, fine variations in analog voltage could be detected. Even with the limited amount of analog information provided by a binary input, we were able to develop a device called a comparator, which has many applications in electronics design. As we'll discover in a later experiment, the 555 timer chip in you’re A & D parts kit can do some pretty amazing things. This is due in part to two microscopic comparators in the chip. How can I apply this? In later experiments, we'll use the threshold voltage to measure the frequency of sound for record and playback purposes. We can also build another type of analog to digital converter using a very simple circuit, the BASIC Stamp and the concept of threshold voltage. We'll use this technique to measure light intensity as well as values for capacitors from the Analog and Digital parts kit. Page 18 · Basic Analog and Digital Chapter 2: Introduction to Bit Crunching · Page 19 Chapter 2: Introduction to Bit Crunching An important step in learning how to make the BASIC Stamp process analog data is learning how to make it send and receive binary numbers. It's also important to understand how binary numbers work, and how to convert from a binary number to a decimal number. BASIC COMMUNICATION This experiment introduces some techniques for transmitting and receiving binary numbers using the BASIC Stamp. In this experiment, we'll make a binary keypad for transmitting binary numbers to the BASIC Stamp. The BASIC Stamp will also be programmed to process and display the binary numbers it receives. The binary numbers will be displayed by LEDs as well as by the Debug Terminal. The Debug Terminal will also come in handy for monitoring and displaying the binary numbers in decimal form. In What’s a Microcontroller?, we learned that binary is the number system used by microcontrollers, and that it works with two digits, 0 and 1. The BASIC Stamp is part of an entire class of digital electronic devices that can interpret 0 volts as binary-0 and 5 volts as binary-1. Binary is useful for describing both states and numbers. In terms of states, the two digits in the binary number system (0 and 1) can be used to describe off/on, closed/open, no/yes, etc. Combinations of binary digits can be used to describe numbers. For example, the binary numbers 101, 110, and 111 describe the decimal numbers 5, 6, and 7. These numbers can in turn be used to describe analog information, such the position of a door as it swings open and closed. Parts Required (2) 470 Ω resistors (2) 220 Ω resistors (2) 10 kΩ resistors (2) Pushbutton switches (2) Red LEDs (misc.) Jumper wires

Advise: Why You Wasting Money in Costly SEO Tools, Use World's Best Free SEO Tool Ubersuggest.