1+1=3: Planning and creation of a 2WD fast electric bike

Show off your E-bike creation here.
Post Reply
thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 02 2019 1:54am

Last summer, I built an electric bike to take me 12.5 miles from Medicine Lake, Montana to Froid, Montana. Using a simple hub motor kit I purchased off of eBay, it had a 28 MPH top speed, 1kW of power, and ran off of a 12S9P pack of 26R cells. It got me to Froid easily, but struggled to get me back to Lake without having to pedal the last 5 miles. As a result, I added 3P more cells to my pack, and it made the round-trip journey without pedaling, as long as there was no headwind. That bike used no custom components (aside from the battery), and was "Version 1".

After finishing rides where the LVC cut out, I noticed that I still had 3.6 volts, nearly half of the battery, remaining. The factory gauge built into the throttle read empty, but there was still plenty of juice. That led me to the first round of controller modifications. I performed https://endless-sphere.com/forums/viewt ... 4#p1399161 [resistor mod] to eliminate the LVC, as well as increasing the shunt current from 26 to around 35 amps. The bike had quite more acceleration and range, but the top speed was unchanged, due to the winding of the motor topping out at 28 MPH, regardless of the current. For LVC, I used "LiPo buzzers" on the balance plugs. This bike was my "Version 2".

Sure, the bike got me where I was going (I didn't have a license quite yet at that time, just a learners permit), but it wasn't much fun to tool along at 25-28 MPH for 12 miles of straight, endless highway. I decided to make some serious mods. I stuffed an Arduino, hall-effect current sensor, temperature sensor, and various other things inside the controller and motor as well as eliminating the shunt entirely. This new bike could do 35-38 for short bursts, but going much over 30 continuously killed the motor, as did not slowing down when going up a long, 1-mile hill. It got me there a little faster, but still lacked hill-climbing power and the batteries got a bit warm (around 40c in the summer). In addition, the motor loved to overheat, despite me drilling holes in the motor. For monitoring, I had the Arduino drive a couple of LEDs through a shift register. Really high tech :D . This was my "Version 3" and I used it for about a month.

After receiving 800 feet of magnet wire for free that the school was throwing away, I decided to use it to upgrade my motor. I ended up with significantly better copper fill (the motor was jam-packed with wire), but it made the motor vibrate a lot. I also upgraded the 7-LED display to a 4x20 LCD display powered by an I2C line running from the Arduino, giving me a lot more room to display data, as well as having settings (such as max current) that were adjustable while the bike was powered on and stationary. Despite the new windings, performance actually decreased a little, due to a reason that I didn't discover until 6 months later. Range was the same, and bringing the charger along ensured I got back with plenty left in the batteries, even when pushing the motor to it's limits. This "Version 3.5" was what I rode all summer, with a nagging suspicion that something wasn't right.

After that summer, I moved to college (Montana State) and used the bike as a general car replacement. Pumping 2kw+ into the 1kw motor made it vibrate horribly and get hot fast, but it got me up the short hills that I had to climb. Something just wasn't right, though. I knew that the increased copper mass should make the bike more powerful, but that wasn't the case.
Given that the bike was vibrating so much, I decided to experiment (with another Arduino) to change the timing of the motor and thus the phase angle. After this change, the motor ran a lot cooler and vibrated a lot less. To this day, I still have an Arduino Nano (potted in epoxy) zip-tied to the frame. This "Version 4" motor setup was capable of going around 35 for medium distances, although the battery, made from low-current cells, was by far the weakest link.

This spring, I designed and built a new 12S12P battery pack from Samsung 30Q cells from NKON, along with the cells from my old pack with the best internal resistance and capacity figures (the IR varied, for the old cells, from 20 to 45 mOhm, and the capacity for some to the cells was above the rated 2600mah). That new pack can do 30 amp hours from 4.1-3.3v, and barely sags at all. Top speed is now around 35 continuous on the flats, but the single hub will always bog down going up long or steep hills.

You are probably wondering, now, how 1 + 1 is 3. At first it doesn't make sense. If you have 2 1kW hub motors on a bike, you should get 2kW of power. Wrong. Hub motors (and BLDC in general, esp. at low speed) are rated by continuous torque instead of continuous power. Going up steep hills, even while backing off on the current, was still causing overheating due to the high torque generated. With twice the torque, I will get sqrt(2) times the speed, and sqrt(2)^3 times the power, which is around 2800 watts, which is close enough to 3000 to say that 1 + 1 = 3. According to my calculations, the bike should be able to do 46 MPH continuous on level ground. Given that I will only be riding at 35-38 for a semblance of safety (40+ is way too fast). My dream of me limiting the speed instead of the overheating motor or battery will have finally have come true. This bike will be called "Version 5" when it is all said and done. I don't think I'll ever need to do a "version 6".

Going high speeds for long distances requires big batteries, and even the 1300 WH pack I have now is not enough to comfortably make it back without charging, given how un-aerodynamic my setup is (especially when I am wearing a bulky raincoat). The cells from my old battery are now sitting around, some as part of an 8s8p pack for a subwoofer (that's a whole different novel) and the others are sitting in a box, charged to storage voltage, and unused. I plan on making a 12s8p pack of those to go in parallel with my main pack. Given the massive amount of battery (nearly 50 amp hours), the battery will not even be running at 1C continuous and thus matching of cells is not critical.

Calculated specs:
Continuous speed: 46 MPH* (33 MPH * sqrt 2)
Continuous power: 3 kW ((sqrt 2) ^ 3)
Top peak speed: 53 MPH (!!)* (38 MPH * sqrt 2)
Peak Power: 4.5kW (For a minute or two)
Range at Top Continuous Speed: 28 miles (with extra battery)* (46 MPH * 2/3 hours - increased heat losses)
Range at 35 MPH: 63 miles (with extra battery)* (28 Miles * (46/35)^3)

* (With the basket empty and a 180lb rider with only a light jacket)

(Real-life tests will be conducted and posted sometime May 2019)
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 02 2019 1:54am

Here are some photos of my old setup, with a comparatively whimpy 40 amp max battery and one motor. It still got me up to 30something on the flats.

The battery:
Image

The motor:
Image

The disgusting Flex-Sealed controller:
Image
Last edited by thorlancaster328 on Apr 26 2019 1:54pm, edited 1 time in total.
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 02 2019 1:54am

The battery is made from 12s10p of Samsumg 30q cells, along with the 24 2600mah Samsung cells that had the lowest IR from my old pack. So far, it hasn't even got the slightest bit warm, as my setup only draws around 45 peak amps and this pack should easily do 100 continuous. Total usable capacity between 4.15 and 3.3 volts is about 30.5 amp hours.
Image
Last edited by thorlancaster328 on Apr 26 2019 2:00pm, edited 1 time in total.
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 02 2019 1:55am

Rear hubmotor from bike, it's spent a winter outside and even gotten frozen once. Thanks to the plastic waterproofing spray on the windings, there is virtually zero corrosion. The black stuff on the rotor magnets is just hardened brake pad dust, it came off easily with alcohol and a brass-bristle brush.
Image


Here is the rotor, had some brake dust on it too, but the plastic waterproofing spray resulted in no corrosion whatsoever. It'll get cleaned and another coat or two this summer when I upgrade the phase wires and go sensorless (I just found out about a week ago that my controllers can do sensorless just fine).
Image
Last edited by thorlancaster328 on Apr 26 2019 2:21pm, edited 1 time in total.
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 02 2019 1:56am

Placeholder for improvements, coding and electrical tweaks, and the much-awaited test results.
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

bakaneko   100 W

100 W
Posts: 112
Joined: Oct 25 2018 6:25pm

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by bakaneko » Apr 02 2019 7:35am

I hope you are studying electrical engineering in college. You will make a good EV or electric bike engineer one day, mah friend. Keep up the experimenting, tinkering, and good work :thumb:

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 02 2019 2:32pm

I am majoring in computer science and minoring in electrical engineering. With those two skillsets, the possibilities will be endless once I graduate from college.
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 26 2019 2:11pm

A few final exams are out of the way, and I've upgraded the front controller with a hall-effect current sensor and soldered a copper wire halfway down the shunt to increase the max current to 65 amps (which I'll never use, just keeping built-in cycle-by-cycle limiting as a fail safe). Unfortunately, I did not take any pictures of the front controller and now it's been programmed and sealed up tight :oops: Right now, I am working on modding the rear controller. It's a bit more complicated than the front controller, with a regen brake and optoisolators to allow the serial communication to function reliably in the presence of obscene amounts of common-mode noise.
The wiring on the regen brake FETs is not that beefy, it doesn't matter because I won't be doing any more than casual slowing down with the regen brake, around 15-20 amps max depending on how initial testing goes.
Image

The front side of the controller just has the LM2596HV module on it to provide 12v to power the soon-to-be-added Arduino Nano and the FET driver for the regen brake. That clip on the back is eventually going to hold a thermistor for monitoring the FET temperature, I also have one in the motor.
Image
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 26 2019 2:31pm

To control and monitor two hubmotors and all their associated paraphernalia, a simple Cycle Analyst was not going to cut it, never mind how expensive it is. At the heart of my build is a waterproofed LCD display secured into a waterproof box with copious amounts of GE Silicone II caulk. The whole thing is powered by an Arduino Nano and the three modules (master, slave 1, and slave 2) will communicate with open-collector Serial running at either 9600 or 19200 baud. (9600 if 19200 causes problems). Only thing left to add to the main controller is a DS3231 EEPROM/RTC module. After setting the trim registers on the DS3231, it should be accurate to within 10 seconds per year. It's crazy how cheap and accurate modern timekeeping devices have become.

Image
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 28 2019 8:50pm

I had finally got it working. The motors were spinning up at the same time, the sensors were calibrated, the PID loops were tuned, and the regen brake was smooth and the FETs for the regen were barely getting warm. After making a few last-minute tweaks in the code, I spun the wheel to test the regen and everything seemed to be working well. I noticed a faint burning smell, but dismissed it as being from soldering through superglue (I rerouted the regen brake wires because the FET with the long, inductive wire was getting hotter than the rest).

Upon plugging the bike back in (with a thin fuse wire in line with the battery), flame and smoke shot out of the controller :oops:. The fuse had blown and the cheap Chinese LM2596HV module had also been blown away.
The destroyed regulator:
Image

I disconnected the controller from everything else and plugged it into my computer. The power light came on dimly, but the microcontroller was long gone. A few seconds later, the Arduino Nano began to smoke and I unplugged it. I desoldered the wires running to it and replaced it, as well as replacing the NCP5181 gate driver for the regen FETs that had also been blown away by the overvoltage event.

Fortunately, the factory controller board, the opto-isolators, and everything else on the bike tested out fine. I'm really glad I decided to use optoisolators between controllers, or I would have likely blown every component on the bike with battery voltage through the 5v rail :?.

From now on, I'm using a 1/8 watt, 1 ohm resistor between vBatt and the LM2596HV voltage converter module. If it decides to fail, it'll be a 1 cent resistor instead of around $7 of additional components up in smoke. I also think the way-too-small replacement capacitor could have been a factor too.
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

User avatar
amberwolf   100 GW

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

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by amberwolf » Apr 29 2019 12:59am

FWIW, there have been (numerous?) reports of the regulators on those converter boards being counterfeit, and unable to handle anything like the genuine part's specs for voltage (and current).

So, you may wish to find an alternate (more reliable) kind of converter. ;)

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 29 2019 1:08am

