# Building a contactor controller (just for fun)



## bigmotherwhale (Apr 15, 2011)

you should look at a multilevel inverter which is the solid state equivalent of a tapped pack contactor controller, if your clever with switching it can also keep the batteries balanced. 

Using a li ion pack on a relay controller like this will result in excessive imbalance and its bound to go wrong, catch fire etc.. 

Honestly... if your struggling to read circuit diagrams for these simple circuits you should probably buy a controller off the shelf and forget about building anything, batteries this powerful as you are aware don't take kindly to mistakes. I don't want to burst your bubble but if its just for fun, make a model first until you are comfortable.

I would still strongly advise against it, if a contactor welds shut and you could directly short out a cell bank....


----------



## Matej (Dec 4, 2015)

bigmotherwhale said:


> you should look at a multilevel inverter which is the solid state equivalent of a tapped pack contactor controller, if your clever with switching it can also keep the batteries balanced.
> 
> Using a li ion pack on a relay controller like this will result in excessive imbalance and its bound to go wrong, catch fire etc..


The plan was to use an isolated 12V source for switching the batteries between three or four different series/parallel arrangements.
For example, if using 8 modules, the modules would switch between 2s4p for low speed, 4s2p for medium, and 8s1p high. Would that still be prone to damaging a lithium battery pack?

If lithium is a bad idea, then I will just stick with golf cart batteries. I mainly intended to use the modules because I should have some left over from my car conversion once I buy a second pack.

This will be a model, more or less. I am definitely not going to hook it up to a battery pack right away, especially with no safety precautions. I may not ever even put it into a vehicle. 
Since the 12V power will not be fed directly from the pack, I should still be able to see it switch even without batteries connected.


----------



## bigmotherwhale (Apr 15, 2011)

if you can parallel the packs like that then you should be okay, each 2p pack should be individually fused incase a contactor welds shut. 

Its going to require a lot of contactors to do this have you got a circuit that you plan on using?


----------



## onegreenev (May 18, 2012)

I would do a low voltage two contactor setup first. Just to know it works as expected. Then move to a larger setup.


----------



## dcb (Dec 5, 2009)

Matej said:


> with schematics, though they are still over my head at this point:


It would be good for you to understand those, but also understand that the power circuit of a modern controller is a hell of a lot simpler.

It is basically a buck converter, but the motor is the inductor and load (i.e. short out the load in this picture and pretend the coil is the motor and you have a basic motor controller).

the switch is a solid state device (i.e. large igbt or parallel mosfets), so it lasts infinitely longer than a relay.

it turns on/off several thousand times per second, and the ratio of on to off time (duty cycle) is varied to control the current flow in the motor. At less than full power/lower rpm it takes a high voltage low current from the battery and converts it to lower voltage higher current within the motor. The diode simply maintains the motor current when the switch is open, otherwise a fair bit of energy would be wasted every time the switch toggles.










so if you are wanting to stick with relays because you think it is simpler, it really isn't. the modern controller power circuit is a lot simpler and reliable and efficiently provides virtually infinite adjustment vs 2 or 4 voltage levels.

The contactor design is so horrible by comparison, seriously, nostalgia isn't a good enough excuse, lack of comprehension can be addressed.

this is about all the effort I have to put into a contact controller  (note, you can see him "manually" duty cycling it on startup and going slow)
https://www.youtube.com/watch?v=unhXEQQk8G8


----------



## ga2500ev (Apr 20, 2008)

dcb said:


> It would be good for you to understand those, but also understand that the power circuit of a modern controller is a hell of a lot simpler.
> 
> It is basically a buck converter, but the motor is the inductor and load (i.e. short out the load in this picture and pretend the coil is the motor and you have a basic motor controller).
> 
> ...


I throw in my 2 cents on this:

A contactor/rectator controller is doable DIY. An actual working switching controller really is not. There are simply too many challenges in terms of switching frequency, switching speed, gate drive current, and motor overcurrent management to effectively build a working switching controller from scratch.

OTOH a contactor/rectator controller is doable DIY precisely because switching occurs at human hands and speeds. Take a look at Lee Hart's discussion of such a controller:

http://www.evdl.org/docs/rectactor.pdf

a 4 step controller is little more than 3 contactors and 6 diodes. At full speed it operates at 100% efficiency.

