I have a LC100-A Inductance/Capacitor meter: https://www.mpja.com/download/33374te%20users%20manual.pdf
that serially transmits the measurements that is also sent to the attached display. I am trying to read the value from the meter with a Mega2560. There is no information regarding the serial interface on the LC100 in its manual, and I have not been able to find any info beyond that.
I run the following sketch that results in the meter value being displayed in the Serial Monitor one character at a time (in reverse order, but I can figure out how to fix that), but the problem is that it catches a number of random characters and spaces before and after (see attached image of Serial Monitor display).
#include <SPI.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial3.begin(57600);
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial3.available()) {
char inByte = Serial3.read();
Serial.println(inByte);
}
}
Attached is pic of Serial Monitor. The data I am needing is the 17107.
I tried the sketches from the “Serial Input Basics” both receiving with end markers and receiving with start and end markers, neither works.
Those 'random' characters are likely non-printable framing characters such as STX and ETX. Try printing the values as hex or binary and let's have a look a what they really are.
I printed to Serial monitor as Serial.println(inByte,BIN); and Serial.println(inByte,HEX); and just got BIN and HEX equivalents to ASCII.
I did analyze a pattern while printing to Serial Monitor in char (see attached pic of Serial Monitor screen shot). The “0000017126” is the data I am looking for (the measurement from the Capacitor meter is displaying 171.26 pF. There is apparently leading zeros that are not displayed on the unit.
Then there is all of the ransom characters before and after. As I scroll the Serial Monitor this pattern repeats every approximately 95-105 characters (not exactly consistent).
I see the manual and I see several schematics of the meter, but I only see a USB connection to the outside world. How are you connecting the meter to the Arduino?
To Paul,
I have soldered into the Tx and GND labeled through holes (J5) on the LC100-A connecting Tx to RX3 (pin 15) on Mega and GND to GND. See attachment pic.
Paul, That is my problem, I do not find any reference to this J5 serial interface on the LC100-A but I know that it is functional for two reasons:
By reading one character at a time (see sketch above) I eventually get the correct values from the LC100-A that is being displayed on the meter. But I get a lot of other characters around it that I cannot sync.
In December of 2017 a forum post discussed this same issue (Topic: getting a value from pin Rx and use it in the program). The poster stated he eventually got the data he needed (just in reverse order). I am using the same sketch he posted and also get the correct data (in reverse) but, again, with random characters also.
Thank you
Roger
Sorry,
Here is code that generated previous attachment of Serial Monitor. (I do not see how to copy/paste; I highlight lines of output and it pastes only first line)