Smart EBike: Dashboard + Motor controller + Battery BMS

The Stig said:
Ok who's gonna sell me an open source controller:p
Hello.

Thank you for your interest. How much money would pay for this Smart Controller?

About selling this controller, there are a few options:

1 - I can negotiate with Adafruits Indutries (USA company with huge sucess selling OpenSource products) and get a fee for each sell, they can produce and sell on their online shop for the wider client community they have.

2 - My own company may in future produce and sell (I would need to propose to my business partners).
 
I got a propose from a teacher of electronic department, from the local university, to get his students working on this project :)

Will be 3 teams of students working on project basis and I will be on of the jury for final avaliation.

This are great news for the project development :)
 
casainho said:
The Stig said:
Ok who's gonna sell me an open source controller:p

Thank you for your interest. How much money would pay for this Smart Controller?

Thats a good question!

Sorry I haven't had time to read the thread yet but...

Depending on it being comparable to lyens controllers in terms of most features: I might do $100 on a 72V+ 20A controller. or 48V 25A.
$170 for a 72V+ 50A controller.
Ease and versatility of programming will be a big thing.

What would the rest of you pay...?
 
The Stig said:
casainho said:
The Stig said:
Ok who's gonna sell me an open source controller:p

Thank you for your interest. How much money would pay for this Smart Controller?
Thats a good question!

Sorry I haven't had time to read the thread yet but...

Depending on it being comparable to lyens controllers in terms of most features: I might do $100 on a 72V+ 20A controller. or 48V 25A.
$170 for a 72V+ 50A controller.
Ease and versatility of programming will be a big thing.

What would the rest of you pay...?
Ok thank you. I must say I am not a commercial and I didn't any market research (but I have some connections to repair workshops of EBikes/EScooters and EBicycles). To say the true, I do not depend of this project to get the food on the table BUT I believe it must be useful, have value to users and be commercial project to have success.
 
I got the current control working but unfortunately seems that PWM channel 3 don't do the current control (it worked before, it may be damage now), only channel 1 and 2. I bought already 2 new STM32 boards.

Current control circuit (using DAC, TIM1_ETR and Opamp LM258):
file.php


Wireless sensor network
The cheap way to connect this controller to SmartPhones is using Bluetooth and it is already planned.

After discussing some ideas, seems important to have a display on EBike and not a SmartPhone. EBikes already have a display/board computer and the idea is to put a new one and connected to Smart EBike Controller. Also would be good to have a connection to battery pack BMS (BMS may also be Smart and send each cell voltage, batteries temperature and current to display).

I am thinking to add a cheap $1.5 NRF24L01 2.4GHz Transceiver Module to the controller, so it can connect to the Smart Ebike Display and Smart EBike BMS.

So, Smart EBike would have 3 systems:

- Smart EBike Display
- Smart EBike Controller
- Smart EBike BMS

The display would be the master and other the slaves. The display would show to user the controller variables like speed and current and BMS variables like battery voltage, cells voltage and temperature.

The display will be a cheap $35 STM32 Development Board w/ 2.8" TFT LCD Touch Screen:
file.php



Current status of prototype 3

In progress
- Assembly the controller board on a metal case (fix the mosfets to metal case for heat dissipation) and test on a real bicycle.

Missing
- UART Bluetooth module wiring and firmware.
- Android application with Bluetooth communication.

Done
- the 4 ADC signals (voltage, current, throttle, mosfets temperature) measured automatically (without CPU intervention) and with DMA.
- the PWM signal is working, with the duty cycle setup by the ADC throttle signal.
- Hall Sensors are working using the STM32F100 specific hardware for this.
- the 6 steps commutation works (motor runs as expected).
- Cruise Control (after 5 seconds with throttle at the same position, I can let it go to zero AND the PWM duty cycle keeps constant until I move/increase again the throttle or hit the brakes).
- Brakes are working (including resetting the Cruise Control) using the STM32F100 specific hardware for this.
- Current control works (using DAC, TIM1_ETR and Opamp LM258). Thanks to NJay for explaining me with great detail how this should work.
 

