YR1035+ enabling serial port to read data

Oleksii

Member
Joined
Mar 18, 2020
Messages
116
Hi all !
Owners of YR1035+ could see in Menu an entry "6. RS232" and probably wondered why is this for?
yr-settings.jpg
I figured it out !
(let me note that right here that Add: must be 00, otherwise data will be missing. And Baud can be changed, but it will not be saved when you turn device off/on)

If open it you will see this PCB:
pcb.jpg

There is once place where some chip supposed to be soldered, but it's missing:
chip-location.jpg

If look on PCB traces you will see that 2 bottom go to USB D+ and D- (using 2nd PCB layer).
And 2 traces on left go to a main square chip. If touch one (which I marked by black as T) by oscilloscope, you will see some data transmitted each half a second.

I figured out that missing chip is well known CP2102, which is serial -> usb converter, when you connect it to PC and have virtual COM port appearing.

Here is more close look:
pcb-chip-key-pin.jpg
I marked KEY by red where chip KEY pin should be.

Here are pin names from datasheet:
chip-pins.png

Where to take the chip itself?
You can by a cheap converter (there are tons of such in market) and unsolder it, here an example:
chip-source.jpg

On mine were not any marks on top (actually almost not visible white dot was), so it was hard to understand where is key pin after you unsolder it.
But bottom is such kind of mark on square corner:
chip-bck-side-key-pin.jpg

Solder it manually (it was really hard as the ship is not for manual soldering):
chip-soldered.jpg
and it appeared as serial port and I could read serial data !!! Wooohooo !

You can spot that I also soldered a small capacitor C11 on the PCB, which kind of needed according to typical schematic (C2 on it) and should be 0.1mF
chip-schema.png
That's all what I did.

Read data time!
Connect t USB and see a virtual com port!

I'm many years Linux user so here is my way how I did it. Example output data when I removed/inserted a 18650 cell a few times:

