XPD: open-source keywin e-bike lab replacement

I suggest running 3 heavy gauge cables up to the handlebars.... when you want to slow down start rubbing the wires together :eek: Two will get you DUG DUG DUG DUG... three will send you right over the bars with the most amazing regen you have ever felt. The only trick is figure out how to get all that plasma and heat back into the battery.

Good alternative if you need a front light. Crowbar brakes are good for all sorts of things.

-methods
 
iovaykind said:
Has there been any development in regen settings other than 0(none), 4(weak), 8(strong), or 255(unlimited)?
I would guess that would require a change in the actual MCU programming in the controllers themselves--not something possible without the source code to them, and the ability to completely reflash the MCU.

Well, you could write your own code for the controller MCUs, but you'd be starting from scratch to do that, and presumably would need the developer's info for each MCU type from the chip manufacturers.
 
gwhy! said:
I will also post this up this is my v3 adaptor. The capacitor fixed quite a lot of issues for me when using the lead on different pc's .


Hello,
There was an error on this scheme. The switch should not be connected to the +5 V but the 0V. Here is the right schema:
forum259445_M.jpg


To see on our forum in France : http://cyclurba.fr/forum/259421/customisation-d-un-contrnileur-nO-base-chip-infineon.html?discussionID=3279#
 
I have my switch in the +5, so my diagram was correct for my setup but I dont really think it makes that much difference what line its in, i just think its better in the + line from a electrical point of view.
 
Thank you Andrey!

I've downloaded XPD and it's awesome. It is so much better than the old hexed config programs.

I wanted to compare the output of XPD before I sent data to the controller. I installed some virtual serial ports and collected the data using debug-read-EB3xx.py. I only found one difference between the hexed software and XPD in which data[27]=3 is hard coded. The hexed programs set data[27] to the index of the controller type. Setting data[27]=3 would indicate EB312. I modified my copy of XPD from trunk and included a patch below in case you're interested.

  • 1:EB306
  • 2:EB309
  • 3:EB312
  • 4:EB315
  • 5:EB318

xpdm/infineon3.py.diff
Code:
Index: xpdm/infineon3.py
===================================================================
--- xpdm/infineon3.py	(revision 67)
+++ xpdm/infineon3.py	(working copy)
@@ -79,6 +79,7 @@
         "Raw2BattCurrent"  : lambda R: (0.71 * R) - 0.1,
         "Voltage2Raw"      : lambda U: U * 3.184,
         "Raw2Voltage"      : lambda R: R / 3.184,
+        "ControllerType"   : 1,
     },
     {
         "Name"             : "EB309",
@@ -88,6 +89,7 @@
         "Raw2BattCurrent"  : lambda R: (0.71 * R) - 0.1,
         "Voltage2Raw"      : lambda U: U * 3.184,
         "Raw2Voltage"      : lambda R: R / 3.184,
+        "ControllerType"   : 2,
     },
     {
         "Name"             : "EB312",
@@ -97,6 +99,7 @@
         "Raw2BattCurrent"  : lambda R: (1.43 * R) - 0.1,
         "Voltage2Raw"      : lambda U: U * 3.184,
         "Raw2Voltage"      : lambda R: R / 3.184,
+        "ControllerType"   : 3,
     },
     {
         "Name"             : "EB315",
@@ -106,6 +109,7 @@
         "Raw2BattCurrent"  : lambda R: (1.43 * R) - 0.1,
         "Voltage2Raw"      : lambda U: U * 3.184,
         "Raw2Voltage"      : lambda R: R / 3.184,
+        "ControllerType"   : 4,
     },
     {
         "Name"             : "EB318",
@@ -115,6 +119,7 @@
         "Raw2BattCurrent"  : lambda R: (2.14 * R) - 0.06,
         "Voltage2Raw"      : lambda U: U * 3.184,
         "Raw2Voltage"      : lambda R: R / 3.184,
+        "ControllerType"   : 5,
     },
     {
         "Name"             : "EB306/CellMan",
@@ -124,6 +129,7 @@
         "Raw2BattCurrent"  : lambda R: (1.43 * R) - 0.1,
         "Voltage2Raw"      : lambda U: U * 3.184,
         "Raw2Voltage"      : lambda R: R / 3.184,
+        "ControllerType"   : 1,
     },
     {
         "Name"             : "EB309/CellMan",
@@ -133,6 +139,7 @@
         "Raw2BattCurrent"  : lambda R: (1.43 * R) - 0.1,
         "Voltage2Raw"      : lambda U: U * 3.184,
         "Raw2Voltage"      : lambda R: R / 3.184,
+        "ControllerType"   : 2,
     },
     {
         "Name"             : "EB312/CellMan",
@@ -142,6 +149,7 @@
         "Raw2BattCurrent"  : lambda R: (2.86 * R) - 0.1,
         "Voltage2Raw"      : lambda U: U * 3.184,
         "Raw2Voltage"      : lambda R: R / 3.184,
+        "ControllerType"   : 3,
     },
     {
         "Name"             : "EB318/CellMan",
@@ -151,6 +159,7 @@
         "Raw2BattCurrent"  : lambda R: (4.28 * R) - 0.06,
         "Voltage2Raw"      : lambda U: U * 3.184,
         "Raw2Voltage"      : lambda R: R / 3.184,
+        "ControllerType"   : 5,
     },
 ];
 
