Reading data from my sabvoton controller

Electric Motors and Controllers
salahsolar   1 µW

1 µW
Posts: 3
Joined: May 12 2018 7:10pm

Re: Reading data from my sabvoton controller

Post by salahsolar » May 17 2018 7:50am

I don't have a reverse wire, So I m sending from the arduino the HEX code that change motor direction as the PC software does, it works just fine and I can reverse the motor direction by a switch, but as I turn the controller off and restart it, the switch doesn't work anymore, as if there is no communication between the arduino and the controller.

any ideas ?

Manny   10 W

10 W
Posts: 81
Joined: Nov 23 2011 7:14am
Location: The Netherlands

Re: Reading data from my sabvoton controller

Post by Manny » May 18 2018 1:35am

i think the adruino needs to send the start code to the controller on startup.

and maybe you can add the reverse wire to the controller. I map out the wireing on my controller in this post:
viewtopic.php?f=30&t=56378&start=25#p1337210

hope this helps

dtm1087   10 µW

10 µW
Posts: 6
Joined: Feb 03 2017 9:37pm

Re: Reading data from my sabvoton controller

Post by dtm1087 » Apr 03 2019 10:53pm

I had a couple people message me for source code to the dashboard. Unfortunately, I lost it in an HDD crash.

I ended up getting rid of the "street legal" set up I had, and converting it to a bicycle. I wanted to make sure I would be able to comply with my local legal compliance of an "electric assist bicycle". So I needed to have a way to limit power to 750W, and limit top speed to 25 mph. I looked into the 3-speed switch on the controller, but I was unable to get it to work. Instead, I remembered being able to read data from the controller, and wanted to see if I could also write configuration data and program max current, and motor speed limit on the fly with an arduino. I believe I was successful, so I thought I would document it here in case anyone else is looking for something similar.