And most importantly, it is actually doable DIY.

ga2500ev


----------



## dcb (Dec 5, 2009)

ga2500ev said:


> And most importantly, it is actually doable DIY.


well, there are a lot of folks building their own controllers, so I don't know what to tell you. microcontrollers and drivers and cooling and sensing have a learning curve, sure, but there are so many applications that it is a really good investment from a diy perspective, and the electronics diy arena is seriously booming. 

So it is a matter of perspective and initiative, even the contactor controller is out of reach for a lot of people. I did look at the rectactor diagram, and a couple years ago it wouldn't have made any sense to me, but now it was immediately obvious (and obvious that the first diagram didn't have a "zero current" setting).


----------



## ga2500ev (Apr 20, 2008)

dcb said:


> well, there are a lot of folks building their own controllers, so I don't know what to tell you. microcontrollers and drivers and cooling and sensing have a learning curve, sure, but there are so many applications that it is a really good investment from a diy perspective, and the electronics diy arena is seriously booming.


I would say that over my years here, lots of folks have made the attempt, but the successes have been few and far between. Jack Bauer had reams of pages of discussion on his controller here. Paul and Sabrina's Open revolt has a design thread that easily spans 5000 posts. Major and Tesseract have literally written dissertations of material on the development of the Soliton controller.

The issues of switching controller design are subtle with a lot of complex interrelationships among the components and the parameters.. There's not only a learning curve, but there's no guarantees that even once someone has climbed that learning curve, that they will have a successful result.

So showing the basic block diagram of a switching controller and stating that it's more simple than a module that effectively consists of a contactor and two diodes really misses the mark.



> So it is a matter of perspective and initiative, even the contactor controller is out of reach for a lot of people. I did look at the rectactor diagram, and a couple years ago it wouldn't have made any sense to me, but now it was immediately obvious (and obvious that the first diagram didn't have a "zero current" setting).


It's a module not a complete system. A complete system still requires a main contactor to separate power from the motor.

So anyway, instead of just going back and forth, let me motivate this with an example. Here are some items that I have collected into my power electronics junkbox over the years:

STE140NF20D
N-channel 200 V, 10 mΩ typ., 140 A STripFET™ II Power MOSFET
(with fast diode) in an ISOTOP package

http://www.st.com/web/en/resource/technical/document/datasheet/CD00222025.pdf

Multiple HCGF5A 3700 mfd capacitors for input capacitance:

http://www.hitachiaic.com/docs/products/Screw_Terminal_Electrolytic_Capacitors/HCGF5A.pdf

Now I'm interested in a controller for a Kollmorgan bike hub motor 36V similar to the one here: http://visforvoltage.org/blog/engrscotty/5028

Control electronics are not an issue. I have access to various PIC microcontrollers with all the requisite timing and comparitor electronics for monitoring and PWM. But to simplify let's say for the sake of argument the main controller is a raspberry pi.

OK. So exactly where do we start prototyping? Here are a bunch of questions:

1. What is the switching speed?
2. What are the power electronics required to drive N channel mosfet? Specifically how does one create the high current driver required to switch the MOSFET efficiently?
3. Since the MOSFET gate has to be at least 10V above the drain, which is connected to the top of the battery voltage, where does the gate drive voltage come from?
4. How much input capacitance is required?
5. What mechanism is used to ensure that the motor isn't slammed with overcurrent, especially when starting from a stop?
6. What resistance is required for the capacitor precharge? Also how long does that precharge cycle have to last before engaging the main contactor?
7. Exactly what diode should be used? Actually that's a trick question because the best diode to use is the diode in the MOSFET. Unfortunately that diode is turned the wrong way. So you actually should wire up a second mosfet with a grounded gate to get the required diode.

So that's a good start. I'm actually interested because at some point I would like to put that electric bike controller together. Also I have some interest in using some cheap, medium powered treadmill motors for some other projects. Of course they run at 100-120V to develop maximum power, so now not only are we talking about PWM control, but also isolated DC-DC conversion to get the 12-24V battery input into that 100-120V range at some decent efficiency.

It would be wonderful to get some real answers. It would even be more wonderful to have page page/site similar to Lee Hart's rectactor discussion. But as I've been saying, though conceptually switching motor controllers seem simple, the reality is far from it.

