Suggestions for OpenSource Electric Unicycle firmware

Support for creating custom user applications on the VESC.
yes_we_can_gogreen
Posts: 40
Joined: 13 Apr 2016, 10:27
Location: uk
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Suggestions for OpenSource Electric Unicycle firmware

Postby yes_we_can_gogreen » 13 Apr 2016, 10:36

Hi everyone.

I am working to develop an OpenSource firmware for the cheap generics Electric Unicycles (EUC) and the project page is here: https://github.com/generic-electric-uni ... ation/wiki

We are using the cheap available generics EUC, the chinese boards (STM32F103). Right now the firmware can control the motor speed (BLDC SVM), although not very well the control algorithm.
We can also read and control the max current (shunt resistor on the board for total current of the motor).
We can also read the IMU and we have the output angle with some filtering already.

I am learning a lot, like reading topics for motor control, etc. Right now the motor seems to lack torque on start which seems very important for me, as the wheel need to balance.
I would like to have your suggestions for the motor control firmware, etc. Do you think there is the need to have FOC for this application?

I will investigate if VESC could be used for this project.

Pixid
Posts: 5
Joined: 14 Apr 2016, 09:09
Location: Germany
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Suggestions for OpenSource Electric Unicycle firmware

Postby Pixid » 14 Apr 2016, 09:40

Hey I'm building an self balancing electric skateboard like the OneWheel ()
I connected a MPU-6050 to an arduino nano. Then the arduino is calculating from the angle of the board the right amount of current with an PID-controll loop for self balancing.
The arduino is connected with UART to my VESC.
I'm using FOC because it gives me the best startup torque.
I'm currently testing the board and fine tuning.

yes_we_can_gogreen
Posts: 40
Joined: 13 Apr 2016, 10:27
Location: uk
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Suggestions for OpenSource Electric Unicycle firmware

Postby yes_we_can_gogreen » 14 Apr 2016, 09:50

Pixid, thanks for sharing!!

Would be great if you share your code and some details on github so I could learn and maybe reuse.

When you say "right amount of current" you mean you are controlling the torque, using as input the angle? Are you trying to calc and control speed?

How many PID controllers do you have on your code? which are the inputs and the outputs?

Do you think this make sense??

(ANGLE) ---> (balance controller) ---> (speed controller) ---> (torque controller) ---> (MOTOR PWM)

ANGLE is the angle output from the IMU;
balance controller will output a speed value;
speed controller will output a PWM duty-cycle value (PI controller for now);
torque controller control the duty-cycle PWM value and the motor max current.

Whats inputs are you providing to VESC?

Someday I would like to try that skates :-)

Pixid
Posts: 5
Joined: 14 Apr 2016, 09:09
Location: Germany
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Suggestions for OpenSource Electric Unicycle firmware

Postby Pixid » 14 Apr 2016, 13:00


yes_we_can_gogreen
Posts: 40
Joined: 13 Apr 2016, 10:27
Location: uk
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Suggestions for OpenSource Electric Unicycle firmware

Postby yes_we_can_gogreen » 14 Apr 2016, 14:29

Thanks. Looking forward to read your code and information :-)

Pixid
Posts: 5
Joined: 14 Apr 2016, 09:09
Location: Germany
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Suggestions for OpenSource Electric Unicycle firmware

Postby Pixid » 17 Apr 2016, 19:06

Here is a short video about my OneWheel:

yes_we_can_gogreen
Posts: 40
Joined: 13 Apr 2016, 10:27
Location: uk
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Suggestions for OpenSource Electric Unicycle firmware

Postby yes_we_can_gogreen » 17 Apr 2016, 21:58


Pixid
Posts: 5
Joined: 14 Apr 2016, 09:09
Location: Germany
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Suggestions for OpenSource Electric Unicycle firmware

Postby Pixid » 21 Apr 2016, 15:11

So here is my Arduino Code for my OneWheel. It is by far not finished and some parts of the code was reused from other projects. I hope it will help some of you with your projects :)
https://github.com/Pixid-Design/VESC-OneWheel

yes_we_can_gogreen
Posts: 40
Joined: 13 Apr 2016, 10:27
Location: uk
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Suggestions for OpenSource Electric Unicycle firmware

Postby yes_we_can_gogreen » 24 Apr 2016, 15:39

Thanks!!

I found that I were using SVM to control the motor and it seems I can't quickly change direction with it. Instead I went back to use other way that original controllers use and now I am near - I am pretty sure that now is a question to tune PID:



http://forum.electricunicycle.org/topic ... ment-39809

Good luck with your project and thanks for sharing :-)

dpetrillo
Posts: 25
Joined: 24 Dec 2015, 01:47
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Suggestions for OpenSource Electric Unicycle firmware

Postby dpetrillo » 18 May 2016, 18:14

I've used the MPU6050 in a couple of projects before and I'm using it now with the VESC to add wheelie control to my ebike.

There are a few things I needed to do to get good operation out of the MPU6050. First is take advantage of the onboard MPU in order to use it to process all of the sensor fusion. I used the popular: https://github.com/jrowberg/i2cdevlib/t ... no/MPU6050

At the time (July 2015) there were still some holes in the tutorials that left me scratching my head.I think the solution was that I needed to include math.h in order to get atan2 to give the correct calculations on my hardware (atmel328.) After I got all of that working, I had extremely reliable and robust world acceleration values that I could use to calculate a gravity vector in one axis that would work correctly through 360 degrees. It's probably possible to make a simple balancing robot using raw data and a PID loop, but doing the extra work to use the onboard MPU and get robust readings will probably give you better performance.


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Return to “Custom Applications”

Who is online

Users browsing this forum: No registered users and 1 guest