Help Safe Make His Motor Current Limiting Controller

Get all your technical information about electric bikes here.

Help Safe Make His Motor Current Limiting Controller

Postby Beagle123 » Fri Sep 14, 2007 5:10 am


Safe, I've noticed that you've been pounding us with charts and graphs because you want motor current limiting. Well, I've decided to tell you how to make it! And since this is the season where you hybernate and lay your eggs, you can tackle it indoors away from the fridgid winds.

First of all, you need to make a "black box" that goess between the controller and the throttle. It would take the throttle position and motor current as its inputs, and it would output a correct voltage to the controller. So how do we build this box? Answer: a microchip. The microchip will receive the inputs, if the motor current is too high, it will be limited, and the message sent to the controller. So when you turn the throttle to speed up, it sends the message to the microchip, and the microchip decides what to do.

Here is a microchip you can use on your computer. The actual microchip is the little rectangle in the lower left with all the electronics in it. THe other things are tools to help you work with the microchip.

You can buy this set-up at parrallax.com. This is called the Board of Education.

This "Board of Education" has a USB jack on it, so you can pluig it into your computer's USB port. With that connection, you can write computer programs in pBassic on your computer, and transfer them to the chip. WHen the chip is programmed, you can pluck it off the board, and put it in your device (bike)




Attachments
DSCN0571.JPG
DSCN0571.JPG (88.24 KiB) Viewed 1181 times
User avatar
Beagle123
10 kW
10 kW
 
Posts: 624
Joined: Wed May 02, 2007 2:35 am
Location: Los Angeles

Postby Beagle123 » Fri Sep 14, 2007 5:12 am


The first input to the chip is motor current. That means you need to get a current sensor like this:
User avatar
Beagle123
10 kW
10 kW
 
Posts: 624
Joined: Wed May 02, 2007 2:35 am
Location: Los Angeles

Re: Help Safe Make His Motor Current Limiting Controller

Postby cadstarsucks » Fri Sep 14, 2007 5:20 am

Beagle123 wrote:
This "Board of Education" has a USB jack on it, so you can pluig it into your computer's USB port. With that connection, you can write computer programs in pBassic on your computer, and transfer them to the chip. WHen the chip is programmed, you can pluck it off the board, and put it in your device (bike)

I am glad it is not the "board of education" from my childhood, that one was about 2.5' long and had the signatures of my father's graduating class on it.

Dan
User avatar
cadstarsucks
100 W
100 W
 
Posts: 134
Joined: Wed Aug 29, 2007 5:35 am

Postby Beagle123 » Fri Sep 14, 2007 5:57 am

See the pins sticking out of the bottom of that thing? One connects to the negative, one to +4 volts and the other is variable. THe two big terminals act like a shunt. Since this is a 50A current sensor, the third wire will be at range between 1 and 4 volts depending on how much curent is runningha through the shunt.

This is the info you need to execute MCL.

So you'd connect the two big connectors (shunt) between two motor wires, and observe the voltage changes. The three small connectors would be hooked up to the pins of the microprocessor. Which pins? You can pick whichever you want. Then write your program using those pins.

You would need to attach your throttle to the microprocessor too. THere is an intermediate step to this. The throttle gives off analog data, so you'd run it through a atod chip first. THen give the microprocessor the number. Basicly it converst an analog signal into a number between 0 and 255.

Once you set up the sensor, then you just type in a program like this:

Loop Forever


get motorcurrent from pin 12
get throttle position from pin 11
IF MOTORcURRENT > 20 THEN

MOTORcURRENT = 20
else if throttlecurrent > 70 then
volts to Controller = volts to Controller + .5

END IF
WAIT 1.2 second
END LOOP

Then you click run program. The program is copied onto the basic stamp (microcontroller) and executes.

You can set-up a fake current controller to be used to program a microchip. Use a battery and a potentiometer to make various voltage inputs, and check to see if the program is working. You can have the results of the program displayed on your computer screen. So as you adjust the voltage of your fake current sensor, you can see how the programm is responding. Once its giving out the correct signals, hook it up to your bike.