ga2500ev


----------



## dcb (Dec 5, 2009)

ga2500ev said:


> So showing the basic block diagram of a switching controller and stating that it's more simple than a module that effectively consists of a contactor and two diodes really misses the mark.



well when you expand those modules into a multi-speed controller, it gets ugly quick is what I'm getting at (and I did specify I was talking about the power circuit). i.e. for just 3 speeds:
6 high power contactors
6 high power diodes (which ironically would probably be surplus IGBTs)
some resistor fudge thingie to get rolling smoothly.

vs infinite speeds and reliability
1 high power igbt
1 high power diode (or just use a dual igbt module)
1 contactor just because. It will work without it, but suspenders and belt. And the contactor is only cycled once per drive, not constantly.

but yes, the details are many, in both cases (dc converter?)



ga2500ev said:


> STE140NF20D
> N-channel 200 V, 10 mΩ typ., 140 A STripFET™ II Power MOSFET
> (with fast diode) in an ISOTOP package
> ...


You know, I really do appreciate lee hearts offerings, and the rectactor is a neat circuit, but honestly for a bike, and this is based on experience, you don't really need anything but an on-off switch. I had a moped that I broke the throttle cable on by the carb (funny how straining on the throttle didn't make it go any faster...), it had a little kill button for your thumb. I basically clipped the pigtail of throttle cable in the full open position, and pulsed the thumb button for idle (maybe a tiny blip once a second, it was all automatic in my head after a couple miles), and just removed my thumb for "full throttle", which wasn't all that different from off. Drove it like that for years.

so maybe you control your mosfet with a normally open switch that is convenient for your thumb, and just duty cycle it manually?

edit, I would just put it on the low side, with an off bias, and a zener and resistor and a thumb pushbutton switch to engage it from the pack, and a cheap analog ammeter so you have some idea if it is getting abused. edit2: oh, and another diode across the motor for good measure.
edit3: if you decide to add a driver and logic later you still can, I don't think you will need it though, not if you have ever played a video game with buttons.


----------



## dcb (Dec 5, 2009)

but also, dc controllers are dirt cheap on ebay too, less than your aging component collection by now.


----------



## domosher (Jul 10, 2011)

building a relay control can work but it is better to do it on paper first to develop the process. To use relays you will need relays that are rated for 4 to 5 times the expected running current to prevent welded contacts. You will need 1 or 2 relays even if you make or buy a solid state control. A solid state control needs to monitor the current in at least one of many ways. The series pass elements should not be pushed past 60% of there ratings for reliability, I would not use a MOSfet as a diode they will not any peak currents over there ratings a good Schotkey diode will handle up to 10 times its average rating, and dissipate 1/4 as much heat.


----------



## ga2500ev (Apr 20, 2008)

dcb said:


> well when you expand those modules into a multi-speed controller, it gets ugly quick is what I'm getting at (and I did specify I was talking about the power circuit). i.e. for just 3 speeds:
> 6 high power contactors
> 6 high power diodes (which ironically would probably be surplus IGBTs)
> some resistor fudge thingie to get rolling smoothly.
> ...





dcb said:


> but also, dc controllers are dirt cheap on ebay too, less than your aging component collection by now.


DCB,

The fact that you keep moving the goalposts really is proof of my point that a switching controller is a challenging effort DIY. Honestly, it doesn't matter that my parts may be old stock, or that the application may be small. What does matter is that both meets the criteria for parts and application where a switching controller is appropriate. 

There seems to be a hangup with the fact that the rectator has more parts, which does in fact mean that there are more points of failure. But both the design and the application of those parts are trivial to understand: take two equal voltage modules and attach a diode to each one. Then bridge the two modules in series with a switch. When the switch is off the two modules are in parallel. When the switch is on, the two modules are in series. Combined modules can be built in pairs, and then further joined using the same method.
As the OP pointed out you switch between 2P1S and 1P2S configurations.

BTW the 4 module configuration gives you 4 speeds, not three. Combining a 2P1S in series with a 1P2S gives a 3S speed setting. So with 12V base modules, you can get 12V, 24V, 36V, and 48V for example.

But let's not get off track. Nothing about this discussion is about if you need a switching controller, or if you can buy one. 

