EcoModder.com

EcoModder.com (https://ecomodder.com/forum/)
-   Open ReVolt: open source DC motor controller (https://ecomodder.com/forum/open-revolt-open-source-dc-motor-controller.html)
-   -   Paul & Sabrina's cheap DIY 144v motor controller (https://ecomodder.com/forum/showthread.php/paul-sabrinas-cheap-diy-144v-motor-controller-6404.html)

MPaulHolmes 12-13-2008 04:25 AM

Paul & Sabrina's cheap DIY 144v motor controller
 
(ADMIN NOTE:
This thread is very long, but LOADED with all sorts of great information. To skip straight to some of the end results of all the hard work of Paul and others, please visit the WIKI on this project, located at:
http://ecomodder.com/wiki/index.php/ReVolt )




There are 3 basic parts to an electric car:

Motor Controller
Batteries
Motor

Freeway capable EVs are more expensive than slow EVs because you need more batteries (sometimes: could use buddy pairs at lower voltage) and a high voltage controller. The same motor can often still be used, just by advancing the brushes, and maybe adding a blower to keep it cool.

So, it seems to me that the best place to focus efforts to making freeway capable EVs more affordable (under $1500?), is to focus on the controller. About $1200 or so can be shaved off the cost of a new controller.

So, here's my plan:
First, I'll make a smaller controller. I plan on it being 72v 40amp. Then, I'll try to scale it up. I'll test the smaller controller on my ebike, which has a brushed dc motor.


Today, I ordered most of the components and tools needed to make the bike controller. As they come, I'll take pictures of the things and the process. I'll try to get the bike controller done before school starts in January.

Some of the more important parts I ordered include:

50 MHz two channel oscilloscope

Ten IRFB4110 mosfets
IXDD414PI mosfet gate driver
Five STTH6002CW freewheel diodes
Atmel STK500
ATMega8 microcontroller
7.5 to 76V in, 5V out DC-DC
7.5 to 76v in, 12v out DC-DC
Twelve TS-ED 200v 470uF Panasonic Capacitors

MPaulHolmes 12-13-2008 04:35 AM

So, how do you make a controller?

The microcontroller (ATMega8 in my case) can generate pulse width modulation (PWM) signals. So, it listens to the throttle, and then sends a PWM signal to the mosfets' gate driver. The gate driver amplifies it a bit. The gate driver's job is to turn the mosfets on and off according to the PWM signal. Then, the mosfets massively amplify the PWM signal. That signal is sent to the motor, and you drive down the road. That's it!

The microcontroller can also monitor things like battery pack voltage, temperature, or whatever you want!

Daox 12-13-2008 08:57 AM

Very interesting! I'm all ears on this one.

MPaulHolmes 12-13-2008 04:37 PM

I think for the car's version, the controller will be powered by the auxiliary 12v battery, or by some other 12v source, rather than by the full pack voltage. However, the pack voltage ground will still not share a ground with the 12v battery, unlike in Kelly Controllers (aahh!).

The cost of components is about the same, but there are several advantages:

First, have you noticed that controllers say things like 48v-72v, 84v-120v, etc... That's because inside the controller is a DC-DC converter to step down the voltage, and it has a limited input range. So instead, my controller will have an available pack voltage input of 12v to 156v or something like that. As long as it stays clear of 200v, it will be fine, since I'll be using 200v mosfets.

Second, you can have the controller take care of pre-charging it's own resistors, rather than having that be something external.

Third, the high voltage input dc-dc converter has quite a few extra external components needed to make sure it will function properly. The 12v-12v option doesn't have any, so it's much simpler.

This represents 6 hours of Saturday research. My eyes hurt. good bye!

captainslug 12-13-2008 09:27 PM

Quote:

Originally Posted by MPaulHolmes (Post 78281)
Third, the high voltage input dc-dc converter has quite a few extra external components needed to make sure it will function properly. The 12v-12v option doesn't have any, so it's much simpler.

Also very true. High voltage input DC-DC converters can be as abhorrently expensive. Especially when compared to the cost of simply adding a 12V battery (of appropriate AH rating) and simple 12V charger.

Intrigued 12-14-2008 12:05 AM

Some Thoughts...
 
Wow. You're really gonna make this happen, aren't you?!?!

Some thoughts on all this:

1) Can you say "Patent"? You should learn to, if you can't... This sounds a whole lot more interesting that trying to explain "2x=6" to a bunch of smart-mouths who don't care!
2) I'm more than all ears on this one. I'll be all eyes on the emails for replies to this thread, too.
3) This looks to end up being a controller and pack voltage indicator in one. Way Cool! :cool:
4) Will you be selling your version 1.0 controllers cheap when you get to 2.0??? :D

