XPD: open-source keywin e-bike lab replacement

Get all your technical information about electric bikes here.
User avatar
NeilP   10 GW

10 GW
Posts: 4992
Joined: Nov 27 2010 3:18pm
Location: 49.17303, -2.05354 Jersey, Europe
Contact:

Re: XPD: open-source keywin e-bike lab replacement

Post by NeilP » Mar 10 2012 4:00pm

I have been thinking about this and the different protocols and came up with this idea.

I have an EB312 board on a sensor-less controller, with an Xlyte APM plug on it.

Now the Xlyte APM in setup mode programs the MCU,,it allows you to alter current limits, and in run mode you can change between the 3 speeds and have speed and current monitoring via reading the MCU output.

So my thinking goes like this..if we ( OK I ) can intercept the signals coming to and from from the APM it may give us clues as to the protocols being used...especially we can compare with what we know already in relation to the current XPD.

OK big snag in this theory, how would I go about tapping into and intercepting these signals and recording them.

I am imagining one (or maybe two) of these USB-RS232 adapters as found on the programming cables. Connect the RX side of the adapter to a T between APM and the controller, then use some sort of console terminal logging program ...the name of which slips my mind at the moment to record the data flow between the APm and the board MCU.

I say "maybe two" of the adapters..because..I imagine that you would need to hear the output from the APM (listening on the board Rx port) and then the reply from the MCU (board tx port)

I'll quite happily try and do this if it will help and someone can give me an idea of how I put this idea in to practice
:) Only Irish coffee provides in a glass all four essential food groups: alcohol, caffeine, sugar, and fat :)

User avatar
gensem   100 kW

100 kW
Posts: 1461
Joined: Apr 01 2011 5:28pm
Location: Sao Paulo - Brazil

Re: XPD: open-source keywin e-bike lab replacement

Post by gensem » Mar 10 2012 5:10pm

zombiess wrote:I modded XPD to add in all the extra parameters for the EB3xx boards hoping the protocol was the same, but it fails on programming them. Was worth a shot, but without having someone who knows more about this such as the Author of the program I guess I'm done. I was able to read and understand his code, make the changes was pretty straight forwards, but no luck programming.

My hex edited version programs just fine, Im yet to test it because its pooring rain.. but the 3 speed switch is working nice, so my 0,1 block time should work too.
Justin we really appreciate what you did!

zombiess   100 MW

100 MW
Posts: 2911
Joined: Feb 01 2011 2:16am
Location: Ventura

Re: XPD: open-source keywin e-bike lab replacement

Post by zombiess » Mar 11 2012 3:27am

gensem wrote:
zombiess wrote:I modded XPD to add in all the extra parameters for the EB3xx boards hoping the protocol was the same, but it fails on programming them. Was worth a shot, but without having someone who knows more about this such as the Author of the program I guess I'm done. I was able to read and understand his code, make the changes was pretty straight forwards, but no luck programming.

My hex edited version programs just fine, Im yet to test it because its pooring rain.. but the 3 speed switch is working nice, so my 0,1 block time should work too.
my hex edited versions work great too. I set all my controllers to 0.1S block time.

User avatar
NeilP   10 GW

10 GW
Posts: 4992
Joined: Nov 27 2010 3:18pm
Location: 49.17303, -2.05354 Jersey, Europe
Contact:

Re: XPD: open-source keywin e-bike lab replacement

Post by NeilP » Mar 11 2012 6:18am

mxer wrote:Managed to get this sorted and am programming, which is great :mrgreen:

Have a couple of question tho :roll:

Set the "Battery current limit" to 20.1amps as there was tooo much tourqe 30.1 max was being pulled before, this feature didd't do anything ? Still pulled the 30amps ?

Ok, so that diddn't work so had a play with "Phase current limit" was set at 65.4amps, so set that down to 20amps, now only pulls 4amps max, Ok, getting somewhere, so set to 50amps and now it pulls my desired 20amps :D

But why when i set the phase current limit to 50amps it pulls 20amps? :? , battery current limit doesn't seam to do anything so shall i put that back to default ?....

