VESC
VESC is an open source ESC (electric speed controller), it's named by its creator, Benjamin Vedder, Vedder's ESC.
VESC controllers have become very popular in the electric skateboard community and have proven to be very capable in driving larger robots.
Given that it is an open source platform, you will need to do a bit of work to configue them for your needs.
There are several quality guides including this one from Emmanuel Carillio.
More Information on this FB thread.
- First you'll need to get the VESC tool from the VESC Project.
- Connect the VESC to the motor, receiver, and batteries you want to use. Make sure the lights on the VESC are on then connect the VESC to the computer via a USB cable. Once the VESC Tool is open, click the Connect button.
- The first time you connect to a VESC it will ask for a firmware upgrade. Although things can sometimes work with old firmware, you should upgrad it if you can. The VESC Tool will already have selected the correct firmware for your device so there's no need to select any manually. The firmware upgrad can take a few minutes so be patient. After the firmware has been upgraded, disconnect the power and start over.
- Once the VESC is connected and the latest firmware version is uploaded, hit the 'Setup Motors FOC' button on the front page. This wizard will take you through the motor setup procedure step by step.
- Select the approximate motor size. Its better to undersize here than over size if you're not sure, as this is less likely to damage things, but its not super critical to get exactly right. For example 6374 sized motors are medium outrunners. For inrunners, scroll down. Hit next once the correct size is selected
- Next step is to select the number of battery cells. This sets up the low voltage cut off, so don't set it too high. You can leave it at the default of 3 cells if you want to effectively disable the low voltage cutoff.
- You can ignore the part that asks you to set up gear ratios and pulley diameters.
- Next, press 'Run Detection (no CAN)' (or 'Run Detection', it makes a minimal difference if you have no CAN bus set up). It will give you a warning saying it’s going to spin the motor. Once you accept it will make some alarming noises and the motor will move around a bunch.
- If all goes well a box will pop up informing you that it was successful and provide a load of motor parameters. If you're running sensors be sure to detect that they were detected correctly (This test was done with a sensorless motor). If they didn't detect, double-check your sensors are connected and functioning correctly. Hit Ok once you are ready. If the motor doesn't spin, and you skipped upgrading the firmware, go back and upgrad it.
- You are then given the option to test which way the motor is spinning and invert the direction if needed. This is also good chance to test that the motor spins as expected. Pressing either Fwd or Rev on your transmitter will spin the motor slowly in either direction. Hit 'Finish' once you are done.
- Press the 'Input Setup Wizard' on the main page and select load default config. Once thats done, the list above will appear. Assuming this is a 2wd robot with one motor a side, select 'Single VESC'. For 4wd or 2 motors per wheel, you can either use CAN bus, which is configured using the other two buttons, or you can set each VESC up seperately and just use the same servo output from the RX with a Y lead.
- Select PPM input for Servo signals. Turn on your transmitter and make sure the RX is connected. Select Duty Cycle mode, click refresh in the bottom right, then move the stick up and down fully. The bars on the bottom right should move with the stick. Once you've done that, let the stick rest in the center, and click Apply
- P{PM Configuration is where you set up how the VESC responds to inputs. For most robot applications you want to use “Duty Cycle” mode, which controls the motor speed with stick position. Next, you want to set 'Median Filter' and 'Safe Start' to 'False'. This allows the VESC to recover immediately after a fault without having to center the sticks. This is vital as a VESC will often flag an error after a current spike from a big spinner hit or similar, so turning these off means it immediately recovers automatically. You also have the option to adjust the ramping time, which is how fast it responds to your stick inputs. Generally, you don't want these to be zero as the controller may lose track of the motor while trying to keep up with the stick movements. 0.2 seconds generally works well for the drive, but larger values can be used for weapons to ensure a reliable spin-up.
Once these are set, hit 'Write Configuration to VESC' and then 'Next' and you are done! The motor should now spin when you move the stick.
- In most cases the default setup will be fine and no other settings need changing, but there are a few points worth knowing in case issues crop up. The motor current (which sets the max torque) will be set automatically by the detected parameters and is generally pretty accurate as to the max current the motor can happily handle. You can turn it up a bit but usually this leads to the motor overheating. The 'Absolute Maximum Current' setting is the current at which the controller will flag an error. DON'T TURN THIS DOWN unless you want your robot cutting out all the time.
The -ve motor and battery currents set your regen. Especially with weaponry, its best to turn the -battery current down to around -10A to stop it from charging the batteries to quick and damaging them. Don't set it too low as this can cause a bug where the motor doesn't stop spinning.
After any changes hit the 'Write Motor Config' button (M with a down arrow in the top right) in order to write the changes to the VESC.
A common issue is a motor cutting out after quickly throttling up. This is due to the current ramping too quickly and going over the Absolute Max Current limit. To fix this KP and KI can be adjusted. The settings for this are found under the FOC tab, though these apply whether using FOC or BLDC mode. Try increasing KP and KI by 10x, write the motor config and try again. If this improves things keep adjusting around until the motor gets up to full speed consistently without cutting out. There's probably a more scientific method to this, but trial and error is the easiest and has a low risk of damaging things.