MPaulHolmes 12-14-2008 04:03 AM

First draft schematic
 
1 Attachment(s)
Hey, Intrigued, if only teachers could whoop students as if they were a red-headed step child, I would teach for free. If you are going to be excited about each post, I'll have to really make sure I actually have something interesting to report!

This is a modified version of Ian's "speedy" controller. His was for a 24v trolley. This version is 72v, and powers the mosfets and the micro-controller with the 12v auxiliary battery (that powers the lights and blinkers and other stuff). It doesn't share a common ground with the battery pack.

Notice that the PWM output from the ATMega8 is the PWM input into the gate driver. The driver amplifies the PWM signal, and then opens the floodgates of all the mosfets at the same time!

By the way, if you have ever wondered why a pre-charge resistor is important, it's because there are TONS of huge capacitors inside the controller! They don't like to be short circuited! OOH, so we need just a little more stuff inside that schematic to have it pre-charge when the 12v battery power is applied.

Intrigued 12-14-2008 02:34 PM

Quote:

Originally Posted by MPaulHolmes (Post 78362)
Hey, Intrigued, if only teachers could whoop students as if they were a red-headed step child, I would teach for free.

Huh. If they pay there like they do in Missouri, you're pretty close to that pay level already! :rolleyes: My mother is a retired Special Education teacher. She says the worst part is that the kids KNOW that you can't touch them. :mad:

Quote:

Originally Posted by MPaulHolmes (Post 78362)
By the way, if you have ever wondered why a pre-charge resistor is important, it's because there are TONS of huge capacitors inside the controller! They don't like to be short circuited!

FINALLY!!! All I needed was for it to be put in words I understand!!! :thumbup: YESYESYES!!! I remember enough from my learnin' during my "first college-hood" days back in the 70s to finally understand what's going on. You dump enough electrons into a circuit that is wanting to soak them up, and something's gonna give... :eek:

Whew! <wipes forehead...> I finally got a decent handle on EV range vs. battery technology, and now I understand "flux capacitors"!!! (That's from somewhere in Darin's thread, I think...;)) Now it's on to the rest of the pieces parts. Maybe in 20 years or so I'll have everything figured out in my "gotta-understand-it-thoroughly-or-too-chicken-to-try" brain, and I can do it all by my lonesome!!! :D (Thanks, MPaul!)

MPaulHolmes 12-15-2008 11:35 PM

Some things came today!
 
5 Attachment(s)
So far, the big capacitors, mosfet drivers, little itty bitty MLCC (multi-layer ceramic chip) capacitors, and the awesome mosfets came today. The oscilloscope is in the mail. I also got some sheet metal and wrist strap to make a static free workbench in the garage. Great news! I get to solder those MLCC's!!!! What the heck?

TheSGC 12-16-2008 06:02 PM

What are you using for current limiting? I too am working on a controller but won't get to it until classes are over. I am using a PIC controller, hall effect current sensor and 100 volt MOSFETs for my prototypes. I am working on a modular controller that will be limited to 60 AMPs, but be able to connected in parallel for more juice.

MetroMPG 12-16-2008 07:02 PM

Quote:

Originally Posted by MPaulHolmes (Post 78708)
I also got some sheet metal and wrist strap to make a static free workbench in the garage.

Sorry, that admission has just disqualified you from the "duct tape, cardboard and hammers" school of DIY ecomodding. :)

MPaulHolmes 12-16-2008 07:35 PM

hall effect sensor
 
Quote:

Originally Posted by TheSGC (Post 78874)
What are you using for current limiting?

For the bike, I'm using no current limiting. In my case, the motor's resistance and GHETTO old lead acid batteries will be enough current limiting to keep the mosfets from blowing up. I've already tried the bike with a simple on/off switch at 60v (no controller. it was awesome torque,horrible range, very jerky and scary).

