Jump to content

Firmware


jayjay23

Recommended Posts

Happy that we achieved the same performance as the original firmware (pretty sure the Kunteng developers also implemented that very low resolution FOC) -- here the tests the other developer did -- I have some more ideas to try improve the results :-)

The new controller arrived today. I've done some measurements on the test bench with the original firmware. The effiency is worse at higher mechanical loads in comparison to the 12 FET Lishui (FOC sensorless)...
With your SVM_4 (8bit) algorithm we seem to do quite the same as the original firmware :-)


Image
 

Link to comment
Share on other sites

On 9/11/2017 at 8:00 PM, Tomek said:

as said ealirer, I applaud @electric_vehicle_lovers dedication to cheap controllers... but aren't these controllers history anyways? we all want to ride Gotways, Kingosongs, Inmotions and Rockwheels that go well beyond 30kmph... I think custom hardware is inevitable for any serious project. Also, I've been reading on VESC forums that VESC doesn't do as good a job on slow speeds as hoverboard controllers, so that makes me doubt if VESC in itself is an answer. @lizardmech, did you have any more progress on your VESC/instaspin experiments?

PS

at 345euro the official VESC 6 from trampa is too expensive for me for just toying around, but as soon as clones start appearing, I'll get two to hack a hoverboard and play around with self-balancing algorithms. My plan is to leave VESC software untouched and have a separate arduino with an IMU/gyro and a PID loop.

The VESC seemed ok with hall sensors for startup. Not sure if an audiuno would complicate matters you probably need to make minor adjustments to the VESC itself for balancing vehicles, just sending it current commands via uart may not be enough. The only real downside with the VESC is it's overly complex for an EUC, it doesn't boot instantly. Either an instaspin or cut down VESC fork without the RTOS would probably be better for most users. Most of the code needed for everything exists, I can never just figure out how to combine it all.

Hobbyking sells cheap VESC 4 clones now, for driving a hoverboard motor there's not much need for expensive versions. https://hobbyking.com/en_us/turnigy-skateboard-esc.html

Ti have cheap kits as well you can combine these two to make an instaspin controller that can run hoverboard motors.

https://mouser.com/ProductDetail/Texas-Instruments/LAUNCHXL-F28069M/

https://mouser.com/ProductDetail/Texas-Instruments/BOOSTXL-DRV8305EVM/

You could connect a stm32f407 dev board to the ti motor driver board and use it with VESC firmware as well.

Link to comment
Share on other sites

  • 2 weeks later...

@lizardmech what do you think of the increasing voltage of the latest wheels ? 84V, maybe 100V. They seem great (I myself bought a Mten3 but not daring faster than 30km/h for now) and you need less current... Is VESC able to do it or is it a "custom" choice as @Tomek mentioned ?

Have you guys seen thi  s ? http://www.austinglider.com   

Link to comment
Share on other sites

On 9/30/2017 at 8:32 AM, jbwheel said:

@lizardmech what do you think of the increasing voltage of the latest wheels ? 84V, maybe 100V. They seem great (I myself bought a Mten3 but not daring faster than 30km/h for now) and you need less current... Is VESC able to do it or is it a "custom" choice as @Tomek mentioned ?

Have you guys seen thi  s ? http://www.austinglider.com   

Depends on the reason for the voltage increase. If the motor remains the same increasing the voltage will give it a higher maximum RPM. If the motor has different windings for the higher voltage you can have the same original performance with lower currents which can be useful for unicycles where they're limited by wire thickness due to the axle.

On the original VESC hardware one of the main components has a maximum voltage of 60V, it can't really safely handle more than 55V. Solving that limitation requires a complete redesign as I did.

the austinglider looks interesting there's no technical information though, with the amount of vapor ware around balancing vehicles I'm always skeptical until they show proper details.

  • Like 1
  • Upvote 1
Link to comment
Share on other sites

1 hour ago, lizardmech said:

Depends on the reason for the voltage increase. If the motor remains the same increasing the voltage will give it a higher maximum RPM. If the motor has different windings for the higher voltage you can have the same original performance with lower currents

My guess is that the motor is different  as well. But the main point seems to be an increased max speed, but there is also an increased power. As a consequence, the use of fans also seems mandatory... 

