Let's make an #e-bike out of garbage. You will need.

* One dumpster bike (free)
* One cargo rack (free)
* One hub motor (dumpster dived, but about $200 new)
* One motor controller (about $20-$50 new)
* A battery (recycled, but about $100 new)

I'm going to rewire some used 12v lithium batteries to make a 36v battery with a smart battery management system (monitor charge from your phone).

I started by installing the front wheel, installing the cargo rack, mocking up where I'll mount the battery, controller and throttle.

Next I'll wire the key components, get the wheel turning, then look at which of the other wires need to be connected. (Some brake cutoffs, pedal sensor, maybe a key lock to see if a wild @alice appears).

This happens to be a folding bike, because that's what was at the front of the bike pile.

Ookay, part 2 of "dumpster e-bike", getting the motor running.

First, make sure you have the wheel the right way around. That's probably power cable on the right hand side. A hub motor has a clutch inside and only motorises one way.

Invert the bike, then hook up the three motor wires to the motor, connect the 5-wire hall sensor plug if you have one, and then join the "self learning" wire. Connect the battery and the wheel should turn slowly. Give it ten seconds or so, then power down.

Disconnect the "self learn" wires, and add a throttle. Reconnect the battery. Give the throttle a gentle turn (I've used a potentiometer for initial testing as then I don't have to fight against a spring). The motor should turn.

Spin your pedals and observe the back wheel. If the front wheel is turning the wrong way, swap any two of the motor wires and it should go the other way. Try another two wires if not.

Arguably, your bike is now rideable. But don't.

Things left to do are

* Mount the battery securely
* Mount the motor controller securely in a weatherproof cover (you can buy zip-up pouches for this purpose)
* Fit some brake cut-out switches
* Look through all the other wires on the motor controller and see if any of them look like fun.
* Maybe fit a speedometer.

Here's the motor running. Super quiet, the ventilation fan in the roof is louder.

This is my "daily driver" e-bike. Purchased for $200 as "battery does not charge", the battery was fine, but the controller was blown. The bike is so old it was clearly designed for lead batteries, the the lithium battery only fills one third of the otherwise empty battery. box. I ripped off all the plastic fairings, and sourced a new controller and throttle as a set. I fitted an anti-theft handlebar basket (should be a pink one for maximum effectiveness) and it just goes.

Electronics: https://s.click.aliexpress.com/e/_c2QulvH3 or https://www.aliexpress.com/item/1005008500641642.html
Waterproof cover for electronics: https://www.aliexpress.com/item/1005005475025309.html

Junkyard e-bike build part three: I have dozens of these 12-volt lithium batteries which were previously lightly used in solar lighting installations. I used three of them to test-run the 36 volt e-bike motor yesterday. Two of them fit nicely on the cargo rack, but that would only be 24 volt. So I am going to cut up two of these 12v 50Ah¹ 3S15P batteries (three banks of cells, each bank 15 cells in parallel), and use the 90 individual cells to make a 10S8P battery (36 volt, 25 Ah) that fits the rack space neatly and also has a modern smart battery management system with bluetooth connectivity.

The existing battery management boards in these batteries appear to be simple "overcurrent protection and rebalancing" modules, I'll be discarding those.

¹ All labeled battery capacity figures are lies unless proven otherwise.

Junkyard e-Bike build part 4: Reconfiguring a salvaged battery. Lithium batteries can be scary. The "negative" terminal is the flat end, and the entire outside of the case. The positive terminal is the small circle on the top. DO NOT USE METAL PRY TOOLS. It is easy to pierce the thin shrink-wrap coating of the cells and connect positive to negative. Do this and you will get sparks and/or fire. Explosion is unlikely due to the nature of cylindrical cells. Use a plastic or wooden spudger to open up space between the battery and any nickel bus-strips you need to cut.

Here I am using bamboo tweezers to allow me to safely (ish) cut the nickel strip.

The shrink wrap cracked during separation (again done with a non-conductive spudger) so these cells will need to be re-wrapped. At this point I am thinking that recycling these batteries is too much work for someone who doesn't already have all the safety wrapping materials to hand.

You can buy new or refurbished cells with intact safety coatings; for example from recyclers like Substation 33 in brisbane, and various local e-bay sellers.

For recycled cells, the welded nickel strip can be removed by grasping the loose end with some needle-nose jewelers pliers and winding the strip around the pliers.

@Unixbigot you can also purchase ceramic-bladed cutters for a few dollars
@jpm oshit i have some. changing.
@Unixbigot ahahahahahaha oops