Show and Tell: Homemade 60V 50A eBike Controller with OLED Display

Pyrotrons

1 mW
Joined
Sep 9, 2017
Messages
12
Location
Houston, Texas, United States
No pictures yet (except my PCB layout) because it's still in the works, but I've decided to make my own controller; pretty much because I love electronics, but also because of crisp, bright, OLED displays. I've settled on "Blue", as it matches my Trek 820.

I'll be uploading my progress here, and all of my design files once it's finished.

Ebike Controller Specifications:

Atmega1284P microcontroller @ 16Mhz

Vbatt +/- 1%, scaled for 52-66V (As per recommendations on LunaCycle's website). It was a design challenge, ended up having to create -12V with an ICL7662, then precision-it with a 10V reference, then shoot that through a 1% resistor network to scale the low end to 0V.... then added non-inverting opamp gain to scale the high end to 5V. So 66V to 52V input gives me exactly 5V to 0V output to the ADC.

Ibatt +/- 1%, scaled for I really don't know yet (I'll measure it when I get everything bolted together and riding.) 10W, 1 milliohm shunt with Kelvin connections plus an LTC6104 current sense amplifier. Cool part. It simulates (LTspice) like it should work, please wish me luck.

10bit Throttle scaling... turned out to be harder than I thought because (fortunately) I found a ground loop on the PCB. Had to figure out the best way to isolate that (make an analog isolator) and went in circles for a little while. I ended up with three pins of the microcontroller for SPI input to a digital isolator, and then to a 10-bit DAC (MCP4911 series are wonderful little parts). Power for the DAC and digital isolator output comes from the speed controller throttle power itself... about 4.3V (5V through a diode, had to figure that one out too).

Motor temp msm't using LM35, 0-150C.

Accessory 12V 20W power output via Meanwell DC-DC converter brick.

"Ignition" control for the speed controller, using a rather small 100V IXYS optoMOS MOSFET. This will be master shutdown if the system detects anything really bad.

On-board EBS/Regen brake control with Lbrake/Rbrake inputs

- I'm considering adding an accelerometer... would be kinda cool. All the display electronics are there, I might as well, right?

15W of ~50kHz ultrasonic drive for all the goddamn dogs. Using a gate drive IC (UCC27425) as a single-chip H-bridge to drive a 25W, 3.5" tweeter through a small inductor...the ~0.15uF tweeter plus inductor will resonate somewhere in the 40-60kHz range... could *never* drive this at resonance with such a low-Z gate driver, otherwise it'd blow parts, so, since I have precise digital control I'll just tweak the power level with frequency and drive it somewhere off-resonance where it won't let the smoke out.

Display: 4 x 20 OLED, SPI interface, Newhaven NHD-0420DZW, Blue. Sex. I've removed a diode and inductor from this display, and have created my own 0-12V analog signal for display brightness, so it's dimmable.

PWM Hi-Side MOSFET outputs for Headlight, Taillight, Hazard. All good to about 8 amps.

Speed Msmt using an optocoupler and one of the Hall Effect signals that I plumbed onto the board. Motor+Controller Hall signals needed connected anyway. I haven't tested it so it probably won't work... in which case I'll just use a normal magnet+spokes+Hall rig.

----------

If anyone's interested in anything specific, let me know.

So it's a Trek 820, LunaCycle 60V 20AH battery, "Voilamart" "48V" "1000W" motor and E.R.T. sinewave 3kW spd. controller. I have no idea what this motor actually is... if anyone knows I'd appreciate input.

Wonder how fast it'll go :shock:
 

Attachments

  • ctrl.png
    ctrl.png
    28.8 KB · Views: 273
Back
Top