Designing a Commuter Controller

Get all your technical information about electric bikes here.

Designing a Commuter Controller

Postby Alan B » Wed Nov 03, 2010 7:54 am

Recently I was reading the thread of Justin's 2008 ebike trip across Canada. He built his own controller and had some interesting features. Every time I read about someone who built their own controller I think about things that I would like to have in my own controller. Things that would be easy to do if we had sourcecode. Hacking the hardware is nice, but I want access to the software as well.

I see others have built controllers, or are in the process. There are many aspects of this we can share even if we are developing different units.

I would like to focus my effort on building a simple commuter controller. Something to get started with some hardware and software and get some experience. Rev 0. Start simple and improve.

Scale the requirements to get things moving for this prototype. Not to take away from the "Best Controller" project at all, but this could be a testing ground which will be faster to prototype real hardware and software.

I'd like to see something that would be useable on a bike with common motors we already have. So we can swap it into our systems for some real world testing and development. Get that homemade controller grin going!

I suggest some simplified "prototype requirements" like:

The prototype should be useful, not a tangle of wires on a bench. It should be able to run on a bike with a common motor at reasonable voltages and currents. The actual capability would come out as the detailed design evolves, but something along the lines of existing controllers. Something reasonably easy to attain on the first try.

Use readily available through hole parts for this prototype. Designed so people with moderate soldering skills can make it. Easy to repair and mod.

Limit the PCB to one that we can readily get in small quantities at reasonable cost. Keep the unit compact. Significantly smaller than infineons. Use a free design tool that is easy to learn and make a public open schematic and layout so folks can make their own version of it with their own improvements. One such solution I'm aware of that works this way is expresspcb. There are undoubtedly others, let's pick one. Their 2 layer plated through miniboard is 3.8 by 2.5 inches and costs $51 for three boards and they turn it around in a few days. They have free software for schematics and pcb design that takes a couple of minutes to learn. It is 1.25 ounce copper, so plan for bare wires to be added to support reasonable current, but again this is not a mega controller (yet). It is the baby that can grow up later. And the folks who want to use external really big FETS can wire them right up to this small board, so that might be a viable "big controller" approach as well.

We can get creative and put some parts on the backside of the board if needed, but keep it serviceable. One small pc board. Leave the fancy master CPU till later, just do the motor control board. A compact (probably six) FET unit. Standalone capable, or can be integrated into a larger multiboard system later on. (as you will see below this changes slightly as the design evolves and two boards are proposed).

Use FETs that are readily available, through hole, low cost and fit on the board - constrain by space but keep it simple to start. Not a huge number of them. How many will fit on this board? We want to keep the price moderate, we may be blowing some of these boards up as we try out software ideas, etc. I'd rather blow up smaller numbers of FETS while testing just from a practical standpoint, even if it means testing at lower current.

Voltage - again, what is simple, will fit, and will be useable by most as a test platform for the controller technology (not the performance edge of bike motors). Perhaps not a switching regulator on this first prototype. Add that later? Unless someone has a small footprint trusted design in hand.

Use a micro with open high level software tools. This probably means the AVR since other suggestions either are surface mount only or don't have free high level tools. Choose the most capable fairly common through hole chip with the best hardware for motor control that is well supported for the purpose (app notes, sample code, etc) and low in cost.

Scale other requirements back to what is essential to make it operate on a bike. Throttle, ebrake. Detectors for sensorless control if they will fit (this will be an important software development area). Toss the things that are not really needed like 12V outputs, etc. This is a platform for developing experience and software. To do that well it needs to be run on the bike. It should be easy to reprogram without necessarily removing it from the bike. A jack on the board that can be brought out with a cable.

Extra inputs/outputs as available for other things. What does the chip have room for? Like a skilled woodworker, find the "grain" and work with it. Do what is easy and put off what is hard and nonessential for a future model.

Then we make a few and get started. Once some hardware is out there this project might really take off. Share some software. Write some code, rewrite, throw it out and write it again once the issues are better understood.

Anyone interested in collaborating on this?

