## E-Bike system – Part 2 – CAN Interface

The first part of the E-bike system will be a computer interface to connect to all the nodes using the CAN-bus. This will be used for diagnostics, parametrization and software flashing. This makes it the logical starting point before developing the other parts of the system.

There are several commercial tools for this. Of course I could have used one of them, but it’s more fun, and cheaper to build my own. The tool I’m used to, is CANalyzer from Vector which is extremely competent but also extremely expensive. CANalyzer woll be a big inspiration for the windows application I build to communicate with the hardware interface.

#### Windows application

The windows application will have some basic features for setting up a signal database and debug generic messages, but also some specific features for communication with the different parts of the E-bike system. The application is created in C# .NET using Microsofts free Community edition of Visual Studio

## Increasing the power of cheap eBay BLDC-controller

After installing sensors in the Turnigy 80-100 motor I needed a high current sensored BLDC controller. Since I’ve decided to use a 12 S LiPo battery the maximum voltage of the newly charged battery is 50,4 V with a nominal voltage of 44,4 V. Most high power e-bike controllers are designed to operate on >72 V and are quite large.

When i find the time I will build my own controller but for now, I want to modify a small 48 V 350 W controller, that I bought for \$25 from eBay, into something that is a lot more powerful. The key to increase power handling capability is to decrease the heat losses under high power. As a side effect, more of the energy in the battery will be used to move the bike and less to heat the controller.

the modification is done in a couple of steps described below.

## Replace transistors

The controller originally contained six STP75NF75 MOSFET which can handle a voltage of 75 V and (according to the datasheet) 75 A. The typical resistance when turned on is 10 mΩ which is quite high. Realistically I think six of these is capable of handling ~15 A continuously with decent cooling. I’m not even sure if they are genuine and 48 V 350 W will be ~7 A  so the original controller isn’t really pushing them.

Instead i will use six IRFB3006 which can handle 60 V and up to 195 A (again, according to the datasheet). The silicon could actually handle up to 270 A but the wire bonds between the silicon and the case limits this to 195 A. The typical on-resistnance on these are 2 mΩ, five times lower than the original FETs! Another popular transistor to use when modding e-bike controllers is the IRFB4110 which is capable of handling 100 V but not as much current as the IRFB3006.

## Beef up the PCB traces and wiring

The original high current PCB traces of the controller had some extra solder on them to increase the current capabilities. To increase this even further i added 3×1.5 mm copper wire to these traces. Compared to copper, solder is a pretty bad conductor so this will decrease losses and heating under high currents considerably.

There was one problem with this, copper and PCB laminate have different Coefficients of Linear Thermal Expansion, a view from the side reveals that the board got a little curved when soldering. I hope this doesn’t break anything.

The wimpy phase and battery wires on the original controller is replaced with 6 mm² wire instead to handle he increased current. And a lot of the special function wires on the controller are removed. I only need the throttle and brake inputs.

## Modify the current shunt

When I ordered this controller I was pretty sure that it were based on the Infineon XC846 ship as most china-made e-bike controllers are. These controllers can have the current limit and many other properties changed in software by connecting your computer ti the controller. Instead this controller is based on a STM8 microcontroller, maybe this is programmable but I haven’t found any information on how.

Instead of programming I can increase the current limit by decreasing the resistance of the current shunt. The processor measures the voltage drop across a short bit of wire with a known resistance to determine how much current the motor uses. If I for example decrease the resistance of this wire to half, the current will be twice of what the processor thinks.

Today I recorded two videos running the motor. The first one is just running the motor in sensorless mode. I actually got it running once in sensored mode but as soon as I started adjusting the sensor angle the controller fell back into sensorless mode. The throttle in this video is a tired 10k trimpot hence the uneven throttle signal.

I also made a small load test just holding the motor. In this video the motor is run on the lowest speed possible in sensorless mode. The battery used in this clip had a voltage of 46 V. Since the currentmeter maxes out at 5,5 A the load power I created is somewhere around 250 W

## Electrifying a Puch Maxi

