Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
This simple meter macro reads an analog input pin from an Arduino USB device and displays the reading directly in volts. Hitting any key exits the macro.
The K=5.0 / 1023 line assumes that the power supply is exactly 5.0 volts, but you can calibrate the unit for greater accuracy if you can measure the 5 V supply with a separate meter that you trust; just replace the 5.0 with that reading.
Optionally, you can set the Arduino analog reads to use a more-sensitive range of 1.1 volts full scale, by removing the semicolon from the start of this line:
;Port=$(hF0) + "b" + $(h03) ;Uncomment for 1.1V range
Note, however, that calibrating the 1.1 V range is not so easy, since the Arduino doesn't have a handy terminal where you can read the actual 1.1 V value. Also, the more-sensitive range may pick up more noise.
;<Help=H492D Posn#0="Ardu" ;Scan for Arduino Posn#1=0 ;First match @_ComDev_Scan ;Scan COM devices for match ;Port=$(hF0) + "b" + $(h03) ;Uncomment for 1.1V range UP=hA0 ;Use Analog pin A0 K=5.0 / 1023 ;Factor, 0-1023 count to volts UK=0 WHILE.UK=0 ;Wait for any key to exit UK=Key?! ;Get key, if any IF.UK=>0 ;Any key hit? LoopBreak=2 ;Exit WHILE if so ENDIF. Port#D1=UP ;Request analog input UA=Port?2 ;analogRead input pin UP V=UA * K ;Convert to volts Mtr0=V + " V" ;Display volts WEND. ;Back for next pass Mtr0= ;Close meter ;Port=$(hF0) + "b" + $(h01) ;Restore 5V range Port#O=0 ;Close COM port
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2023 by Interstellar Research
All rights reserved