Attachments

  • current_control.png
    current_control.png
    4.6 KB · Views: 1,822
  • f4f22f6a-9312-47e2-9883-06ecb20cb29a.jpg
    f4f22f6a-9312-47e2-9883-06ecb20cb29a.jpg
    163.4 KB · Views: 5,440
Anything open source is good. I don't know much electronics or programming but if I could give work with a programmer to start playing around and programming things like adaptive traction control for a 2wd with accelerometer and gyro feedback and stuff... eventually we might make something reliable

Well ES people what would y'all pay for something like that? how about just for one of the first few open source controllers?
 
The Stig said:
Anything open source is good. I don't know much electronics or programming but if I could give work with a programmer to start playing around and programming things like adaptive traction control for a 2wd with accelerometer and gyro feedback and stuff... eventually we might make something reliable
Seems complex what you say about "adaptive traction control for a 2wd with accelerometer and gyro feedback and stuff". But OpenSource is the way to go - look at the success of OpenSource Arduino and all the tools (hardware and firmware libs) available to hackers like us :) -- the same is going on with the more recent OpenSource RaspberryPI...
 
walls99 said:
casainho said:
- Current control works (using DAC, TIM1_ETR and Opamp LM258). Thanks to NJay for explaining me with great detail how this should work.
Are still planning on implementing close loop phase current/torque control?
"close loop phase current/torque control" <--- what is this?

I am (and I will) really busy with my own company but I am also finding time to also working on this Smart EBike project -- I feel I do not have time to think or implement "close loop phase current/torque control". Right now, I have a bicycle with a motor and a battery waiting for this controller, that is my priority now. I will also start putting the Bluetooth working and the Android application. What I plan right now to see and setup on Android application:
- show to user: wheel(motor) instantaneous speed; instantaneous battery voltage; instantaneous current; instantaneous motor power usage.
- user setup the controller: motor max current; controller low voltage cut.

Walls99, I am thinking in future to use your OpenSource BMS and make it "Smart" (if not enough already). What kind of functionalities does it have? Does the controller read/have each cell voltage?
I would like to get on the Smart Display each voltage cell of the Smart BMS, with wireless communications. Seems that battery pack needs a good control from the BMS and is good to be able to see each cell voltage. In the end, I would like to get a system to tell me how much Power (Watts / hour) is available on my battery and his storage capacity. Also a preview of how many kms available to travel with current battery charge.

Smart EBike: Display with touchscreen + Motor controller + Battery pack BMS. Wireless communications between each three systems.
 
casainho said:
"close loop phase current/torque control" <--- what is this?
This is when the PWM is controlled by a fast PI loop to achieve a target phase current. The throttle command is then used to set this phase current/torque target instead of the PWM directly . If you want the throttle to command motor speed, you just need an outer loop (slower) to control the torque target.

casainho said:
Walls99, I am thinking in future to use your OpenSource BMS and make it "Smart" (if not enough already). What kind of functionalities does it have? Does the controller read/have each cell voltage?
My BMS is quite basic, it only controls the charge/balancing and per cell HVC/LVC. My BMS controller cannot measurement the cell voltage nor measure the output current. Coulomb counting is implemented in the motor controller. 2moto has built a "Smarter" version of my BMS, you should check with him, see here: http://endless-sphere.com/forums/viewtopic.php?f=14&t=45383
 
walls99 said:
casainho said:
"close loop phase current/torque control" <--- what is this?
This is when the PWM is controlled by a fast PI loop to achieve a target phase current. The throttle command is then used to set this phase current/torque target instead of the PWM directly . If you want the throttle to command motor speed, you just need an outer loop (slower) to control the torque target.
Hmmm, ok, thanks for the explanation. I am used to KUxxx controllers for my EBicycle and I am pretty sure the throttle setups PWM directly. On EBicycles I have almost no experience, I can't say how the ones I tried works.
Riding my EBicycle, I like the PWM mode since is "natural" as I like to keep pedaling and I want to feel that with more wind and uphill road I need to give more of my energy to keep the velocity. As for EBikes, I don't know, but maybe a constant speed is better.

