拙网论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 144|回复: 0

Sound Card Data Logging With A PC

[复制链接]

949

主题

1001

帖子

3736

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3736
发表于 2018-7-30 09:25:58 | 显示全部楼层 |阅读模式
[size=1.3em]results from applying this technique to Neato's charger are now posted in the Neato Forum http://www.robotreviews.com/chat/viewtopic.php?p=121692#p121692

An inexpensive means of logging voltage or other data is provided by the analog sound card interface on PC's with free software, as an alternative to PC interfaced storage oscilloscopes, hardware data loggers, etc. While not too expensive in PC forms, I simply haven't much use for them besides some hobby things here, so examined what could be done at minimal cost. This experimental setup was configured for analyzing battery charger operation, and has yet to be applied. The technique may have other applications with appropriate hardware. The hardware here just reflects parts on hand and there can be many possibilities. The more common dual supply opamps found in Radio Shack, for example, might be used, but I'm just not familiar with them.

methodology

The method is to synthesize in the PC a constant audio signal such as an 8khz sine wave used here, a bit below maximum speaker output to reduce distortions. The standard 44khz sampling rate was used here though can be increased to 96K with higher output frequencies on some equipment. Most sound cards do not pass a DC input to the audio software, so an oscillating signal is modulated by the voltage to be logged and the returned wave amplitude serves as the measure of the logged voltage.

For this experiment a linear voltage controlled volume control was breadboarded solderlessly with opamps to isolate the input voltage range 16-18v near the end of battery charging on Neato robots equipped with 12 cell NiMh batteries, typically full in the 16-17v unloaded voltage range. The charger may go above 18v. This technique increases the resolution of the input wave graphics display in sound recording software. The 22K resistor in the output to the mic input was suggested in oscilloscope software for the sensitive input (see references at end).



