Open Source CA alternative on German pedelecforum available

thx! I'll try that low pass filter!

Maybe I should fit all stuff (BLDC controller, ACS758, Arduino, Battery Voltage Devider, LM2596HV +5V/+3.3V PSU etc...) into ONE box, and just use one cable to the handle bar for throttle, buttons and display. This way I get less noise from both current and voltage readings :idea:

All the stuff that is located at the handle bar does not suffer any noise due low resolution (throttle, buttons) or already come with noise suppression from factory (LCD).

thx a lot for you input! I hope I can come up with a PCB that is more sophisticated than the forumscontroller, but still simple to build for everyone.
 
A third possibility for BLDC controller sourcing is using industry standard controller boards used for robots and other factory machines. Most of them work with 200V+, having high RDS_on Fets, but there are also versions that only use up to 60V in the 2kW range. The powerstage is mostly separated from the brain, so maybe we can just use our own Powerstage with an industry standard (IS) brain. Not all IS controllers use Ethercat bus, they are also available with CAN bus connection. In the next step we will search for some IS boards that fit the application and then start programming a CAN interface for Atmel/Arduino. We will also compare this PIC implementation with RISC Processor version before we start coding. We will get some support from the poly-technical college in Gießen in this regard.
I always thought these IS boards are expensive, but they aren't. They are in the same price region as ACM BLDC ebike controllers or RC ESCs.

Thx for all your help, we will keep you posted ;) It will take some weeks to get this project started, hope we can come up with some dyno tests in June o July. We think of hooking up two converted geared hubmotors (making the axle rotate) as a motor dyno/ controller test bench.

The I2C connection to SmartBMS and the Bluetooth interface have to wait till we got this working.

Still, there will be some version for ACM ebike controllers, ATM i have no time to work further on this, but I got some of the noise issue solved. Measure the PIC induced noise with an Osci helps to find the right resistor and capacitor values. I'm not pleased yet but at least it works much better now. The forumscontroller is not sophisticated for everyday use IMO, it needs a lot more hardware development to make this a product with value. The PCB design will take at least till May. But now that our team got a new member, we can work on 2 sites at the same time.
 
Maybe I should just use differential ADCs like the famous turnigy wattmeter uses. Maybe this way I get better readings. I will get some Arduino Leonardo, which has them or a MCP3208 with SPI interface with my arduino nano, i'm still a bit stuck here :?

Wattmeter: http://www.hobbyking.com/hobbyking/store/__10777__Turnigy_Watt_Meter_and_power_Analyzer_DE_Warehouse_.html
 
Njay said:
ATtiny26 also has them, as well as other tinys.

Thx, this is the one the turnigy wattmeter uses, Doctorbass once made a wire plan /schematic: http://endless-sphere.com/forums/viewtopic.php?f=3&t=13607&start=125#p242804
 
I'll order an AD737JN RMS-to-DC converter. BTW we are already thinking of using software mode of the OZ890, now that we have all requirements for that.

Now that the OZ890 works together with Arduino, I'll implement a PID controller for the speedlimiting function. We do not use any code from the "Forumscontroller" since it is already too much to understand properly. We do all the code ourselves. Already wrote most of it but still did not solder any Prototype. Hope that can be done at the weekend.

BTW the ACS758 is history, we wont use it since it is too expensive and does not have better accuracy than a simple wire shunt that does cost almost nothing
 

Attachments

  • BMS + eBike wireing_with_ATtiny 85.jpg
    BMS + eBike wireing_with_ATtiny 85.jpg
    28.8 KB · Views: 3,884
The BMS interface is mostly done... now we go straight forward to make a Menu that is accessible through both the Arduino with 20x4 LCD screen and the bluetooth adapter using an Android phone

Here is a vid
http://youtu.be/oHkFnj4Nktc

We chose to use the I2C interface for almost all peripherals, so we have enough I/O pins left for at least 4-buttons, since we dislike the 2-button interface of the CA :( takes hours to configure. In the end we might use five buttons: Up-down-right-left-enter

ATM we use:
7 Digital-Pins: 5 for buttons, one for the tire speed sensor and one for the PAS sensor
4 Analogue Pins: 2 for I2C, 1 for the throttle input, 1 for throttle output

so we have 6 digi pins and 4 analogue pins left

What we still want to add:
-total km and trip km stored in internal EEPROM
-phase current sensor and motor speed sensor for Middrives (2-digital pins)
-motor temp sensor (1 analogue pin)
-read battery temp over I2C (0 pins)
-power limiter, you can enter your desired range and it limits the power so you will reach your destination without a flat battery :) (0-Pins)
-servo derailleur that works togther with a throttle limiting function during shifting and automatic down-shift if you come to a dead stop (1-digital pin)
-theft protection, uses 2-digital pins, one for the Key and one for the tire lock release
- Replace the the 20x4 text LCD with 128 x64 graphic LCD