walls99 said:
casainho said:
Walls99, I am thinking in future to use your OpenSource BMS and make it "Smart" (if not enough already). What kind of functionalities does it have? Does the controller read/have each cell voltage?
My BMS is quite basic, it only controls the charge/balancing and per cell HVC/LVC. My BMS controller cannot measurement the cell voltage nor measure the output current. Coulomb counting is implemented in the motor controller. 2moto has built a "Smarter" version of my BMS, you should check with him, see here: http://endless-sphere.com/forums/viewtopic.php?f=14&t=45383
GREAT!!! Other like me that prefer C and not the ASM ;) And I am thank you for sharing your project just as 2moto did. I credit here: "This prototype hardware is based on the hardware from Open Sensorless BLDC controller project from walls99. The main differencies are a different microcontroller and no BEMF circuit. Also the firmware were is C instead of assembly."

Now I need to read in full the 2moto message :)
 
Walls99, for speed control I found this application note for STM32F100 (the same I am using) -- and is written in C :)

Six-step sensorless BLDC motor drive example software for the STM32

The program is written in C and provides the main functions of sensorless synchronization to the permanent magnet rotor position of a 3-phase BLDC motor along with 3-phase bridge commutation, speed regulation, acceleration/deceleration control, and gating control logic which is specific to the STMicroelectronics® SLLIMMTM module STGIPN3H60. The driving logic can be easily adapted to any monolithic or discrete 3-phase bridge which requires six logic control signals. Deadtime functionality is provided
within the STM32.

The speed regulator monitors the speed reference and speed estimate to determine a speed error and, from this, generates the commanded duty cycle needed to keep the motor running at the desired speed. The speed regulator is a conventional proportional plus integral type algorithm.
 
close loop phase current control would be a huge benefit. Currently throttle control with todays ebike controllers is very bad, and you have to adjust to them because they are unlike cars or motorcycles. The worst thing is with medium to high powered setups, if someone is not very careful about the throttle control, the bike will jerk - making potential future ebike lovers uncomfortable. Its one reason my GF won't get on my 1000w bike with instant start lyen controller, but she likes the 250w red bike in my Profile Picture.

Anyway lets call it CLCC :D (close loop current control). So Maybe CLCC could also open the window for a lot of things... like what I was talking about adaptive traction control etc...
 
I just got current control fully working and works great!! Turns out that I had a bad solder on one mosfet.

The current control works very well but not so good at near 100% PWM, were the motor starts to make some noise, vibration and fully stops. Anyway, that's only at about 95% up to 100% of PWM.

I tested the current control by setup the max current with values like 0.5A, 1A, 2A, 5A and 10A (in theory, should go up to 50A but my power supply gives no more than 10A). I used my hand to try stop the motor and I verified PWM changing automatically as expected. The LM258 OpAmp output seems to work well and also the PWM changes for max current.

Here a video I recorded with max current = 0.3A ( motor_set_max_current (0.3); ). The Cruise Control were set and the motor were running at low speed because current control were working (normal current at max velocity is about 0.8A). We can see on the oscilloscope the signals for PWM and current signal sensor output:

[youtube]i0VohXLZfCA[/youtube]

The Stig said:
close loop phase current control would be a huge benefit. Currently throttle control with todays ebike controllers is very bad, and you have to adjust to them because they are unlike cars or motorcycles. The worst thing is with medium to high powered setups, if someone is not very careful about the throttle control, the bike will jerk - making potential future ebike lovers uncomfortable.
Thank you for your explanation. I understand it can be a problem and I just remember I did cut 1 of the 2 shunt resistors of my KU123 controller, just to have half of max current on it, to have a soft start. I also want a soft start, with a programmable ramp up on speed -- that's also one of the reasons I started this project!
 
What the hell kinda pants you wereing? LOL Im just bugging don't realy need to know.

So what was the blue trace? Negative-source on one phase? Looks like some ringing going up and down.... How well is your paower stage set up. Im sorry I have sent you files yet but im trying to make sure mine can be used othewise the SCH is about all you will be able to look at.
 