If i could understand this i would feel more comfortable, not understanding it worries me i have set values that could damage my system...

I did notice i had a bit of stuttering/grundting going on but that could of been down to a low (ish) battery ?.....

OH bollocks..I just spent 20 mins going through your post and created a really nice answer., individual quotes, from your question..with bits pulled from BLDC theory threads i found..quoted and referenced ..all to help you understand the difference between phase and battery amps...but i swapping tabs, I seem to have lost it...F**K

OK no reasons..in a nutshell..it is to do wtiht how the controller and motor works..mosfet switching , charge being stored in the capacitors and then released..so greater phase amps
Go to http://www.ebikes.ca/simulator/

and click and drag in the graph while looking at the middle talbe of figures below the graph. Look at Mtr Amps (=phase amps) and battery amps..note what happens as you drag from left to right in the graph
http://mh-nexus.de/en/hxd/
:) Only Irish coffee provides in a glass all four essential food groups: alcohol, caffeine, sugar, and fat :)

User avatar
Alan B   100 GW

100 GW
Posts: 7741
Joined: Sep 11 2010 7:43am
Location: San Francisco Bay Area, USA
Contact:

Re: XPD: open-source keywin e-bike lab replacement

Post by Alan B » Mar 11 2012 9:56am

Phase amp current "multiplication" comes from energy stored in motor inductance. :)

User avatar
NeilP   10 GW

10 GW
Posts: 4992
Joined: Nov 27 2010 3:18pm
Location: 49.17303, -2.05354 Jersey, Europe
Contact:

Re: XPD: open-source keywin e-bike lab replacement

Post by NeilP » Mar 11 2012 10:17am

Yea, i had lots of stuff like that in my first post that 'vapourised', but was not go to go pulling up all those references yet again :)
:) Only Irish coffee provides in a glass all four essential food groups: alcohol, caffeine, sugar, and fat :)

User avatar
Alan B   100 GW

100 GW
Posts: 7741
Joined: Sep 11 2010 7:43am
Location: San Francisco Bay Area, USA
Contact:

Re: XPD: open-source keywin e-bike lab replacement

Post by Alan B » Mar 11 2012 10:26am

I hate it when that happens.

User avatar
etard   1 MW

1 MW
Posts: 1935
Joined: Aug 03 2008 3:28pm
Location: Redlands, CA

Re: XPD: open-source keywin e-bike lab replacement

Post by etard » Mar 16 2012 11:30am

This is soo cool, thanks to all you guys, it was a community effort, drawing from all the good posts in this thread, but I now have a custom built Keywin 12 FET controller programmed to some safe operating parameters. I'm off to test this baby out....
Four wheels moves the body, Two wheels moves the soul
Thanks to Justin @ http://www.ebike.ca He brings the soul to ES

User avatar
hillzofvalp   1 MW

1 MW
Posts: 1876
Joined: Dec 26 2010 2:09am
Location: Los Angeles, CA

Re: XPD: open-source keywin e-bike lab replacement

Post by hillzofvalp » May 26 2012 11:25am

Zombie, could you elaborate more on the hex-editing method and maybe share your experience with unlimited regen on your eb318 with the cromotor?

Maybe you could just email me your setup file

User avatar
shorza   1 kW

1 kW
Posts: 488
Joined: Oct 13 2010 11:29pm
Location: Melbourne, Australia

Re: XPD: open-source keywin e-bike lab replacement

Post by shorza » May 29 2012 5:17am

Hey guys, has anyone been able to make this work for the EB3xx boards yet?

Is the only other option to use the program Lyen gave me?

DAND214   1 GW

1 GW
Posts: 3231
Joined: Aug 10 2008 8:28pm
Location: About 1200 miles south of Chicago, in sunny/rainny Port Richey, Florida!

Re: XPD: open-source keywin e-bike lab replacement

Post by DAND214 » May 29 2012 9:00am

This is soo cool, thanks to all you guys, it was a community effort, drawing from all the good posts in this thread, but I now have a custom built Keywin 12 FET controller programmed to some safe operating parameters. I'm off to test this baby out....
So what do you consider safe parameters?

Dan