I while ago I bought a Turnigy 80-100 motor to put on my bike. For several reasons, mechanical, electrical and self-preservational, I ended up putting a more suitable E-Bike hub motor on my MTB and the large Turnigy motor has been lying on my unfinished-projects-shelf since I bought it. Recently my brother told me he has an old Puch Maxi moped, where the original petrol engine were broken, that would be the perfect candidate for this motor.

The motor is just a little bit larger than a soda can and capable of producing 7 kW of power for short periods of time. It will probably be more safe to mount it on a moped instead of a bike considered the moped is built to handle a lot more power than a bike.

In Sweden, there are two classes of legal moped, where this is classified as ‘moped class II’ limiting the motor power to 1 kW and maximum speed to 25 km/h. With this motor the moped will be very illegal but I will keep it off public roads. It would however be interesting to limit the power and speed electronically and try to get every permit needed to use it in traffic. Sadly I suspect that’s impossible due to all bureaucracy involved.

The moped has a chain drive with a 415 chain, hence I needed a chainwheel matching this chain and the motors 12 mm shaft. I found the Swedish company Kedjeteknik that was very helpful and helped me custom make a 10 tooth chainwheel for 415 (1/2″ x 3/16″) chain at a reasonable price. There is a 12 mm hole for the shaft with dual stop screws. I really hope this will manage the ~5 kW of power I want to get out of the motor.

I bought the 180 rpm/V wind of this motor meaning the maximum rpm would be 180 times the battery voltage. This is quite fast with only a single reduction, especially on a bike with 26″ wheels. On the moped with 17″ wheels and a rewind of the motor this will be perfect.

The rear sprocket of this moped is 43 tooth and the wheel diameter is 17″. As a battery i will use the same type as on the MTB, 12 cells of LiPo in series resulting in a battery voltage of 44.4 V. As a rule of thumb the final velocity will be about 80% of maximal velocity. With this information the expected top speed can be calculated.

Motor speed using 44.4 V battery and 180 rpm/V motor

$180 * 44.4 * \frac{2\pi}{60} = 837 rad/s$

wheel speed after 10:43 chain reduction

$837 * \frac{10}{43} = 195 rad/s$

80% of unloaded speed with 17″ wheels

$195 * \frac{17 * 0.0254}{2} * 0.8 = 33.7 m/s = 121 km/h$

Which is a little too fast, half of that speed would be enough. Since the equations above are linear one way of achieving this is to rewind the motor for 90 rpm/V instead of 180 rpm/V. This motor is wound with 6 turns per phase and terminated in delta. By increasing the number of turns to 7 and terminating the motor in Y instead the resulting kV will be ~90 rpm/V. (I think I’ll write a more in-depth article about brushless motors in the future describing why)
Last wekend my brother and I made a motor mount out of 5 mm aluminum that bolts on to the original motor mount of the moped. I only have a picture from a mobile camera right now but I will update this post with better pictures in the future.

Next post will be about the motor modifications, which are extensive…

## Electric MTB

I’ve got a 6 km bike ride to work, the route is mostly flat but there is a high bridge I need to pass and the wind is not your friend when biking westward in Gothenburg. Despite this it is quicker for me to go by bike than public transport. The problem is that I do not want to be all sweaty when i arrive to work.

The solution: Put a motor on the bike

My bike is an Crescent Balder 24 speed mountain bike with front suspension and aluminum frame. Here in Sweden there are some regulations limiting an E-Bike to 250 W of power and a maximum speed of 25 km/h. That is not enough for me but I need a drive train that is possible to limit when driving on public roads.

After several hours of reading at the Endless Sphere forum I settled for a Nine Continents conversion kit including a 2809 rear wheel motor, 48 V 27 A motor controller, twist throttle, regeneration break handles and some other parts needed for the conversion. This kit has what is called an Infineon controller (based on the Infineon XC846 chip) and is programmable and possible to limit within legal limits.

This is a 12 MOSFET version of the controller with a somewhat splash proof aluminum case that i mounted on a luggage rack from Biltema. One of the reasons that i choose the Nine Continents kit was that someone wrote on the web that it was one least bad china made E-bike kits regarding weather resistance.