@@ -171,6 +180,7 @@
         "Widget"      : infineon.PWT_COMBOBOX,
         "Range"       : (1, len (ControllerTypeDesc)),
         "GetDisplay"  : lambda prof, v: ControllerTypeDesc [v - 1]["Name"],
+        "ToRaw"       : lambda prof, v: v,
     },
 
     "PhaseCurrent" :
@@ -677,7 +687,7 @@
         "SensorAngle",
         "PASMaxSpeed",
         "LimitCruise",
-        3,
+        "ControllerType",
         0,
         0,
         0,
 
cwah said:
Can it work for mac?
I'm going to have to go ahead and confidently say yes. However, it won't be simple.

XPD needs:
  • Python 2.7
    Python runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java and .NET virtual machines.
    http://python.org/
  • PyGTK 2.24
    PyGTK applications are truly multiplatform and they're able to run, unmodified, on Linux, Windows, MacOS X and other platforms.
    http://www.pygtk.org/
  • PySerial 2.6
    This module encapsulates the access for the serial port. It provides backends for Python running on Windows, Linux, BSD (possibly any POSIX compliant system), Jython and IronPython (.NET and Mono).
    http://pyserial.sourceforge.net/pyserial.html

    Relevent Mac OS X support code from http://sourceforge.net/p/pyserial/code/HEAD/tree/trunk/pyserial/serial/serialposix.py
    Code:
    elif plat[:6] == 'darwin':   # OS X
    
        version = os.uname()[2].split('.')
        # Tiger or above can support arbitrary serial speeds
        if int(version[0]) >= 8:
            def set_special_baudrate(port, baudrate):
                # use IOKit-specific call to set up high speeds
                import array, fcntl
                buf = array.array('i', [baudrate])
                IOSSIOSPEED = 0x80045402 #_IOW('T', 2, speed_t)
                fcntl.ioctl(port.fd, IOSSIOSPEED, buf, 1)
        else: # version < 8
            def set_special_baudrate(port, baudrate):
                raise ValueError("baud rate not supported")
    
        def device(port):
            return '/dev/cuad%d' % port
    
        baudrate_constants = {}
 
cwah said:
Thanks, I'm already drowning :lol:

I don't even know how to install them on my mac with the source :lol:
If getting it running natively on Mac OS X is to much, you could always install VirtualBox with Windows 7 inside. There are binaries for all of the necessary Python components for Windows. Then it's just of a matter importing the USB serial device into VirtualBox which is straightforward. If you have any ambition to program your controller, I think it is worth the effort.
 
Does XPD works with EB312 controllers?

How to install on a (very) old WinXP notebook?

I want to use the RS232 serial port without using a USB-to-RS232-serial-converter. Is this possible?
I know in this case I have to use a RS232-level-to-TTL-level-converter (MAX232).
 