The sole question is given the opportunity, what is the likelyhood of success building a working prototype each type in a DIY situation.

I would love to prototype a working 36-48V switching controller. But there is no straightforward methodology that I have come across that describes how to do it. Instead there are thousands of pages and posts of all the issues to contend with. And almost all of those surround the issue of the fast and effective switching of the switching element.

The rectator is simple precisely because the switching speed is so slow. It's not a chopper. Switching happens at 5-10 second intervals, not in 50 microsecond intervals. Switch drivers can be dumb and inefficient and still work effectively.

Honestly all the questions that I asked about the switching controller can also be applied to the rectator. Consider the issue of starting the motor. While Lee Hart's example used a resistor, a more efficient method would be ramping up the motor current by pulsing the main switch. So apply 12V for example but cut off the main switch when the motor reaches a current setpoint. So exactly the same issues of measuring motor current and controlling the switch comes into play as with a switching controller.

In fact there's really no reason that a "modern" rectator could not in fact use MOSFETS for the switches. Of course similar switch driver issues come into play. But again it's switching once every 5 seconds, not once every 50 microseconds. So the management is quite a bit simpler.

I know it seems like I'm arguing that the rectator is better. I'm not. I am arguing that a rectator is simpler to understand, and more importantly, much simpler to control and monitor. As such it does have the possibility of successful development in a true DIY circumstance.

ga2500ev


----------



## dcb (Dec 5, 2009)

ga2500ev said:


> DCB,
> 
> The fact that you keep moving the goalposts really is proof of my point that a switching controller is a challenging effort DIY.


I did no such thing. I've never claimed switching controllers were anything less than a steep learning curve. You claimed that simple implementation was important, so I gave you the simplest implementation for your alleged "real world" situation, that still used a solid state switch, with a followup that there are actual controllers at your power levels that are really cheap so you don't kick yourself later. One of OPs stated concerns was cost for "full power".

You completely ignored it, the simplest reliable solution, a thumb controlled mosfet switch. Isn't that a bit hypocritical?!?


----------



## ga2500ev (Apr 20, 2008)

dcb said:


> I did no such thing. I've never claimed switching controllers were anything less than a steep learning curve.





dcb said:


> It would be good for you to understand those, but also understand that the power circuit of a modern controller is a hell of a lot simpler.
> 
> It is basically a buck converter, but the motor is the inductor and load (i.e. short out the load in this picture and pretend the coil is the motor and you have a basic motor controller).
> 
> ...


You were saying?



> You claimed that simple implementation was important, so I gave you the simplest implementation for your alleged "real world" situation, that still used a solid state switch, with a followup that there are actual controllers at your power levels that are really cheap so you don't kick yourself later. One of OPs stated concerns was cost for "full power".
> 
> You completely ignored it, the simplest reliable solution, a thumb controlled mosfet switch. Isn't that a bit hypocritical?!?


This wasn't about a simpler solution. This was about an implementation of a switching controller which you stated was a "hell of a lot simpler."

Like the OP, the interest in building DIY controllers is really to understand how they work. When you understand everything about a project, you can build, adapt, and scale as needed. It severs the dependence on manufacturers to build and repair stuff because you built it yourself.

I want nothing more than to understand how to build switching controllers at all power levels. It would be really great if the implementation was as simple as the block diagram. But I don't see any clear explanation how to do that matches the rectator discussion. Anyone with any electronics knowledge can follow Lee Hart's discussion and build a simple controller at any power level.

I asked 7 questions in my example. I haven't seen an answer to any of them yet.

As for ignoring your point, it wasn't about switching controllers. So simpler or not, it wasn't relevant to the discussion.

ga2500ev


----------



## miscrms (Sep 25, 2013)

Another thing to keep in mind with contactor controllers, my understanding is they were most practical when you had a pretty under powered battery / motor. Connecting even 12V of decent size modern Li cells into a 8 or 9" forklift motor is going to be able to dump a lot of instantaneous current into the motor, 100s of amps or more wouldn't surprise me. There's not much voltage sag there to naturally limit the current the way there would have been in an old lead battery. That's going to require beefy wiring / contactors etc to keep from melting anything. Those 100s of Amps are probably also going to produce 100s of ftlbs of instantaneous torque at low rpms. That's either going to produce a very jerky response at the wheels (like braking traction once a second say) or be smacking the driveline very hard, or both depending on gearing. At very low switching frequency this can also induce oscillation, which aside from being very uncomfortable will increase the likelihood of breaking your driveline.

