Food Living Outside Play Technology Workshop DC Motor Controller for Electric Bicycle by scd on November 25, 2011 Table of Contents DC Motor Controller for Electric Bicycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Intro: DC Motor Controller for Electric Bicycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Step 1: Parts List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Step 2: Schematic Drawings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Step 3: Digital Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Step 4: Pulse-Width Modulation (PWM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Step 5: Power Section construction details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Step 6: Assembly and Enclosure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Step 7: Circuit Board Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Step 8: Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 http://www.instructables.com/id/DC-Motor-Controller-for-Electric-Bicycle/ Intro: DC Motor Controller for Electric Bicycle I designed this controller for my Crystalite Sparrow 48V electric bicycle hub motor. The core function of a DC motor controller is to periodically read the throttle setting and adjust the current being supplied to the motor. It does this with a technique called pulse-width modulation or PWM (more on this later). Other functions of the controller include: 1) low-voltage cutoff .. monitor the battery voltage and shut down the motor if the battery voltage is too low .. this protects the battery from overdischarge. 2) over-temperature cutoff .. monitor the temperature of the FET power transistors and shut down the motor if they become too hot .. this protects the FET power transistors. 3) over-current cutoff .. reduce the current to the motor if too much current is being supplied .. this protects both the motor and the the FET power transistors. 4) brake cutoff .. shut down the motor when the brake is applied .. this is a safety feature .. if the user applies brake and throttle, the brakes win. Note1: This is a relatively advanced instructable. Don't attempt it if you don't have experience with power electronics. The voltages and currents used in this project can be dangerous and appropriate safety precautions must be used. This instructable outlines what I did to make this project, but it is not a substitute for proper safety training in power electronics. Check with your local community college for availability of classes in your area. Note2: In addition to the 48V battery voltage, this controller requires a 12V power supply. I used a separate DC-to-DC converter to supply the 12V power. See my other instructable on constructing this DC-to-DC converter. Note3: This controller is over-designed for this application. The IRFP4468 FETs are rated for a maximum of 195 Amps (each) at 100V. This application will typically use less than 10 Amps at 50V. I have been commuting (10 mile round trip) almost every day for the past 2 months using this controller and it has been trouble free (knock-onwood :) Image Notes 1. Crystalite Sparrow 500W hub motor Step 1: Parts List Here is the parts list (with Digikey part numbers) for all the electronic parts. You will also need: a) a prototype circuit board (the one I used is from a local electronics surplus store) b) wire. I used 30AWG wire for the low current connections and 14, 12 and 10AWG wire for higher current connections. c) 1/8" heat shrink tubing (about 2" in length) d) two 6-32 x 1" screws e) 4 x insulating pads for the FETs and power diodes (these can be salvaged from a broken PC power supply) f) a heat sink for the power section. (this can be salvaged from a broken PC power supply) g) an enclosure. (this can be salvaged from a broken PC power supply) The following tools are required: a) a programmer for the microcontroller. I used an AVR ISP programmer (check EBay) b) a soldering iron (and solder of course) The following tools are recommended for debugging: a) a digital multimetter (DMM) for checking connections, etc. b) an oscilloscope is handy for checking the PWM waveform, etc. http://www.instructables.com/id/DC-Motor-Controller-for-Electric-Bicycle/ Step 2: Schematic Drawings Here are the schematic drawings. Sheet 1 is the digital section and sheet 2 is the power section. Step 3: Digital Section This photo shows the digital section (page 1 of the schematic) wired up and connected the the Atmel programmer. Image Notes 1. throttle 2. Atmel AVR ISP programmer 3. Digital section 4. DMM 5. Scope probe http://www.instructables.com/id/DC-Motor-Controller-for-Electric-Bicycle/ Step 4: Pulse-Width Modulation (PWM) This photo shows the PWM signal (pin 15 of the ATMega8 micro) used to turn on/off the power FETs. When the signal is high, voltage is applied to the motor. This waveform is for about a 1/4 throttle setting. Step 5: Power Section construction details These photos show how the FETs and power diodes are attached to the heat sink. They must be kept electrically isolated from the heat sink. The screws are covered with 1/8" heat shrink tubing and the FET and power The heat sink that I used is re-purposed from an old broken PC power supply. Image Notes 1. 1/8" shrink-wrap tubing 2. 6-32 x 1" screw Image Notes 1. IRFP4468 power FET 2. insulator (salvaged from a PC power supply) http://www.instructables.com/id/DC-Motor-Controller-for-Electric-Bicycle/ Image Notes 1. Aluminum heat sink (salvaged from a broken PC power supply) Image Notes 1. IRFP4468 FETs 2. STTH6002 power diodes Step 6: Assembly and Enclosure These photos show the controller with digital PWM and power sections completed. The monitors (e.g. battery voltage monitor) are not connected yet. Image Notes http://www.instructables.com/id/DC-Motor-Controller-for-Electric-Bicycle/ 1. reset button 2. ATMega8 micro-controller 3. LM7805 heat sink 4. 470 uF cap Image Notes 1. PC power supply case Image Notes 1. 12V power input 2. The yellow and block wires go to the motor 3. the blue and yellow wires are from the 48V battery 4. The red, black, and green wires connect to the throttle Image Notes 1. PC power supply case Image Notes http://www.instructables.com/id/DC-Motor-Controller-for-Electric-Bicycle/ 1. funky rain cover 2. 10AWG wire (to battery) Image Notes 1. DC motor controller Step 7: Circuit Board Layout I used a circuit board CAD program to create this layout. I have not fabricated this circuit board. http://www.instructables.com/id/DC-Motor-Controller-for-Electric-Bicycle/ Step 8: Software The software is not currently available .. Related Instructables Advanced Brushless Power Systems for Small Electric Scooters by teamtestbot Camping Wind Turbine by ineverfinishanyth DC motor control with Joystick and PIC16F877A by NewHouseTM Make a Rotating Microphone by noxidgerg Halloween Robot by climber-man http://www.instructables.com/id/DC-Motor-Controller-for-Electric-Bicycle/ Automatic Window Blinds Controller (PICAXE) by biochemtronics