Reading data from my sabvoton controller

Electric Motors and Controllers
Post Reply
Manny
1 W
1 W
Posts: 63
Joined: Nov 23, 2011 7:14 am
Location: The Netherlands

Reading data from my sabvoton controller

Post by Manny » Aug 27, 2017 12:55 pm

for my Aprillia project https://endless-sphere.com/forums/viewt ... 12&t=83316 I want to read data from my sabvoton svmc96080 controller.

the usb connector on the sabvoton is not USB, luckily its just serial.

the original "programming cable" is a usb to serial converter with a usb connctor on the other end.

Image

the +5v and gnd are in the same place, the D+ is the controller Tx and the D- is the controller Rx.

the communication uses the modbus protocol @ 19200 baudrate.

the PC software sends a code to write a register twice(just to be sure i guess) to start the communication. without this when requesting data all the data will be zero.

after the start code the PC software requests the same data continuously.

the data requested is the info you see on the main screen of the PC software.
I know what most of the data represents, some is still unknown.

I made a simple and crude ardino sketch that reads the data and sends the battery voltage to the arduino serial terminal. this code needs work. it is not fault tolerant it doesn't check the CRC on the incoming data. For my project I need to combine this code and the stepper motor code, and I like to do battery state of charge tracking to display on the dial.

the .xlsx file is all i know at the moment.
Attachments
Protocol.xlsx
(11.58 KiB) Downloaded 46 times
test_comm.zip
simple test program
(1001 Bytes) Downloaded 45 times

User avatar
Dui, ni shuo de dui
1 W
1 W
Posts: 52
Joined: Jan 29, 2016 3:21 am

Re: Reading data from my sabvoton controller

Post by Dui, ni shuo de dui » Aug 27, 2017 9:01 pm

Absolutely awesome, a gillion thanks to you Manny!

I'm still not sure about how this protocol works exactly (I'm not really a programmer), but I'll try the code that you provided and see if I can extrapolate the other data. I would like to display the followings on my dashboard:
-Battery voltage (should be no problem since the code you posted is designed for that)
-Phase current, or Battery current, (I think that battery current may be easier to display)
-Controller temperature
So let me know if at some point you discover how to access these data :)

I would also love to be able to program on the fly, like having a button to enable/disable regen, lower or upper flux weakening, and battery max current.
No idea if this would be feasible though.

Again, thanks a lot, I bet this will interest many people here!

User avatar
Dui, ni shuo de dui
1 W
1 W
Posts: 52
Joined: Jan 29, 2016 3:21 am

Re: Reading data from my sabvoton controller

Post by Dui, ni shuo de dui » Aug 27, 2017 9:05 pm

How do you plan to initialize the steppers?
Steppers cannot memorize their position after shutdown, so will you have some kind of endstop to caibrate it at startup?

This part is really not a problem for me but I'm curious about how you plan to do it,

Manny
1 W
1 W
Posts: 63
Joined: Nov 23, 2011 7:14 am
Location: The Netherlands

Re: Reading data from my sabvoton controller

Post by Manny » Aug 28, 2017 1:44 pm

