Poor Man s A/D Converter By Dave Wissel at Wave Technology



Similar documents
Voltage boost and buck circuits using Atmel AVR Tiny13V for driving a white LED.

Lab 7: Operational Amplifiers Part I

Transistor Amplifiers

Bipolar Transistor Amplifiers

8-bit Microcontroller. Application Note. AVR400: Low Cost A/D Converter

Transistor Characteristics and Single Transistor Amplifier Sept. 8, 1997

Building A RISC Microcontroller in an FPGA

Welcome to this presentation on Driving LEDs Resistors and Linear Drivers, part of OSRAM Opto Semiconductors LED Fundamentals series.

LM 358 Op Amp. If you have small signals and need a more useful reading we could amplify it using the op amp, this is commonly used in sensors.

css Custom Silicon Solutions, Inc.

Physics 623 Transistor Characteristics and Single Transistor Amplifier Sept. 13, 2006

FFT Frequency Detection on the dspic

Electronics. Discrete assembly of an operational amplifier as a transistor circuit. LD Physics Leaflets P

Low Cost Pure Sine Wave Solar Inverter Circuit

BJT Characteristics and Amplifiers

Chapter 19 Operational Amplifiers

Measuring Electric Phenomena: the Ammeter and Voltmeter

Measuring Resistance Using Digital I/O

Op-Amp Simulation EE/CS 5720/6720. Read Chapter 5 in Johns & Martin before you begin this assignment.

Operational Amplifier - IC 741

8-bit Microcontroller. Application Note. AVR415: RC5 IR Remote Control Transmitter. Features. Introduction. Figure 1.

Microcontroller Code Example Explanation and Words of Wisdom For Senior Design

6.101 Final Project Report Class G Audio Amplifier

Basic Electronics Prof. Dr. Chitralekha Mahanta Department of Electronics and Communication Engineering Indian Institute of Technology, Guwahati

BIASING OF CONSTANT CURRENT MMIC AMPLIFIERS (e.g., ERA SERIES) (AN )

ARRL Morse Code Oscillator, How It Works By: Mark Spencer, WA8SME

ADC-20/ADC-24 Terminal Board. User Guide DO117-5

Bipolar Junction Transistor Basics

Accurate Measurement of the Mains Electricity Frequency

THE BASICS OF PLL FREQUENCY SYNTHESIS

Programmable Single-/Dual-/Triple- Tone Gong SAE 800

Pulse Width Modulation (PWM) LED Dimmer Circuit. Using a 555 Timer Chip

Basic Op Amp Circuits

Diodes have an arrow showing the direction of the flow.

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

Section 3. Sensor to ADC Design Example

Digital to Analog and Analog to Digital Conversion

Digital Logic Elements, Clock, and Memory Elements

Controlling a Dot Matrix LED Display with a Microcontroller

Conversion Between Analog and Digital Signals

How To Use A Watt Saver On A Microcontroller (Watt Saver) On A Cell Phone Or Mp3 Player

Theory of Operation. Figure 1 illustrates a fan motor circuit used in an automobile application. The TPIC kω AREF.

Display Board Pulse Width Modulation (PWM) Power/Speed Controller Module

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

LAB 7 MOSFET CHARACTERISTICS AND APPLICATIONS

LABORATORY 2 THE DIFFERENTIAL AMPLIFIER

Using NTC Temperature Sensors Integrated into Power Modules

css Custom Silicon Solutions, Inc.

Interfacing Analog to Digital Data Converters

How to use AVR Studio for Assembler Programming

Digital to Analog Converter. Raghu Tumati

SIMPLE HEART RATE MONITOR FOR ANALOG ENTHUSIASTS

Diode Circuits. Operating in the Reverse Breakdown region. (Zener Diode)

AVR Butterfly Training. Atmel Norway, AVR Applications Group

NTE923 & NTE923D Integrated Circuit Precision Voltage Regulator

Troubleshooting And Repairing ATX Power Supply

Single Supply Op Amp Circuits Dr. Lynn Fuller

Welcome to this presentation on Switch Mode Drivers, part of OSRAM Opto Semiconductors LED Fundamentals series. In this presentation we will look at:

FPAB20BH60B PFC SPM 3 Series for Single-Phase Boost PFC

Pulse Width Modulation Amplifiers EQUIVALENT CIRCUIT DIAGRAM. 200mV + - SMART CONTROLLER .01F OSC Q pF

BIPOLAR JUNCTION TRANSISTORS

Frequency Response of Filters

A Low-Cost VCA Limiter

A Digital Timer Implementation using 7 Segment Displays

Experiment # (4) AM Demodulator

Physics 120 Lab 6: Field Effect Transistors - Ohmic region

Design Project: Power inverter

Temperature Sensors. Resistance Temperature Detectors (RTDs) Thermistors IC Temperature Sensors

APPLICATION NOTE. Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Atmel AVR 8-bit Microcontroller. Introduction.

If an occupancy of room is zero, i.e. room is empty then light source will be switched off automatically

Features. Applications

ENEE 307 Electronic Circuit Design Laboratory Spring A. Iliadis Electrical Engineering Department University of Maryland College Park MD 20742

MAS.836 HOW TO BIAS AN OP-AMP

CONSTRUCTING A VARIABLE POWER SUPPLY UNIT

DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION

Lecture 24. Inductance and Switching Power Supplies (how your solar charger voltage converter works)

Measuring Insulation Resistance of Capacitors

Ignition Alert Anti-Theft Security System for Motorbikes with Remote Control Amit Yadav, Anushri Jha, Neelesh Gupta

POCKET SCOPE 2. The idea 2. Design criteria 3

Application Report SLOA030A