I've got a power zener across the output and a low-value low-watt resistor on the input, so if it fails it shouldn't take out more than the resistor and possibly the diodes. If that happens, I'll just buy a genuine one from Arrow or Mouser and replace the dud one.

The one in my (currently front) controller has been running for over a year on a 12s pack with no issues. I'll add the same safety features to that regulator as well.

[Edit]
Damn! The overvoltage on the 5v line also shorted out the hall-effect current sensor! :oops: Good thing Prime is only two days.
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

User avatar
amberwolf   100 GW

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

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by amberwolf » Apr 29 2019 1:43am

Zeners on the 5v and other lines, too, sounds like a good idea. ;)

My experience with systems is that generally anything that can go wrong will, at the worst possible moment, and take out as many other parts of the system as it possibly can.... :/ And sometimes the failures induced aren't complete failures, just damage sufficient to allow complete failure when the system is under stress (like when you're using it at a critical moment).

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » Apr 29 2019 3:48pm

It was definitely a good idea to put zeners on the power rails. During testing the regen brake, I was spinning the wheel with the pedals and heard a faint pop. It's likely that the few-volt spikes generated by regen, plus a nearly fully charged 12s battery, pushed the Chinesium LM2596hvs over the edge.

Fortunately, nothing else was damaged other than the 25¢ zener (which failed hard short, saving the rest of the board) and a 1¢ 1/16 watt 1 ohm resistor (which blew like a fuse). I've put in an order from Arrow for genuine LM2591HV voltage regulators (same exact pinout), as well as throwing in a few 256KB I2C EEPROMs for datalogging purposes.

