Custom E-Bike
Goal : Construct E-Bike using reclaimed E-Scooter motor
Specifications/Research :
For one reason or another, I have always had the desire to attach a small gasoline motor to a bicycle. In more recent years, this has evolved into the desire to electrify my mountain bike. Given that electric bike conversion kits of reasonable quality cost at least $400 WITHOUT a battery pack, I started searching for a used motor online.
Progress log :
- 10-03-22: I picked up a used electric motor off craigslist. It had previously been installed in an electric scooter. While a hefty enough looking unit, a comparatively meager $80 netted me zero documentation, diagrams, or even company markings on the motor. It was composed of three pieces: the motor, the sprocket housing, and the mount. It had a black and red pair of lower gauge wires I guessed were its battery connections and a multicolored set of higher gauge wires that I guessed were used to control the motor.
- 11-01-22: After fully disassembling the motor and still finding zero indication of its origin, I did at least figure out that the motor was a DC brushless motor and was mated to a planetary gearbox. I also identified which of the smaller wires were ground wires by confirming continuity with the negative battery connection. After plugging the larger wires into a DC power supply set to a conservative 24V, I noticed that one of the ungrounded smaller wires was holding at five volts. After researching e-bike throttles, I realized my setup was likely the common one: A ground wire, a 5V wire, and a third wire that acts like a potentiometer between the first two. This third wire has a voltage reading between 0 and 5 volts depending on the throttle's position. Using a second DC supply to simulate this, I applied a 1.5V test voltage to the third wire and was rewarded with the motor's motion. After my suspicions were confirmed about the first five, I determined the last two wires to be some variety of kill or start switch; immediately stopping the motor's rotations when connected.
- 01-10-23: While being mounted to a steel plate orthogonal to the motor's axis of rotation, I was going to need some sort of base to actually attach the unit to my bike's frame. I had long considered the best place to put the motor; eventually setting on using the front water bottle mounts and mechanically connecting the motor to the front sprocket cassette. The downside of this setup is that the motor will be connected to the crank arms when turning. The upsides are that the bike remains functional with or without the electric motor and that the amount of mounting hardware I would have to design would be minimized. I initially wanted to build it out of stacked lengths of square aluminum stock, but quickly realized I would have to remove far too much material for sufficient rigidity to be maintained. Somebody had recommended that I simply use a piece L shaped steel stock and I came to conclusion that it was worth a shot. All I had to do was correctly drill its two alignment holes whose position was determined by splitting the difference between caliper measurements of the motor and bike. Next, I drilled and tapped the three holes receiving the bolts that fix the motor to my steel mount. After removing as much excess steel as I felt comfortable doing, I smoothed its edges and tested its fitment with the motor. While I didn't have access to 100% of the motor's chain tension adjustment, I had at least an inch and a half. This translates to around three inches of slack in the chain which would be plenty. Also around this time, I ordered two separate low-power volt meters; allowing me to get readings of my individual 12V cells instead of the full series voltage. To attach to my handlebars, I 3-D modeled and printed a simple two piece design that combined with wood screws.
3D printed volt meter enclosure
- 02-16-23: At this point, I found a fatal flaw in my design: the sprocket already attached to the motor had teeth completely unlike the ones on my bike's sprockets. Due to having an outer diameter less than two inches and an inner diameter of precisely 3/4", I was unable to source an off the shelf solution. I had tried ordering what looked like a correctly sized sprocket from a gas motor bike website but was unable to adequately repurpose it. Frustrated, I just decided to try designing one in CAD. With numerous careful measurements and several comparative glances, I recreated a version of my motor's sprocket with the appropriate teeth size. I 3-D printed a 1:1 scale model and installed it into my bike with a new one-way bearing. To test my mount's rigidity and my sprocket's movement, I did some mountain biking with my motor and its connecting chain installed. Unfortunately, the two screws usually reserved for a water bottle did not do enough to secure the motor. Every bump caused the motor to shake around up to 1/2" out of alignment. To fix this, I added two sets of slots equidistant from the original mounting screws in order to attach the motor mount with two hose stainless steel hose clamps. I also painted the main piece black. All that being said, the test sprocket worked well and after some small tweaks to the tooth geometry, I was ready to make my sprocket out of metal.
CAD model of new sprocket
Steel motor mount with hose clamp improvement
- 05-12-23: While I had initially planned to CNC my sprocket out of steel stock for obvious reasons, two things convinced me to switch to aluminum: ease of machining and the fact that the front sprocket cassette was made out of aluminum. With a fair bit of assistance, I used fusion 360 to develop the CNC commands. For my first attempt, I used a smaller, older 5-axis machine relegated to smaller jobs. While I had used the CNC for carving wood for a custom speaker cabinet project, milling metal was significantly less forgiving; forcing me to absolutely ensure my setup was properly adjusted. Still, I started my first run with the execution speed turned way down until I was sure everything was moving how I wanted. Even with my careful setup and start, I noticed at the beginning of the third operation that something was amiss. I stopped the machine and found that the z-axis had become increasingly unaligned; slowly sinking and milling deeper than was intended. Even though this piece of metal was unusable, I adjusted many of the CNC commands' settings to slow the movement of the milling operation somewhat. After securing another piece of metal and allowing the machine to be rigorously inspected, it was time to try again. Starting slowly like the first time, I realized, much more quickly, that the same issue was occurring. After stopping the milling and adjusting the settings again, I was ready. This time, I had someone much more experienced in metal CNC check off my CNC commands. With this confirmation, I made one final attempt on the older machine. This time, I changed the order of operations to do the largest milling pass first in order to see if it is acting up. This turned out to be a good idea because I immediately saw that the same issue of the z-axis becoming unaligned was occurring again. At this point, I was pretty sure my CNC commands were not erroneous and I was encountering a hardware issue. Frustrated, I knew that I only had one more attempt with this piece of metal, so I wisely took some time to rethink my strategy.Failed sprocket, you can tell by the corners that the bit was drifting down when it shouldn't have been as it milled inward
- 05-15-23: At this point, my previously mentioned CNC mentor had started to pity me and agreed to use their newest machine for my project. Running my same CNC program, this new machine milled up my block of aluminum with great haste and precision. To make sure my bearing fit with sufficient clearances, I programmed the inner bore operation to be slightly undersized so that it could be slowly, manually enlarged to the final diameter. After this was done, the bearing was pressed in with a small amount of glue. To reduce CNC programming and possible retooling, I had previously removed the chamfer from the faces of the teeth. To add this to my finished gear, I put a 1/2" dowel about 8" long inside a drill chuck that grabs the inner part of my one way bearing. While spinning the dowel shaft, I slowly pressed the faces of teeth in a belt sander; assuring the gear and belt sander spun in opposite directions. Repeating the process for both sides, I slowly added in a ~5° chamfer. Once I was happy with the results of the sanding, I tested the sprocket on my bike chain and saw that it interfaced very cleanly with little play. I installed my finished sprocket into my motor's gearbox and called it a day. Custom CNC'd sprocket installed into the motor
- 09-20-23: With a set of 12V lithium batteries on order, I finally prepared my bike for motorization. I drew up a full wiring scheme in order to find how many connectors I would need. At this point I decided to match the motors 10 AWG wire for the battery cables and 22 AWG wire for the control wires. Simple renditions of the wiring schema:
- 11-01-23: Once I got my batteries, I utilized their built-in mounting bolts to design a simple battery holder that could be fixed to my bike using a u bolt. I printed this first version and was very pleased with the results. Along with some small dimensional tweaks, I also incorporated the volt meters and the kill switch into this mount for the second version. This way, the meters would be close to the batteries and the kill-switch would be close to the motor, reducing the number of wires I would have to have running to and from the handlebars. With my second design printed, I was finally able to wire up the bike. Unfortunately, nothing happened when I went to test the bike under its own power for the first time. The first thing I did was check the throttle, which had sat on my bike for months exposed to the elements; and sure enough it wasn't doing anything. Using a DC power supply, I jumped ~1.5V to the signal pin of the motor and sure enough it whirled to life.
Testing set-up
- 11-01-23: I ordered a new throttle that had a keylock switch which I had hoped would add to the bike's security. Unfortunately, it arrived with some unintentional functionality; it output a minimum of ~2.5V when it is supposed to output 1-5V. This means the motor immediately kicked on when I plugged in the new throttle and gave me quite the scare. Disillusioned with waiting, I simply attached the GND/5V/signal wires for the throttle to a 500k potentiometer so I could finally test it. It worked well enough but the logarithmic scale of the pot made it so that the motor didn't actuate until about 7 and the rest of the speed control was between 7 and 10. When I went to test it, the motor was unable to pull me from a complete stop but was able to assist pedaling at mid to high speeds. Unfortunately, during my third run, I tried to start the motor at too low of a speed and the torque of the motor destroyed the one-way bearing; making the motor's power translation pitifully small. One plus was that the battery voltages didn't decrease almost at all during all of my testing, leading me to believe that the capacity will be pretty decent once the controls and bearing are sorted out.
Test run setup with single volt meter and potentiometer speed control
- 12-04-23: While initially happy with my 3d-printed battery mounts, they began to sag slightly. Worried about my hefty lithium battery investment, I knew another solution was needed. This time I decided to use aluminum and mount the batteries behind the seat. My initial design grabbed the seat post in a similar fashion to a connecting arm inside a combustion engine, but a busted tap sent me back to square one after hours of effort. Next, I simplified my second design by simply drilling a properly sized angled hole into an aluminum block and gripping the seat post with imbedded set screws. I cut most of the material away with a bandsaw and cleaned it up with some a manual mill; a tool whose usefulness I could definitely find myself utilizing in the future. In addition to smoothing the sides and top, I used a ball end mill to carve several weight relief channels into the mount. While the final result wasn't CNC perfect, it was certainly nicer than anything I would have been able to achieve with more traditional hand tools. The mount is comprised of two aluminum pieces which grab the seat post and the mounting holes on top of my batteries. Two additional 3d-printed parts were added to provide additional support to the bottom of the batteries.
Two 12 volt lithium batteries mounted to the seat post without 3d-printed supports
- 12-15-23: Instead of risking another bad throttle or ill-suited key mechanism, I bought a proper 500k linear potentiometer along with a key switch whose key can be removed in either of its two positions. I used these along with the voltmeter I had to design a control box for the handle bars. I 3d-printed my first version, but it felt too flimsy for my comfort. After some thickening and a second 3d-print, I assembled my new control box and tested it. Everything worked as expected with the motor actuating about 20% into the potentiometer's rotation. Happy with this result, I permanently attached the control unit to my motor. The major thing left to do now is fix my torque issue, which will require a complete redesign to my motor mount because I need to change which sprocket the motor is connected to.
Handlebar mounted control unit with voltmeter, key switch, and speed control potentiometer
- 01-17-24: After constructing a new motor mount which was capable of hooking into my bike's largest front sprocket, I had one of my most promising tests yet. The combination of larger bolts for the chain tension track and the use of u-bolts for the bike frame attachment made this my mount exceedingly solid. Unfortunately, the same could not be said for the one-way bearing inside my custom sprocket which promptly grenaded about 5 minutes into the test. That being said, this was the first time the motor really moved the bike for more than 50 feet, so a win is a win. I still was hopeful I could just upgrade the bearing with a more robust unit. I ordered a more expensive bearing with steel internals, but it unfortunately met a similar fate as the previous ones. At this point, I was feeling very defeated since it seemed like my only option other than abandoning the project was a complete redesign.
Improved steel motor mount to link motor with largest front sprocket
- 03-02-24: After much consideration, I finally decided to sacrifice the ability to pedal the bike traditionally. My sprocket would instead be mounted directly to the motor instead of through a one-way bearing. To achieve this, I had to CNC a second gear but with the internal dimensions such that it could be pressed directly on to a 1/2" diameter shaft. I tested it with my second steel mount, and it worked exceedingly well. This time, I took the bike for a full 20 minute or so ride around my neighborhood without any major problems. The only issue I ran into was the gearing of the motor, as the motor was barely stressed under load and the top speed was not incredible. That means that my original prediction that the motor should be on the smallest sprocket was correct. Even though I must fabricate yet another mount, I am more than proud of the bike's current performance. For once in a long while, I am excited to see where this project goes in the near future.
Remade sprocket permanently fixed to motor shaft
- 06-04-24: Taking a page out of the Lotus book, I made this newest mount with aluminum and JB weld. The rough shape was cut out on various saws while the final shaping was done on a mill. In addition to a new mount, I decided it was finally time to make a new motor plate in order to integrate a chain tensioner. This plate was designed in CAD before being laser-cut out of 3/16” steel. Most of the chamfering was done with a chamfering bit and an air nibbler before being finished off with a file and sandpaper. The only issue I ran into was the length of the control wires that were no longer able to reach the control box in its intended location. Finally, I designed and 3D-printed a plate that sits where the original second sprocket in order to prevent the chains from leaving their sprockets in the front. This front sprocket set is a new one which I picked up used and removed the crank arm from. I also added an aluminum bar with a u-bolt such that my feet would have something to rest on. Additionally, I swapped the second and third sprocket on this new piece such that the gearing ration between the motor and the tires was lowered (less speed, more torque) but this still may not be the ideal gearing. Regardless, the bike currently much more resembles the e-scooter that it took a motor from than a traditional e-bike. Though it doesn’t have enough torque to pull you up a steep hill from a complete stop, it more than gets up to bicycle speed on reasonably flat roads. Getting some time to actually use the bike as a method of transportation for a couple weeks has also given me further insight into the motor’s operation. The first thing I had to adjust was the sprocket on the tensioner, which had to be enlarged in order for chain tension to be maintained at all times. In terms of performance, the motor seems to have a max speed and a max power output. Due to the fact that I frequently hit the max power of the motor and almost never the max speed, the bike would currently benefit from lowering the gearing ratio (less speed, more torque). This means I either need to make the third sprocket smaller (impossible) or make the first sprocket larger. All that being said, I am cautiously optimistic because this is the first time that the project has been in a remotely useable state. As the saying goes, beats walking.
Assembled bike with new additions: New motor mount/plate with integrated chain tensioner and its new sprocket
- 09-02-24: After using the bike practically for some time, I can confidently say it works exceedingly well. It has certainly saved me time traveling to campus and I can just take the battery set into class with me for security. The first major change I made was making a new front motor-interfacing sprocket out of laser-cut steel to fix my spacing and gearing issues. Now, you can use it like you would a motorcycle where you start in a low gear and move up gears with increasing speed. Next, the two largest issues with it were the weird footrest placement and the battery location. Luckily, I found that the rest would just barely fit between the motor and the main sprocket. Additionally, the U-bolts for the footrest and the motor mount were replaced with a specialized flat u bolt to increase surface area contact between the bolt and the bike frame. This, along with steel muffler clamp spacers, has vastly increased the strength by which mounted parts are attached. For the batteries, I started looking at my first mount and realized its rigidity could be increased by mounting between two frame tubes instead of just to one. This new mount, in addition to the tie-down strap I was using before, made me feel much better about the stability of the batteries. Though I could no longer remove them and take them into class, the batteries' removable cables and key switch still assured me that this would still be a very hard bike to steal. The final improvement I made was moving the control box to its proper position on the handlebars and adding a spring to its potentiometer such that it would always return to a closed throttle like a real motorcycle. I also added a resistor between the speed potentiometer and ground such that the motor would actuate closer to the start of the potentiometer's travel. These final additions have made the bike both more efficient, comfortable, and practical. Though I could continue tweaking components for incremental increases in power or efficiency, I am really happy with where the project is at and have decided to move on.
Bike with new footrest location and battery mount
Spring return potentiometer inside control box mounted to proper location

Full bike with new sprocket visible
Conclusion
This has been a long and hard road, but I really feel satisfied with the results. This project was one where I sort of dived into a very deep pool, ignorant of how just many considerations a "vehicle" like this can have. I started with a completely unmarked motor and an old mountain bike, ending with something both really fun and capable of saving me time and effort on a regular basis. Due to the fact that many of the problems I had to solve during this project were mechanical ones, it was enjoyable to do something I have some intuition for but have never studied in any sort of formal way. I would be remiss if I didn't thank the fine folks at the UCSD DIB makerspace for continually providing guidance and assistance, this project wouldn't have been possible without Mark, Dave, and David. Comment what you think the name should be! - I'm inclined toward Caractacus ;)



Comments
Post a Comment