For the car, I'm going to use an off the shelf hall effect sensor. It's like $16 I think. It can read up to 600 amps.
Possible Choice for Hall Effect Current Sensor

That sounds like an awesome project you are doing! I hope you keep me updated. I like the idea of having modules that can attach to increase the max amps. That sounds very interesting!

MPaulHolmes 12-16-2008 08:09 PM

4 Attachment(s)
Quote:

Originally Posted by MetroMPG (Post 78888)
Sorry, that admission has just disqualified you from the "duct tape, cardboard and hammers" school of DIY ecomodding. :)

You are right. It felt really wrong... But, I don't know if this makes things ok, but I will use some used christmas wrapping paper to make the surface less cunductive. In case I ever drop a battery upside down on the table or something! Actually, that would probably still be really bad since the paper isn't very strong.

The table is grounded through a 1 megaOhm resistor to the ground pin of an outlet.

MPaulHolmes 12-17-2008 09:28 PM

3 Attachment(s)
Today was pretty productive. First, it snowed a whole bunch! It doesn't snow that much around here, so it's been really cool. It's late now, and the sky is bright pink. Weird!

The EVTech list has been really, really helpful. For the car's version of the controller, 4 ounce copper pcb is required. That stuff is sort of hard to come by at your local radio shack. What it means is that every square foot of the pcb (printed circuit board) has 4 ounces of pure copper on it. That's a lot! Someone on the EVTech list is sending my wife and me 2 pcb's of 5 OUNCE copper for free!!! That's thick!

The bike version of the controller will be able to handle around 40 amps. So, there has to be a copper bus on which all the current flows. Each mosfet will contribute about 8 - 10 amps to the bus. Such a high current requires pretty heavy copper. I'm thinking of using 10 gauge wire for the bus.

So, here's the rub. How do you solder a lead (leed) from a mosfet to such a heavy wire that will be about 6 or 7 inches long? Try it! Take a soldering iron and try it! It's tough. The dang wire won't heat up enough. So, 2 days and many EVTech.org conversations and reading and trying several things that don't work led to an awesome solution! But that's for another update... I just heard the doorbell ring...

HOLD EVERYTHING!!! WHO COULD BE VISITING IN THIS SNOW STORM? ONLY THE UPS MAN!!!!!!!!! That's right! The programmer and 2 microcontrollers (atmega8) just arrived! heck ya dude! This is where things get interesting...

Oh no! It's a static sensitive device? I need a static free workstation! Hmm... What to do? hahaha!

Intrigued 12-17-2008 09:47 PM

Quote:

Originally Posted by MPaulHolmes (Post 79125)
So, there has to be a copper bus on which all the current flows. Each mosfet will contribute about 8 - 10 amps to the bus. Such a high current requires pretty heavy copper. I'm thinking of using 10 gauge wire for the bus.

So, here's the rub. How do you solder a lead (leed) from a mosfet to such a heavy wire that will be about 6 or 7 inches long? Try it! Take a soldering iron and try it! It's tough.

For cryin' out loud, man! Find a piece of scrap copper tubing somewhere, pound it flat with your Oprah hammer, drill a few holes in it, and BOLT the wires you solder to the leads to the now flat copper strip...or something like that...

...or am I missing something here... :confused:

MPaulHolmes 12-17-2008 11:58 PM

You're not missing anything! Want to know something funny? Lee Hart, the Godfather of Electric vehicles on the EVDL and the EV Tech list suggested something close to what you just said. You know what, I think your idea is maybe better than what I was going to do. There are a few things to deal with, like the bolt heads hitting the pcb underneath the copper bars, but that's not so bad. It can be worked around I think!

Edit: Well, maybe I'll save that way for the car, because I don't need that much copper for the bike version. hmm...

Sometimes you get going in one direction, and you need someone to come along and throw in a little common sense! Thanks, Intrigued!

Intrigued 12-18-2008 12:15 AM

You're welcome! :thumbup:

Although I'm not so sure about the common sense part... I just took 4 times to log in, because I had my stupid "Caps Lock" on... :D

MPaulHolmes 12-18-2008 06:30 PM

STK500 operational!
 