PLUS a "Terminal" to mount on the handlebar and perform useful features. This can be done with an off the shelf unit, so it is not a major part of this project. I add it here because it may have impact on the controller as the two work in synergy. Functions such as speed, current, power, etc monitoring and control can be handled by this unit and the controller working together. Initially it would be little more than a debugging tool for the controller, later it can evolve as far as wanted to be the controls for the controller as well as the ebike's readout system.

References

Building the Best Controller thread:
viewtopic.php?f=2&t=20731

Oldswamm's Economical Hi-Amp Controller thread:
viewtopic.php?f=2&t=22728

Another controller build thread found 11/30:
viewtopic.php?f=2&t=23205
Last edited by Alan B on Wed Dec 01, 2010 12:33 am, edited 14 times in total.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby Alan B » Wed Nov 03, 2010 7:54 am

Commuter Controller

Requirements

Three phase brushless DC motor control
Hall sensor (3) and Sensorless (pedal first) control modes (requires comparators on phase voltages)
Sine control mode? (requires 2 phase currents) (provide for on CPU board but don't implement on FET board)
Pulse by Pulse Current Limit (Battery shunt trip in hardware)
Protection from overcurrent, overtemperature and (if practical) shorted motor to hall wires
Open Hardware and Software
Components through-hole if possible, SMT if necessary
Size - approx 4x3x2 inches (finalize during PCB layout)
Modular two board design, plug between boards
FET board has all High Voltage and HV I/O, can be various versions for different performance levels
Control board contains micro and low voltage I/O - can be used with any FET boards, standardized module
First FET board design for moderate performance, six TO247 FETs (allow spacing for TO264 as well?)
Battery up to 16S LiFePO4 3.7V or 14S LiPo 4.2V
Battery Voltage: 24-60V (18-65V max)
Current limits have long term, short term, and time to long term limits (10s?)
FET Temperature thresholds ramp current limits down (full to 100C, derate to zero at 150C?)
Battery Current (pulse by pulse limited): adjustable, max ~50A? (shunt spec)
Phase Current (pulse by pulse limited): adjustable, max ~100A?
Capacitor bus ripple voltage <0.5V??
PWM Freq: adjustable 15-30khz, nominal 20khz
Interfaces - Throttle, eBrake, regenControl, serial I/O, extra I/Os for speed switches, status LEDs, etc??
Multidrop optically isolated serial I/O bus can be used for multiple purposes including programming and
- handlebar displays and controls as well as BMS communications plus
- connect multiple slave controllers for multi motor installations
Ebrake goes direct to FET drive disable to insure safety (and micro motion abort input)
Precharge Cap bank capability designed in (charging R on FET board, second HV input)
FET heatsink temperature monitoring
CA type display for serial - see master controller below
Reprogrammable without opening box (via serial cable)
Tools open or free

Design

Use at least 75V rated parts (FET, Cap, 12V Regulator). Leave 20% or better margins to working values (60V).

FETs: 6 x IRFP4368 TO247 (75V, 1.5 mOhm@195A, 20nF 500nC gate)
HV Capacitors: 75+V (0.1,1,10,100)?uF low ESR per FET pair, use set of caps for frequency response (analyze)
12V Capacitors: (0.1,1.0,10)? per driver 20V low ESR, plus one 100uF tantalum? (analyze)
FET Drivers: NCP5181PG or NCP5181-D or LT4444 or ? (2A) through hole unless no room then smt?
Battery Current Shunt: 50A/50mV? 4 terminal, good temp coeff
Battery Current Limit: hardware shunt to comparator vs DAC setpoint, programmable limit
Phase Current: Measure 2 phases NOT, calculated, limit settable in software, limit to 100A max? (eventually base on measured performance)
Microprocessor: ATMega32M1 in TQFP32 with BLDC motor support hardware on-chip, 32K code, etc
Pre-Regulator: Not required until V > 72V for this 12V regulator
12V Regulator: switching 17..72V (75V max) to 12V at 500mA? (Innoline R-78HB12-0.5)
Final Regulator: 5V linear low quiescent current
Serial Interface: optically isolated, pinout compatible w USB adapter (FTDI TTL-232R) or Master Controller (see below)
Two small stacked mating pc boards: FET board, Control board, joined by connector near center on non-component sides
FET Board: FETs/drivers/capacitors/shunt/12V reg/temp sensor, Phases out, Power SW connector
Control Board: Micro, 5V Reg, Low Voltage I/O, programming, hall inputs, serial, throttle, ebrake, regen, speed, brakelight output, etc
Board Interconnect: 24 pin, 12x2 row, 4 gnd, 2*+12, 2 shunt differentials, 6 gate drives, 3 phase samples, heatsink temperature, +V sample, ebrake, 6 spare?? (provide for 2*2 phase current diff inputs)
Precharge: two HV inputs, one for regulator feeds caps through built in charge resistor, another direct
FET board: preferably 4 layer, 3oz copper (design so middle layers V+ and GND can be left out on prototype?)
Control board: 2 layer, 1oz copper
Boardsize: Nominal is 2.5 x 3.8, will be adjusted to fit design and box
Box: aluminum extruded, use for heatsink, design boards to fit, FETs bolt to it for heatsink ?? (select box) OR use heatsinks and panels to make box
Schematic Capture and PCB Layout tools: KICAD ?
PCB Manuf - BatchPCB for prototypes and small runs, Phoenix Gold for larger runs?

Software Notes

Low side Commutation and High side PWM for standard BLDC control to begin, then
Use Synchronous rectification (complementary PWM on high side driver saves power in FET)
Hall effect health monitoring and automatic disable of sensor mode (becomes pedal first)
Hall sensor auto-failure interpolation (go to mode 2)
Mode 0: Sensored/Sensorless auto transitions at 5MPH mode (standard)
Mode 1: Hall sensor mode (the usual)
Mode 2: Sensorless mode (pedal first)
Sine commutation mode uses PWM to all three phases (use time interpolation of halls, only one need be working, start with sensored mode and transition to sine) SKIP
Adjustable motor timing (test, mostly for high RPM motors)
Fuel gauge (coulomb counting)
Proportional regenerative braking (separate input or button/throttle)
Adjustable top speed limit
Adjustable power, current, acceleration limits
Several parameter sets (modes)
Cruise control, gain, etc
Voltage detection autosets LVC from table lookup?
Per cell LVC with appropriate BMS communication or ebrake BMS input
Throttle modes including battery current, phase current/torque, blended
Throttle range calibration mode
Throttle fail detect and lockout, prevent start on high throttle
Hall and phase order diagnostic mode
Various diagnostics
Monitor program to facilitate serial programming (only monitor need be programmed via ISP)
Gcc-AVR toolchain
Python for server side software as needed



Companion Master Controller and Readout

To maintain a System Design this portion of the system is selected and documented here.

This Master Controller not Required to use the Motor Controller, but this facilitates communicating with the controller and reducing wiring on the bike. It provides readouts such as speed, current, battery gauge and logs information for later analysis.

Requirements

Handle control and display functions for the ebike System, motor controller and BMS
Off the shelf AVR based module to use same development tool chain, open tools, etc
Display, visible day and night
User Interface (buttons, encoder, etc)
Beeper
Red LED?
Multidrop serial I/O to communicate with Controller(s) and BMS
Inputs suitable for Throttle, ebrake, regen, speed, etc optionally to reduce wiring through bike
Ebrake goes direct to controller also for safety
Runs on 12V from controller?

Design

Commercial Product: ATMega128 Development Terminal (Olimex, Sparkfun $59)
Housing: (tbd - select)
Handlebar Mount: (tbd ?)

Features of this "Olimex ATMega128 Development Terminal" available from Sparkfun et al:
ATMega128 CPU with 128K program flash
Serial w TTL levels
RS232 DB9 interface jack w RS232 levels
16 char 2 line LCD display with LED backlight
Five pushbuttons
Buzzer
5V regulator 78L05, 12VDC input
16mhz xtal osc
Relay w 10A contacts for ? 12V accessories?? power to controller logic???
Various input and output pins, ADCs etc
more features not mentioned here...

References

http://www.atmel.com/dyn/products/produ ... rt_id=4307 ATMega32M1 data, app notes
Last edited by Alan B on Thu Dec 02, 2010 8:36 pm, edited 53 times in total.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Prototype Controller

Postby Alan B » Wed Nov 03, 2010 8:22 am

One feature I'd like to see is a blended sensor/sensorless control. Start from standing using hall sensors, but transition to sensorless control once moving smoothly. Monitor the hall sensor health continuously. If they stop working, revert automatically to peddle first operation, unless we can figure out a way to do sensorless starting (which is possible but might take more hardware).
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Prototype Controller

Postby Alan B » Wed Nov 03, 2010 8:27 am

Another feature I'd like to have is proportional regeneration using a separate input. Use a left hand thumb input to regulate it, possibly a thumb throttle or lever. Keep the brake fingers on the brake but provide another input to control electronic braking.

I would also like some options on the throttle control. Motor current/torque would probably be the best, but with access to the code I would try some different ideas.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Prototype Controller

Postby Alan B » Wed Nov 03, 2010 8:32 am

To focus on the hardware a bit,

How many FETs will fit on this board? Probably six to-220's. What's the best choice available here?

How much voltage/current? Can we do 100V 40A if we use good parts?

What would be good drivers to use?

Suggestions for the high voltage to 12V regulator?? Can we avoid the resistor issues?
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Prototype Controller

Postby texaspyro » Wed Nov 03, 2010 10:51 am

I'd skip the Express PCB. It locks you into the one vendor, and I don't think that they do heavy copper.

KICAD might be a good option. It used to be known as "kill yourself cad", but has apparently gotten a lot better. I have not used it in a long time. Gold Phoenix in China builds boards for cheap with quick delivery and they can do 6 oz copper.
texaspyro
1 MW
1 MW
 
Posts: 1539
Joined: Wed May 12, 2010 6:53 pm

Re: Designing a Prototype Controller

Postby Alan B » Wed Nov 03, 2010 12:33 pm

texaspyro wrote:I'd skip the Express PCB. It locks you into the one vendor, and I don't think that they do heavy copper.

KICAD might be a good option. It used to be known as "kill yourself cad", but has apparently gotten a lot better. I have not used it in a long time. Gold Phoenix in China builds boards for cheap with quick delivery and they can do 6 oz copper.


Thanks for the suggestion. I'll take a look at KICAD. I do want to keep this quick and simple. Expresspcb is really quick to learn and simple to use. And the $20 boards come in less than a week. They will sell you the gerber files if you want to go elsewhere, but I don't think we are looking at large quantity boards anyway, and relaying out in another tool can easily be done later if that is important.

I would like to have a board in our hands before Christmas. We need something that gets things done without a big learning curve or delay.

Is the copper weight actually important if you are going to overlay wires anyway? The goal for this controller is 30-40A, not 100. Can we get low cost low quantity prototype boards with heavy copper quickly?
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby Alan B » Wed Nov 03, 2010 12:48 pm

Another schematic/pcb recommendation given to me is gEDA:

http://geda.seul.org/wiki/geda:faq

Are there others? Do folks who have experience with one or several of these want to make comments on the suitability of these tools and their experiences with them??

I adjusted the name of the thread from ".. Prototype Controller" to "... Commuter Controller" since that is a good characterization and this term was used in the Best Controller thread for this level of controller. I think it applies well to this phase of the project. It is still a prototype, but the size/power level/voltage/etc is commuter type rather than maximum/racing levels.

I would like this controller to be adequate for commuter use and small enough that commuters could practically carry a spare one every day if they wished.
Last edited by Alan B on Wed Nov 03, 2010 4:09 pm, edited 1 time in total.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Prototype Controller

Postby texaspyro » Wed Nov 03, 2010 4:04 pm

Alan B wrote:Is the copper weight actually important if you are going to overlay wires anyway? The goal for this controller is 30-40A, not 100. Can we get low cost low quantity prototype boards with heavy copper quickly?


The idea behind heavy copper boards is so you don't need to mess with soldering bus bars, etc to the board. Can make for a much cleaner and more compact layout. Gold Phoenix does up to 6 oz copper. They will do 155 sq in for $100, 5 day lead time. Up charge for 3 oz copper is $40... not too bad, $120 for 6 oz (bus bars/wires start to look good at that price).
texaspyro
1 MW
1 MW
 
Posts: 1539
Joined: Wed May 12, 2010 6:53 pm

Re: Designing a Commuter Controller

Postby Alan B » Wed Nov 03, 2010 8:06 pm

It has been awhile since I've done trace current calculations, but it would seem to me that 40 amps is just too much, even for 3 ounce copper for any reasonable trace width especially on a small PCB. So some other provision must be made in which case the heavy PCB copper has little value.

It would be good if a small run of boards was inexpensive. The disadvantage of Gold Phoenix is almost $100 minimum price, and that is for 1 ounce copper with a more than one week turnaround including shipping. You get more boards, but to start with it would be good to have a lower cost for just a couple of boards. I have not done a survey, but expresspcb is only $60 for a run of 3 boards, and they turn them around much faster.

I took a quick look at gEDA and Kicad. Looks like gEDA is not quite as easy to use, so will look further into Kicad.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby Alan B » Wed Nov 03, 2010 8:11 pm

Any suggestions on drivers? Just started to look at that. Probably want a high/low side driver in one chip. One with plenty of drive. The micro will have separate outputs for the high and low side with programmable delays to control shoot-through. So the driver should have separate inputs.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby Alan B » Wed Nov 03, 2010 8:44 pm

Any experience with the IRS2001 FET driver?
http://www.irf.com/product-info/datasheets/data/irs2001pbf.pdf
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby CamLight » Thu Nov 04, 2010 1:23 am

Alan B wrote:It has been awhile since I've done trace current calculations, but it would seem to me that 40 amps is just too much, even for 3 ounce copper for any reasonable trace width especially on a small PCB. So some other provision must be made in which case the heavy PCB copper has little value.

It all depends on what you consider to be a reasonable trace width. Any trace that will have a bus bar wire soldered on to it will probably have to be at least 1/4" wide? With 3oz copper and copper planes filling in everywhere, a single 1/2" trace will handle 40A with probably at most only a 30C temp rise. The layout of the board is important here. Runs paralleled on opposite layers can help a lot too. Two 1/4" traces (mirrored on top/btm of board) will run cooler than a single layer 1/2" trace.

I'd love to see the board not depend on soldered bus bars since that adds so much variability to each build. And, it's a PITA to solder on the bus bar. :) But, if desired, a portion of the solder mask above some of the copper runs could be left out for adding bus bars. This way the board can be manufactured as a 1oz. board with bus bars or a 3oz. board without bus bars?
John M.
Owner
CamLight Systems
CamLight
10 kW
10 kW
 