Get a book called "Robot Builders Bonanza" It will explain all this.
User avatar
Beagle123
10 kW
10 kW
 
Posts: 624
Joined: Wed May 02, 2007 2:35 am
Location: Los Angeles

Postby cadstarsucks » Fri Sep 14, 2007 6:19 am

Why not just do it analog? A simple opamp ckt would do it. An LM358, a TL431, a 1N4148, and a few resistors will do the trick. Of course you still need the current sensor.

Dan
User avatar
cadstarsucks
100 W
100 W
 
Posts: 134
Joined: Wed Aug 29, 2007 5:35 am

Postby safe » Fri Sep 14, 2007 8:02 am

Great Idea!

Assuming the prices for this stuff aren't unrealistic the idea of being able to "build your own" programmable MCL controller circuit sounds great. I'll have to spend some time looking into it some more and figure out if there are "gotcha's" that aren't obvious right now, but it looks like a nice way to integrate the computer with the bike.

I think we all know that eventually there will be computer chips and software control all throughout the electric bike, so this is a step in that direction.

Seems to me you have most of what you need to do it yourself right now... why not try it?
User avatar
safe
100 GW
100 GW
 
Posts: 6700
Joined: Fri Dec 22, 2006 12:14 pm

Postby The7 » Fri Sep 14, 2007 8:24 am

The current on the BLDC motor side is AC current.
You may have to design an circuit for converting AC current to DC voltage when using the current sensor chip.
User avatar
The7
10 kW
10 kW
 
Posts: 774
Joined: Wed Jul 11, 2007 5:07 pm
Location: Vancouver

Postby safe » Fri Sep 14, 2007 8:50 am

The7 wrote:The current on the BLDC motor side is AC current.
You may have to design an circuit for converting AC current to DC voltage when using the current sensor chip.


I'm using a brushed motor. It's easier to experiment with new threories if you start with a platform that is easier to work with.

The conclusion from the gearing analysis alone (if you recall) was an increase of 24% in efficiency, 28% in power, and a reduction in heat by 33%. The MCL will add more benefits beyond that, so the 5-10% baseline efficiency advantage of the brushless will kind of get lost in all the other gains.

I'd prefer brushless, but in the overall scheme of things the newly discovered gains of MCL (if they are real and can be verified) will dwarf the small baseline advantages of brushless.

The brushless would be "Version 2.0"... :wink:

As they say: "Keep It Simple"

We also need to realize that using the same voltage the MCL solution is also going to increase peak power... so there are efficiency as well as power issues that are going on.

And finally... I was talking with a local builder of recumbent bikes and he was asking about hub motors verses motors with gears and I had to give him the "lecture" about "steady state" verses "sport" performance demands. For people who are "steady state" riders (of which the recumbent type of riding tends to be) the need to pay attention to the full powerband is pretty small. But for people like myself that demand almost constant acceleration or peak power (or nothing) the demands of the motor are reversed.

:arrow: Sport bikes need an Induction (Tesla) motor or the closest you can come to it.

:arrow: Steady State bikes that cruise, but don't attack the road are better suited with high efficiency, but narrow rpm motors. Hub motors would suffice for such a riders demands.

So the MCL is really a "bridge technology" between the "steady state" DC motor and the "sport oriented" Induction motor.

It's not the "ultimate solution" but it does make a decent compromise...
User avatar
safe
100 GW
100 GW
 
Posts: 6700
Joined: Fri Dec 22, 2006 12:14 pm

Postby cadstarsucks » Fri Sep 14, 2007 10:27 am

The7 wrote:The current on the BLDC motor side is AC current.
You may have to design an circuit for converting AC current to DC voltage when using the current sensor chip.

You get the AC version of the chip and make a precision rectifier ckt. and then offset it to 0V ad use it to clamp the analog from the throttle. It is more straight forward in analog.