Then we have 1 digi pin and 3 analogue pins left.. if we then want to add XCell RT support or other additional feature we have to use an additional IC or think about changing the chip. But till then a lot of work has to be done :)
 
Pseudo Torque Mode Throttle Mapper

we try to implement a pseudo current throttle feature without the use of ANY PID controller, since PID sucks. I tried the CA function a lot. There are always some oscillations no matter how low the GAIN is set. You can set the gain for a prticular speed, but at lower/higher speeds you will always see oscillation :(#
That's why I made an own approch, just by cutting off the unused /Lost Throttle Range (LTR) and map it to a full range: The Pseudo Current Mode Throttle.

Lost Throttle Range (LTR) of Speed-Throttle-eBike controllers: When already driving at a certain speed, the
throttle range from 0% to the percentage of the current speed level will
result in no output torque at all.
This feels strange, since if you pull the
throttle somewhat, nothing happens. If you pull the throttle a little more,
it will result in undesired massive torque output


This should work fine for most controllers, since they

1. have mixed mode throttle (speed+torque mixed mode)
2. The Integral gain factor is set quite low in the most Infineon, Xiechang, Greentime, bmsbattery controllers.
3. their internal PI-controller only uses positive torque, no negative (regen) torque.

In fact, this does not limit the current further than the max_current set in the controller. It just makes the throttle user friendly, since it restores the FULL throttle range at all speeds. SInce there is a fixed map, that is just setup once during setup mode, there is no closed loop PID controller involved, just open loop control. This way there wont be ANY oscillation, and no hassle with setting any Gain Parameters. The Pseudo torque controll mapper will setup itself during test mode (read attached paper). There will be an additional function that makes it possible to map the throttle non-linearly, to make throttle behavior even smoother

PS: We got another project like this, the member steelmesh also shares his code with us : ) http://endless-sphere.com/forums/viewtopic.php?f=2&t=51879&p=771878#p771878
 
When using a "real" torque throttle, the throttle behavior must be adjusted. This can be done using a map. For every throttle/torque value we want to output, we get a specific voltage at a certain motor speed. This open loop control mehtod can look like a landscape and it's also used for engine spark timing or fuel injection for example.

problem is, we need to storage 100x100 values for 1-100% throttle and 1-100kph in 1% and 1kph steps. this is 100x100 bytes which is 10kbytes. Arduino only storages 1kbyte and it would be impossible to measure all 10 000 values for the user. What we want to do is to built a test stand and measure at least 16x16=256 values. This does not mean there are only 16 speed and throttle values. We still can extrapolate between theses and still have a very nice throttle behavior. As said, best thing would be to flash the controller to be torque controlled, then we would have not to deal with the PI-controller at all. But we can't since chinese people stay closed source :(

Since:

ALL we want build in the end is a real torque throttle. We want a drive that amplifies the users torque applied to the cranks, no matter if amplified by one or 100. A human can spent around 250W, so a factor of 100 would be 25kW, which is less than most motorcycles have, so this seem reasonable.

Here is a "fuel map" shown in Matlab for example. As well as we need, it shows motor speed and throttle position and outputs a specific value (fuel time). We need to output the voltage to the throttle input of our BLDC controller.
 

Attachments

  • fuel map.png
    fuel map.png
    71.5 KB · Views: 3,758
I noticed today that my controller may have extreme throttle lag and that is why the CA oscillates at its output all time. Still I insist on open loop control, since it makes the most direct control throttle possible. Maybe we onle read no-load, half load and full throttle curves and interpolate between these. Should still run a lot better than closed loop control. Maybe we run another chip directly inside the controller. These chips are so cheap and this way we finally have got a good throttle interface and we can store additional data like setting phase amps, battery amps and LVC without using any closed source code.

I'm really interested in the new i2c controllers form bmsbattery. maybe they are customizeable either. They come with an S-LCD1 E-BIKE LCD METER that uses some "RX" and "TX" wires.
 
you don't need to store all the throttle settings

decide on a minimum setting (enough to get you moving) and a max setting

then plot a graph to show amps (min to max) vs throttle position

solve to get an equation, then use that in your program