8-Bit Microcontroller with Flash. Application Note. Using a Personal Computer to Program the AT89C51/C52/LV51/LV52/C1051/C2051

Diodes and Transistors

Eliminate Ripple Current Error from Motor Current Measurement

The 2N3393 Bipolar Junction Transistor

Analog and Digital Filters Anthony Garvert November 13, 2015

Routinely DIYers opt to make themselves a passive preamp - just an input selector and a volume control.

The $25 Son of a cheap timer This is not suitable for a beginner. You must have soldering skills in order to build this kit.

What Is Regeneration?

International Journal of Electronics and Computer Science Engineering 1588

Simple 1.5-V Boost Converter for MSP430

Electrical Resonance

OPERATIONAL AMPLIFIERS

Series and Parallel Circuits

DAC Digital To Analog Converter

Ocean Controls RC Servo Motor Controller

NCP1612. Enhanced, High-Efficiency Power Factor Controller

Chapter 6: From Digital-to-Analog and Back Again

Transcription:

Poor Man s A/D Converter By Dave Wissel at Wave Technology Years ago some of the then-old engineers working in the cost-completive area of consumer electronics told me, If it can t be done with a handful of resistors, caps, a 1N4148 diode and an MPS3904 or MPS2907 transistor, it ain t worth doing. At the time it made me laugh but one has to marvel at just what can be done with such low-cost 2 cent components; in fact it s an art form to do so--simplicity has elegance all to itself. This circuit was born of necessity though, for a quick demo. I needed a quick way to read a thermistor in a voltage-divider circuit and I didn t have an available micro (on-hand, that moment) with an internal A/D.and I didn t have the pin-count to do the R2R approach. The micro I was using already had a comparator built-in on two of its pins. Yes, I probably had an op-amp to do the constant-current source but didn t have a whole lot of board space as I had already cobbled-up the board space. Besides I had a whole bin full of PN2222 s and 1N4148 s staring me in the face. Why not take the challenge of the old guys? COMPARATOR, RAMP GENERATOR AND TIMER APPROACH TO A/D CONVERSION In order to make a poor-man s A/D with a comparator one needs to generate a rampvoltage over time and feed this to the spare input of a comparator. The other input of the comparator gets whatever analog-level one is trying to convert. (In my case I had a thermistor I needed to crudely measure so this becomes a voltage input via a divider circuit.) One also needs the timer of a microcontroller. One starts a timer on the ramp beginning and when the comparator toggles due to the level of the comparator-input to be measured, one stops the timer. The value of the timer is the value of the analog signal. The way to generate the ramp voltage is with a constant current source fed into a capacitor. This is born-out by the voltage across a capacitor as related to time and current: V(t)= 1/c ƒi(t) dt If i(t) is a constant (I) than this is simply: V(t)=1/c I t which is a constantly increasingly linear voltage over time. The way to create a constant current source is with some form of amplifier. An op-amp can do this function well but we re limiting ourselves to cheap transistors. Referring to the circuit diagram if the top of C1 and R2 is a constant voltage just after the 5 volt step function, the voltage at the base of the transistor will be about 0.55 volts. The voltage drop of the transistor is just below this amount such that the emitter voltage is

about 35mv. The action of the base emitter junction keeps this voltage constant such that the resistor has 35mv/1.8K or about 20microamps of current. As the voltage is constant, this current is constant. From the [V(t)=1/c I t] equation for a voltage of 5 volts takes 2.5msec with a 10nF capacitor and 20uA of current. All that ones needs is a timer that counts to roughly 255 over 2.5msec while the ramp is happening. I included a quick Simmetrix spice analysis of this circuit so one can see the effect of the step-function; the step function is the round source in the drawing below on the left. The curve is the voltage on the collector of the circuit showing the linear curve of voltage vs. time resulting from a constant current across the capacitor. The spice time shown is less than the measured 2.5 msec due to the 2N2222 and 1N4148 models being generic. In addition the capacitor in the actual circuit was slightly larger than 10nf due to tolerance.

The circuit has limitations such that the time is highly dependant on the diode drops of the diode and the transistor. As such the time will vary. In addition the lower range is limited to just above zero which more precisely is tied to the voltage drop across R1 and Q1B-E. But for a poor man s A/D I was able to swap PN2222 s and 1N4148 s from different lots with very little difference. Here is a flow chart of code to do the conversion. Note that one must subtract the reading as shown from 255 if the comparator inputs are as I show in the schematic.

;********************ATMEL AVR POOR MAN S A/D USING COMPARATOR******* ; The registers called Temp, Temp1, Temp2 are registers in the r16 to r31 defined earlier ;CCSTART is an output on Port D defined earlier ;We defined a pin called DEBUGPIN earlier in the code to test the timing on a scope ;A 16usec timer was being used for another function so it was used x2 HARVESTTEST: LDI TEMP, 0X03 OUT TCCR0, TEMP ; SETS TIMER CLOCK DIVIDE BY 64 (62.5khz; 16usec per count) cbi portd, debugpin sbi portd, debugpin cbi portd, debugpin sbi portd, ccstart; starts the constant current source ldi temp, 0x00 out tcnt0, temp ;rests timer to zero

;needed to let CCstart ramp up Harvesttestloop: sbic acsr,5 ;skip if comparator is low rjmp harvesttestloop sbi portd, debugpin ;sets the debug pin out cbi portd, ccstart; stops cc source sets back to zero in temp, tcnt0 lsl temp ;multiplies by two ldi temp3, 255 sub temp3, temp ;swaps it around so high value is low value rcall DISPLAYDATA ; YOUR SUBROUTINE CALL TO DISPLAY TEMP3 ldi temp,0 out tcnt0,temp ;resets timer counter rcall delay ; a delay routine ret