5 Attachment(s)
programmed the micro-controller (after some difficulty getting everything plugged in right! ANGER!) with a program that lets you see some LED's so I could actually tell that it worked. It worked! Unfortunately, the program needed to run a motor controller doesn't really make it easy to see that it's working. I need a dang throttle, and a bunch of electrical components, and just build the left half of the motor controller itself (most of the low power side in the schematic above) just to test the stupid program!

So, I programmed the ATMEGA8 with the motor controller program, on faith, trusting that it's all good. Now I need to build a prototype of the low power half of the controller. No mosfets on this version. Basically, I'm going to be "driving" an LED (baby motor! hehe). Now, this LED will get brighter and dimmer through PWM. I guess I'm making 3 motor controllers, a WEENIE BABY LED 5v 0.01amp "motor controller", a medium 72v 40amp bike controller, and a monstrous 144v 400amp (500? 600???) car motor controller! Hold me back, hold me back!

I have to go to Sylvan really soon, and it's super stormy and snowy! Man, I wish I had more time!

The pictures show the STK500 with the ATMega8 micro-controller plugged in (ready to receive it's motor control program), and various screen shots, including showing that it has been successfully programmed! Hurray!


"Time is the fire in which we burn!" (some guy on like Star Trek 8 or something, when Captain Kirk got stuck in the Nexus with Whoopi Goldberg and Captain Picard)

Intrigued 12-18-2008 08:01 PM

ooooooOOOOOOoooohhh! (Like that bunch of alien toys on Toy Story)

I see a possible sideline for MPaul Enterprises, here... not only building controllers, but tweaking the programming on all of your buddies' computers in their cars, so that they get even better gas mileage!!!

<You have saved us from the evil Fuel Lord. We are forever in your debt!> (us) :D
(you) :eek:

Daox 12-19-2008 09:29 AM

Great work Paul!!! Looking forward to more updates.

Funny 12-19-2008 12:49 PM

I don't even have an EV and I find this facinating :D. I would think that you could mass produce these for a bunch of people on this forum ;).

Just kidding, though the instructions are in depth enough that once this is working, you may have something that goes mainstream! Good luck!

MPaulHolmes 12-19-2008 01:17 PM

1 Attachment(s)
Thanks! I've been thinking that a highly modularized kit (not lots of skill needed to assemble, maybe just time) might be good. Once a program is written and works well for the controller, the ATMega8 chips are only about $1 each, and the STK500 programmer takes less than a second to program the chip, and software is free, but don't tell Microsoft that. Maybe if I assembled a bunch of logic boards (the low power half), and cut the bus bars (the heavy copper B-, B+, and M-) for the controller, and etched the heavy 4 ounce (per square foot) copper PCB that will be bolted to those bars, and maybe soldered the mosfets and capacitors to the heavy board, the rest would be maybe a couple hours of work assembling that someone without a lot of tools could do?

Update: Some anger! I programmed the chip, built the low power half of the circuit, and the dang LED didn't come on! It's hard to use a $2.99 volt meter to measure voltages that are going from 0 to 5 volts thousands of times a second. My oscilloscope will probably be here really soon, since the probes and power cord came yesterday! I need that thing to see what's going on!

Update 2: I found a mistake in the assembly of the circuit. I hope this fixes the problem.

MPaulHolmes 12-21-2008 12:57 AM

Baby motor controller (5v 0.01amp) completed!
 
4 Attachment(s)
There were more than a few mistakes in both the circuit AND the program! It took HOURS to fix them all. ANGER! My beautiful oscilloscope came today. No plug that fit, but I had a spare computer plug that fit. With it, I could enter the world that I had been blind to until now.

So, I hooked up a throttle, and could control my pwm signal. Next, I need to send the pwm signal to a driver to amplify it, and then use the driver to turn on a few mosfets. Next step, 72v 40amp bike controller! Hold me back! Hold me back!

The picture of the oscilloscope with the green lines shows the pwm. It was about 80% of full throttle.

I think I'll install this version in my car and see what sort of acceleration I get. I'm guessing about the same as the forkenswift. :turtle:

Intrigued 12-21-2008 09:42 PM

Ouch! Someone who lives close to Darin go over and pull that knife out of his back. I could feel that all the way from here... :D

bennelson 12-21-2008 10:28 PM

I'm sensing an EcoModder Open Source Car Project™ coming on here.....

Paul, maybe you wanted to keep around the "baby PWM driver".

You could put it on your dashboard so that as you spin the engine up and down, the LEDs get brighter to indicate your power. Might be a cool motor indicator!

MetroMPG 12-21-2008 10:49 PM

Anger! (So much anger in this thread...)

No, no, that's OK. You guys can have your copious extravagant power. And your acceleration. And your breaking of things from said power. Nya, nya.

Intrigued 12-21-2008 11:04 PM

Quote:

Originally Posted by bennelson (Post 79731)
the LEDs get brighter to indicate your power. Might be a cool motor indicator!

Oooo! I'm likin' it even more. A controller, pack indicator, dc convertor, and tach all in one!!! :p

Soon, we'll all be saying it: "You have saved us from the Evil Fuel Lords. We are forever in your debt!" :turtle:

bennelson 12-21-2008 11:05 PM

Us 72V electric cars are pretty furious!

Whatever I brake, I just have to rebuild stronger!

http://gallery.me.com/benhdvideoguy/...C_0321/web.jpg

Funny 12-21-2008 11:11 PM

Re-build the parts until they stop breaking for a month. Then mass produce the sucker. That's how the Big 3 does it... oh yeah... never mind :D.

MPaulHolmes 12-22-2008 03:41 PM

Program with step by step instructions
 
1 Attachment(s)
Hello! OK, so I have carefully tested the small controller, and watched the results on the oscilloscope. Finally, the software appears to be without any errors, and is much simpler and easier to read now. I think I'll run the bike controller at 4kHz. It may irritate dogs in the neighborhood, but it will keep switching losses down, and it's just a first draft. Well, second draft if you count the 5v 0.01amp one.

To compile this program, download the FREE Atmel AVR Studio!
Atmel AVR Studio


To compile the program, change the file name to end with .c instead of .txt

It wouldn't let me upload it here unless it was in ".txt" format.

There are a lot of page references in PWMAndInputTest.txt. They refer to the PDF of the documentation for the ATMega8. It can be found HERE!
Also, the code assumes you are using the PDIP version of the chip (28 pin version).

Intrigued 12-22-2008 04:36 PM

// GOOD Programmer! Good Boy!
// Leaves lots of notes, if for no other reason, to remind himself
// ...of what the heck that all was...
// 2 years later when have forgotten... :D

Christ 12-23-2008 03:16 AM

LOL intrigued... I learned a long time ago, to leave plenty of notes, even in HTML... if nothing else, it helps other people using your de-compiled stuff to learn.

MPaulHolmes - Subscribed - Better late than never? LOL.

I'm quite interested to see where this goes as I lean more and more toward converting my CR-X to an EV.

MazdaMatt 12-23-2008 09:08 AM

I just had a peak at your schematic and read up on the IXDD414. I would like to HIGHLY recommend that you have some sort of fail-safe switch attached to the enable line instead of tieing it high. You could put it on the dash as the "start" switch.

Also, i don't know if you've done this because i didn't read the code... I would highly recommend that you use a watchdog timer that will put the chip into a reset state where the pwm line is driving the mosfets off.

I'm a computer engineer... i write embedded code for a living and i spend a lot of time dealing with the hardware for which i write code (i've got a pile of boards on my desk right now that i'm testing). I will definately follow your thread and see what you're up to and make little inputs where i can. Be sure to post anything that is puzzling you or any little ideas that you'd like expanded.

Cheers, and good luck.

Intrigued 12-23-2008 10:29 AM

Quote:

Originally Posted by Christ (Post 79951)
LOL intrigued... I learned a long time ago, to leave plenty of notes, even in HTML... if nothing else, it helps other people using your de-compiled stuff to learn.

;) Back during my "first college-hood" in the '70s, (Before Al Gore :p) the only computer languages around were COBOL and FORTRAN. I took a liking to COBOL then, but was an Aviation Technology major, and didn't mess with it.