(was at school the last time I actually did that... I'd probably do a graph in excel and guesstimate it tbh)

so something like
amps = minimum amps + ((throttle voltagex10)squared)

the squared bit (or whatever you put in there) controls the ramp... so full throttle is more than just twice half throttle
(gives more control?)
 
I dont really get it....ATM my throttle "PAS through" works just like the Cycle Analyst THrottle PAS thorugh:

1.User sets min Voltage Input (0 throttle) and max throttle just not turning the throttle when steup mode is entered and then pulling full throttle
-> min and max throttle input is set (for example my hall throttle does: 0.85V-4.35V), even the latest does not have such a "setup study mode", you have to enter these values yourself
2. Setting the output voltage range/Controller throttle input: Output is ramped from 1V to 4V within a minute and my device looks how fast the wheel turns. For example with my controller that is 1.39V-4.11V, so output 0% is 1.39V and output max is 4.11V. It stores throttle_volts@max_spd and max_volts@stop

Now if 0.95 (+0.1V) is input, it ouputs 1.40V so the Wheel starts moving. If Hall throttle outputs 4.35V, my device outputs 4.36V. That is the full range, but only feasible at low speed form 0-6kph.


Next Version should be:
Over 6kph the controller throttle range is only 1.61V-4.11V, so my device should output 1.61V @0.9V inut, to 4.12Vouput@4.35Vinput at that speed.

from 6-12kph, the controller has a throttle range of only 1.95V , so my device has 1.95Voutput@0.9Vinput to 4.12Voutput@4.35Vinput (due LTR)
from 12-18kph, it's 2.2V@0.9V to 4.12V@4.35V
from 18-24kph, it's 2.5V@0.9V to 4.12V@4.35V
from 24-30kph, it's 2.85V@0.9V to 4.12V@4.35V

and so on. Next next version will be to interpolate between these values, and test this on my test bench
 
but... if you want a torque throttle, don't you want to adjust by amps and not by speed ?

so if you go to half throttle, and you know you want 40amps

you have the arduino ramp up the throttle until battery amps = 40 and then hold the throttle there ?

(you need to control the ramp up speed etc..., but that should be no biggie?)


I thought you were talking about how to read the throttle position and work out how many amps you want... maybe I missed the point here?
 
did you read my paper completely? http://endless-sphere.com/forums/download/file.php?id=115796

I wnat amps, but not battery amps. I want motor/phase amps, that is not the same. sorry for bothering you, but my thread is more a "documentation thread" than a discussion. If you have questions, just PM me ;) I'll pas the missing info to the thread
 
no, I hadn't read that

why do you want phase amps and not battery amps? battery amps are easier to work with ?

sorry for the confusion, maybe the controllers you're using are different to the ones I've used/dismantled

all the ones I've worked with only limit amps at the amp limit of the controller, other than that it doesn't matter if you twist the throttle to 5mph or 30mph, you'll get full controller amps up to that speed, which is what I was basing my posts on
 
if you pull full throttle, that is always full throttle with every controller. So where is your point? I want to make the throttle behave better, maybe you just didnt even recognize what i'm talking about cause you always drive slow?

I just want a torque throttle like in a gas powered car (have you ever driven one? then you will know what I mean :? ) which has nothing to do with battery amps at all
 
I'm not quite sure how to take your reply, maybe something has been lost in translation in that post or maybe our previous ones ?

with speed control throttles, even if you only pull the throttle half way, you get full power/amps until you hit half speed, it's the same if you twist the throttle up to 5mph or 50mph, you get full power up to that speed

torque = power = amps

it doesn't really matter if you measure battery amps or phase amps, until you get up to really high numbers, when you start watching/measuring everything in the hope you don't blow anything up...

fyi, I'm running a cro motor at 140v and 100 battery amps... I was running 150 amps, but needed to tone it down a bit while I'm still planning my final build
I don't have a lot of experience with petrol bikes, about 10hours with on road bikes and 10 hours with off road bikes, but I've been driving cars/vans/trucks for 10+ years so I know what you're talking about
 
with speed control throttles, even if you only pull the throttle half way, you get full power/amps until you hit half speed, it's the same if you twist the throttle up to 5mph or 50mph, you get full power up to that speed
Your controllers definitely have different behavior. Which ones do you use? Where did you earn your experience with PI and PID controllers? Are you building robots, too?

If my bike would only have a pure speed throttle like you describe, I would only crash/hit wheelies and then crash. This is "full throttle ore no throttle" only behavior is not drive able at high power levels.
I believe there are no real speed throttle like you describe. They always use a PI-controller. So if your actual value is near your target value, the actuator value wont change too much. i.e. if only hit the throttle for 5mph, it will only accelerate slowly if you start from a dead stop.

I definitely write too much text but not enough code
 
Got some further... try to implement an accurate current measurement. I'll try an Arduino Pro Micro now, since it also has differential ADC channels, it's as small as the Pro Mini but has on-chip USB, so no separate RS232 modules is needed. This is nice to develop the functions of the Attiny 85

