Talking voltmeter Using Atmega644
The Handy Lab Buddy is a tool every ECE should have. The four features of this tool include a talking voltmeter, logic probe, voltage averager, and frequency measurer. As a cheap and accurate device that outputs whatever being measured through speakers, it’s one of its kind and an essential tool for lab work.
Have you ever tried to debug a circuit and just wished your voltmeter would talk to you? Or have you ever been too lazy to turn on and calibrate the oscilloscope to measure the frequency? Well, this is the device for you. There are four operating modes of the Handy Lab Buddy. The first mode is a voltmeter that measures voltages up to 5V and says the voltage measured through speakers. The second mode is a logic probe that beeps once in a low tone if the output voltage is low and beeps twice in a higher tone if the output voltage is high. The third mode, a feature unique to this device, is a voltage averager that takes multiple samples in succession (perhaps a noisy voltage signal) and calculates the max, min, and mean voltage and speaks the values over a speaker. The fourth and final mode measures frequency with great accuracy from about 10 Hz to 100 kHz and speaks the value over a speaker. A device capable of all these functions and a “talking” ability at a very cheap cost is not available in the market today and is very useful to the ordinary engineer not wanting to invest in an oscilloscope. As very enthusiastic electrical engineers, we decided to build this device – simply for our own benefit, as it helps tremendously when debugging circuits.
We used quite a few features of the Atmel Mega644 MCU to implement this system, such as speech generation and output, multiple ADC conversions, the output of the pulse width modulator (PWM), and some others.
Rationale and Sources:
In all honesty, this was a secondary project idea for us, originally suggested by Bruce Land. Our original project idea, the Electronic Dartboard (discussed later), had tremendous problems with the hardware in the later weeks of the design cycle that forced us to abandon it. As our working efficiency and debugging experience increased dramatically in those frustrating few weeks, we managed to start and finish this new project within the final days of the semester.
The first big challenge for us was to get sound bites from AT&T and convert them for appropriate use for the MCU. Using the speech generation document by Bruce Land, we utilized his MATLAB programs to downsample from 16 kHz to 8 kHz and create header C files. The compression used in the MATLAB program was a differential pulse-code modulation (DPCM) with a 4:1 compression which sends 2:1 derivative samples.
To calculate the voltage generated, we had to use the built-in analog to digital converter in the MCU. Simple bit conversions were done, and we had to divide the 10-bit digital voltage output by 1024 over VREF (5V) to get a floating point value for the voltage. For the logic probe, the same thing was done, except an additional comparison was made to a threshold. The third feature, calculating the min, max, and average of samples of voltages, used pretty much the same principle as above except used additional variables to store the previous mean, min, max and sample number of samples. Frequency is measured using an elegant combination of software and hardware. Our frequency hardware first filters out the DC component of any input, then reapplies a DC bias, resulting in an AC waveform around the biasing point of our high frequency inverter. The output of this inverter is then stabilized. The final wave is thus a clean square wave, which is then used to trigger the external interrupt on the microcontroller. The software then responds to the interrupt, first synching the timers to the waveform, then measuring the the period of the waveform. Finally, the period is converted into frequency. Using this method, we can reliably measure frequencies from 10Hz to 100,000kHz.
There were two ISRs, one of them controlled the part of the speech played using a table, based on a timer, and the other, an external interrupt, controls triggers when to measure the time elapsed from the previous trigger, to measure frequency.
The user-interface of the Handy Lab Buddy is as demonstrated above. In the first two modes, after the analog voltage measurement is done, the signal needs to only go through an ADC before output to the LCD and to the speakers. For mode three, the voltage averager, the user presses the button on the probe when he/she is ready to take samples, then releases it to stop taking samples. The display shows the final output and it is automatically spoken. The fourth mode, frequency measurment, the user first has to change the banana plug connection to the frequency measurement pin (because of circuit isolation, described later in detail), then the signal passes through an inverter circuit to digitize the analog signal, which then triggers the external frequency ISR on the microcontroller (described later). After measurement in software, it is outputted onto the LCD and speakers. The four buttons that determine the modes are operated by a basic debounce state machine.
The biggest tradeoff during this design project was our decision to completely scrap our original idea and use this one. Our original idea was to create an Electronic Dartboard, where a player would draw concentric circles on a whiteboard, a infrared camera (removed form a WiiMote) would then be calibrated to the circles and display them on an LCD. Then, the user would “shoot” an IR dart (laser) at the whiteboard, which the WiiMote camera would have picked up and drawn the location on the LCD. However, the WiiMote IR camera was not reliable enough outside of it’s original controller. On top of that, we concluded the large LCD we were planning to use was fried after much testing. We worked on these getting these two hardware components to work by going to lab a lot of extra times overthree weeks to no avail. Thus, due to faulty hardware and being incredibly pressed for time, we decided to switch to this project, which our professor had initially suggested in class. In retrospect, we’re glad we made that decision, as we were able to come out with a complete, working product in a short span of time. The detailed schematics and code for the old project are described later.
One tradeoff we faced was during the design of our frequency measurer. We wondered how to calculate the frequency. One way of doing it was to use an Fast Fourier Transform algorithm as linked on the course website. However, we realized that the DFT/FFT would take up too much processing power and memory because of the look up tables. Besides, our frequency measurement only needs to measure the most prominent frequency, and the DFT/FFT would be doing unnecessary computation. Thus, we decided to take more of a hardware based approach, by digitizing the signal by passing it through an inverter, then using an interrupt to calculate the frequency.
Relationship to Standards:
There were no relevant IEEE, ISO, ANSI, or DIN standards related to this project.
Existing Patents, Copyrights, Trademarks:
There were no existing patents or trademarks associated with our project. We did utilize Bruce Land’s code for the implementation of the LCD and drivers, and his MATLAB code for converting .wav files from TextToSpeech to .h files.
The hardware design for the Handy Lab Buddy was rather simple. To program the Atmel ATMega644 Microcontroller, the STK500 development board was used. The Mega644 MCU was then put on the Custom PC Board, provided by the lab. Soldering components onto the PC Board had to be done with careful precision, as the pins were small and very compactly laid out.
For more detail: Talking voltmeter Using Atmega644
Leave a Comment
You must be logged in to post a comment.