Since the Sudden Stop at the bottom of that fall that put me in this cursed wheeled conveyance, I have been going through my "second college-hood." Guess what one of the first things was I studied? COBOL! Even 9 years ago nearly a third of what was coming out in the business world was in COBOL for use in AS-400s and other midrange-to-mainframe computing-type contraptions. Now that I'm close to my Bachelor's degree (Business) there's not much use for it anymore, but if I can figure out how to live until Y2.1K, I could sure help in reprogramming all of the old-timers - again! :eek:

EDIT: Wait a minute... ARPANET IN '69, TCP/IP first written in '74. Maybe it wasn't before he invented the internet...

MPaulHolmes 12-23-2008 11:47 AM

Quote:

Originally Posted by MazdaMatt (Post 79958)
I just had a peak at your schematic and read up on the IXDD414. I would like to HIGHLY recommend that you have some sort of fail-safe switch attached to the enable line instead of tieing it high. You could put it on the dash as the "start" switch.

ABSOLUTELY! I was reading about that too. It would be a shame to have such a wonderful soft shutdown available and not even use it. I'm just being super simplistic right now for the bike version. I've never done anything like this before (I'm a substitute teacher), and I'm just trying to get something as simple as possible to work as the first draft.

I think I was just going to add a thermistor right next to the mosfets, and monitor that in the software. The idea was that their case temperature would not be allowed to get above a pre-determined safe amount. As it got closer to that max temp, I'll ramp down the duty cycle all the way to 0. Since the input pin is wired to ground through a resistor, the mosfets would be shut off that way instead.

My Analog to digital converter is going at about 125,000 samples per second, so I thought that would be quick enough for monitoring temperature increases. This brings up a question I have. The maximum sample rate of the A/D Converter is like 4 MHz, but the ATMega8 documentation says the conversions are the most accurate with no more than 200,000 sample/sec. It doesn't say how inaccurate it gets the faster it goes, so I've limited mine.

Quote:

Originally Posted by MazdaMatt (Post 79958)
Also, i don't know if you've done this because i didn't read the code... I would highly recommend that you use a watchdog timer that will put the chip into a reset state where the pwm line is driving the mosfets off.

I haven't done this. I saw that there is such a thing as a watchdog timer on the ATMega8, but I have no idea what it is. I'll read up on that. It sounds like a very good idea.

Quote:

Originally Posted by MazdaMatt (Post 79958)
I'm a computer engineer... i write embedded code for a living and i spend a lot of time dealing with the hardware for which i write code

Man, I love ecomodder. This site is the reason my wife and I were able to get our conversion done. So many experts in such a wide variety of fields!

MazdaMatt 12-23-2008 11:55 AM

Hehe... don't confuse "educated and working" with "expert" :D

I will be proud to help this project in any way i can. You have accomplished an amazing amount without any embedded systems/electrical engineering background. Good work!

Quite frankly, you don't need to sample the A/D converter that fast... 100Hz would be fine.

Watchdog timer was an obscure concept when i started this stuff. It is actually quite simple. You enable it, then it counts down till it expires and resets the chip. The idea is that your code will regularly reset the timer so that the chip doesn't reset. If ever your program hangs due to an unforseen bug (it happens to the best!) your system resets and you carry on with life. Ideally, a watchdog reset would be followed by an immediate shutdown of the motors.

In my reading, the big risk with DC motors is the ability to run away at full throttle if your control goofs up. I'd do as much as possible to ensure that this doesn't happen... just keep it in mind, don't hang up your project on it.

MPaulHolmes 12-24-2008 06:08 PM

video!
 
Our first video of the motor controller

Oh ya! We have thermal shutdown (until it cools) now as a feature.

bennelson 12-24-2008 06:44 PM

Nice video.

I almost did a spit-take when you pulled out the hair dryer to test the thermal shutdown.

I think that's the exact same thing I would have done!

MPaulHolmes 12-24-2008 07:18 PM

1 Attachment(s)
That hair dryer was right out of the Ben Nelson playbook. Remember the coffee can brakes? hehe!

I attached the (once again) revised version of the program, with the thermal shutdown included.

EDIT: I ordered a hall effect current sensor. I wasn't going to, because I don't think we need one in this case. However, current limiting is critical with EV controllers, so maybe we'll do it for practice.

MetroMPG 12-25-2008 10:46 AM

Yay! The hair dryer saved the Muppets! Or something.


All times are GMT -4. The time now is 10:37 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com