The motor comes already laced in a 26″ rim and has mounts for disc brakes and a 7-speed freewheel, the only thing missing is a tire.

The 2809 means that the stator and magnets are 28 mm wide and each stator tooth have 9 turns of wire wound around it. There are different configurations of this motor, for example 2807 which have 7 turns wind resulting in a faster motor. The 2809 has a top speed of 35 km/h, on flat ground with 48 V battery voltage, which is enough for me. The slower speed means that the motor will be more efficient than the faster one at slow speed, for example uphill or with strong headwinds.

To power the motor I use Lithium Polymer (LiPo) batteries made for electric RC airplanes. At the moment I have 4 Turnigy 5000 mAh 6S 20C LiPo Pack batteries with 6 cells @ 5.0 Ah each. These are connected together as two 12s1p (12 cells in series and one paralell) packs like the one below.

But the two packs can also be paralleled for a 12S2P pack with twice the range. The serial/paralell harness is made out of HXT 4mm Gold Connector for the battery, 10 AWG (~5,27 mm²) wire, a 30 A automotive fuse and a Andersson SB50 connector.

12 cells, at 3,7 V nominal voltage, in series results in a battery voltage of 44,4 V. 2 cells, of 5,0 Ah in parallel results in a total 44,4 V 10 Ah battery or 444 Wh of energy. My plan is to, at a later stage, extend this to 3 packs in parallel to 666 Wh of energy. Commuting to and from work with the bike has shown a energy usage of ~12-14 Wh/km. Mostly dependent on the amount of pedaling from me and wind speed/direction.

The battery specs say that they will deliver 20C continusly which means 20 times the capacity. My current battery with 10 Ah capacity will hence deliver a maximum of 200 A @ 44.4 V which is almost 9 kW of power.

There are a couple of different types of batteries used for electric bikes LiPo (which I use) has the highest power- and energy-density. The downside with LiPo is that they can be quite dangerous if you mistreat them, for example overcharge or puncture them in which case they will explode in a ball of fire. There are other lithium chemistrys for example LiFePo4 which are more stable but have lower energy density and much lower power density. There exists LiPo batteries that can deliver up to 90C while I haven’t seen LiFePo4 batteries capable of more than 10C. There are nickel and lead based batteries as well but they belong to the last century IMHO. Maybe I’ll write a more in-depth post about batteries, battery management and chargers in the future.

If you have any sort of experience repairing bicycles the install is easily made in a couple of hours, the most difficult thing was that the dropout has to be filed a little to suite the large axle on the hub motor. Since all torque from the motor is transfered through the dropouts the axle is 14 mm instead of the ordinary 10 mm bike wheel axle. The hub motor axle is flat on two sides making it fit in the 10 mm dropouts. Since the bend radius on the non-flat sides is 2 mm larger than on a regular bike wheel the frame dropouts has to be filed to a bend radius of 7 mm for a good fit.

Since an aluminum frame is not as strong as a steel fram I decided to use what is called a torque arm to strengthen the dropouts. When using a hub motor that delivers a considerable amount of torque to the small flat sides of the wheel axle this is a must if the dropouts should survive. For example a powerful hub motor on an aluminum front fork without torque arm could end bad if the motor manage to twist itself out of the dropouts and the wheel comes loose. The rear wheel is probably less dangerous but I still don’t want the bike to break.

In the picture above you can see that there is no wire to the rear derailleur. The bike is originally a 24-speed bike but the hub motor only has room for 7 sprockets. Since the gear lever was mounted on the handbrake lever on this bike the rear 7 gears had to leave room for the regenerative brake lever supplied with the conversion kit making this a 3-speed bike. The left gear and handbrake lever is still intact controlling the front derailleur and brake.

I have used the bike to commute to work for a couple of months now and it works perfect. I have some future upgrades I want to make:

• Move controller to water bottle mount
• Replace phase wires to 12 gauge
• Create fiberglass battery box
• Tidy up cabling

This time of the year the weather in Gothenburg usually not invite to biking so I’ll have the winter to perform these upgrades on the bike.