kifukarider said:
Thank you Andrey!
I wanted to compare the output of XPD before I sent data to the controller. I installed some virtual serial ports and collected the data using debug-read-EB3xx.py. I only found one difference between the hexed software and XPD in which data[27]=3 is hard coded. The hexed programs set data[27] to the index of the controller type. Setting data[27]=3 would indicate EB312. I modified my copy of XPD from trunk and included a patch below in case you're interested.
Thank you a lot! I had the impression the byte 27 is just always '3' standing for third version of the controller (e.g. EB3xx) but it seems I just checked with EB312 :)

Anyways, it looks like that byte is not used anyway, as nobody had any problems programming all types of controllers. However, I have included your patch and it will be in next version. Thank you once again! :)

As for MacOS, you need a relatively recent PySerial version that supports MacOS. XPD itself will list any /dev/tty.usbserial* devices it finds in the drop-down list. Of course, you will also need to set up PyGTK.

I would be glad if someone could put up a working instruction for MacOS, as I don't have access to any Mac. I get regularily questions about this.

P.S. I'm sorry to appear here so seldom... I work on two jobs, and doing some volunteer work, so I have literally zero free time.
 
e-doc said:
Does XPD works with EB312 controllers?
How to install on a (very) old WinXP notebook?
Just like on any other windows system.

e-doc said:
I want to use the RS232 serial port without using a USB-to-RS232-serial-converter. Is this possible?
I know in this case I have to use a RS232-level-to-TTL-level-converter (MAX232).
That's possible, under Windows that'll work out of the box (serial ports are always COM*), under Unix you'll have to modify xpdm/scanposix.py and add /dev/ttyS* to the list of serial ports to show in the drop-down list, under Mac you'll have to add /dev/cuad* to that list.

And don't forget the level converter, you'll blow the controller if you connect RS-232 directly (it uses +/- 12V voltage levels while MCU wants 0-5V).
Also you'll have to get somewhere +5V to feed the MCU, otherwise it won't work (and you need a way to turn +5V on or off, to be able to reset the MCU).
 
jovae49 said:
gwhy! said:
I will also post this up this is my v3 adaptor. The capacitor fixed quite a lot of issues for me when using the lead on different pc's .
There was an error on this scheme. The switch should not be connected to the +5 V but the 0V. Here is the right schema:
forum259445_M.jpg
That's interesting and it could help to the problem that many experience that controller isn't accepting commands even after the voltage switch being turned off and on again.
That could happen because of the parasitic feed via the TX pin, the switch on VCC won't interrupt the TX pin, thus the MCU could not be RESET by interrupting the VCC line.
By interrupting the GND we will cut off the voltage feed both through VCC and TX pins, thus this approach looks more safe. But the button should be normally OFF, on your drawing it's normally ON.

The best would be to use a dual-switch button to interrupt both GND and VCC... and perhaps even to short the VCC side of the controller to GND (when the power to controller is OFF), to discharge the VCC capacitor inside the controller.
 
I bought the 12 FET IRFB3077 INFINEON CONTROLLER (MOTOR WITH HALL SENSORS) from EM3EV from Paul.

How do i know which profile i should be using by default with XPD?
There is a profile '12FET default' preset 2 different controller version Infineon 2 & 3.

Been advised from LBS (who are also on this forum) to set it lower than the factory as it will shorten the life of my batter
I'm trying to set the battery current limit & phase limit down. Batter from 30 to 20, and Phase from 'x' to 30A
 
Could you list what you are trying to control.
Notor, battery v & ah and bike and weight.

I don't think you will be happy with 30a phase. that is like putting a 24v battery in a 48v system.

If you bought it from Paul, why not use his software and his settings first. Then make adjustments. I know there is no way to see what your controller is set at before reprogramming it. paul should have a factory setting that you can adjust.

I do know that 30a phase didn't work for me.

Dan
 
Nuts! its too late now. I've already resetted to one of the profiles on XPD! ;p
i'll get on to Paul.

The eLBS said the battery from Paul are good for a first ebike, He's just advised to lower the amps on the controller to try prolong the life of the battery.

MAC 8T Rear, Controller Type: 12 Fet 40A (36-52V, IRFB3077), Battery: 50V 12.3Ah 580Whr
http://www.changebike.com/product_fb_df-609D-W.html 13kg folding mountain bike.
Also - how do i know which model this is? EB312 or EB212?