We might use the Arduino Micro and just use parallel LCD interface instead of i2x, since this board has more than enough pins. Arduino micro is more expensive but we still sova money, since we dont use an i2c to parallele board anymore. We have also more freedom in pin assignment
 
some update... i experimented a bit on the torque throttle circuit. Basically, it might work on a bike, still this is just cosmetics for a problem that can only be solved by using the right controller. I will go a different route and built my own controller, using Lebowskis controller brain. The arduino will just be used as a user interface and connection between motor controller BMS and bike. There wont be any current measurement or voltage measurement, throttle enhancement and stuff. All that is already done in the BMS and the motor controller. Arduino will just calc speed, connect to the phone/GPS, LCD screen, BMS, motor controller, set speed limit, max power etc.
 
The throttle mapping idea is interesting. I've done a few torque mode throttle setups and the oscillation problem is very difficult to handle if there is too much latency in the throttle response. Industrial controllers get around this by using feed-forward or predicting the response ahead of time in software, but this would be hard to get dialed in. Using an analog controller with an analog current measurment circuit, I got it to work quite nicely even with quite a bit of gain.

I'm interested in the BMS hacking too. Even if there was a basic setup that made those boards useful, it would be great as the price isn't prohibitive. I've always avoided the active cutoff on the main power circuit due to cost and heat considerations. One way around some of the problems would be to implement a high side active cutoff that only powers the logic (key switch) line on the motor controller. This is typically well under 1A. Even if you forget to turn the system off after a ride, when the BMS trips, the power drain would drop to near zero.
 
fechter said:
I'm interested in the BMS hacking too. Even if there was a basic setup that made those boards useful, it would be great as the price isn't prohibitive. I've always avoided the active cutoff on the main power circuit due to cost and heat considerations. One way around some of the problems would be to implement a high side active cutoff that only powers the logic (key switch) line on the motor controller. This is typically well under 1A. Even if you forget to turn the system off after a ride, when the BMS trips, the power drain would drop to near zero.

Heat isn't that big issue, you can push 20amps through a single fet without heatsink. With 4Fets and heatsink I get all i'm after, 200amps peak should be ok. The Brain has to be powered by an own small battery so it can communicate with multiple BMS/batteries while they are still switched off. Once the "handshake" is made and the BMS Fets conduct, the small battery of the brain can be recharged, so the small battery can be really tiny. For my tests I use a single 18650 cell. Would be great to use one with very low self discharge so it doesnt die during the winter.

One aim is to connect multiple batteries with different state of charge (SOC) at the same time, The Brain decides which one of them becomes discharged. This way all batteries can be discharged till they are equal. The BMS is necessary for each pack anyway for short circuit prodection, so there is no additional cost for this feature.

During this "handshake" between the multiple BMS/batteries and the Brain, the brain has to know the SOC, the max power ability of the battery, the life cycle etc, so it can decide which max power can deliver and which batteris sould be used during which drive states. For example, if one battery got hot, it should not take a lot discharge /regen power anymore, a different one should be used, so the brains switches this BMS Fet off and switches a different pack on. If one pack is almost empty, it should get some regen power first, if one is fully charged, it should not get any regen power. If only a single battery is connected, motor power has to be cut so it fits the discharge abilities of the single pack.
 
Hi,
I'm new to this forum. I'm thinking of "interfacing" my e-bike to an arduino for a while.

Crongrat, great job already done :D
Have you considered using a "cheap" chinese android tablet as the user input/output device ?

The cheapest I found is the "JXD S18" at <$45 (4.3'')
sku_161536_1.jpg

http://dx.com/p/jxd-s18-4-3-resisti...ad-tablet-pc-w-tf-wi-fi-g-sensor-black-161536
but have crappy resistive screen, no bluetooth, no GPS :(

The cheapest one I found with Bluetooth + GPS and even GSM/2G built in and 3G dongle ready is the "Freelander PD200" at $90 - $100 (7'')
sku_227510_1.jpg

http://dx.com/p/freelander-pd200-7-...m-gps-sim-bluetooth-otg-fm-black-white-227510
currently sold-out on dx.com but can be found elsewhere ...
 
possible, i dont mind which phone you use. The software works with any android phone. Got one for 60 bucks around the corner with bluetooth, GPS, WLAN etc... a motorola defy mini.


ATM it only displays the Cell voltages. I dont want to have a phone on my bike at all times, that's why I use an external LCD screen. The phone interface is just for debugging and setup ATM. With a good android software you could do a lot more, like mixing GPS info and battery SOC to tell the system how much energy you may consume to reach your destination
 
Back
Top