Moral of the story: :warn: Make sure all power components are genuine or suffer the consequences, even if it's more expensive. I would have saved money if I would have done this in the first place. Lesson learned.

The bike should be good and working once the parts arrive, most likely this Wednesday. I can't wait to ride it :D
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » May 06 2019 1:08pm

I was expecting to finish the bike sooner, but with college and finals and whatnot, it got pushed to the back burner and I have just now finished it. The wiring clutter of last year's setup is long-gone, with only a serial cable and battery power running the length of the bike. I've also nearly doubled the battery capacity to a whopping 49AH/2200WH size, and range anxiety should be long gone.

Image

This cavity used to be stuffed with coiled-up throttle, brake, and various other wires
Image

My initial guess of 52MPH top speed and 46MPH continuous also turned out pretty accurate, I managed 50MPH for 3 miles on a half-full pack and the motors were only around 40°C above ambient temperature. The limiting factor will be me, not my bike, as I do not want to go 50 or even 40. I'll probably set the cruise control around 33-35MPH for longer rides. I'll post a video of this thing hitting top speed sometime soon :)

As for range, the bike was doing around 35-40 watt hours per mile on level ground with no wind at 30 MPH. That's around 55-60 miles of real range on a full pack under good conditions (no wind or big hills). The battery pack is a tight fit in the triangle, and I have 3-4 layers of sheet metal and tape around the cells at all frame contact points to protect the cells, as well as copious amounts of silicone around the cells themselves.