[edit]To capture any voltage range with this circuit, divide the input measured down to 2v for the lowest voltage measured for input to the first opamp through its first resistor; the divider bottom should be only the 4.7K used not to disturb the higher resistances which follow to the op amp. The divided highest voltage must not exceed 3v (or 5v max supply this part# with other changes). The op amp resistor ratio is set so the reduced high end input drops to 2v at the negative or inverting input and to zero at the output. The input is then inverted onto the scale 0-2v which cuts off the second op amp output of the mic signal with a 2v subtracting input.

The exact requirements of Sound Cards audio input jack are not well documented. Fancier cards have separate Line-In and Mic-In jacks, while others have single jacks with software configuration taking both signals, some are stereo and some only mono. The different levels are described different ways but seem to be around 1v RMS for LIne and 10mv for Mic. Whether A/C signals or DC I haven't found. The circuit shown was found to work by experimentation. The driver for a RealTek mic input on my system never used before turned out to need updating with a peculiar bug terminating recording after a few seconds. Many user problems with mic inputs are reported on the web.
The RealTek mic input here was configured with "boost" zero and Level 40. Possibly more resolution in the recording display could be had with higher levels, but these seemed adequate to start with. Lot of variables in sound processing applications.

Open-source audio editing software Audacity can be used to record and display the data; this is a major open-source project with elaborate features for professional use and extensive instructions. http://audacity.sourceforge.net/

The output signal is synthesized here by a free simple signal generator program "audiogenerator" outputting only a sine wave: http://www.ringbell.co.uk/software/audio.htm
[edit]free Visual Analyzer oscilloscope program supplies a square wave generator better http://www.sillanumsoft.org/.
Most signal generator programs are more elaborate and not free. At the highest end are music synthesizer programs which can output multi-part orchestral instruments simultaneously, e.g. a full piano reproduction, for USB/MIDI interfaced electronic keyboards.

calibration

Applying battery voltages through a potentiometer for testing, measured on a multimeter, the wave input data received is shown in this extract from the Audacity screen display:



The frequency with which voltage changes can be observed is shown by the shorter time frame display of individual sine wave cycles (which won't look truly sine wave due to digital synthesis and input sampling):





The intended analysis of battery chargers is not complete, and whether this technique will be useful there is still unknown. Results will be posted in the Neato Robotics forum. The methodology is posted here for technical content and possible other interest to readers.

Related Software
oscilloscopes
Besides audio applications Sound Cards have been applied to reproduce standard oscilloscope displays. Some references are posted here http://www.robotreviews.com/chat/viewtopic.php?p=121402#p121402
The battery analysis appeared easier to perform with audio editing software than all the complications of scopes, and some of that software is not free.

Windows Sound Recorder
Another free recording program is included in Windows: Sound Recorder. This is a command line program, listed in various ways in old Windows versions, but accessed in Win7 through search for "soundrecorder", which can then be selected in the search results without command lines. An undocumented feature is saving full sampling .WAV files instead of default compressed .WMA. Search "soundrecorder /file <filename.wav>"
Records only a mono track and seemed to produce less amplitude when played back in Audacity than recording there directly.
One of Audacity's features is Voice Activated recording which would allow recording long input sessions skipping voltages below the threshold 16v configured in the hardware here.

VU Meter
A graphics gimmick program in open-source displays an output level VU-meter picture: http://sourceforge.net/projects/windowsvumeter/
though Audacity also has a meter. However, the audicity meters, separate for input and output, show input only when recording. Configuring the microphone in Windows to "listen" out to the speakers will show levels on the VU Meter. The configuration window has a small vertical bar graph meter as well, but the VU shows numbers.

Numerical Sample Data
Many programs convert Wav format binary sample files into text CSV files for analysis with spreadsheets etc.
One free I found "wmatocsv" http://www.008soft.com/wmatowav.exe (apology lost the descscription main page link). [error: this is wma to wav, not csv -- will see if can find the proper link]

[size=1em]Last edited by glnc222 on February 6th, 2014, 10:29 pm, edited 4 times in total.


glnc222Robot Master Posts: 4749Joined: January 23rd, 2012, 9:19 pmLocation: North Carolina, U.S.




Re: Sound Card Data Logging With A PC
[size=1em]by glnc222 » January 25th, 2014, 5:21 am
[size=1.3em]Square Wave Improvement
A square wave generator is included in free Visual Analyzer Oscilloscope http://www.sillanumsoft.org/
which may improve on the sine wave tried. An artifact can occur when too few samples are taken to always hit the peaks, while with the square wave virtually all samples will be at the peaks however slightly slanted the verticals come out -- spectral analysis disturbed by this does not apply here. Tested with Audacity sampling at 96khz and all samples are on the flats.
The charger logging with 8khz sine showed a 200hz ([edit] two per cent) variation which is probably an artifact of sampling the sine only half a dozen points at 44khz, not hitting the peaks. Sort of a moire pattern results as the bottom and top sample move around the curve. I will repeat the analysis and strongly expect there is no interruption to charging voltage as literature refers only to several seconds long pulsing not evident.


glnc222Robot Master Posts: 4749Joined: January 23rd, 2012, 9:19 pmLocation: North Carolina, U.S.




Re: Sound Card Data Logging With A PC
[size=1em]by glnc222 » April 28th, 2014, 11:42 pm
[size=1.3em]Inexpensive Data Logger
Saw this listing on ebay, might be more reasonable than high frequency storage oscilloscopes for developing stuff:
6 channel analog 1Khz sampling. One of those PIC microcontroller things. Appears to connect to a PC.
http://www.ebay.com/itm/iCP12-usbStick-Microchip-PIC18F2550-IO-Development-Board-/280916642088?pt=BI_Oscilloscopes&hash=item4167efc928
For higher frequency PWM (pulse width modulation) motor signals, there is a scale on multimeters for frequency and duty cycle -- why need a scope?

[edit]got one from the company site:
http://www.piccircuit.com/shop/pic-dev-board/119-icp12-usbstick-pic18f2550-io-board.html?PageSpeed=noscript
Works on an Intel 32-bit Windows 7 machine but not on an AMD 64-bit windows machine, with NVIDIA system board drivers; the latter are also a problem with Neato USB communication. Probably just a 64-bit windows thing here. There is a serial com driver in the logger software package, maybe that doesn't work on 64-bit. Certain products have separate versions for 64-bit, including Neato's updating driver.
[edit] company assures me it works in Windows 64 bit; might be that peculiar defect in old Nvidia system board drivers, not worth finding out. Doesn't apply to newer AMD systems.

[size=1em]Last edited by glnc222 on June 11th, 2014, 3:17 am, edited 2 times in total.


glnc222Robot Master Posts: 4749Joined: January 23rd, 2012, 9:19 pmLocation: North Carolina, U.S.




Re: Sound Card Data Logging With A PC
[size=1em]by mfortuna » April 29th, 2014, 7:35 am
[size=1.3em]One drawback I see is the 5V input limitation. You would probably want to build a voltage divider for up to say a 20V input or use a 10x scope probe. With either case you could lose resolution on the ADC.

[size=1.1em]Mike
Reds x 3, Dirt Dog, Disco (now a parts bot), Create, Scooba 350, and Security Dawg
Evolution Mint
Neato XV-11
Shark Ion 750



mfortunaRobot Master Posts: 5816Joined: February 5th, 2006, 10:35 amLocation: NH


Re: Sound Card Data Logging With A PC
[size=1em]by glnc222 » September 6th, 2014, 11:43 pm
[size=1.3em]Another source of inexpensive data loggers (besides their big stuff) is Dataq Instruments of Akron, Ohio, U.S., specialist in data acquisition instruments, not general purpose microcontrollers and such.
http://www.dataq.com/
There is free software listed.

[edit]For higher frequency stuff normally requiring a scope, a cheaper than usual PC scope is available, the Simplescope from Ukraine, on ebay. $30. 1.25meg sample rate.
There is also software available to use an Arduino for some displays, though a lot of discussion on debugging it.
Arduino's are under $10 from China and all the software is public domain online.





回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|抱朴守拙BBS

GMT+8, 2025-5-26 05:38 , Processed in 0.187319 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表