Posts: 728
Joined: Sat Dec 13, 2008 8:51 pm
Location: New York City, USA

Re: Designing a Commuter Controller

Postby Alan B » Thu Nov 04, 2010 6:00 am

Thanks for your comments.

Brainstorming mode on. Got woken up awhile ago with problems at work. So now mostly awake.

I favor designing for adding wires or using heavy copper so either way works. One thing I have wondered is if the traces were designed for adding wires to them, with through holes, things might be much easier. Design the traces to be the same width or slightly wider than #12 or #10 wire and have holes to attach the ends of the wires to, so they could be soldered at the ends like any other component rather than flat-soldered. Not sure that would work out, but designing with the wires in mind should help make them easier to add. There was a discussion of using copper sheet cut to lay on the traces. That might be more practical than making 6 oz copper boards. We can always limit the current to 20A to start with and then add copper, as long as we've made it easy to do that.

To keep the board small I think we need to use the third dimension for heavy conductors rather than making wide traces. Should these conductors be insulated wire "jumpers" rather than traces at all? Or a mix of the two?? Perhaps some copper pieces that connect to the tabs of the devices should be used, under the screw head site so as not to reduce the thermal performance.

Changing Gears,

I suppose another approach to consider is using two small boards stacked, one mostly covered with FETs. The other with everything else. How to cool them? The heatsink could then be on the plane parallel with the board and the FETs would be bent over flat with the heatsink surface away from the board. Then the board could have very large traces. The whole top side could be pretty much +V and the whole bottom side Ground.