I started from the Arduino sketch in the OP. I just got it to a functional state. It could be MUCH cleaner, possibly using a Modbus library like this (https://playground.arduino.cc/Code/ModbusMaster/) instead of sending the raw bytes. However, for my application, it was fine.

I started by capturing the serial data by using an application called "Device Monitoring Studio" (https://www.hhdsoftware.com/device-monitoring-studio) in a 14 day trial period. From there, I was able to determine the following registers:
Motor Speed Limit: 0x0A4C
Rated DC Current: 0x09F7

The format for writing registers is similar to the format to the read data sketch in the OP.
Byte 1: 0x01 (address of controller)
Byte 2: 0x06 (write single register)
Bytes 3-4: Register Address
Bytes 5-6: Data
Bytes 7-8: CRC

For example, to set the motor speed limit to 100%, I wrote
01 06 0A 4C 00 64 4A 2E

The last two bytes are a kind of check to ensure data integrity. They can be obtained either by capturing the data, using an online CRC calculator, or generating them on the fly on the Arduino. I was super lazy, so I just used this online calculator: https://www.lammertbies.nl/comm/info/cr ... ation.html (Use CRC-17 (Modbus)) This calculator gives the bytes in reverse order. For example, it is says 0x4B37, byte 7 is 0x37, byte 8 is 0x4B.

With that, I was able to modify the original sketch to write the correct registers. Note: you need to run the enable_data function before the Sabvoton controller will allow you to write other registers.

I'll attach my sketch, but again, don't judge me too much! I used the switch from my rear brake lever to signal the Arduino when I want to switch modes. It requires 5 ON/OFF cycles within a few seconds, and then it will send the appropriate commands to the Sabvoton controller to switch modes. Works pretty well so far. I am powering the Arduino off of the 5V present on the Sabvoton controller USB connector, so I am using a low-power library to minimize current draw.
Attachments
Sabvoton_Legal_Switch_3.zip
(1.68 KiB) Downloaded 63 times

ashwin   1 µW

1 µW
Posts: 2
Joined: Dec 09 2015 7:12am

Re: Reading data from my sabvoton controller

Post by ashwin » Aug 09 2019 3:10pm

Manny wrote:
Aug 27 2017 12:55pm
for my Aprillia project viewtopic.php?f=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.
Hey Manny

How did you figure out what the start and data request codes were?

Thanks

Manny   10 W

10 W
Posts: 81
Joined: Nov 23 2011 7:14am
Location: The Netherlands

Re: Reading data from my sabvoton controller

Post by Manny » Aug 14 2019 2:06am

hi,

in the .xlsx file you can find the code:

start code: 01060FC73421EDFB hex

hope this helps you.

slothorpe   1 mW

1 mW
Posts: 14
Joined: Aug 02 2019 1:54pm

Re: Reading data from my sabvoton controller

Post by slothorpe » Aug 14 2019 11:45am

I now have a relatively mature arduino sketch with which you can read and write arbitrary registers, I have also implemented a command to "play through" multiple values ​​and a command to output entire register areas.

If anyone is interested, here it comes:
https://github.com/slothorpe/SabvotonCo ... erface.ino

A typical session looks like this:
https://github.com/slothorpe/SabvotonCo ... mdLine.png

And here's the list of registers I've identified so far:
https://github.com/slothorpe/SabvotonCo ... ister.xlsx

Maybe it helps someone ...
Last edited by slothorpe on Jan 21 2020 9:01am, edited 1 time in total.

Manny   10 W

10 W
Posts: 81
Joined: Nov 23 2011 7:14am
Location: The Netherlands

Re: Reading data from my sabvoton controller

Post by Manny » Aug 15 2019 2:52am

Cool

that looks good.

slothorpe   1 mW

1 mW
Posts: 14
Joined: Aug 02 2019 1:54pm

Re: Reading data from my sabvoton controller

Post by slothorpe » Aug 17 2019 12:51am

I will make some updates of the sketch, but the adress remains, so if you want to use it, look eventually for a new version.
maybe I put i on GitHub later.

Simonas0   10 µW

10 µW
Posts: 5
Joined: Nov 09 2019 12:36pm

Re: Reading data from my sabvoton controller

Post by Simonas0 » Dec 15 2019 3:28pm

Hi everyone,

does anyone know if the protocol on USB RX/TX is the same as on the Sabvoton's LCDs connector (that with 5 wires (+, ignition, -, RX, TX))?

I'm asking, because I bought Sabvoton without LCD wires (but with regular Sabvoton's LCD) and I wonder if I could "cheat" and hook it on USB wires.

flashtel   1 mW

1 mW
Posts: 19
Joined: Oct 04 2015 3:45am
Location: Perth, Western Australia

Re: Reading data from my sabvoton controller

Post by flashtel » Jan 01 2020 2:39pm

HI Guy's,

This is really awesome work.

Can I please please encourage you to use git hub, at the moment the links slothorpe has put up are not accessible.

I just used this guide to setup the two repositories I have shared in this post. I used git before, I found this guide just seemed to "click" for me.

https://www.atlassian.com/git/tutorials ... repository

I've forked a number of repositories for the "Smart BMS" interface. It looks like much of it is the same constructs as you are using for the read/write on the Sabvton controllers. The code "bres55" has written is the most "modular" format for building a universal interface that could be used for both controllers and BMS's.

I have designed a board / hat for the MegaPro with 4 opto isolated serial interfaces that uses low quiescent drain regulators to interface to 3 BMS. The board is powered separately from the main packs and this combined with the low drain regulators will ensure the packs don't over-discharge.

I just made a repo here for the boards eagle files.

https://github.com/flashtel/Mega_Opto
Screen Shot 2020-01-02 at 1.10.23 am.png
Screen Shot 2020-01-02 at 1.10.23 am.png (117.62 KiB) Viewed 1335 times
After I found this thread I've added a 4th for my Sabvaton to use with the code you have created.. In addition I have include interface port for the wiegand based protocol to connect to an RFID reader.
Screen Shot 2020-01-02 at 2.56.42 am.png
Screen Shot 2020-01-02 at 2.56.42 am.png (415.1 KiB) Viewed 1335 times
This is my modified version of the "bress55" code, I've changed the "MySerial" definition to a reference that can be switched in the software routine between the various opto coupled serial interfaces.

https://github.com/flashtel/Smart-BMS-a ... 5851cc4816


My initial intention was to have an 125khz RFID ring, that would be used to "Arm" the bike after checking each of the 3 Battery Packs for charge state and bringing them online. If I can incorporate the code you have developed, I can extend that to "Arming" into a specific controller configuration.
Screen Shot 2020-01-02 at 2.57.19 am.png
Screen Shot 2020-01-02 at 2.57.19 am.png (312.76 KiB) Viewed 1335 times
ie 2 RFID key's one for "Offroad / Monster" mode and another for "OnRoad /Legal Compliant Mode".

In the Mega_Opto library I've added an I2C interface for a 0802 LCD with 3 buttons. I don't like having "large" displays on the bike. It is as small and discrete as I could make it.

I have ordered 5 boards and I have Pick n Place machine here it, takes me literally 5 minutes to make additional boards once I have the setup, all the components are low cost.

If you want one PM me.

This is what I am going to power the "Managment Board / Mega_Opto" with.

Thanks Paul
Screen Shot 2020-01-02 at 3.35.04 am.png
Screen Shot 2020-01-02 at 3.35.04 am.png (279 KiB) Viewed 1335 times

slothorpe   1 mW

1 mW
Posts: 14
Joined: Aug 02 2019 1:54pm

Re: Reading data from my sabvoton controller

Post by slothorpe » Jan 21 2020 4:13am

Ok, good point, moved my sketch to GitHub: https://github.com/slothorpe/SabvotonCo ... eInterface

slothorpe   1 mW

1 mW
Posts: 14
Joined: Aug 02 2019 1:54pm

Re: Reading data from my sabvoton controller

Post by slothorpe » Mar 08 2020 2:46am

Btw. something else:

I am currently developing a more intelligent control for the speedometer for my scooter, which will include the Sabvoton data (e.g. current, status, temperatures) and at the same time set the parameters depending on the speed level. The whole thing is based on an Arduino Mega, which then communicates with the Sabvoton via Modbus and simultaneously evaluates the other data of the scooter.

It then occupies the "USB" port of the Sabvoton, which, as you know, is only a simple serial interface with TTL level, so you can no longer use the original Bluetooth stick.

So I had the idea to include a Bluetooth adapter ... I analyzed the original Bluetooth stick a bit more closely ... and was really surprised:
This is not a simple Bluetooth serial converter, but a microcontroller that even speaks the Modbus protocol in the direction of Sabvonton, the APP only calls up the data ...

My solution now is, that I have integrated a stupid HM-05 Bluetooth - serial converter, so that I can not configure the controller with the mobile app but at least with the PC program via Bluetooth ...

The next step is that I will build my own speedometer with an intelligent TFT display (Nexion), unfortunately I am not the hero when it comes to graphic design ...

Bartosh   100 W

100 W
Posts: 126
Joined: May 10 2017 3:32pm

Re: Reading data from my sabvoton controller

Post by Bartosh » Mar 08 2020 4:53am

slothorpe wrote:
Mar 08 2020 2:46am
My solution now is, that I have integrated a stupid HM-05 Bluetooth - serial converter, so that I can not configure the controller with the mobile app but at least with the PC program via Bluetooth ...
If you don't want to implement your own Modbus RTU wrapper, you can also try to use the old SVMC app for Android (buggy as hell BTW). If you manage to make it work on your phone, there's plenty options to play with, but not all. Sabvoton used to include this kind of (regular) BT module in the past, right now they switched to BLE micro and developed a new app.

You can PM me if you need help with the old apk, I may have a modded version somewhere on hdd.

slothorpe   1 mW

1 mW
Posts: 14
Joined: Aug 02 2019 1:54pm

Re: Reading data from my sabvoton controller

Post by slothorpe » Mar 08 2020 3:47pm

Cool, sent you a PM

slothorpe   1 mW

1 mW
Posts: 14
Joined: Aug 02 2019 1:54pm

Re: Reading data from my sabvoton controller

Post by slothorpe » Mar 10 2020 4:12am

Manny wrote:
Aug 28 2017 1:44pm
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.
Any idea how to calculate the actual phase current out of „Torque current fbk“ ? Can‘t really see, what this parameter means, it goes between something - and + while running.

Post Reply