Dan
User avatar
cadstarsucks
100 W
100 W
 
Posts: 134
Joined: Wed Aug 29, 2007 5:35 am

Postby fechter » Fri Sep 14, 2007 10:56 am

I posted an analog version a while back. I'm not very good at writing code. Since Safe is running a brushed motor, we don't have to worry about measuring an AC current.
Attachments
Safe Current Limiter.jpg
Safe Current Limiter.jpg (48.19 KiB) Viewed 1127 times
"One test is worth a thousand opinions"
User avatar
fechter
100 GW
100 GW
 
Posts: 9389
Joined: Sun Dec 31, 2006 3:23 pm
Location: California Bay Area, USA

Postby safe » Fri Sep 14, 2007 11:18 am

The analog version looks to be the cheapest... but the idea of having the ability to program the MCL circuit looks like a lot of fun too. I need to know what all that stuff costs first before I decide. With software capability I might invent some other even more exotic algorithm, or at least experiment with others.

The MCL concept is essentially the same end result as the old way of using a resistor... you only get as much current as is proportional to the voltage. The PWM added the "current multiplication" which also added the extra motor heat... but I guess the thinking was that it was better to heat up the motor with excess torque than heat up the resistor based controller.
User avatar
safe
100 GW
100 GW
 
Posts: 6700
Joined: Fri Dec 22, 2006 12:14 pm

Postby cadstarsucks » Fri Sep 14, 2007 11:23 am

safe wrote:The analog version looks to be the cheapest... but the idea of having the ability to program the MCL circuit looks like a lot of fun too. I need to know what all that stuff costs first before I decide. With software capability I might invent some other even more exotic algorithm, or at least experiment with others.

The MCL concept is essentially the same end result as the old way of using a resistor... you only get as much current as is proportional to the voltage. The PWM added the "current multiplication" which also added the extra motor heat... but I guess the thinking was that it was better to heat up the motor with excess torque than heat up the resistor based controller.

That really depends on where the current is sensed...before or after the freewheeling diode.
Dan
User avatar
cadstarsucks
100 W
100 W
 
Posts: 134
Joined: Wed Aug 29, 2007 5:35 am

Postby safe » Fri Sep 14, 2007 2:18 pm

:arrow: Is the price really $65 as it appears to be?

That's a lot of money to start to spend (because that's just the board itself) before you even get to solving the problem.

The analog circuit doesn't look that complicated and if used in conjunction with a "Watt's Up Meter" or "Cycle Analyst" it should be pretty easy to debug.

If I have a choice of spending $65 for the "Board of Education" or a "Watt's Up Meter" I'll take the meter.
User avatar
safe
100 GW
100 GW
 
Posts: 6700
Joined: Fri Dec 22, 2006 12:14 pm

Postby Beagle123 » Fri Sep 14, 2007 3:49 pm


It will cost about $100 for the board, and another $40 for the basic Stamp (microprocessor chip). The sensor is about $20. You can also get a hall sensor to measure RPMs for about $8. I'm sure there's a voltage sensor (seems obvious). In the end you'll have the tools to make your own "Watss's up" meter, except that you can have it give commands to the controller.

I'm going to tinker with it myself someday. I hope to make an automatic transmission of some sort. It will sense current, and rpms and accelerate or increase gears in response. The possibilities are endless once you get the inputs working.

I don't know what to say about fetcher's idea. He's the electronics genius, I'm not.
User avatar
Beagle123
10 kW
10 kW
 
Posts: 624
Joined: Wed May 02, 2007 2:35 am
Location: Los Angeles

Postby Beagle123 » Fri Sep 14, 2007 5:02 pm


I forgot to mention that all the info for this is at parallax.com.

Also, if you look at the picture of the Board above, the white area where you plug in wires is where you connect to the pins on the chip. Notice that they are numbered. Each number corresponds to a pin on the chip. So to plug the sensor into pin 12, just connect the wire to the corresponding slot in the white board.