I'm warming to the two board stack idea. The boards could be component side away from each other for easier access. Really neat if the FET board was four layer with power and ground in the middle. That might be possible to afford. And might solve the issues while keeping the footprint small. The monster FET guys would like it too since they could leave off the FET board. Probably could get 12 FETs on a small board. Plus if the FETs get blown it might be just that one board to replace... How to assemble this, to get to the screws on the devices to heatsink? Easy enough to do the first time, but how to replace FETS? Maybe just replace them all, they usually go together anyway??

So how does that sound. Two boards, 2.5 by 3.8 or thereabouts, plug together. One with FETS and little else (possibly HV regulator, capacitor, and the shunt), the other with the rest?? Only the FET board needs bus bars or heavy copper. Lots of room for copper. Plus a replacement board could be done later with IXYS fets or whatever... But something inexpensive to start with. And through hole for ease of DIY.

Another variation on the two board idea is to put FETs on two edges of the power board standing up. Probably get 12 FETS and lots of copper on this board. This would leave more room for capacitors in the middle with the FETs standing at the two long edges of the board. It would be easier to work on. Probably more practical. Screw terminal block at one end for power in, and at the other end for motor out. The hall cable would come to the controller board. The FET board would just have the high voltage and high current. The micro board would get 12V from the regulator on the FET Power board.

