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

@Unixbigot I'm curious why you didn't stuff the battery box full of Lithium batteries for amazing range. :)
@szakib i’m still using the battery that came with the bike. When time comes to replace it, that’s exactly what i’ll do.

@Unixbigot @szakib

...raining on this parade slightly, what about safety / control parts for speeds people want ebikes to do and loads people want to carry?

Yes, upcycle, freecycle, build! Also consider physics and that these bikes are often originally made by someone smashing through as many as possible for [insanely low wage] per day...

@adamsteer @szakib Safety and speed concerns will be better-met-than-store-bought. As for quality, see one of my alt-texts "This is probably what bicycle snobs call a BSO a Bicycle-Shaped-Object meaning it came from a variety store and is of indifferent quality.". I am developing the thesis "start with the simplest thing that could possibly work, if e-biking works for you, then you can transfer your drivetrain to a better frame in time". For the acoustic bicycle I commuted on for years (and will electrify next), I went to "Bicycle Revolution" a (defunct afaik) local business that builds quality hard-wearing bicycles out of recycled classic parts; they built me a rock solid bike with new wheels and brakes on a classic frame and chainset for $350. I don't think anyone *needs* to spend $4000 up on a bicycle, electric or otherwise.

@Unixbigot @szakib

fair, just...BSOs may or may not stand up to daily driving, thay needs to be clear.

I'm not surprised bicycle revolution went under. A decade ago the parts alone for the job you described would have run close to $300. Refurbing a classic wheelset (full hub rebuild etc, without any new spokes) around half that price (in the place I worked, and we were cheap).

@Unixbigot @szakib

...I also think everyone should just get a free high quality, well designed pedal assist e bike adapted to their needs (one a professional mechanic will happily service) as an inalienable human right πŸ™ŒπŸ»