@Dan - what do you mean the 30a phase didn't work for you? Do you have a similar battery?
 
just open the controller. there it's written on the board. 312 or 212. i don't think there is a way to determine from the outside. on the other hand if this is quite new it's 100% a 3xx series. 2xx where sold some 2 years ago.
and especially for the mac paul started bundling it with the 3xx controllers as they match better with high rev motors.
 
I am running a 8t MAC with a EB312.
battery wise has been from 12s or 15s LiPo. The motor was very weak if I ran 30a battery and anything less than phase 2x battery.

Rather sure you have a EB312 since Paul only lists the programming cable for it. Unless you bought it a few years ago, which he didn't offer that battery back then.

I am guessing the it's the INR18650-20R cells which are rated for 10C. Which pack do you have? The 580 w/h or the ??

All you can do is try it. Don't like it change it, that is what this is all a bout.

Dan
 
I have just read through this whole thread and please let me say thanks to you all for the fine work and help over the last couple years. Anpaza, well done! It has been a big help to me and I feel a bit better equipped to work out the problems I am having flashing the controller on my just finished build http://endless-sphere.com/forums/viewtopic.php?f=2&t=55605. Got some good techie friends though so I am sure we can get it sorted. May have a few questions later. Am currently working on safely installing this cruise module with teklektik (another saint):
image.jpg
I just really like the convenience of it over the CA method. Hope to report back with instructions on the CA V3 thread when we get it working properly. Obiwan
 
kifukarider said:
cwah said:
Thanks, I'm already drowning :lol:

I don't even know how to install them on my mac with the source :lol:
If getting it running natively on Mac OS X is to much, you could always install VirtualBox with Windows 7 inside. There are binaries for all of the necessary Python components for Windows. Then it's just of a matter importing the USB serial device into VirtualBox which is straightforward. If you have any ambition to program your controller, I think it is worth the effort.


I didn't see this thread. But i got the XPD working on my MacBook Pro. It was a little bit of a struggle but if some of you are interested i can tell what i did.
If it works for more people we could share the information how we got it to work.

Let me know if somebody would also like to try it!
 
Obiwan007 said:
Bart, I would love the information on how to get this working on a Mac. Please do expound! Obiwan

Ok here we go ;)

Download the XPD software for mac:
http://prdownload.berlios.de/xpd/xpd-0.3.2.tar.bz2
Just unzip somewhere you prefer.

Download the driver for the usb serial cable:
http://plugable.com/drivers/prolific
And I followed the instruction on this site to check if everything went well:
http://plugable.com/2011/07/12/installing-a-usb-serial-adapter-on-mac-os-x/comment-page-2
remember the IODialinDevice my one was “/dev/tty.usbserial” you will need it later on.

Download and install Python:
https://www.python.org/download/

Download and install pySerial:
https://pypi.python.org/pypi/pyserial >> pyserial-2.7.tar.gz (md5)
Unzip it and install it from the Terminal program:
Go to the pyserial directory the command looks something like this if (you are in the directory where you unzipped it):
cd pyserial-2.7
and run the following command
sudo python setup.py install

Change settings in for XPD software:
Go to the directory where you unzipped XPD.
There you will find the file “scan_posix.py” in map xpd-0.3.2/xpdm.
Change de code “(glob.glob('/dev/ttyUSB*')): “ to the information of IODialinDevice which we found in step two. For me I had to change it to “(glob.glob('/dev/tty.usbserial*')): “

That’s it!
When you start xpd you get an error that the file xpd.svg can’t be openend. That’s not a problem. I think you can change it by first change the file type in something Mac knows and change the reference in the gui.xml.
 
joss76 said:
other , I test yesterday to use XPD whith EB806 board but it's don't work ? it's though a XC846 infineon chip ...

I too have a 6-FET controller, Infineon XC846 chip, EB806 board (which is supported by KeyWin Ebike-Lab ParameterDesigner.exe).
I am right in assuming that the EB206 settings will not work in XPD?

Many thanks! Regards, Dan
 
Back
Top