So the interconnect would be:
ground (at least 2 pins)
six gate drive signals (drivers on controller board)
12V to controller
shunt millivolt signal differential, 2 pins
main voltage sampled down to ADC level
FET temperature sensor(s), perhaps 2
maybe one 10 pin dual row connector (20 pins)? right in the center? making board alignment easy??


The power board would have:
power in screw terminal block (2)
motor out screw terminal block (3)
FETs
capacitor bank
shunt (100A?)
hv to 12V regulator


The controller board would have:
micro
12v to 5v regulator
interfaces - throttle, ebrake, regen, etc
serial interface
programming interface
FET driver (perhaps this goes to the FET board?)
hall interface
protection for all the inputs/outputs to make the board robust (a failure might take out the FET board but hopfully not the micro)
20 pin connector to mate to FET board
XX pin flat cable type connector, most application I/O comes through this
6 pin 1 row 0.1" connector for serial/usb adapter
6 pin onboard connector for ISP programming (loading monitor)


Now maybe I can go back to sleep....
Last edited by Alan B on Thu Nov 04, 2010 7:18 pm, edited 2 times in total.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby texaspyro » Thu Nov 04, 2010 11:09 am

My welder uses 3 oz copper and dumps 20,000 amps... but not continuous. I've done over 1000 welds in about 30 minutes and the traces/fets were not even warm. The layout that I use has two power busses (drain and source) with parallel runs for each on both sides of the board. It is a two layer board. The gate leads are hand wired by wires, not etches on the board. This allows for uninterrupted high power busses on a two layer board.