You can also use this borad as your actual device. You can program it, then just unplug it from the computer's usb, and attach it onto your bike. You don't have to transfer the chip to its own device. Just plug the controllers wires into the white board. So this board would be the actual MCL unit.

When you do this, it will run off a 9v battery. There is a 9v battery connector on the board.

User avatar
Beagle123
10 kW
10 kW
 
Posts: 624
Joined: Wed May 02, 2007 2:35 am
Location: Los Angeles

Postby dirty_d » Fri Sep 14, 2007 5:36 pm

even if you use a brushed motor the current isn't stable it has a waveform because the backemf varies with the position of the poles so so does the current, but it should be an easy fix, if you put a low-pass filter on the output of the current sensor you should get a good stable signal for the average current through the motor, right? i like the idea of using a micro controller and writing code, a op-amp would be simpler but that just seems more fun. beagle are you a programmer?
User avatar
dirty_d
10 kW
10 kW
 
Posts: 995
Joined: Sat Jun 16, 2007 4:15 pm
Location: Massachusetts

Postby Beagle123 » Sat Sep 15, 2007 5:11 am


I'm a computer programmer, but that's really the easy part. I think this Basic Stamp will only run about 500 lines of code, so its not a big program, but plenty for our purposes. The hard part for me is the electronics. The stamp thinks in digital terms, and you're dealing with analog signals, so you have to use aanother stock chip to make a voltage into a value between 0 and 255 (255 = max). That value is fed to the stamp via the pins inhexidecimal format (8 pins on or off etc). Then you can use that value in your program.

It would take a bit of work. I'm hoping to tackle it after I finish my bike. I'll be able to do it eventhough its my first try. I can get the answerss I need to get it done.

I hope to get a bunch of you guys to cooperatee on building bikes, so we can specialize. I'm sure I could do something really good if that was all I had to do.
User avatar
Beagle123
10 kW
10 kW
 
Posts: 624
Joined: Wed May 02, 2007 2:35 am
Location: Los Angeles

Postby cadstarsucks » Sat Sep 15, 2007 8:40 am

Beagle123 wrote:
I'm a computer programmer, but that's really the easy part. I think this Basic Stamp will only run about 500 lines of code, so its not a big program, but plenty for our purposes. The hard part for me is the electronics. The stamp thinks in digital terms, and you're dealing with analog signals, so you have to use aanother stock chip to make a voltage into a value between 0 and 255 (255 = max). That value is fed to the stamp via the pins inhexidecimal format (8 pins on or off etc). Then you can use that value in your program.

It would take a bit of work. I'm hoping to tackle it after I finish my bike. I'll be able to do it eventhough its my first try. I can get the answerss I need to get it done.

I hope to get a bunch of you guys to cooperatee on building bikes, so we can specialize. I'm sure I could do something really good if that was all I had to do.

Or if you insist on doing it the hard way just get a proper micro...one that has A/Ds on chip. I still say you are better off with analog unless you are doing a predictive algorithm, but I do not believe that is what is being discussed.

Dan
User avatar
cadstarsucks
100 W
100 W
 
Posts: 134
Joined: Wed Aug 29, 2007 5:35 am

Postby safe » Sat Sep 15, 2007 9:22 am

Analog or Digital?

It's a tough call. The obvious advantage of analog is that it only takes a few inexpensive components to make it work, but then you have to expand you intellect enough to comprehend the weird ways that analog circuits work and be willing to nurse all their idosycracies like temperature variations, etc... Digital is really the better solution because you've exported everything to the computer and can focus on software.

Here's an idea...

:arrow: Why not start with an actual real life computer?

You could easily pick up a used older laptop for next to nothing and then the main issue would be connecting the computer to whatever you wanted to control. You could more or less capture everything and then you could do all kinds of telemetry analysis of your riding behavior including:

1. Peak Current.
2. Speed.
3. Rpm.
4. Volts.
5. Amps.
6. Mileage

...basically you could "reinvent the Cycle Analyst (DrainBrain)".