The "Cycle Analyst" is the only thing left to finish now. I still have to add a password system, a clock setting function, a headlight control, and various other settings and features. Once I have finished, polished, and documented that project, it'll end up in a separate thread. I'll warn you right now in advance that it's not going to be a simple project to assemble, as there is a lot of soldering, filing, and calibration needed. Basic programming knowledge will also be required, as will PID loop tuning per controller.

Photo of the entire bike (Inside because I'm still working on the code). It could almost pass for a bicycle :lol:
Image
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

thorlancaster328   1 W

1 W
Posts: 52
Joined: May 25 2018 3:20pm
Contact:

Re: 1+1=3: Planning and creation of a 2WD fast electric bike

Post by thorlancaster328 » May 31 2019 7:10pm

June 2019 Update
The "Cycle Analyst" device is largely finished and I have uploaded the code to my Github repo at https://github.com/thorlancaster/electr ... controller. The documentation is not quite there yet, but all the code and a few sparse schematics are in the repository. The three controllers are wired up using an open-collector opto-isolated Serial bus with the closest controller to the master controller powering it. If you have lots of electronics experience, you can dive in at this stage, but most will want to wait until I have it buttoned up. I'll start a dedicated thread on it soon.

YouTube Video
<rant>
My old HP computer, about two weeks ago, would not turn on for no apparent reason. Upon opening it up, I found that the screw to the hinge had broken off due to the plast-o-loy frame flexing whenever I opened the lid and ripping the ribbon cable to the power button. The other side was showing the same symptoms as well, so the only fix would be to get the whole case of the computer replaced for around $150. I decided to just buy a new used computer off of eBay, and I chose a Dell with a Magnesium alloy chassis for only $99 and I am very satisfied. Compared to the new "lightweight" HP, the difference in build quality (and battery life) is night and day. Why do they have to use Chinesium in all modern products?
</rant>
The video has been on my phone for a while, and today I finally got around to installing the necessary programs to get the files off of it, and uploaded the video to YouTube. If it still says "Processing", it should be done within the hour. Check out the video here: www.youtube.com/watch?v=4MuIWC-3-lw

Solar Charging updates
The MPPT works okay, with a bit of lag (30s) as it finds the MPPT. There is an error in either the slave#2 or master firmware that results in the amps being rounded to the nearest 10th of an amp, which causes some MPPT hesitation. It's a minor issue, I'll fix it when I have the time. Efficiency is around 85-90%, plenty for my purposes. Thinner motor laminations would improve that number, it's just cheap 1kw Chinese motors on this thing.
Find weakest component, upgrade it, repeat until satisfied. Rome was not built in a day.
When in doubt, get bigger MOSFETs / Batteries / Motors / Etc.

Post Reply