There is a photo at viewtopic.php?f=2&t=2633&start=570#p280216
texaspyro
1 MW
1 MW
 
Posts: 1539
Joined: Wed May 12, 2010 6:53 pm

Re: Designing a Commuter Controller

Postby Alan B » Thu Nov 04, 2010 2:59 pm

texaspyro wrote:My welder uses 3 oz copper and dumps 20,000 amps... but not continuous. I've done over 1000 welds in about 30 minutes and the traces/fets were not even warm. The layout that I use has two power busses (drain and source) with parallel runs for each on both sides of the board. It is a two layer board. The gate leads are hand wired by wires, not etches on the board. This allows for uninterrupted high power busses on a two layer board.

There is a photo at viewtopic.php?f=2&t=2633&start=570#p280216


Nice. What is the copper weight on those traces. Nevermind, you said 3 oz. Thanks.
Last edited by Alan B on Thu Nov 04, 2010 6:57 pm, edited 1 time in total.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby Alan B » Thu Nov 04, 2010 3:16 pm

I was researching micros last night. Found one that looks quite excellent for this application. Has specific hardware for BLDC motor controls including built in sensorless comparators and a current comparator that can shutdown the output PWM signals in case of motor overcurrent. This is programmed with "fuses" in the chip so no processing time is involved - it is pure hardware. It is designed for automotive controls of brushless DC motors, so almost exactly what we are looking for.