Arlo1 said:
What the hell kinda pants you wereing? LOL Im just bigging don't realy need to know.
Those are cycling pants, they are popular here among road and mountain cyclists. And I use them when inside house, to keep warm :)

Arlo1 said:
So what was the blue trace? Negative-source on one phase? Looks like some ringing going up and down.... How well is your paower stage set up. Im sorry I have sent you files yet but im trying to make sure mine can be used othewise the SCH is about all you will be able to look at.
The blue trace on oscilloscope is PWM signal from STM32F100. Here is the schematic (note that board is currently all wires):



Walls99, can you please see on the schematic the 10mF capacitors? are they ok there (GND after the current sensor??)
 
casainho said:
Walls99, can you please see on the schematic the 10mF capacitors? are they ok there (GND after the current sensor??)
It depends on what you what to measure. Right now, the capacitors are on the "circuit ground" side of the sensor, so they will filter the phase current and you will only see the battery current. If you want to measure the instantaneous phase current which is only possible during the PWM ON part of the cycle, then you need to place the capacitors on the "battery ground" side. On my controller, I configured the ADC to automatically sample the phase current at the end of the ON cycle for every cycle. When the conversion is finish, about 5us later, it triggers an interrupt so it can process the PI control loop to update the PWM based on the phase current/torque target command.
 
walls99 said:
casainho said:
Walls99, can you please see on the schematic the 10mF capacitors? are they ok there (GND after the current sensor??)
It depends on what you what to measure. Right now, the capacitors are on the "circuit ground" side of the sensor, so they will filter the phase current and you will only see the battery current. If you want to measure the instantaneous phase current which is only possible during the PWM ON part of the cycle, then you need to place the capacitors on the "battery ground" side.
That's what I want to do, control the current on PWM cycle by cycle.

walls99 said:
On my controller, I configured the ADC to automatically sample the phase current at the end of the ON cycle for every cycle. When the conversion is finish, about 5us later, it triggers an interrupt so it can process the PI control loop to update the PWM based on the phase current/torque target command.
Ok, good to know/understand how you do. On my controller, STM32 and the OpAmp already do the current control but not with PID, I will need to implement PID If I want.
Good that PIC you uses that includes an opamp, the STM32F100 I use don't have one but others STM32 more expensive have. But mine have an ADCs with "comparator/watch dog" that may work as the same as the comparator, I never used such thing before...
 
casainho said:
walls99 said:
On my controller, I configured the ADC to automatically sample the phase current at the end of the ON cycle for every cycle. When the conversion is finish, about 5us later, it triggers an interrupt so it can process the PI control loop to update the PWM based on the phase current/torque target command.
Ok, good to know/understand how you do. On my controller, STM32 and the OpAmp already do the current control but not with PID, I will need to implement PID If I want.
Good that PIC you uses that includes an opamp, the STM32F100 I use don't have one but others STM32 more expensive have. But mine have an ADCs with "comparator/watch dog" that may work as the same as the comparator, I never used such thing before...
The PIC doesn't have an opamp for HW current limiting. The current control come from the PI loop and it takes several cycle for the current to converge towards the target. Over current protection is also supported but in SW by comparing the instantaneous phase current with a predefined maximum.
 
Here is my concept for Smart EBike.


Right now the controller is what I have more developed but the display should be relatively quick to implement, as it is mainly firmware coding. Each one system works stand alone but can communicate wireless with SmartPhones and between each system. This way the system is modular and can be developed in a modular way.

The display is 3 chinese cheap boards:
- Mini STM32 STM32F103RBT6 Development Board w/ 2.8" TFT LCD Touch Screen ($32.80)
- DC-DC for supply the LCD Touch Screen: DC-DC LM317 ultra low ripple Stepless adjustable Input:63V-4.5V Output:60V-1.5V ($3.35 on Ebay)
- Wireless module: 2.4GHz NRF24L01+ Antenna Wireless Transceiver Module For Microcontrol ($0.99 on Ebay)

The enclosure for display can be designed in 3D and 3D printed with black (or other color) plastic ABS.
 

Attachments

  • Smart EBike-small.jpg
    Smart EBike-small.jpg
    92.4 KB · Views: 1,794
  • Smart EBike-small-1.jpg
    Smart EBike-small-1.jpg
    13.1 KB · Views: 5,339
