¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: #Differential_Voltmeter #differential_voltmeter


 

Mike M.??? KU4QO

That fake screen clear just scrolls the last line entered on the screen off the top
of the display.? This gives the impression that there is only one constantly
updating data being presented for view.? I found that many lines scrolling upward
across the screen was distracting.?

If using a dumb terminal program that understands all the escape codes it would
be possible to use those to control screen display.? That is not the case with the
Arduino IDE built-in dumb terminal screen.? It is beyond dumb.

This differential voltmeter was built because the Arduino is ground-referenced
which makes it difficult to use a single ADC input to measure drop across a resistor
where both ends of said resistor are above ground.? It also works great with
a pair of RF detector probes to measure gain or loss across a stage in your circuits.

There are many ways to change the code so it shows DB, Log-values, and so on.

Arv? K7HKL
_._


On Mon, Sep 17, 2018 at 11:27 AM Michael Maiorana <zfreak@...> wrote:
Arv,
Thanks for posting.

Can you explain the reason for this line in your code?

Serial.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); // fake screen clear

I'm wondering if it had anything to do with having issues with re-printing data on the same line in a terminal. I wrote something in the Arduino environment that displayed data every second, and using the Arduino serial monitor it properly kept things on the same line, but no matter what I tried using a regular terminal emulator (like putty) I couldn't get the same result.

Thanks
Mike M.
KU4QO

On Mon, Sep 17, 2018 at 12:16 PM, Arv Evans <arvid.evans@...> wrote:
This Arduino based voltmeter is handy for use on the workbench.? It can be built
as a zero-to-5V version, or as a zero-to-50V version.? This is free code, feel free to
modify it to suit your own needs.

----------- Start code -------------
/*
?* Differential Voltmeter
?*
?* by:? Arv? K7HKL
?*????? 16 September 2018
?*?????
?* Measures ADC-0 as A volts and ADC-1 as B volts.? Then computes difference and
?* shows A and B measurements, and A-B difference.
?* Output to both 2X16 LCD and to attached ttl/USB dumb terminal is non-blocking It will
?* work with or without the dumb terminal connected.
?* Arduino can be a Pro-Mini to avoid possible 20 MHz interference from USB-TTL circuit.
?*
?This sketch was adapted from LCD sketch "Hello World!"

? The circuit:
?* LCD VSS pin-1 to ground? [Ground for LCD]
?* LCD VCC pin-2 to 5V????? [5V for LCD]
?* LCD RS pin to digital pin 2? [Register Select]
?* LCD EN pin to digital pin 3? [ENable]
?* LCD D4 pin to digital pin 4? [Data-4]
?* LCD D5 pin to digital pin 5? [Data-5]
?* LCD D6 pin to digital pin 6? [Data-6]
?* LCD D7 pin to digital pin 7? [Data-7]
?* LCD R/W pin-4 to ground
?* LCD VC pin-3 to ground?? // on newer backlighted LCD the Conterast pot is not needed.
?* LCD LED+ pin-15 to +5V?? // Backlight, use 220 to 1K in series for brightness limiting
?* LCD LED- pin-16 to ground [ Ground for Backlight]

?Library originally added 18 Apr 2008
?by David A. Mellis
?library modified 5 Jul 2009
?by Limor Fried ()
?example added 9 Jul 2009
?by Tom Igoe
?modified 22 Nov 2010
?by Tom Igoe
?modified 7 Nov 2016
?by Arturo Guadalupi
?-----------------------------------------------------------------
??? Libraries are wonderful...everybody modifies them and doesn't
??? tell anybody what the changes are.?
?-----------------------------------------------------------------
?This example code is in the public domain.

?

*/

// include the library code:
#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 2, en = 3, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

float a;??? // ADC-0 input (0-1023)
float b;??? // ADC-1 input (0-1023)
float A;??? // a * (5/1023) Volts
float B;??? // b * (5/1023) Volts
float dif;? // dif = A-B

void setup() {
? // set up the LCD's number of columns and rows:
? lcd.begin(16, 2);
? // Print a message to the LCD.
? lcd.println("Differential");
? lcd.print(" Voltmeter");
? delay(2000);? // 2 second delay
? Serial.begin(115200); // serial port baud rate
? Serial.println("Differential Voltmeter");
? Serial.println("A????????? B??????? A-B");
}

void loop() {
? // set the cursor to column 0, line 1
? // (note: LCD line 1 is the second row, since counting begins with 0):
? lcd.setCursor(0, 1);
? a = analogRead(0);
? a = analogRead(1);? // read ADC-0 twice to normalize sampling capacitor
? A = a * (5 / 1023.0);?? // converts ADC-0 out to volts
??????????????? delay(3000);
? b = analogRead(1);
? b = analogRead(1);? // read ADC-1 twice to normalize sampling capacitor
? B = b * (5/1023.0);?? // converts ADC-1 out to volts
? // A = A * 10;? B = B * 10;? // Use this line for zero-50V version
? dif = A - B;
? lcd.print("A= "); lcd.print(A);
? lcd.print("?? B="); lcd.println(B);
? lcd.print("dif=");
? if (A > B) {
??? lcd.println("A>B");
? }
? else? {
??? lcd.println("B>A");
? }
? dif = A - B;
? Serial.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); // fake screen clear
? Serial.println("? A??????? B???????? A-B");
? Serial.print(A); Serial.print("????? ");
? Serial.print(B); Serial.print("????? ");
? Serial.println(dif);
}

/*? USER MANUAL
?*?? Use Arduino Nano or Arduino Pro-Mini.? Connect 1602 style LCD as shown in code.
?*??
?*?? Voltmeter range is zero-to-5V.? For zero-to-50 volt range add 100K and 10K
?*?? divider resistors on ADC-0 and ADC-1 inputs, and uncomment line 87.
?*?? "? // A = A * 10;? B = B * 10;? // Use this line for zero-50V version"
?*??
?*?? Set PC dumb terminal baud rate to 115200, or change line 71 to match your dumb
?*?? terminal rate.
?*??
?*/
---------- end code ----------

Arv? K7HKL
_._


Join [email protected] to automatically receive all group messages.