This chip requires very few parts externally to handle motor controls. It needs FET drivers of course, and regulation, but mostly it needs protection from the inputs, so some resistors, zeners, optical isolators, etc. But it would make a very capable and small controller. Plenty of I/O for this application.

There are two problems, however. One is that it is surface mount only, none of the dip AVRs seem to have this level of motor control hardware. That is not too bad as it is not too hard to hand solder this part, and someone could do that bit of soldering for you and the rest of the build can be through-hole for DIY builders. The more difficult problem is finding the micro chip in small quantity. It was under $5 in 1,000 quantity but the common places did not stock or sell them individually (Digikey, Mouser, Newark). Further searching is called for. Anyone finding the ATMega32M1 (32-TQFP) in small quantities let me know.

Thanks,
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby rebelpilot » Thu Nov 04, 2010 4:04 pm

ATAVRMC310 is the device board for ATmega32M1 AVR microcontroller.

http://www.atmel.com/dyn/products/tools ... ol_id=4375

Buy online from Atmel $99.00
http://store.atmel.com/PartDetail.aspx?q=p:10500151

Micros in stock at Avnet no min. $4.92 (have 1880 stock)
http://avnetexpress.avnet.com/store/em/ ... n=products
rebelpilot
1 kW
1 kW
 
Posts: 338
Joined: Wed Jul 28, 2010 12:44 pm
Location: Ontario, Canada

Re: Designing a Commuter Controller

Postby texaspyro » Thu Nov 04, 2010 4:23 pm

Alan B wrote:Anyone finding the ATMega32M1 (32-TQFP) in small quantities let me know.


Then the question is... does GCC support it? If not directly, is at close enough to say the ATMEGA32 to be usable? Also, does the standard AVR programmers (like the STK500) support it. You will probably need one to initially configure the chip and its fuses so that you can program a serial bootloader into the device.
texaspyro
1 MW
1 MW
 
Posts: 1539
Joined: Wed May 12, 2010 6:53 pm

Re: Designing a Commuter Controller

Postby Alan B » Thu Nov 04, 2010 4:35 pm

texaspyro wrote:
Alan B wrote:Anyone finding the ATMega32M1 (32-TQFP) in small quantities let me know.


Then the question is... does GCC support it? If not directly, is at close enough to say the ATMEGA32 to be usable? Also, does the standard AVR programmers (like the STK500) support it. You will probably need one to initially configure the chip and its fuses so that you can program a serial bootloader into the device.


Excellent find!

Good questions, I have STK500, Dragon, AVRUSB, etc. to load software. They indicate ISP programming so I would design the board to have an ISP jack for loading them monitor program. After that use USB/serial to program it.

GCC is an important question.

This chip is looking quite interesting.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby Alan B » Thu Nov 04, 2010 4:38 pm

Some messages say GCC support released in 2008.

Example code on Atmel site indicates GCC used.

Looks promising...
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby rebelpilot » Thu Nov 04, 2010 4:41 pm

I checked out the product page at Atmel. All the above starter kits and programmers support the chip. Don't know about GCC.

http://www.atmel.com/dyn/products/produ ... rt_id=4307
http://www.atmel.com/dyn/products/produ ... ATmega32M1
rebelpilot
1 kW
1 kW
 
Posts: 338
Joined: Wed Jul 28, 2010 12:44 pm
Location: Ontario, Canada

Re: Designing a Commuter Controller

Postby Alan B » Thu Nov 04, 2010 7:11 pm

I will order a couple of these parts to make sure they're actually available. Add to my chip collection. They are the 85C version, not the full automotive temperature range.
Last edited by Alan B on Thu Nov 04, 2010 8:48 pm, edited 1 time in total.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: Designing a Commuter Controller

Postby texaspyro » Thu Nov 04, 2010 7:14 pm

There is a header file for the ATMEGA32M1 in the latest GCC release...
texaspyro
1 MW
1 MW
 
Posts: 1539
Joined: Wed May 12, 2010 6:53 pm

Re: Designing a Commuter Controller

Postby Alan B » Thu Nov 04, 2010 7:19 pm

Excellent!
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Next

Return to E-Bike Technical

Who is online

Users browsing this forum: Google [Bot], Marcojr, speedmd, TRIGON391 and 17 guests

cron