User avatar
anpaza   10 W

10 W
Posts: 69
Joined: Dec 07 2010 5:24pm

Re: XPD: open-source keywin e-bike lab replacement

Post by anpaza » Jul 08 2012 3:21pm

Hi guys, long time no see ;)

If somebody wants to participate in testing a newer XPD with support for EB3xx, you can download the alpha version from here:

http://cs.ozerki.net/zap/pub/xpd/0.3.0-alpha/

NOTE: This version was barely tested, it works for me but I can't guarantee it will for you.

For windows download xpd-0.3.0a-windows.zip and install just like earlier XPD versions.
For linux download xpd-0.3.0a.tar.bz2, unpack and "make install".

Also it would be nice to test it with EB2xx, since I updated the "flashing" logic a bit so that (I hope) the chance for the "Invalid reply byte" failures should be minimal.

Another new feature - the serial port list is dynamically updated. That is, with earlier versions you had to insert the programming cable first, then wait until the serial port appears in the system and only then launch XPD. Now you just launch XPD, and when a new serial port appears XPD will automatically refresh the list of serial ports. This works fine in linux, I would be interested somebody to test this with windows.

User avatar
gensem   100 kW

100 kW
Posts: 1461
Joined: Apr 01 2011 5:28pm
Location: Sao Paulo - Brazil

Re: XPD: open-source keywin e-bike lab replacement

Post by gensem » Jul 08 2012 3:27pm

not dead?

WB anpaza!
Justin we really appreciate what you did!

User avatar
anpaza   10 W

10 W
Posts: 69
Joined: Dec 07 2010 5:24pm

Re: XPD: open-source keywin e-bike lab replacement

Post by anpaza » Jul 08 2012 3:40pm

I'm too young to die yet :D
Problem was, I had no EB3xx at hand for experimenting. Until yesterday :P

User avatar
Alan B   100 GW

100 GW
Posts: 7741
Joined: Sep 11 2010 7:43am
Location: San Francisco Bay Area, USA
Contact:

Re: XPD: open-source keywin e-bike lab replacement

Post by Alan B » Jul 08 2012 8:02pm

Thanks for providing a great software alternative for these programmable controllers.

User avatar
hillzofvalp   1 MW

1 MW
Posts: 1876
Joined: Dec 26 2010 2:09am
Location: Los Angeles, CA

Re: XPD: open-source keywin e-bike lab replacement

Post by hillzofvalp » Jul 08 2012 8:19pm

Great! I'll test it out with my EB318 tonight.

DAND214   1 GW

1 GW
Posts: 3231
Joined: Aug 10 2008 8:28pm
Location: About 1200 miles south of Chicago, in sunny/rainny Port Richey, Florida!

Re: XPD: open-source keywin e-bike lab replacement

Post by DAND214 » Jul 08 2012 8:29pm

This is soo cool, thanks to all you guys, it was a community effort, drawing from all the good posts in this thread, but I now have a custom built Keywin 12 FET controller programmed to some safe operating parameters. I'm off to test this baby out....
So what do you consider safe parameters?
Dan
I'm still waiting.

I want to know what you consider safe.

Dan

User avatar
hillzofvalp   1 MW

1 MW
Posts: 1876
Joined: Dec 26 2010 2:09am
Location: Los Angeles, CA

Re: XPD: open-source keywin e-bike lab replacement

Post by hillzofvalp » Jul 08 2012 8:50pm

What is safe depends a lot upon how the controller is built.. but for 12FET controllers, usually 120 phase amps and 65 battery amps is safe. a very small block time always is helpful.

User avatar
gensem   100 kW

100 kW
Posts: 1461
Joined: Apr 01 2011 5:28pm
Location: Sao Paulo - Brazil

Re: XPD: open-source keywin e-bike lab replacement

Post by gensem » Jul 08 2012 8:56pm

You cant just tell an amount of amps is safe or not... you need know the voltage too.
Either way my 12fet 4110 died in a long hill doing 50a main.
Justin we really appreciate what you did!

User avatar
hillzofvalp   1 MW

1 MW
Posts: 1876
Joined: Dec 26 2010 2:09am
Location: Los Angeles, CA