prepare port (some Linux magic) and see prints:
# tio -b 9600 /dev/ttyUSB0
read it then in more nice view:
# cat < /dev/ttyUSB0 | strings
022.5mR 3.5065Vxw
022.5mR 3.5065Vxw
022.5mR 3.5065Vxw
022.5mR 3.5065Vxw
022.6mR 3.5065Vw3
022.5mR 3.5065Vxw
022.5mR 3.5064Vy
022.5mR 3.5065Vxw
022.5mR 3.5065Vxw
022.5mR 3.5065Vxw
022.5mR 3.5065Vxw
022.5mR 3.5065Vxw
022.5mR 3.5065Vxw
01.47mR 3.5065V
OL mR 3.5966V
OL R 3.4558V
OL R 3.3377V
07.35 R 3.3377V5
OL R 3.0777V
OL R 2.9724V8
OL R 2.8733VV
OL R 2.7767V
OL R 2.5944V
OL R 2.5944V
OL R 2.5136Vx
OL R 2.3494V
OL R 2.2725V
OL R 2.1950Vh
OL R 2.1277V
OL R 2.0530V
OL R 1.9908V
00.00 R 1.9215V}
0.000 R 3.5065V
002.0mR 3.5065Vjy
020.9mR 3.5065V@e
021.5mR 3.5065V}
021.7mR 3.5065Vv
021.8mR 3.5065VF
022.5mR 3.5065Vxw
022.5mR 3.5064Vy
022.5mR 3.5065Vxw
022.6mR 3.5065Vw3
024.9mR 3.5065VN
OL R 3.5543V
OL R 3.4703V
OL R 3.4962VE
OL R 3.0845V
OL R 3.0845V
OL R 2.9823V9
OL R 2.8851V
OL R 2.6958V
OL R 2.6075V|q
OL R 2.5174V8
OL R 2.4388V1f
OL R 2.3573V
OL R 2.2769V
OL R 2.1300V{d
OL R 2.0641V
133.6 R 2.0641VX
00.00 R 1.9953V=
0.000 R 3.5065V
002.0mR 3.5065Vjy
020.6mR 3.5065Vpq
021.2mR 3.5065Vg
021.6mR 3.5064Vs`
021.7mR 3.5065Vv
021.9mR 3.5065VB

You can see some garbage at the end of each line. It's there indeed, some not ASCII bytes which I don't take care of. They should be some checksum, I guess.
Attaching also raw capture of the data, if someone needs it, find it in attachments.

I have to say that there no any software for it to read the data. I also tried read data using software for another IR meter - RC3563, but it cold not parse it correctly, so data formats are different.

Based on my success support of YR1035+ was added to Mega Cell Monitor and you can use it there.
 

Attachments

  • YR1035+.zip
    382 bytes · Views: 401
Last edited:
  • Like
Reactions: cak
@Oleksii

So yea I played around with my YR1035+ and did the CP2102 update,
1640317999809.png
and I got serial data....... yes.
1640318855817.png
So now what am I going to do with it?
I can see all that on the YR1035+ screen and now I have it on my PC. so what?
Never leaving an opportunity to learn something new I got out the python book so to speak and started to play with the output string.
This is what an amature came up with after a couple of days scratching my head and losing some more hairs.
Nicely parsed output ready for machine reading and importing into excel with xwings.
1640319107135.png
Here's the code. Please feel free to snicker, laugh, tear it apart or fix it. but it works and for someone who has never coded till a few years ago I feel pretty good.

Wolf


Python:
import serial.tools.list_ports
import time
ports =serial.tools.list_ports.comports()
yr1035 = serial.Serial()

portList =[]

for onePort in ports:
    portList.append(str(onePort))
    print(str(onePort))

val = input("select Port: COM")

for x in range(0,len(portList)):
    if portList[x].startswith("COM" + str(val)):
        portVar = "COM" + str(val)
        print(portList[x])
  
yr1035.baudrate = 9600
yr1035.port = portVar
yr1035.open()

while True:
        if yr1035.in_waiting > 0:
            yr1035_data = str(yr1035.readline(18))
            #print(yr1035_data)
            values_r = yr1035_data
            values_r = values_r.lstrip("b")
            values_r = values_r.strip("'")
            values_r = values_r.strip("\\x02")
            #sep_r = 'm'
            #values_r = values_r.split(sep_r, -1)[0]
            sep_r1 = 'R'
            values_r = values_r.split(sep_r1, -1)[0]
            values_v = yr1035_data
            values_v = values_v.lstrip("b")
            values_v = values_v.strip("'")
            values_v = values_v.strip("\\x02")
            sep_v = 'R'
            values_v = values_v.split(sep_v, 2)[1]
            sep_v1 = 'V'
            values_v = values_v.split(sep_v1, 1)[0]
          
            #print(values_r)
            #print(values_v)
            print(f"RESISTANCE:{values_r}Ω")
            print(f"VOLTAGE:{values_v}V")
        
      
            time.sleep(1)
 
Last edited:
Any 3.3V USB-TTL converter could be used.
 

Attachments

  • USB.jpg
    USB.jpg
    121.5 KB · Views: 176
Your python code gives:
Traceback (most recent call last):
File "D:\Down\YR1035+\reader.py", line 40, in <module>
values_v = values_v.split(sep_v, 2)[1]
IndexError: list index out of range

after about 10 acquisitions
 
IndexError: list index out of range

after about 10 acquisitions
Hm @Kabron not sure what you mean by that.
I just ran it for 80 cycles and no issues.
I am by no means a professional coder so if you can fix it please be my guest.
Maybe it works on the CP2102 better?
¯\_(ツ)_/¯

Wolf


C:\RC3563>python yr1035.py
COM3 - Silicon Labs CP210x USB to UART Bridge (COM3)
select Port: COM3
COM3 - Silicon Labs CP210x USB to UART Bridge (COM3)
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8141V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8141V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8141V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.2mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
RESISTANCE:70.3mΩ
VOLTAGE: 3.8142V
 
Here is my output
COM137 - USB Serial Port (COM137)
RESISTANCE: OL Ω
VOLTAGE: .00064V
RESISTANCE:^x\x02 OL Ω
VOLTAGE: .00058V
RESISTANCE:8f^x\x02 OL Ω
VOLTAGE: .00065V
RESISTANCE:V{\xcex\x02 OL Ω
VOLTAGE: .0005V
RESISTANCE:V\x89\xfex\x02 OL Ω
VOLTAGE: .V
RESISTANCE:63Vxnx\x02 OL Ω
VOLTAGE: .V
RESISTANCE:50V\x88\x9ex\x02 OL Ω
VOLTAGE: .V
RESISTANCE:57V\x8a\xaex\x02 OL Ω
VOLTAGE: .V
RESISTANCE:52V\x89\xfex\x02 OL Ω
VOLTAGE: V
RESISTANCE:.00057V\x8a\xaex\x02 OL Ω
VOLTAGE:V
Traceback (most recent call last):
File "D:\Down\YR1035+\reader.py", line 40, in <module>
values_v = values_v.split(sep_v, 2)[1]
IndexError: list index out of range
And this is COM sniffer output
78 02 20 20 4f 4c 20 20 52 20 2e 30 30 30 36 34 56 7a 5e x. OL R .00064Vz^
78 02 20 20 4f 4c 20 20 52 20 2e 30 30 30 35 38 56 8f 5e x. OL R .00058V.^
78 02 20 20 4f 4c 20 20 52 20 2e 30 30 30 36 35 56 7b ce x. OL R .00065V{.
78 02 20 20 4f 4c 20 20 52 20 2e 30 30 30 35 32 56 89 fe x. OL R .00052V..
78 02 20 20 4f 4c 20 20 52 20 2e 30 30 30 36 33 56 78 6e x. OL R .00063Vxn
78 02 20 20 4f 4c 20 20 52 20 2e 30 30 30 35 30 56 88 9e x. OL R .00050V..
78 02 20 20 4f 4c 20 20 52 20 2e 30 30 30 35 37 56 8a ae x. OL R .00057V..
78 02 20 20 4f 4c 20 20 52 20 2e 30 30 30 35 32 56 89 fe x. OL R .00052V..
78 02 20 20 4f 4c 20 20 52 20 2e 30 30 30 35 37 56 8a ae x. OL R .00057V..
78 02 20 20 4f 4c 20 20 52 20 2e 30 30 30 35 36 56 8b 3e x. OL R .00056V.>
78 02 20 20 4f 4c 20 20 x. OL
Obviously your and my data out are different. Maybe new FW version/ Mine is 2.211
 
yr1035_data = str(yr1035.readline(19))
this corrects the problem
 
Apropo,
did you observe such screen?
It appeared with beep after several minutes of serial communication and start to send the following data:
78 02 2d 2d 2d 2d 2d 20 52 20 2d 2d 2d 2d 2d 2d 56 da ef x.----- R ------V..
78 02 2d 2d 2d 2d 2d 20 52 20 2d 2d 2d 2d 2d 2d 56 da ef x.----- R ------V..
78 02 2d 2d 2d 2d 2d 20 52 20 2d 2d 2d 2d 2d 2d 56 da ef x.----- R ------V..
 

Attachments

  • VOhm.jpg
    VOhm.jpg
    69.5 KB · Views: 36
Obviously your and my data out are different. Maybe new FW version/ Mine is 2.211
Yes I concur. Could definitely be either the firmware or the CP2102.
By enabling line 26 #print(yr1035_data) I get a result of b'\x0200.06mR 7.8701V\x ***' or whatever suffix it likes. could be x92k or in this case xa2.
Hence all the lstrip and strip functions to clean the data up.
1658114421408.png1658114498929.png1658114738124.png
If I add your suggestion and change from 18 to 19 I start getting odd results.
yr1035_data = str(yr1035.readline(19))
So in conclusion It works for me with the CP2102 and may not work for all TTL chips
( some code manipulation may be required)
Apropo,
did you observe such screen?
I do after some time it will go to "Sleep" when there is no reading. Albeit I get the same visualization on the serial monitor.
Wolf

1658115112236.png1658115243633.png
 
Hi,

UPDATE 2022-10-30 dump-yr.sh was updated to have a dynamic ttyUSB name

For those that do not have enough room to install python (For example the serial console terminates on a small openwrt device), there is another way to get the info.. using strings command. Basically ssh to the openwrt device (where serial console to yr1035+ is located) in a manner like this:

Code:
host$ cat dump-yr1035.pl
#!/usr/bin/perl

open my $cmd,"ssh -l root openwrt_device_ip -t exec ./dump-yr|" or die "popen";

while(<$cmd>) {
   chomp;
   $time = time;
   print "$time $_\n";
}

Then on the openwrt device we need to create this (make sure you install stty to set /dev/ttyUSB0):

root@mt3020_openwrt:~# cat dump-yr
Code:
#!/bin/sh

dev=/dev/$(ls /sys/bus/usb-serial/drivers/pl2303/|grep ttyUSB)
bauds=9600

stty -F $dev $bauds ignbrk -icrnl -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke 
exec strings $dev

root@mt3020_openwrt:~#

Result:
host$ ./dump-yr1035.pl
root@openwrt_device_ip's password:
1666441340 OL mR .00485V
1666441340 OL mR .00478V
1666441341 OL mR-.00567V(
1666441341 OL mR-.00572VzEx
1666441341 OL mR-.00546V
1666441342 OL mR .00444VI
1666441342 OL mR .00441VJ
1666441343 OL mR-.00546V
1666441343 OL mR-.00538V=$x
1666441343 OL mR-.00524Vi
1666441344 OL mR .00413V[


@Oleksii Kudos for figuring out the console ports.In my case I did not connected tx from USB adaptor.. only RX. Still I have all 3 wires going into the device because that makes harder to pull those out :)
 

Attachments

  • yr1035-ser-con.png
    yr1035-ser-con.png
    1.9 MB · Views: 35
Last edited:
I have added a 3.5mm Jack to the back of the unit, this way it's still portable.. I was playing around with C# (with a 3.3V USB-Serial) but I didn't get any good readings, then I connected it to a Wemos....
 

Attachments

  • IMG_3507.jpg
    IMG_3507.jpg
    260.4 KB · Views: 80
  • IMG_3506.jpg
    IMG_3506.jpg
    982.1 KB · Views: 79
  • IMG_3529.jpg
    IMG_3529.jpg
    1 MB · Views: 81
Yes, exactly. It was just to show that it's working - I was thinking about making a client on the pc and send the data via wifi or to send data to google sheets... or a SD card connected to the Wemos...
 
In my case I use yr1035+ to measure a shunt and test Amps capacity.
I am thinking to use a RPI Pico to measure volts as well , and Pico gets the reading from yr1035+ over serial.
Or any other microC , I was thinking PICO because is available,cheap, and is having micropython.
Then you can aggregate the data and see Amps , WattHours, graphs etc,
 
Good idea, the Pico also run at 3,3V like the Wemos / ESP boards. I just started with the Wemos because of the C language...
 
Back
Top