Then limited voltage for VESC is not a good point.

Link to comment
Share on other sites

  • 2 weeks later...

Just recorded some minutes ago -- the video shows the motor running using my lab power supply (that can handles max of 10A). Firmware was limiting the motor max current to be about 8A. Motor max speed is 45km/h when the wheel is on the air.

This controller family supports from 0.25kW  to max of 4.3KW (72V, 60A), which should be ok to implement vehicles like hoverboards up to motorcycles running at 100km/h!!

Current motor interface implement the following methods, that can be used to control the motor and get his running speed value. This was tailored for EBike application but if anyone want to build a different thing like an EUC, we can help developing the firmware for that specific needs of the motor control.

/***************************************************************************************/
// Motor interface
void hall_sensor_init (void); // must be called before using the motor
void motor_init (void); // must be called before using the motor
void motor_set_mode_coast (void); // disable PWM output
void motor_set_mode_run (void); // enable PWM output
void motor_set_pwm_duty_cycle_target (uint8_t value);
void motor_set_current_max (uint8_t value); // steps of 0.5A each step
void motor_set_regen_current_max (uint8_t value); // steps of 0.5A each step
void motor_set_pwm_duty_cycle_ramp_inverse_step (uint8_t value); // each step = 64us
uint16_t motor_get_motor_speed_erps (void);
/***************************************************************************************/
 

Another project developer implemented support the LCD and mobile app:

 

Edited by electric_vehicle_lover
  • Upvote 2
Link to comment
Share on other sites

Yesterday, I did the very first ride on one EBike, with OUR OpenSource firmware -- and I was happy because my son was the first to see and try :-)

 

And 3 days ago, XenonJohn just post a video where it shows how he is building an EUC using Arduino + a brushless motor controller:

 

  • Upvote 3
Link to comment
Share on other sites

nice progress @electric_vehicle_lover! also, cool link to XenonJohn. All his stuff is documented and shared, but a bit of a mess scattered around the internets (he seems to only use off-the-shelve BLDC controllers in all his projects, but has a lot of know how on balancing and mechanics), @lizardmech here's (one version of) his balancing code: http://www.instructables.com/id/Arduino-Self-Balance-Controller-using-DIGITAL-IMU-/, looks like a pretty straight forward PID, and seems to work well enough...

Link to comment
Share on other sites

  • 2 weeks later...

So I tested the FOC of this dirty cheap motor controller:
https://opensourceebikefirmware.bitbucket.io/Various--Endless-sphere.com_forum_messages--2017.10.23_-_FOC_and_no_FOC_comparison.html

2017.10.23 - FOC and no FOC comparison

The next information is about the results of using “very low resolution FOC”.

On the tests I run the motor with or without “very low resolution FOC”. The motor was providing the same mechanical output, was running at the same speed 16km/h and with the same load (on a bike training roller).

With “very low resolution FOC
As we can see, the phase B current is aligned with the all sensor signal, meaning the Id current is zero and IQ current is max.
The phase B amplitude is 0.94V that represents a current of 5.8A.
images/91-1.png

Without “very low resolution FOC
For the motor to be able to run at the same speed 16km/h as on the first test, the PWM duty_cycle / energy had to be increased.
The phase B current is not aligned with the all sensor signal (and this misalignment varies with motor load and speed), meaning the Id current is not zero and IQ current is not the max possible.
The phase B amplitude is 1.2V that represents a current of 7.4A.
images/91-2.png

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Our OpenSource firmware is now running on some EBikes :-)

Today I tested the ebrake regen, this is my first direct drive motor that I am running at 1200W (48V 25A) and run at max speed of 42km/h at 48V. This motor could work for an EUC but it needs a large EBike rim :-)

Electric brake is so fast and powerful on an EBike!! I just implemented ebrake/regeneration on our OpenSource firmware for EBikes -- on the video, the wheel was rotating at 42km/h and the motor was also doing electronic braking: very strong and fast!! -- not mechanical braking were used. Our OpenSource firmware works for EBikes motor controllers from 0.25KW up to 4.3KW and can run motorcycles up to 120km/h.

 

 

  • Upvote 2