Re: XPD: open-source keywin e-bike lab replacement

Post by hillzofvalp » Jul 08 2012 9:19pm

right, I forgot-- and 3500W

DAND214   1 GW

1 GW
Posts: 3231
Joined: Aug 10 2008 8:28pm
Location: About 1200 miles south of Chicago, in sunny/rainny Port Richey, Florida!

Re: XPD: open-source keywin e-bike lab replacement

Post by DAND214 » Jul 08 2012 10:37pm

Thanks for that info.

No hills to worry around here.

i am running 15s lipo on a 8t Mac 26" wheel.
the 6 fet is doing better than my 12 fet as to smoothness thru the power range. I wish I wrote down what I set it at. did a lot of changinging to get a smooth pull. The 12 fet is at 45 and 100 amp. if I go lowe it seems to have a missfire from 10mph to 15 then it's smooth. With higher levels it is smoother or it goes thru the rough spot faster.

Both are EB3xx boards I got from Keywin and are done with 4110 fets and heavy braided traces. Both are running rather cool as the 6 fet is heatsinked in the frame of my BlackComb. It fits nice under the seat frame area. Both bikes hit 40mph with pedal assist.

I wish there was a way to recover the settings you put in if you didn't write it down.

thanks for the info.

Dan

User avatar
anpaza   10 W

10 W
Posts: 69
Joined: Dec 07 2010 5:24pm

Re: XPD: open-source keywin e-bike lab replacement

Post by anpaza » Jul 09 2012 3:14am

Maximal controller current heavily depends on cooling. If you put it into a closed box, it will overheat even on moderate currents, if you provide it with a good air flow, you can get twice more amps from it. That's a important factor to keep in mind when designing your new ebike.

electraflyit   10 W

10 W
Posts: 78
Joined: Jul 08 2008 12:19am
Location: Toowoomba, Queensland

Re: XPD: open-source keywin e-bike lab replacement

Post by electraflyit » Jul 09 2012 5:52pm

I tried it on a basic EB306 from Keywin and it came up with 'Programed successfull' or something like that.
I can't try it on a bike yet until I upgrade it to 100v.

thanks for all your work
Eddie

User avatar
anpaza   10 W

10 W
Posts: 69
Joined: Dec 07 2010 5:24pm

Re: XPD: open-source keywin e-bike lab replacement

Post by anpaza » Jul 09 2012 6:32pm

Nice.

When somebody tests new XPD, I'm very interested what was the real battery current (measure with CycleAnalyst/ampermeter etc). Different manufactures use different shunt values, thus expect that the real current may be quite different from the programmed value.

For now I know about CellMan's controllers, he recommends programming his EB306 & EB309 by choosing EB312 in KEBL/XPD, and his EB312 by choosing EB312 and setting the current value twice smaller than desired.

I'll add the models EB306/CellMan, EB309/CellMan, EB312/CellMan in the final release, but for now just do like he says.

User avatar
amberwolf   100 GW

100 GW
Posts: 29879
Joined: Aug 17 2009 6:43am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: XPD: open-source keywin e-bike lab replacement

Post by amberwolf » Jul 09 2012 8:07pm

Since my Windows laptop has a power connector problem and won't run or charge the battery, and this will take several hours to disassemble, fix, and reassemble, I thought I would try an old Imac G5 with OSX 10.4 I have here, but Python Launcher can't open any of the XPD versions. I used to know a fair bit about the Mac, but have forgotten most of it in the last 5 years of not using any of that knowledge. :(

Python's IDLE will "run" XPD, but it doesn't actually run as intended, simply shows the script in action. I am not sure if it is showing me errors, or simply all of the script in "notepad" form. I can type up what it shows here, if necessary, but it's pretty long, and I can't copy and paste from that machine to this one.

I skimmed thru the thread and the XPD (and python) websites, and didn't see any info on troubleshooting XPD on a Mac.


What I will try to do for now is drag the bike far enough into the bedroom to get the programming cable to reach the Windows PC's USB port, and see what happens there. (XPD does run on this PC).

Post Reply