I too have been fascinated by some of these vintage technologies, but IMHO you have to be very careful about trying to apply a vintage solution into a modern system. The reason they often worked at all was because they were matched to the limitations of the rest of the system.


----------



## miscrms (Sep 25, 2013)

The commuta-car you mentioned, for example, had a 2.5-3.5hp motor that could only propel the 1250 lb vehicle 28mph wide open with a 36V pack, 35mph with a 48V pack.


----------



## dcb (Dec 5, 2009)

ga2500ev said:


> This was about an implementation of a switching controller which you stated was a "hell of a lot simpler."


No, I said exactly:
"the power circuit of a modern controller is a hell of a lot simpler."

I never ever implied the rest of the controller was easy, not once, though it does eventually make sense. You keep putting words in my mouth and saying I did things I did not do, and expect me to sort out your bicycle controller for you in the process, screw that noise. You can do your own homework, or try to build a 1000 amp capable contactor controller.


----------



## ga2500ev (Apr 20, 2008)

I have succeeded in locating some answers to at least a few of my questions posed earlier. Julian Ilett has a pair of youtube tutorial series explaining MOSFET operation and a deceptively simple optoisolated MOSFET gate driver that can handle switching in all MOSFET configurations, including N-Channel high side with a floating gate switch.

Julian's Practical MOSFET tutorial series describes the basic operation and configurations of both N-channel and P-channel MOSFETs. Of particular interest would be videos 4,5, and 6, which outline high-side N-channel, microcontroller interfacing, and using the optoisolated driver from the other series. This set can be found here:

https://www.youtube.com/playlist?list=PLjzGSu1yGFjUgTVkhb4WslOVDNAZ3K4yR

The driver called the DCOI (pronounced decoy) construction and operation can be found in this series of videos:

https://www.youtube.com/watch?v=uff1nzFo140&list=PLjzGSu1yGFjVmWH5g-bcTcssOVFvZnRtp&nohtml5=False

The basic operation of the LED side of the optoisolator circuit starts a the 2:10 mark of the 4th tutorial. The schematics are shown at the beginning and end of the 5th video. The 6th video describes the use of the driver with a high side N-channel and a bootstrap capacitor driving the gate.

This collection of videos answers some of my questions:


ga2500ev said:


> 2. What are the power electronics required to drive N channel mosfet? Specifically how does one create the high current driver required to switch the MOSFET efficiently?
> 3. Since the MOSFET gate has to be at least 10V above the drain, which is connected to the top of the battery voltage, where does the gate drive voltage come from?


Given this newfound information, an interesting exercise would be the design of a rectator module using a N-channel MOSFET as the switch. The base design of the module uses 2 diodes to parallel the modules and a switch to connect them in series:

M+
D1 UB
+-S-+
LB D2
M-

M+,M-: Modules +/- terminals
UB,LB: upper and lower batteries
D1,D2: diodes.
S: switch.

So if S is an N-channel MOSFET then the drain connects to UB- and the source to LB+. As long as the gate and the source are at the same voltage, the MOSFET is off and M+ is the parallel voltage UB and LB (minus the diode drop).

Turning on the MOSFET is the catch 22. Once the MOSFET it on then UB+ will above the source and can drive the gate indefinitely. However, with the MOSFET off, only a diode drop separates UB+ and LB+, which is not enough separation to turn the MOSFET on.

So this is where the bootstrap cap comes into play. When the MOSFET is off, the voltage between M- and M+ is used to charge the cap. Then the DCOI driver switches cap so that the bottom of the cap is connected to the source, and the top of the cap is connected to the gate. The sum of the two voltages at the gate turns on the switch which snaps M+ to the serial voltage of UB and LB. At this point UB can then drive the gate indefinitely until the DCOI switches the gate back the source, turning off the MOSFET and restarting the cycle.

Other than a 12-15V zener diode to limit the gate voltage when UB and LB are larger than 12V, it's really as simple as that.

ga2500ev


----------