Link to comment
Share on other sites

  • 2 months later...

Last month, January 2018, I started to work professionally, for a greener environment <3

I joined BFO Mobility, a German company that develops high technology for electric bicycles, like ABS brakes!! They also develop products for electrified micromobility as the Flynn scooter -- this scooter don't have a throttle and user needs to kick for the motor to run, it is like electric unicycles, without throttle but using sensors like IMUs to feel the user <3 <3
Both Ebike ABS system and the scooter are using IMUs and a lot of math :-)

Screenshot_from_2018-02-07_17-18-28.png

 

 

Link to comment
Share on other sites

Are the EUC riders inverted pendulums??

I was looking to some videos about balance and I found a lot of examples, of classes, showing inverting pendulum and how to get the motion equations. Seems inverted pendulum is a typical challenge for students and so we get a lot of videos about it -- here is one that seems relevant to get the equations that may be applied to our firmware:

 

 

Edited by electric_vehicle_lover
  • Upvote 1
Link to comment
Share on other sites

The EUCs are definitely using inverted pendulum, I think the IPS brand name is even a reference to that. There's plenty of code examples that can easily be used, the problem as always is no one with programming experience is willing to work on open EUC firmware. I think once a very basic one is created it would be very easy for people to iterate on it and add features but with 3 years worth of posts and not a single person willing to write any EUC related code the thread just goes in circles.

Link to comment
Share on other sites

I would like to try develop balance code but for fun, as I don't plan to ride EUCs. I like the math challenge, I need to learn more and more because is important for me professionally.

After 3 years, I learned a lot and assembled a notes file/site with a lot of technical documentation: https://eggelectricunicycle.bitbucket.io as no one ever did, so I am really happy.

  • Like 1
Link to comment
Share on other sites

Just get these + a mpu 6050 breakout board. Less than $100 and all you would have to do is get the mpu 6050 working via i2c then write balancing code. Probably not quite strong enough to ride an EUC properly but it would take little effort to get it working enough to kickstart a viable open EUC project. All the motor code is provided, I tried all the off the shelf motor control options, the Ti instaspin one is the most powerful still, the STmicro and NXP are a little more user friendly but lacking in documentation, less open and generally less advanced, the Ti MCUs are just much better at motor control overall as it was designed for motor control rather than being general purpose MCUs.

https://mouser.com/ProductDetail/Texas-Instruments/BOOSTXL-DRV8305EVM

https://mouser.com/ProductDetail/Texas-Instruments/LAUNCHXL-F28069M

Link to comment
Share on other sites

@electric_vehicle_lover, I just got hub-motor wheels from an old "hoverboard" and two of these bike controllers: https://www.aliexpress.com/item/36V-48V-350W-Brushless-Motor-Controller-For-Electric-Vehicle-Scooter-with-without-Hall-Sensor-NEW-Arrival/32808013830.html?spm=a2g0s.9042311.0.0.Foqcxb for a DIY project, and thought about playing with making my own self-balancing code on an external arduino along the way... only to find out that these, and almost all other, e-bike controllers sold on aliexpress don't include the reverse function anymore (they did before)! any chance your software is compatible with those boards (I'll anyways open it up tomorrow to check what's inside, but perhaps you'd know already)? if yes, how much time do you expect setting up the whole toolchain (on a mac) would take for a relative noob to be able to start playing with it?

Link to comment
Share on other sites

38 minutes ago, Tomek said:

@electric_vehicle_lover, I just got hub-motor wheels from an old "hoverboard" and two of these bike controllers: https://www.aliexpress.com/item/36V-48V-350W-Brushless-Motor-Controller-For-Electric-Vehicle-Scooter-with-without-Hall-Sensor-NEW-Arrival/32808013830.html?spm=a2g0s.9042311.0.0.Foqcxb for a DIY project, and thought about playing with making my own self-balancing code on an external arduino along the way... only to find out that these, and almost all other, e-bike controllers sold on aliexpress don't include the reverse function anymore (they did before)! any chance your software is compatible with those boards (I'll anyways open it up tomorrow to check what's inside, but perhaps you'd know already)? if yes, how much time do you expect setting up the whole toolchain (on a mac) would take for a relative noob to be able to start playing with it?

