You are here

Serial Control From PC

4 posts / 0 new
Last post
aguzel
Offline
Last seen: 3 years 7 months ago
Joined: 2020-08-21 01:14
Posts: 2
Serial Control From PC

Dear People, 

I would like to control a Brushless DC motor with VESC. As far as I understood, we can control the motor with different ways. 

I understood that we can control the motor via USB but I couldn't find a document that shows how we can control the motor via USB from PC. 

I have a project that has a bunch of code and the code itself has to communicate with VESC instantly. Is it possible to control the motor w/o opening the VESC Tool setup the motor. Also, can I change the motor limit parameters by using serial read/write instantly while motor is running via external serial comm code. 

 

Regards, 

 

TheFallen
Offline
Last seen: 9 months 4 weeks ago
VESC Original
Joined: 2017-09-11 11:46
Posts: 222

The motor can be controlled via USB, as it's USB Serial so should be fairly easy to interface to with most programming languages.

There isn't an official, updated, serial communications command list, I've been using this python library for my own projects: https://github.com/raess1/PyVESC-FW3.33
Otherwise you'll have to reverse engineer your own from: https://github.com/vedderb/bldc

The VESC tool simply sends serial commands/data to the VESC, you would be replacing it with your own program.

I believe you can chance settings while the motor is running but I have no experience with this as I was only trying to get diagnostics data out.

aguzel
Offline
Last seen: 3 years 7 months ago
Joined: 2020-08-21 01:14
Posts: 2

Thank you for your answer.I think I will both writing and reading data from VESC hardware by using my own program. I actually want to run with C#, so I need to deep dive in  https://github.com/vedderb/bldc

Regards, 

atlas

Jens
Offline
Last seen: 2 months 2 weeks ago
VESC Free
Joined: 2017-09-14 17:10
Posts: 3

Some time ago I made a PC-application in C++ (imitating the vesc tool), which can communicate with the Vesc.

https://github.com/JensOverby/user_vesc/tree/main/cmate_client/src

"Main" is in cmate_client.cpp, and this file is a bit of a mess. The other files I think are ok. You will have to reverse engineer a bit yourself.

I think I used the "COMM_CUSTOM_APP_DATA" command. However, I don't know if this command is intended for this kind of thing, or for something else. I had to hack my way through in the firmware part of the interface, to get the information all the way to my firmware-user-app.

The vesc doesn't seem to be built for this kind of thing, which I think is an absolute TODO. I'm sure there will be other pc-android-ios applications in the future for vesc, apart from android/ios-vesc-tool that needs to pass information through to potential firmware-user-apps

Also, I don't think that it is even possible to communicate from the new LISP-usercode with diy PC/android/ios-applications. With a little effort it should be possible for "someone" to figure out a non-hack-way of allowing it in the interface.

/Jens