At the end of all that the only component missing is the MCL.

Where this makes sense is with the Tesla-style Inductive motor. If I were to simply buy a Variable (Switched) Reluctance motor that is roughly 1000 watts in size (they do exist) then I could transcend all this petty DC motor stuff (and even gears) and go straight for the jugular vein of "sport performance". For the VR/SR Inductance motor you really need to control it by computer.

:arrow: The "bottom line"...

If you think too much and try too many far fetched ideas at once you never get anything done. I've already got my #002 project that has three months of hard work invested into it with at least another month to go before it's finished. All this advanced electrical stuff should be done only as time allows and that means "in the dead of winter" when there's nothing else to do. I'm inclined to go with the analog solution because it might not be perfect, but it just might be "good enough" to get the job done. (with control knobs to keep it adjusted it should work fine)
User avatar
safe
100 GW
100 GW
 
Posts: 6700
Joined: Fri Dec 22, 2006 12:14 pm

Postby maxwell » Sat Sep 15, 2007 9:32 am

You could go my totaly OTT route and have 2 DSP chips!
Attachments
built_177.jpg
built_177.jpg (76.76 KiB) Viewed 609 times
maxwell
100 W
100 W
 
Posts: 157
Joined: Sat Mar 31, 2007 10:25 am
Location: Sunny UK

Postby safe » Sat Sep 15, 2007 10:40 am

http://www.RockyMountainTechnologies.com

These guys make Switched Reluctance motors that would work really well for an electric bike. (94% efficiency)

The price?

SR130M - $2,225

Wow... :shock:

Looks like if you want to get anywhere near the level of Inductance motor performance you need to use gears and an MCL circuit... or break your bank account...
User avatar
safe
100 GW
100 GW
 
Posts: 6700
Joined: Fri Dec 22, 2006 12:14 pm

Postby fechter » Sat Sep 15, 2007 11:07 am

Yikes!
Where's that washing machine that has one?
"One test is worth a thousand opinions"
User avatar
fechter
100 GW
100 GW
 
Posts: 9389
Joined: Sun Dec 31, 2006 3:23 pm
Location: California Bay Area, USA

Postby safe » Sat Sep 15, 2007 4:01 pm

I saw a vacuum blower for around $500 that was using a Switched Reluctance motor... so I suspect the prices are going to be all over the place. They look easy enough to build that you could even do it yourself. Just how much performance you get would be suspect... the guys that build motors spend a lot of time refining it, so the chances of getting it right on the first or even the tenth time are slim.

With some luck a good, low priced, switched reluctance motor will turn up...

Just keep your eyes open for them... :shock: 8)
User avatar
safe
100 GW
100 GW
 
Posts: 6700
Joined: Fri Dec 22, 2006 12:14 pm

Postby dirty_d » Sat Sep 15, 2007 4:29 pm

although it would be cool to go digital with this there isn't really any point, all it is i a current limiter, the analog way is so much simpler and it should just plain work better too. the circuit that fechter posted is pretty easy to understand if you just really take a look at it and study how it works, go read about what op-amps do then it should start to make sense.
User avatar
dirty_d
10 kW
10 kW
 
Posts: 995
Joined: Sat Jun 16, 2007 4:15 pm
Location: Massachusetts

Postby Beagle123 » Sat Sep 15, 2007 4:56 pm


That's a good idea dirty. I have to admit, I haven't done my homework on analog circuits. And I think you're right that most of what it add up to is just a fancy current limiter. And with my luck, a bus will be headed straight for me on the day my current limiter is attached. :shock:

The real benefit though is battery management, and gear management. Its just more optimization, hoping to gain a few percentage points in efficiency and range etc.

I'm still putting it off too.
User avatar
Beagle123
10 kW
10 kW
 
Posts: 624
Joined: Wed May 02, 2007 2:35 am
Location: Los Angeles


Return to E-Bike Technical

Who is online

Users browsing this forum: Little-Acorn, Naldo, rscamp and 13 guests