Dui, ni shuo de dui wrote: -Battery voltage (should be no problem since the code you posted is designed for that)
yes the battery voltage is in the example. i am wondering if the ratio between the data value an the real battery voltage is the same for all models of the sabvoton.
Dui, ni shuo de dui wrote: -Phase current, or Battery current, (I think that battery current may be easier to display)
phase current is easy if your not using the flux weakening. if your using that you need to do some calculation between the "Torque current fbk" and the "Weaken current fbk". there is no readout on the pc software for the battery current :( hopefully it is some were in the data. hard to test on the workbench.
Dui, ni shuo de dui wrote: -Controller temperature
the controller temp is one of the parameters i will check my controller.

the arduino programe uses two serial ports one to talk to the pc and one to talk to the controller. the controller connects to pin 10 and 11 (and GND, +5V is not conected).
Dui, ni shuo de dui wrote:How do you plan to initialize the steppers?
Steppers cannot memorize their position after shutdown, so will you have some kind of endstop to caibrate it at startup?
Exactly

User avatar
ElectricGod
100 kW
100 kW
Posts: 1352
Joined: Nov 01, 2015 5:24 pm

Re: Reading data from my sabvoton controller

Post by ElectricGod » Aug 31, 2017 2:24 pm

A small app that runs in windows would be cool or an APK and plug the USB cable into your phone.

dtm1087
10 µW
10 µW
Posts: 5
Joined: Feb 03, 2017 9:37 pm

Re: Reading data from my sabvoton controller

Post by dtm1087 » Sep 11, 2017 8:02 pm

This is great! I've been working on a display for my Ebike, and this is way cleaner than what I was going to do. Basically, my setup is an Arduino with a cheap $15 LCD display. The Arduino talks directly to the controller and displays information on the screen. The arduino & screen powered via a 12V -> 5V buck converter, which is in turn powered by a Main Battery -> 12V buck converter. I know running series buck converters isn't the best, but I needed 12V for my lights and I just hate wasting power using the onboard linear regulator. I got communication up and running yesterday, and everything works great while the bike is standing still.

The problem I'm trying to figure out now is as soon as I give it any throttle (actually, as long as the wheel is spinning), all the data from them controller is garbage. When the wheel stops spinning, everything returns to normal. After further investigation, every bit from the controller is a "1" when the wheel is spinning. That sounds a lot like a grounding problem, but I am sharing a ground between my display and the Sabvoton via the "USB" cable and the regulator that the display is running off of.

As a troubleshooting step, I put my bike on a stand and plugged my laptop in with the official Sabvoton app, and I did NOT see the same behavior. I got consistent data at all speeds. So there is definitely something wrong with my setup... If anyone has any ideas, I'm all ears!
Thanks,

dtm1087
10 µW
10 µW
Posts: 5
Joined: Feb 03, 2017 9:37 pm

Re: Reading data from my sabvoton controller

Post by dtm1087 » Sep 11, 2017 9:05 pm

As a follow up, all the bits are not "1". It looks like I just have a crazy amount of noise on my data line that's causing it to pick up errant bytes. I should be getting 57 bytes back, but instead I'm getting much more...

User avatar
Alan B
100 GW
100 GW
Posts: 7027
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: Reading data from my sabvoton controller

Post by Alan B » Sep 11, 2017 9:09 pm

Perhaps an optical isolator on the data path would clear it up, and perhaps some additional bypassing on the supplies.

dtm1087
10 µW
10 µW
Posts: 5
Joined: Feb 03, 2017 9:37 pm

Re: Reading data from my sabvoton controller

Post by dtm1087 » Sep 13, 2017 9:34 am

No luck with the bypass caps. Working on isolation now. Waiting on some parts to be delivered. I'm debating scrapping my arduino screen and just using a $50 Android Fire tablet. A simple BT adapter should provide all the isolation needed. I might try brushing up on my Android development while I'm waiting on the opto-isolators to ship. The downside is that you'd have to keep the tablet charged, whereas the arduino ran directly off the bike battery. I suppose I could just leave the switching regulators running all the time to keep the tablet topped off and ready to go.

dtm1087
10 µW
10 µW
Posts: 5
Joined: Feb 03, 2017 9:37 pm

Re: Reading data from my sabvoton controller

Post by dtm1087 » Sep 27, 2017 9:53 am

Thanks again Manny for starting this topic, and thanks Alan for the isolation advice. I got everything buttoned up yesterday, and it's working great! It's not very pretty right now (I still need to clean some stuff up), but it's perfectly functional. I ended up developing the dashboard in .Net. It's what I use everyday at work, and I'm way quicker doing things in .Net than I am in Android Studio. Right now, everything is running on an Intel PC stick, but it should be relatively easy to get it to run on a Raspberry Pi or similar SBC using Mono. If anyone is interested, I'll post the sources once I clean things up.

Any HDMI screen would work. I went with this one because it was already in a decent case:
https://www.amazon.com/gp/product/B01I1 ... UTF8&psc=1

So far, the screen displays:
* battery State of Charge - I'm just using a SOC estimation based on no-load voltage assuming 20S pack. This could be changed very easily to any pack configuration.
* Speed - There's a wheel size constant that needs to be changed for different wheel sizes.
* Motor and Controller Temperature - these are plotted on an area chart at the bottom of the screen. The window period is approximately 3 minutes
* Pack voltage & average cell voltage (Pack V / # series cells)

The battery SOC estimation will only update when the throttle is completely "off" to prevent the voltage sag under load from impacting the estimated SOC. This means that if you go wide open throttle non-stop, the battery SOC will never update, and it will report no change until you release the throttle. A future improvement would be to create a definable battery source resistance and account for voltage sag under load. This should be doable since the controller reports both battery current and battery voltage. This would allow SOC updates to happen at any load.

Has anyone else noticed the offset in the returned value for motor temperature? The value returned by the controller increases by about 5-10 degrees C when the wheel is spinning. I observed this behavior both in the official Sabvoton app and my application. I tried to correct for this offset in software, but it's not perfect.
IMG_20170926_172810.jpg
(214.04 KiB) Not downloaded yet
IMG_20170926_172758.jpg

Manny
1 W
1 W
Posts: 63
Joined: Nov 23, 2011 7:14 am
Location: The Netherlands

Re: Reading data from my sabvoton controller

Post by Manny » Nov 03, 2017 9:24 am

amazing, that looks cool

User avatar
sn0wchyld
1 MW
1 MW
Posts: 1723
Joined: Mar 18, 2011 8:27 pm
Location: South Aus.

Re: Reading data from my sabvoton controller

Post by sn0wchyld » Nov 09, 2017 4:33 pm

subbed, this looks damn useful

User avatar
alec
100 mW
100 mW
Posts: 44
Joined: Dec 01, 2017 5:57 pm
Location: Yosemite, Calif.

Re: Reading data from my sabvoton controller

Post by alec » Dec 07, 2017 5:36 pm

Great resource.

I'm currently researching a way to DIY a Bluetooth dongle for this.
"Black Widow" Greyborg [v.2] | Cromotor [v.3] | Greentime 1440 | 24s EIG cells 12kW peak (thread coming soon)
Project(s) in works: FatCON (& DIY Serial/USB to Bluetooth)

User avatar
alec
100 mW
100 mW
Posts: 44
Joined: Dec 01, 2017 5:57 pm
Location: Yosemite, Calif.

Re: Reading data from my sabvoton controller

Post by alec » Dec 07, 2017 5:51 pm

https://www.amazon.com/KEDSUM-Arduino-B ... ms?ie=UTF8

In theory, you should be able to run jumpers from the "USB" (aka serial) female output onto this board... Pretty convenient considering you even have 5V right there on the USB female!

Then setting the baudrate and profile via command line should let this act as a native passthrough.

What do you guys think? Will this work?
"Black Widow" Greyborg [v.2] | Cromotor [v.3] | Greentime 1440 | 24s EIG cells 12kW peak (thread coming soon)
Project(s) in works: FatCON (& DIY Serial/USB to Bluetooth)

User avatar
alec
100 mW
100 mW
Posts: 44
Joined: Dec 01, 2017 5:57 pm
Location: Yosemite, Calif.

Re: Reading data from my sabvoton controller

Post by alec » Dec 07, 2017 6:13 pm

Let's find out on Saturday.
Attachments
Screen Shot 2017-12-07 at 3.13.03 PM.png
Screen Shot 2017-12-07 at 3.13.03 PM.png (53.62 KiB) Viewed 115 times
"Black Widow" Greyborg [v.2] | Cromotor [v.3] | Greentime 1440 | 24s EIG cells 12kW peak (thread coming soon)
Project(s) in works: FatCON (& DIY Serial/USB to Bluetooth)

Manny
1 W
1 W
Posts: 63
Joined: Nov 23, 2011 7:14 am
Location: The Netherlands

Re: Reading data from my sabvoton controller

Post by Manny » Dec 08, 2017 4:08 am

if you set up the Bluetooth board to the correct baud rate is should be fine

Post Reply