top of page
Search

Sound Card ADCs For Electrocardiograms



This system is useful as a way to detect a transmitting phone at close range, however due to the limited bandwidth of a computer soundcard, it is in no way capable of actually decoding the transmissions. As far as other experiments go, why not use your soundcard to detect lightning?




Sound Card ADCs For Electrocardiograms



I like inspecting the output of this circuit using my computer sound card. Probing the output pin on an oscilloscope reveals a beautiful ECG signal, but not everybody has an oscilloscope. I've seen some project webpages out there which encourage people to use the ADC of a microcontroller (usually an Arduino) to perform continuous measurements of voltage and transmit them over the USART pins, which then get transferred to a PC via a USB-to-serial USART adapter (often built around a FTDI FT-232 breakout board or similar), only to get graphed using Java software. That sequence certainly works, and if you already have an Arduino, know its sketch language, and are happy writing software in Processing, that's a great solution for you! However I found the sound card option convenient because everyone has one, and with a click-to-run computer program you can visualize your ECG right away. Note that I added a potentiometer to drop the voltage of the ECG output to make it more suitable for my microphone jack. Ideally you'll find a resistance that uses a lot of your sound card's dynamic range without clipping.


The SoundCardECG project on GitHub is a click-to-run Windows program I wrote to display and analyze ECG signals coming into the computer sound card. The screenshot above shows my heart rate as I watched a promotional video for a documentary about free-climbing. You can see where my heart-rate elevated for a couple minutes in the middle as I watched a guy free-climb a cliff a thousand feet in the air without safety gear. This software is written in C# and fully open source. It certainly works, but has many avenues for improvement (such as enhanced QRS detection). Interactive graphing is provided by the ScottPlot library.


I built this AD8232 breakout board into a nice enclosure to make it easier to experiment with it in the future. The circuity isn't anything special: a linear voltage regulator with capacitive decoupling on the input and output, and an op-amp serving as a unity gain amplifier to buffer the output accessible through a SMA connector, and a current-limited output attached to a female 1/8" audio for easy connection to my computer sound card.


Using a sound card as a scope is not a new idea. After all, a sound card is nothing more than an ADC with a sampling rate of about 100,000 samples per second or 100 kS/s, with typically 16-bit resolution.


Even before you connect a sound card to the external world, you can explore the scope features using the built-in sound card in your computer, with its built-in microphone as input and speakers as output.


Your sound card is taking data at a fixed rate; usually about 96 kS/sec and with a fixed full-scale voltage range at 16-bit resolution. It is fixed. The vertical and horizontal controls of the scope are just changing the display of these measurements.


The limitations of using a sound card scope are due to the performance of your sound card. There is a limit to the lowest frequency and highest frequency that can be measured and to the highest voltage and lowest voltage.


To reduce this risk, I strongly recommend when you want to connect an external signal from one of your projects, do not use your internal sound card. Instead, purchase a low cost external USB sound card.