New mailing list for Smart EBike: https://groups.google.com/forum/?fromgroups#!forum/smart-ebike

I will start using the mailing list to discuss/work with other developers on Bluetooth/UART protocol.
 
Today I tested for the first time the controller on a bicycle. There was some limitations like the mosfets don't have a heat dissipation. Also the current limit was set to 2A (the protection fuse is of 5A).
At the end of first video, the 5A fuse burned. Red LED is power and green one is Cruise Control.

[youtube]I449L6JZkV0[/youtube]

[youtube]wrrfMGUwaAM[/youtube]

[youtube]M8jWLfEaA3E[/youtube]



 
Nice project :) You really build a controller, it should be in the Motor/Controller forum, this way I would have read it earlier!

The pic you chose seems to be great for our job. I use the Arduino Nano and a brushless ESC as a BLDC controller http://endless-sphere.com/forums/viewtopic.php?f=2&t=47124. Unlike on the KUxx controllers, the throttle input of these ESCs sets the duty cycle rather than a speed target, I found this a more direct interface, perfect for a hook-up-throttle controller. But I ran into some obstacles: Sample rate of Arduino is about 7khz max, which is too slow for CLCC :( Hope i can fix this.
I need CLCC, since high phase currents/torque during start up always kills the gears in my converted hubmotors http://endless-sphere.com/forums/viewtopic.php?f=28&t=45245

Your controller seems to be a wider shot, I would like to build one after I finished my project.

About your display:
I Would not want to use a touchscreen, since it's more or less forbidden in Europe to use such things during driving. I use a monochrome LCD, since it can be read flawlessly even in bright sunlight. I want buttons directly accessable from the handle bar for switching speed and display modes. For setup and data logging, one can still use the smartphone via bluetooth.

I would like to add this project to the wiki. Also the schematics and code. Would this be ok for you?
 
crossbreak said:
Nice project :) You really build a controller, it should be in the Motor/Controller forum, this way I would have read it earlier!
Good idea. I wish some forum operator can make this change.

crossbreak said:
The pic you chose seems to be great for our job.
It is not a PIC nor an AVR, it is a ARM STM32F100, the same used on Open-BLDC project.

crossbreak said:
I need CLCC, since high phase currents/torque during start up always kills the gears in my converted hubmotors http://endless-sphere.com/forums/viewtopic.php?f=28&t=45245
It is not implemented yet, but it should be only firmware. There is an application note for the controller:
Six-step sensorless BLDC motor drive example software for the STM32

The speed regulator monitors the speed reference and speed estimate to determine a speed error and, from this, generates the commanded duty cycle needed to keep the motor running at the desired speed. The speed regulator is a conventional proportional plus integral type algorithm.

crossbreak said:
Your controller seems to be a wider shot, I would like to build one after I finished my project.
This project needs people like you, that want to build, test and develop it! It also needs someone to commercialize it, but that can happen later.

crossbreak said:
About your display:
I Would not want to use a touchscreen, since it's more or less forbidden in Europe to use such things during driving. I use a monochrome LCD, since it can be read flawlessly even in bright sunlight. I want buttons directly accessable from the handle bar for switching speed and display modes. For setup and data logging, one can still use the smartphone via bluetooth.
I will take advantage of cheap from China color touch screen display: http://dx.com/p/mini-stm32-stm32f103rbt6-development-board-w-2-8-tft-lcd-touch-screen-157301

Monochrome LCD is a bit more cheap and simple but is much less graphic. There are a lot of information and graphic for show to user, that's why I hope to use this 2.8'' color display.

crossbreak said:
I would like to add this project to the wiki. Also the schematics and code. Would this be ok for you?
Thanks for the interest, is really important for the success of this project. Right now is all development, there isn't any stable version yet, so, I would prefer you put only a description and a link to project page that I update myself. If you post a video or pictures, please use the date.
Soon I hope to start design the PCB and then a stable version should happen.

If you want to participate you are welcome, please ask permissions to write (github, wiki, etc).
 
Back
Top