You would be the first one!! :-)
XenonJohn is doing that but using a commercial and expensive motor controller.

I think would be great if someone do what you are thinking, I want to do it also but I first I want to read and understand the math and also find free time :-) -- If you do it, in full or part, as long as you share information, everyone will win.
I would like to help but I am very limited of time -- at least I think I can try share and discuss tecnhical information.

So, about using a cheap EBike motor controller for running the motor on both directions:
- the firmware I did for this STM8 EBike motor controllers, follow the same PWM code I did for EUC firmware on STM32F103
- the STM8 EBike motor controller firmware currently don't support invert direction as it was never developed as there is no need for ebike application but I think I can do it relatively fast and include simple UART commands to make the motor rotate on both directions
- as for STM8 flashing firmware, I am using Linux and another developers using Windows, you would need to try for yourself and ask help on the forum
- see here which cheap controllers are supported and where to buy them: https://opensourceebikefirmware.bitbucket.io/

- as for Arduino, I would go with Bluepill Arduino as it is very cheap and uses just the same STM32F103 ARM used on EUCs boards: http://wiki.stm32duino.com/index.php?title=Blue_Pill -- get it on Ebay
- you can also get on Ebay, very cheap, the MPU6050 Arduino module, so you would be using the same hardware as EUCs and the same firmware I did developed would work

Edited by electric_vehicle_lover
Link to comment
Share on other sites

@Tomek

Trying to hack an arduino and existing controllers together is a dead end, the motor control software provided by MCU manufacturers is far easier to use. I know the Ti F28069 even has a dual motor FOC example running off the one MCU, I can't recall if the STM one has a dual motor version, NXP one doesnt. All you have to write for any of them is the code to talk to the IMU via i2c and connect your balance code to the provided torque controller.  

Here's a guy running 2 segways motors off the one f28069m

 

Link to comment
Share on other sites

11 hours ago, electric_vehicle_lover said:

Seems that MicroWorks is back online again and has listed the MicroWorks 30B4 board: http://microworks.en.alibaba.com/product/60430498308-801473537/self_balancing_scooter_sourcing_codes_programming_board.html

500 units minimum order though. Looks like they aren't making them unless someone orders a large batch.

Link to comment
Share on other sites

On 2/14/2018 at 2:08 PM, electric_vehicle_lover said:

- the firmware I did for this STM8 EBike motor controllers, follow the same PWM code I did for EUC firmware on STM32F103

I just took the controller I have apart and figured it's a no-name chinese chip (signed D7 1336KM4 18), so not much hope for reusing the controllers I already have.

For my current DIY project I think I'll get those controllers instead https://www.aliexpress.com/item/High-Quality-GREENTIME-15-Mosfets-48-84V-1500W-Dual-mode-Sensor-Sensorless-Brushless-DC-Motor-Controller/32218294528.html. They have reverse function, and should be able to run most EUC motors if I want to reuse them for something bigger, and I should be able to use them without (re)programming anything. @lizardmech for this project I don't have the $$ or time to go for TI instaspin, or VESC (VESC6 would be my choice of tech to explore). The main functionality will be anyways manual control (joystick connected via an external Arduino), but I'd like to play with self-balancing just for the fun of it. @electric_vehicle_lover, thanks for the tips, I have tons of Arduinos lying around, so I'll use what I have. When I'll have more time, I'll definitely buy one of the compatible KT controllers and try your firmware, but for this project I'll take a shortcut and just use the existing pre-programmed software.

Edited by Tomek
Link to comment
Share on other sites

5 minutes ago, Tomek said:

For my current DIY project I think I'll get those controllers instead https://www.aliexpress.com/item/High-Quality-GREENTIME-15-Mosfets-48-84V-1500W-Dual-mode-Sensor-Sensorless-Brushless-DC-Motor-Controller/32218294528.html. They have reverse function, and should be able to run most EUC motors if I want to reuse them for something bigger

I understand, you can see as you go, I like to do that also :-)

One note: as you can see on next video, XenonJohn, needs to configure motor and regen speeds. In the case you discover you can't do with that controllers, you then can try our OpenSource firmware where you can control regen current and motor speed/acceleration.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...