For example, the Sabrent ( -MMSA/usb-external-stereo-3d-sound-adapter-black/#description) low cost ($8) USB sound card has an internal 16-bit ADC that can sample up to 196 kS/sec, but has a limited input frequency range from about 100 Hz to 20 kHz. The Waveforms software tool can drive this USB sound card.


To connect the real world to a sound card, I used a common audio stereo cable plugged into the sound card and a microphone socket. I purchased 10 of these sockets for $11 on Amazon. I wired three solid core hookup jumpers to the PCB (printed circuit board) mount socket. This end is shown in Figure 5.


To test the input measurement range of the Sabrent USB sound card, I created a sine wave signal source using my Discovery 2 Scope with built-in function generator. The amplitude was constant from DC to 10 MHz. I measured this sine wave signal with the Sabrent sound card using the Waveforms interface. Figure 6 is an example of the measured sine wave set for 1 kHz.


I measured the sine wave amplitude displayed from the sound card at different frequencies. Figure 7 shows the ratio of the measured sine wave amplitude at different frequencies, normalized to the amplitude that got through the passband region.


The transient response of the sound card scope to a square wave will be pulses on each edge with a 1.8 msec decay time. This is exactly what I measured. Figure 8 shows the 100 Hz square wave input to the ADC and the resulting measured voltage by the sound card. The 4V peak-to-peak edge comes through, with the DC level dropping off with a time constant consistent with 1.8 msec.


What this behavior illustrates is the limitations of any sound card scope. Because of the poor low frequency response, we can only see the edges of signals. This makes it not very useful to look at slowly varying analog signals, but well suited to measure audio signals above 100 Hz or the pattern of digital signals such as the outputs of digital pins on an Arduino.


However, this low a value for the maximum input range the ADC can measure is a significant limitation. Applying a larger input voltage above 0.3V would saturate the ADC, and more importantly, run the risk of damaging it. To measure 5V signals that I might find on an Arduino, I need to add an attenuating interface circuit between the voltage to measure and the input to the sound card microphone channel.


The maximum tip voltage I can apply is 0.3V. I need to add a voltage divider to the front of the sound card to drop the tip voltage from 5V to lower than 0.3V. This is a voltage divider of 0.3V out with 5V in, or a ratio of (at most) 0.3V/5V = 0.06. I can build this with a simple resistor voltage divider. I selected resistor values of 10K ohms and 330 ohms. Their voltage divider ratio is 330/10,330 = 0.03, which is below our requirement of 0.06. These values are commonly found in many kits. The exact values are not critical, as long as the voltage divider ratio is below 0.06. It would make the input impedance to the sound card 10K ohms, which is a reasonable value to not load down a circuit.


Due to the high pass filter built into the ADC, the sound card scope will mostly see the edges of digital signals. This makes it ideal to see the frequency and duty cycle of signals, such as from pulse width modulated (PWM) signals.


I wrote a simple Arduino sketch to drive a 50/255 = 19.6% duty cycle PWM signal on pin 10 using digitalWrite(10,50). Figure 11 shows the signal at the pin, as measured by the Analog Discovery Scope hardware and the signal measured by the sound card scope.


If the potentials we want to measure are mostly changes/modulations in voltages, we can also use the analog-to-digital converter from the sound card. Although that means we cannot measure static voltages, but only fast changes changes, frequencies above 1hz. The sound card is a very fast and precise ADC (single if mono, or double for stereo), sampling at 44khz or up to 96khz and 24 bit resolution.


When I revised the review of the ESI U24 XL USB sound card, I noticed some potential issues and started to think about improvement of the sound card. I decided to collect my ideas in this article instead of the review to avoid cluttering the review too much. Swapping components inside audio equipment is not too uncommon. This is mostly done during restoration of old equipment because some components like electrolytic capacitors have a limited life expectancy. Swapping operational amplifiers is also pretty common and the rationale behind is to improve audio performance. This may or may not work well. I haven't modified any equipment previously and found this to be an interesting project.


The analog output is connected right to the DAC pins 26 and 27. It is sad to see that ESI did not follow Wolfson's recommendation to implement a low pass filter ahead of the op-amp (see figure 44 of the data sheet). A low pass filter would have cost a few cents and there is still plenty of PCB real estate to implement such a filter. Well, Wolfson recommends a low pass filter for HiFi applications. Maybe ESI did not target HiFi during design of the sound card.


During reverse engineering, I became familiar with the PCB design of the sound card a bit. There is some segregation of the ground between analog and digital, which is not a bad idea. But this segregation does not seem to be well engineered since a lot of signals cross the segregation anywhere, but at the ground merge point. This is a common problem with ground segregation: It is either not well thought out, or not implemented properly on the PCB - or both.


For now, the conclusion is that there is a lot of potential for improvement. When I started the investigation, I thought about upgrading components like op-amps. The longer I investigated the sound card, the more I realized that the design is not worth any upgrade, but needs to be fixed because it is broken by design. The power supply is terrible and therefore, the supply voltages are noisy and any improvement would be a huge advantage. Improving the analog output seems far more rewarding than doing anything with the analog input. Here is a ranking of which improvements I see as most rewarding: 2ff7e9595c


1 view0 comments

Recent Posts

See All

Incredibox 2 Mod Apk

Incredibox 2 Mod Apk: uma experiência musical divertida e interativa Você ama música? Você quer criar sua própria música com uma equipe...

Comments


bottom of page