These forums are archived!
Please create a new account at our new forums here: http://forum.modifiedpowerwheels.com
ModifiedPowerWheels.com powerwheels upgrades, peg-perego and others very welcome

Specializing in Peg Perego and Power Wheels Parts and Machines
Udemy Course
Home | My Files | Profile | Active Topics | Members | Search | FAQ | RSS allows you to view new posts anywhere!!
 All Forums
 Modifications by Category
 Motors/Gearing/Drivetrain
 Creating a uC PWM motor controller
 Forum Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/23/2006 :  08:46:57  Show Profile  Visit jwcolby's Homepage
Back in the late 90s I designed a controller based vending machine (down In Puebla Mexico) to sell phone debit cards. It was based on a Z-World z8xxx micro-controller board using a dedicated 'C' language and controlled all aspects of accepting money into a bill acceptor, and "vending" a card using a custom built card hopper, while logging the quantity / time / date sold, money in the bill acceptor etc. The machine could then dump the data over an RS232 port to a hand held computer that the service person carried. Ever since that time I have been itching to get back into controllers to play around.

Since that time, the controller market has matured and controllers are now cheap and widely available. I am well into the research for building a "simple" PWM motor controller based on a microcontroller. I have ordered the stuff needed to experiment with the Atmel series micros, a handful of the micros themselves, have found sources for high current mosfets and schematics for how to use them to control a motor using PWM.

Using a micro opens up the project to lots of fancy stuff. For example:

1) Using a real Potentiometer based foot pedal (think video games) to allow infinite speed control over the given voltage.
2) "Softstart" algorithems to prevent or at least reduce stripped gears due to to sudden application of torque.
3) Heat sensing and current limiting to prevent motor damage while allowing maximum performance at all times.
4) External circuits (headlights?) that shut off N seconds after the accelerator was last pressed.
5) Warning and eventual shutdown to prevent deep discharge of and long term damage to batteries.
6) Programming the allowable discharge depth (lowest voltage) allowed. The recommendation with deep discharge batteries is MAXIMUM ~60% (current) discharge. Anything beyond that will cause battery damage.
7) Lowering the maximum current draw in steps as the voltage drops so that as the user reaches certain discharge depths the performance starts to degrade, allowing the ability to get home before the machine shuts down.
6) Data logging of date/time of use, starting battery voltage, battery voltage over time (how long your battery is holding up).
7) Data logging of current spikes applied to each motor (max current applied), average current applied etc. for failure analysis.
8) Intelligent control of 18V or 24V systems to prevent damage under these extreme conditions.
9) Governers to allow limiting the speed on a driver basis.
10) Reducing power to a tire off the ground and applying more power to the tire still on the ground to assist traction control, all on a second by second basis.
11) Dimming headlights as the voltage drops to conserve power to get home.
12) Your desired applications here.

I think I read somewhere that I can actually sense RPM so I might even be able to log the motor RPMs for those who want to know that. In fact given rpm and a knowledge of the stepdown ratio, I can log (and even display on an LCD) speed.

Because this will be based on a microcontroller, functionality is limited by the number of pins available on the micro selected and the number of pins required to control things, and the amount of code (code size) required to implement the desired functionality. These micros contain pins that can sense voltages (and thus currents / temperatures etc), built in timers, lots of input / output pins for sensing switches and lighting lights, driving speakers etc.

My intention is to build a system with edge connectors that allow simple screw in of the various wires - V+/V- from the batteries, and V+/V- to the motors / lights / sirens / other peripherals. I own a web site www.colbyconsulting.com and can post upgrades and bug fixes for this stuff on my web site which can be applied live to the machine, although it will require an extra cost device to attach to a usb port / serial port to allow this. I can even provide a forum specifically for this controller.

Lets get our heads together and think about what would be useful to enthusiasts (you and me) in controlling a ride-on toy, and making it cooler for the kids. I'll do the controller, you guys can figure out the motors / gears which I know nothing about.

Sirens anyone? Flashing emergency lights? Beeping backup like the big guys? How about 4 wheel drive? RS232 to connect to a computer for controlling the various parameters and do data dumps? RF range control to prevent your kid from riding his too cool car to the store?

[Your suggestions here]

Please also indicate how much you would be willing to pay for this kind of controller so that I can make design decisions. While thinking about this, please consider how much you have paid for motors because of stripped gears, how much time you have spent changing stripped gears etc. You might think "Oh, this might be worth $25" but if you change a gear one time, that is how much money and how much time? If you are changing gears every X months, how much is that. I have no idea the market for this thing, nor what it will cost in the end (though I do have some ballparks for that - at least the parts involved) so your comments on this are appreciated.

Understand that I have to make a living and controllers is not how I make my living but I am going to do something like this for my son's toy so if it works I might as well see if I can make it cheap enough to actually make it valuable to you. Scooter controllers are fine, but something designed specifically for these toys is a whole different ball game.

What do you think?



JWC

Edited by - jwcolby on 10/30/2006 12:53:32

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/26/2006 :  17:54:32  Show Profile  Visit jwcolby's Homepage
Is nobody interested in a custom controller designed specifically for ride-on toys?

JWC
Go to Top of Page

Grant
Senior Modder

Brisbane
Queensland
Australia



1820 Posts

Posted - 09/26/2006 :  18:45:42  Show Profile  Visit Grant's Homepage
It does sound like a great idea, esp. if you are taking about ride-ons with a large number of accessories. Price wise it would have to be competitive with scooter controllers which offer similar basic functionality.

Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/27/2006 :  06:21:37  Show Profile  Visit jwcolby's Homepage
My first project is going to be a lights / action controller. My son has been begging for headlights and while I am at it I will be adding taillights and a siren. The general idea is that I use a 20 pin controller, the ATtiny26 by Atmel.

http://www.atmel.com/dyn/resources/prod_documents/1477S.pdf

Using this controller I assign a pair of pins to sense a TPDT switch. When the switch is thrown to the left, the left turn signal will blink. When thrown to the switch is thrown right the right turn signal will blink. In the center no turn signal blinking. This switch will be spring loaded so that when released it automatically returns to the center position - no turn signal.

I then assign a pair of outputs to drive MOSFETs (power transisters) which will then apply current to the turn signal lights. IIRC these turn signal lights can be purchased at wally world.

There will then be a second spring loaded SPST switch sensed by another pin on the controller. When this switch is thrown up the controller will turn on the high beams, when the switch is thrown up a second time will turn on the low beams.

The high beams will have a pair of MOSFETs as well. The reason is that there will be an "emergency" switch that is flipped to go into "emergency" mode. This will cause the headlights to flash alternately (like a police car) and a siren to function if available.

The siren will be a speaker driven by a MOSFET. The uController will modulate a pin to cause the sound frequency, which will then get higher and lower over time (like a police car).

This particular controller has an on-chip analog comparator which I will use to sense (for now) the voltage applied to either wheel, doesn't matter which. Sensing voltage will cause the entire circuit to function at all. This chip will then have programming to sense the startup, and allow power to be applied to the lights, but also will sense removal of power (to the wheels) and after a delay of some period (30 seconds?) will remove power to all lights.

High beams will just be full power applied to the lights. Low beams will trigger a low frequency PWM (pulse width modulated) waveform which will to be applied to the headlights. This reduces the total "on time" and thus reduces the intensity of the lights. Power will be applied through a MOSFET power transister.

In summary, a single controller, using three inputs to sense two switches, four outputs to drive the headlights and the turn signals, an output for the siren, and a pin to sense the voltage applied to the motor.

The hardware will consist of:

* A pair of headlights - I used the "tractor flood lights" from wally world.
* A pair of turn signals - not selected but I intend to use a pair of lights from wally world.
* A siren - not selected yet.
* Perhaps a pot to adjust the siren volume.
* (1) SPST spring loaded switch for the high / low beams
* (1) TPDT spring loaded switch for the turn signals
* (1) SPST switch for "emergency mode" (not spring loaded).
* 12 gauge wire to run power to the controller from the battery and from the controller to the lights.
* (1) 1 uController ATtiny26
* (2) MOSFET power transisters to apply current to the headlights.
* (2) MOSFETS to apply current to the turn signals.
* (1) MOSFET for the siren
* (1) PCB (printed circuit board) to contain the uController, (6) mosfets, a voltage regulator (for the uController power) and a hand full of screw type edge connectors which are used to apply +12 / Gnd, connect the switches, and send current to the lights.

If anyone has ideas for specific switches for controlling the lights I am all ears, otherwise I will be using standard switches such as you find at Radio Shack / Jameco.

I can of course add another MOSFET for running lights / tail lights (always on when the car is moving), another switch / MOSFET for fog lights - whatever you guys think might be cool.

This particular chip has 16 pins available for input / output. Of these (so far), 4 pins are assigned to switches, 5 pins are assigned to MOSFET outputs and a pin assinged to sensing the voltage (startup/shutdown). Each additional (SPST) switch will require one pin and a matching pin for a MOSFET so we could have up to 2 additional switches for controlling 2 additional outputs. Anything more and I would need to step up to a larger package which would raise the costs slightly.

The nice thing is that all lights go off automatically N seconds after the car stops, which prevents battery drain. I could also provide another MOSFET just to provide an accessory voltage rail for other circuits which will automatically be powered off N seconds after the car is parked.

The uController will always be powered but can be put in low powered sleep mode which essentially uses under a millamp while the car is not being used. It would "wake up" when power is applied to the motors via the accelerator switch, turning on the lights and accessory voltage rail.

If anyone has comments please feel free to jump in.

JWC
Go to Top of Page

greatdane
Expert Modder

Northwest
IN
USA

737 Posts

Posted - 09/27/2006 :  06:53:57  Show Profile
Jwcolby-

First off, let's say I think the idea is cool and novel, but you are way above my head in electronics with designing a controller-What would the controller accomplish above a traditional higher end scooter controller can do?

My concerns are the first thing to be problematic on the abused plastic cars are the controller-whether it be on a minibike or any other soft start pc board, they are the first to go-my suggestion is to be sure it is sealed/epoxied in a case for longevity-

I myself would prefer to use very simple switches and relays to control the lights and such, since I have no chance of repairing a custom designed controller-

Wish you luck, and interested to see the results-

Go to Top of Page

jacobs_dad
Journeyman Modder

oakville
ontario
Canada

229 Posts

Posted - 09/27/2006 :  07:26:49  Show Profile
sounds really cool......however since I understand very little of what you are saying I would have little chance of repairing it when it breaks.

don't forget about the car horn......my kid loves that.
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/27/2006 :  07:39:25  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by greatdane

Jwcolby-

First off, let's say I think the idea is cool and novel, but you are way above my head in electronics with designing a controller-What would the controller accomplish above a traditional higher end scooter controller can do?

My concerns are the first thing to be problematic on the abused plastic cars are the controller-whether it be on a minibike or any other soft start pc board, they are the first to go-my suggestion is to be sure it is sealed/epoxied in a case for longevity-

I myself would prefer to use very simple switches and relays to control the lights and such, since I have no chance of repairing a custom designed controller-

Wish you luck, and interested to see the results-





My desire is simple, to build a controller that is designed for a ride-on toy. A scooter controller does X things, specifically designed for a SCOOTER and that is that. My son isn't riding a scooter, he is riding a gator. He wants a lights. He doesn't know it yet but he wants a police siren and flashing emergency lights.

I don't have a clue about a scooter controller, I have never tried to use one and am not going to, but I doubt that they do sirens and flashing lights.

As for the softstart, that comes in the next module. As soon as I come up to speed on this chipset and how to program it, I will be building a custom controller to run the motors. That would fit the "scooter controller" better, but I just want to do it myself. I have no idea whether a scooter controller understands reverse (seems unlikely) but when in reverse, the motors have to be at a lower maximum speed. I will need softstart of course (scooters have that of course).

When my son's Gator high centers (at least in low gear) one wheel just spins and he goes nowhere. A RIDE-ON controller will understand that there are two wheels and apply power to each as required so that the ride-on never stops because one wheel is off the ground. Does the scooter controller understand two drive wheels? I don't know, but my controller will.

When my son says "daddy I want ... on my Gator" if I am doing a controller, I can possibly add it.

Bottom line, of course you can go buy a scooter controller and whatever you get is what you get. I want control over what I get, and I like doing controllers. They are fun (for me). If you were going to buy a controller from me, you would also get what you get, however... you would also have input on what you get. I am here asking what YOU think is cool to have. Is the scooter controller manufacturer reading this forum asking what YOU want on your controller?

I know what I want. I am going to build what I want. I may build what you want as well if it is practical and can be done. Once I have the controller, adding more stuff is often a simple matter of adding a switch and an output and writing a function to handle that stuff.

I am not selling anyone anything. I am offering to make available what I am going to build, and I am offering to take ideas from you guys and possibly use those ideas to make it "more neat".

And believe it or not, electronics (properly spec'd) are more reliable than relays (mechanics). As for the waterproofing, good idea. They make this liquid that you dip the board in and it then hardens in a waterproof coating.



JWC
Go to Top of Page

jacobs_dad
Journeyman Modder

oakville
ontario
Canada

229 Posts

Posted - 09/27/2006 :  08:24:04  Show Profile
because I am ignorant but very interested.

I have put 6 lights and a car horn on my kids ATV. I am still planning on adding more things.

I have wired all the lights to one on/off switch which is lit. The horn is wired to the existing push button switch.

Everything is wired to a 12V battery which is independant to the other 12V which just runs the motors.

What would a controller do for me?

Joe
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/27/2006 :  08:25:26  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by jacobs_dad

sounds really cool......however since I understand very little of what you are saying I would have little chance of repairing it when it breaks.

don't forget about the car horn......my kid loves that.



Think of a controller like a two way radio on steroids. What it does is what it does. If it breaks you can't repair it (though I can). However the controller itself is totally electronic. The biggest issue will be the MOSFETs (power transisters). If they are big enough to pass the required current without overheating, then then it should last pretty much forever. No moving parts! And if I socket the Mosfets, then if one dies you can just replace that one, even in the field.

The idea is simple though, you get a board with a bunch of edge connectors which allow you to screw wires in it. Two for the 12v/Gnd from the battery. One connector for each switch. One output connector for each power wire going somewhere (to a light for example) and one connector for the returning ground.

1) You drill a hole in the dash and insert the switch for the headlights.
2) Take the two wires coming out of the switch and screw them into the connectors on the PC marked Headlight switch.
3) Take a pair of wires and screw them into two connectors on the PCB marked "left headlight".
4) Run the other end to the left headlight.
5) Repeat 3 and 4 for Right headlight.
6) Repeat 1 through 4 for Left Turn Signal
7) Repeat for right turn signal
8) repeat for horn.

The wiring is simnple. Switches connect to the PCB, Wires run from the PCB to whatever is being powered.

MY job is to make it understandable (labeled well) and make it work reliably. That means using drive transisters sufficiently durable to handle the expected current, and to plainly state the maximum current that each one can drive.

Your job is to drill the holes, mount the switches, lights and horn, and run the wires. No soldering required, at least to the PCB. All connections will be screw in - strip the wire, twist it to make it neatly bundled, then insert the end in a little hole and screw the screw down.

I would most likely provide the switches, with wires soldered on. Hmmm.. my son't first job...

The controller should probably go under the dash, though again I am listening to suggestions.

And remember that before anyone else even sees this thing, it will be running in my son's Gator, so I will have gone through the installation procedure myself.

I am not selling anything yet. I don't even have the parts, but they are on order. My first board will be a prototype hand soldered on a prototype board. Before this went "commercial" I would have to get it all running and then design a PCB and get it made. It would be at that point (before I make a real PCB) that I would start putting out feelers for whether anyone wanted one, and I would have a very firm cost by then.

Right now all I am looking for is whether anyone thinks this might be something they would consider buying, if so how much they might spend, and what other kinds of cool things "their kids" would like. And how much you might spend has to be thoughtful. I can tell you the lights alone at wally world were about $25 just for two tractor floods. More for a little tail light bar. More for turn signal lights. Of course you will be buying the lights so if you can find them cheaper...

I have to buy switches, Mosfets, the controller. All of these things individually are quite cheap ($2.50 for the controller, 39c for power mosfets for each light etc) but when you add all of it up it will most likely be $20 or so in small quantities just for the PARTS for the board and the switches. Remember too that I will never be able to sell a million of these so I will never get volume discounts - unless I can persuade Peg Perego to throw it on the machine at manufacture which seems highly unlikely.

In the end it doesn't matter to me whether anyone wants to buy one of these. I am doing it for my son's enjoyment and my own satisfaction. If you guys think it is cool and want one, then we will talk business.

In the meantime, just let me know what you think, even if it's just "I would never buy one because of reason XYZ". I am not trying to sell one to you.

JWC
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/27/2006 :  08:44:58  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by jacobs_dad

because I am ignorant but very interested.

I have put 6 lights and a car horn on my kids ATV. I am still planning on adding more things.

I have wired all the lights to one on/off switch which is lit. The horn is wired to the existing push button switch.

Everything is wired to a 12V battery which is independant to the other 12V which just runs the motors.

What would a controller do for me?

Joe



Add flashing lights, siren sounds. And my kid would surely forget to turn it off.

A turn signal isn't a switch, it is a blinking light. I suppose you can go to the parts store and get the widget that they throw in autos to do the blinking. How much is that? I don't know but you might.

I will be doing the "police style" alternating flashing headlights with a dedicated switch for "emergency mode", just because it looks cool and my son will love it. And the siren of course (a plain old speaker).

In the end a controller won't do anything that can't be done another way. One thing I have learned in life is that there are a dozen ways to do anything.

The controller is a nothing more than a little computer. Your desktop can do word processing, a spreadsheet, a database, surf the internet, edit pictures. My controller can control the lights today and next week I can add motor control. Next month I can add whatever else occurs to me (or I read about here in the forums). It is a blank slate on which I add functionality that will make my son's Gator more cool.

The best thing about this though is that it is very generic. There is nothing that is specific to the Gator, it will work just as easily on any other ride-on.

We are all enthusiasts, and this is just my way of adding functionality to the toy.

JWC
Go to Top of Page

TiddlerRacer
Senior Modder

Adrian
MI
USA



1849 Posts

Posted - 09/27/2006 :  09:33:01  Show Profile
There are scooter controllers with the ability to do lights, horn, blinkers, etc., etc. for around $30. Jamesons Dad showed how to make a variable speed footpedal using a thumb throttle from a scooter, a piece of PVC, and an original foot pedal.

Not trying to piss on your parade, I think your idea is cool and I would love to see the finished product, but just know if you were going to make these what you would be up against. If Joe consumer can buy a scooter controller than can handle his lighting, horn, and blinkers for $30, or another unit for $60, they will most likely buy the cheaper unit.

One thing that excites me about your idea is the ability to data log and get real time data during the run. When failures occur you can look back at the data and see what happened, or when upgrading motors or switching gears you can see how close to "disaster" you are.

I thought of doing a throttle contoller build up from scratch but I quickly realized that I would be way over $30 (especially considering my time) for something I could pull off the shelf, wire up, and go.

****Testing the limits of Fisher Price engineering on a daily basis.****
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/27/2006 :  11:18:37  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by TiddlerRacer

There are scooter controllers with the ability to do lights, horn, blinkers, etc., etc. for around $30. Jamesons Dad showed how to make a variable speed footpedal using a thumb throttle from a scooter, a piece of PVC, and an original foot pedal.

Not trying to piss on your parade, I think your idea is cool and I would love to see the finished product, but just know if you were going to make these what you would be up against. If Joe consumer can buy a scooter controller than can handle his lighting, horn, and blinkers for $30, or another unit for $60, they will most likely buy the cheaper unit.

One thing that excites me about your idea is the ability to data log and get real time data during the run. When failures occur you can look back at the data and see what happened, or when upgrading motors or switching gears you can see how close to "disaster" you are.

I thought of doing a throttle contoller build up from scratch but I quickly realized that I would be way over $30 (especially considering my time) for something I could pull off the shelf, wire up, and go.

****Testing the limits of Fisher Price engineering on a daily basis.****



LOL, there is no pissing on my parade, I am doing this for me, not to make a living. And of course you are correct, it is tough to compete with a product that is sold by the thousands.

The only thing I can do is stress that a ride-on is not a scooter.

And log data of course. What data do you need to look at, and how can I get ahold of it?

Can you point me to the thread where the throttle is discussed? I don't want to get in to buying old parts off of Ebay but I do need ideas for how to do a foot pedal. I was just going to go with a game controller pedal or something.



JWC
Go to Top of Page

Scratch_6057
Apprentice Modder


GA
USA

56 Posts

Posted - 09/27/2006 :  11:34:11  Show Profile
John,

My intention WAS to stay out of this, just sit back and see where things went. As TiddlerRacer said, “Joe Consumer” is generally going to use the cheapest, simplest thing he can find to do the job. In most cases that is going to be switches wired directly in line with whatever the load is without consideration of such things as current demand, due in most part to a lack of knowledge or understanding of such things, (just look at the number of people who come into these forums initially using auto or lawn tractor batteries).

Exactly WHO is your Controller for, is it for the Kids or the vehicle modifier? The Kids are going to care about GO, Go FASTER, LIGHTS, HORN. If it doesn’t go any more Dad or mom can fix it or get it fixed. Whiz-Bang things like data logging I would think are more for
the vehicle modifier who is going to enjoy tweaking the vehicle AND has a understanding of the electronics and mechanics involved (few and far between I’m afraid). To make a comparison, if Joe Consumer’s 6 year old son “Tommy” wants a RC car / truck, chances are Joe is going to trot down to Wally World and spend $ 50.00 instead of going to the RC hobby shop and dropping $ 750.00 ~ $ 1000.00 on a high end version RC vehicle. I don’t think you are talking about THAT kind of money for the controller but the principle remains.

NOW as far as what might be COOL to have on a controller (from the modifier’s perspective)
Remote Control KILL SWITCH
How about a AUX Fwd / Rev switch for a Winch control from inside the vehicle?
Temperature Sensors mounted to the motors and automatic (adjustable set point) cooling fans? (use A/D chip or port to read them)
Low resistance resistors in line with the motor(s) and an Analog to Digital chip or port would allow the sensing of Motor Stall, One wheel moving faster than the other ‘High Center’ condition, relative vehicle speed, governing top end for the less experienced driver, etc, etc.

If you REALLY wanted to get wild, add a 3 channel RC receiver to the vehicle, cut the steering shaft add a optical encoder to the steering wheel side and a large quarter scale
Servo or a PW gearbox rigged as a servo to the steered side. Wire things to read the sensor and control the servo accordingly for power assisted steering. Then when the kid gets tired of driving, just stick a big stuffed “Homer Simpson” , “Elmo” or some other kind of doll in the vehicle and you have a GIANT RC car.

With a little creativity / imagination the list of things one can do with these “TOYs” is endless.

In all seriousness, I wish you all the luck in the world with your controller. I do Believe you should consider expanding your horizons beyond the ModifiedPowerWheels group to include other “Electric Vehicles / Go Karts” which people are building as DIY projects or as kits.

Mike L.

Edited by - Scratch_6057 on 09/27/2006 11:43:46
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/27/2006 :  13:03:52  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by Scratch_6057

John,

My intention WAS to stay out of this, just sit back and see where things went... [snip]

Mike L.



LOL, boy am I glad you didn't stay out of this. Yea, this forum is aimed at the modifier isn't it? 99% of parents buy a ride-on for their kids, and that is the last they think of it. The kid rides it as best they can, piss poor traction, battery life and all.

And then there is you and me and the rest of this bunch. We do more, rarely because the kid demands it but rather because we LIKE fiddling with things. We get to credit our kid with waqnting it but c'mon, it ain't the kid. My son LOVES what I do with the toy, don't get me wrong, but he never ASKED for bigger batteries, or traction bands on the tires. I did that because I wanted the car to be better (and actually useful).

So these forums aren't aimed at "joe consumer", and neither is a controller of any kind. Both are aimed squarely at you and me and the rest of the nuts that come here.

Now...

On MY list is remote kill switch. I want something that will remove performance slowly as they get further from "home". It will gradually slow down until it finally just stops if they go too far, "too far" determined by me. I already have "plans" for that feature, in fact the company that manufactures this uController has radio stuff already available, because they are used heavily in the RC industry.

Traction control and SoftStart are two inter-related things. Both will come when I get the programming of these beasts down. Easily added in this catagory is higher voltage handling. From what I am reading on these boards, a lot of the damage done to the toy by using higher voltage is due to the lack of softstart. By having an available softstart in my son't controller, I can immediately appeal to other enthusiasts here, even though I have no current plans to do higher voltages myself.

A winch control? Hmmmm. Pretty useless on a lightweight toy like a Gator but certainly useful on a more rugged machine. Even on a Gator a toy winch would add "coolness".

Temperature sensors are fairly easy, thermistors are cheap. Logging the temperature of the motors would be useful for us modders.

Imaging slowing down the vehicle to prevent the circuit breaker form ever tripping! Sense the current and just slow it down if the current (average) goes too high.

Speed sensing requires watching the current on these toys since there is no active feedback from the motors. That would require a heavy duty shunt (calibrated piece of heavy wire) which would cause a very tiny voltage to be created across the shunt and then sensed by an input. This is als0 doable, though a calibrated low ohm resistance is not cheap. Perhaps I could make one though. I read a forum where using something like this you can actually sense the pulses (back EMF) from the motor and sense rpm. RPM equates to speed. RPM at a given current equates to torque. Etc. Lots can be gained from knowing that piece of information especially for us enthusiasts.

A speed display would be cool of course, as well as voltage readout etc. Unfortunately LCDs add more cost to the project of course but these things can be "options".

As for expanding my horizons, I have to have a "product", something real that I am using before I can really go much further. I will be doing a lot of this stuff, just because I love doing it (as do you guys). Once you embed a controller, all kinds of windows open up. I can actually transmit live data over a radio link if I want to. Imagine sitting at your laptop watching data streams from your son's toy as he barrels around the yard. Speed, rpm, current, voltage, even location if you REALLY want to get fancy and throw a GPS on there.



JWC
Go to Top of Page

K-man
Journeyman Modder

Paducah
KY
USA

484 Posts

Posted - 09/27/2006 :  14:21:53  Show Profile
I agree with the liking to fiddle thing, you lost me after that.....

Since most of my projects are disposable, and I have little time or intellect to spend on powerwheels here are my tips:

Data logging: hmmmmm, 12V too slow, 18V hey now we're getting somewhere, 24V cooooollll, uhhhh whats that smell? yep, 18V is it. Better hit up some yard sales this weekend for parts.....

Remote kill switch: YOU HAD BETTER GET YOUR REAR END UP HERE CAUSE YOU DON'T WANT ME TO COME GET YOU!!!!!

Variable speed control, much like the nitrous button, "little Johnny" soon learns wide open is the only way to go, plus lack of spinning tires on startup is a real bummer for him. Soft start is nice if you have rubber tires but won't protect the gearboxes trying to climb hills with too much weight etc.

Lighting: I'm pretty low budget on this, a flashlight duct taped to hood, or if I am really lazy, my light that has the elastic band for your head will do.

All joking aside, I think Powerwheels should spend more time coming up with a much more sound drivetrain than flashy things like radio and lights. I know the gearboxes on the Rally Karts are monsters compared to the other ones, maybe they have improved them on the new stuff, I know the corvette and Jeep Hurricane look different.
Go to Top of Page

Scratch_6057
Apprentice Modder


GA
USA

56 Posts

Posted - 09/27/2006 :  14:41:39  Show Profile
Kill Switch,
How about using one of those “invisible” Dog Fences? The kind that uses a little receiver built into a collar to ZAP the dog when he gets too close to the edge of the yard.
NO, NO, NO you don’t get to put the collar on the kid. (I think that is illegal in most states now.) You gut the collar and wire the receiver to shut down the vehicle. Expensive unless you already have it installed for a dog but if you do then it is just the cost of another receiver.

Go to Top of Page

EasyGo
New Member




24 Posts

Posted - 09/27/2006 :  15:43:29  Show Profile
You've pretty much covered the things I'd build into a controller... I didn't re-read everything, but I didn't see anything about braking. Depending on how you do the PWM, you could either use the H-bridge (if that's how you implement the motor control PWM) or else some separate MOSFETs using PWM to shunt the current from the motors for proportional braking. Use another throttle controller for brake pedal position sensing.

Regarding throttles, the Hall-effect throttles are SO much less hassle to keep working than a potentiometer. The typical $7 twist-grip throttles have a little 3-wire sensor that has one lead grounded, another lead at 5 volts or a little less, and the third gives a proportional output voltage depending on the proximity of two opposing magnets (one on each side of the sensor). One magnet is moved closer while the other is moved away as you go from 0 to 100%. I think on the one I gutted the South ends of both magnets were toward the Hall-effect sensor -- either way, just keep them in the original orientation if you gut a twist throttle to make a linear one.

Regarding detecting motor speed you can either 1.) calculate the speed by measuring the smoothed current and smoothed voltage, or 2.) measuring the voltage generated by the motor during a fraction of a second that the motor is OFF (has to be long enough that the inductance of the motor doesn't mess up your reading).

To measure the current, you don't need highly precise resistors, you just need to know what the resistance is, ha. I typically measure the drop across a piece of wire instead of using a resistor, and if you load it and measure the amps and volts simultaneously, of course you know the resistance of the piece of wire.

Feel free to correct me if I'm wrong, but on the detail of torque/rpm/current stuff, I believe torque is directly proportional to current, regardless of RPM (ignoring parasitic losses in the motor) -- a given motor's RPM at a given current would equate (proportionally) to HORSEPOWER instead of torque.

-EG
Go to Top of Page

TiddlerRacer
Senior Modder

Adrian
MI
USA



1849 Posts

Posted - 09/27/2006 :  18:57:34  Show Profile
quote:
Originally posted by jwcolby

LOL, there is no pissing on my parade, I am doing this for me, not to make a living. And of course you are correct, it is tough to compete with a product that is sold by the thousands.

The only thing I can do is stress that a ride-on is not a scooter.

And log data of course. What data do you need to look at, and how can I get ahold of it?

Can you point me to the thread where the throttle is discussed? I don't want to get in to buying old parts off of Ebay but I do need ideas for how to do a foot pedal. I was just going to go with a game controller pedal or something.




http://www.ryanhull.com/forums2/weblog.php?w=9

I couldn't find it here - so here is a link to the blog over on Ryan's site. It is about 6 posts down.

As far as what info I'd like - well, I typed up a long response, hit post, and it flew into cyber space and vaporized. Let's see if I can remember.

I would like to see current for individual motors. This way if one motor starts to pull more current you know trouble is brewing with that motor and/or gearbox. You could also run grease tests to see how much different types of grease affect current draw. Another nice feature would be to see how much current was being pulled when a motor failed, then after making different mods you have a baseline and know when catastrophic failure is near due to a high load of voltage, higher ratio gearing, tall tires, or children overloading the vehicle.

Motor temp would be nice, and maybe a thermal cutoff or at least a reduction in voltage delivery when a certain temperature is reached to prevent the motors from cooking.

Shoot...I had about 6 things listed in my original post. I'll edit when they come back to me.

****Testing the limits of Fisher Price engineering on a daily basis.****
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/28/2006 :  05:11:26  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by TiddlerRacer


http://www.ryanhull.com/forums2/weblog.php?w=9

I would like to see current for individual motors. This way if one motor starts to pull more current you know trouble is brewing with that motor and/or gearbox. You could also run grease tests to see how much different types of grease affect current draw. Another nice feature would be to see how much current was being pulled when a motor failed, then after making different mods you have a baseline and know when catastrophic failure is near due to a high load of voltage, higher ratio gearing, tall tires, or children overloading the vehicle.

Motor temp would be nice, and maybe a thermal cutoff or at least a reduction in voltage delivery when a certain temperature is reached to prevent the motors from cooking.

****Testing the limits of Fisher Price engineering on a daily basis.****



If anyone out there knows how to find a standard shunt resister for measuring high current that would be nice. It needs to be ~2-3 watts and .01 Ohm. I really don't want to get into the business of calibrating pieces of wire.

Given that, I can measure the current to each motor and very likely even determine rpm.

I can of course measure temp but that is not as efficient in many ways as just measuring the current itself, i.e. a motor could be drawing high current for awhile before the thermal mass of the motor was overcome and the temperatures start to rise. OTOH, current measurements tell you that instantly.

I want to build a method of preventing the relay from tripping. It is discouraging to my son to have to sit there for 15 seconds while it cools down, and it is also dangerous since it prevents the braking from working if it trips while going up a hill. By sensing the current, I can know how much power is being used in the system and slow the vehicle down to keep total power below the threshold.

One issue with these controllers is that they typically don't have a lot of static ram, on the order of 1-2 KBytes. Thus logging will have to be done intelligently, I can't just throw everything in the world out there every second or it will fill up fast. I am looking at a live data link to transmit data over radio. They now have single chip solutions for cheap ($2.50) that "bolt on" to a microprocessor and works in the 2ghz range - the public band for telephones, wireless routers etc., in fact they are the radio layer for a wireless router. But they are new and I think it will take some research to get it happening.

If I could get it working though, that would enable sending and receiving data from the vehicle without a physical connection. That would be really cool for programming max speed and such, as well as dumping raw data. I could always go with a remote control type link if necessary and might in the end but I sure would prefer these new real data links.

JWC
Go to Top of Page

Scratch_6057
Apprentice Modder


GA
USA

56 Posts

Posted - 09/28/2006 :  05:36:20  Show Profile
quote:

If anyone out there knows how to find a standard shunt resister for measuring high current that would be nice. It needs to be ~2-3 watts and .01 Ohm. I really don't want to get into the business of calibrating pieces of wire.

JWC



Try Mouser
http://www.mouser.com/search/Refine.aspx?Ne=254016+1447464&Ntt=*resistor*&Ntx=mode+matchall&Ns=P_SField&Mkw=resistor&N=1323038%20254378&Ntk=Mouser_Wildcards
Go to Top of Page

greatdane
Expert Modder

Northwest
IN
USA

737 Posts

Posted - 09/28/2006 :  05:38:20  Show Profile
Jwcolby-

I'm following the progress as I'm interested, but on this comment I don't follow your logic-Don't take this as me being critical, just contstructive-
quote:
I want to build a method of preventing the relay from tripping. It is discouraging to my son to have to sit there for 15 seconds while it cools down, and it is also dangerous since it prevents the braking from working if it trips while going up a hill. By sensing the current, I can know how much power is being used in the system and slow the vehicle down to keep total power below the threshold.

If you regulate the power to keep it below the thermal breaker trip point, the car would shut down on the hill and not climb-how is that different that the thermal breaker tripping from the kids point of view? The thermal breaker is tripping because the motors are drawing too many amps and protecting the wiring, likely due to terrain or weight (amount of load placed on the motor).
Go to Top of Page

TiddlerRacer
Senior Modder

Adrian
MI
USA



1849 Posts

Posted - 09/28/2006 :  07:02:56  Show Profile
I remember a couple things now.

One was to obtain RPM you could use an optical beam on the gearbox, drill the first gear as an encoder, and mount the eye on the gearbox.

The other was to possibly mount a strain gauge on the gearbox to measure deflection. This might be useful in determining why some are having consistent first gear shaft failures.

I know both of these are way out there in the realm of ideas, but that kind of stuff excites nerds like me. <LOL>

****Testing the limits of Fisher Price engineering on a daily basis.****
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/28/2006 :  10:14:48  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by greatdane

Jwcolby-

I'm following the progress as I'm interested, but on this comment I don't follow your logic...
quote:
I want to build a method of preventing the relay from tripping. It is discouraging to my son to have to sit there for 15 seconds while it cools down, and it is also dangerous since it prevents the braking from working if it trips while going up a hill. By sensing the current, I can know how much power is being used in the system and slow the vehicle down to keep total power below the threshold.

If you regulate the power to keep it below the thermal breaker trip point, the car would shut down on the hill and not climb-how is that different that the thermal breaker tripping from the kids point of view? The thermal breaker is tripping because the motors are drawing too many amps and protecting the wiring, likely due to terrain or weight (amount of load placed on the motor).



I would not shut down the car and the electronics, I would SLOW down the car to keep the current (average) under the breaker's trip point. The breaker essentially "averages" the current used and if the average rises above a certain amperage for a certain period, it trips (opens). Let's assume that the average current has to be 30 amps for 5 seconds to cause the breaker to open.

Have you ever noticed that the car can go up the hill just fine if it is in low speed, while it would shut down in high speed? The reason that is true is that in low speed the motors are placed in series which reduces the current that it is possible to draw in half. The car slows waaaaaaay down but it continues to climb hills where in high speed it would just trip the breaker.

My controller will be using Pulse Width Modulation (PWM) to drive the motors. PWM basically turns on the motor (full on) for short pulses, very quickly. Thus if you have a waveform that turns on the motor for 1/1000th of a second 200 times per second (just as an example) you are applying current to the motor 20% of the time (20% power to the motor). If you apply power pulses of 1/1000th of a second 500 times / second you are applying 50% power etc. This isn't an exact representation of how it really works but close.

So, if the toy is going up hill and I am applying pulses 1000 times per second (full speed), then essentially the waveform never turns off and 100% power is applied. If the current being sensed is too high, I start backing off the pulses - down to perhaps 900 pulses per second (90% power). The vehicle slows down from the speed it would be traveling at 100% power but the power being used drops keeping it under the 30 amps used.

Now assume that the hill gets steeper. Even applying voltage 90% of the time, the CURRENT used is going to rise because the motor is having to work harder to "maintain the speed". By backing off the "on time" of voltage applied to the motor, I can reduce the amount of current flowing to the motor. The car will slow down but it will still move.

Obviously this only works for so long. Too steep a hill will force the controller to reduce the on time to a point where the car simply cannot move up the hill at any speed. However the CIRCUIT BREAKER HASN'T TRIPPED! Which leaves me (my uController) with control.

It turns out that you can short the ends of the motor together and a natural braking effect is created. As a motor is caused to turn by an external force (coasting down a hill?) it creates EMF (electromotive force), in effect becoming a generator. If you short the motor ends together, then the EMF created by the motor trying to turn (coasting down the hill) attempts to DRIVE the motor against the direction it is going and causes a strong "brake" on the motor. So even if my controller cannot force the car up the hill, it can "short the ends" together and cause the motor to "lock" or brake. We now have a safe(r) brake system.

If the child then tries to reverse the car I can, using the same PWM concept, open / close this "short" to safely keep a (decreasing) brake applied to the car until the car reaches a point where I can safely switch back into "drive mode" applying our normal drive PWM waveform to the motor causing the car to "drive itself".

OTOH, if the circuit breaker trips, the uController loses power as well and is helpless to do anything. The car is truly dead, but no brakes are applied, thus it rolls.

Unfortunately, the car's designers did not do this "motor shorting" trick when the breaker trips so the car just rolls backwards down the hill.

Did that make any sense? It is a bit hard to put into words.

In fact I can use this same "motor brake" effect to prevent the speed from just rising infinitely as the child drives forward down a steep hill. As it sits now, if the child drives down a steep hill, the car just goes faster and faster. Even if the child takes his foot off the pedal, the car just pretty much coasts on down, gaining speed. If I "brake" the motor, the faster the motor tries to go, the more "braking power" is generated to slow the car down.

Obviously nothing is perfect, and I can't stop your child from rolling down a 60% incline, but I can slow it down enormously on any slope where traction remains.

In electric cars and bikes, this "Back EMF" as it is called is often used as a brake and even to recharge the batteries. I will be happy just harnessing it to create a brake.

Again though, this shows where a uController can give you things that simple switches and stuff can't provide.

JWC
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/28/2006 :  10:27:17  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by TiddlerRacer

I remember a couple things now.

One was to obtain RPM you could use an optical beam on the gearbox, drill the first gear as an encoder, and mount the eye on the gearbox.

The other was to possibly mount a strain gauge on the gearbox to measure deflection. This might be useful in determining why some are having consistent first gear shaft failures.

I know both of these are way out there in the realm of ideas, but that kind of stuff excites nerds like me. <LOL>

****Testing the limits of Fisher Price engineering on a daily basis.****



I could certainly do both of these. The thing to remember though is that I really want to provide a "bolt on" system. Bolting on an optical encoder is more than many people (even enthusiasts) are going to want to do. Strain gauges even more.

Now, if YOU want to do that, I could certainly rig the controller to take your measurements and store them.

JWC
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/28/2006 :  10:29:21  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by Scratch_6057

quote:

If anyone out there knows how to find a standard shunt resister for measuring high current that would be nice. It needs to be ~2-3 watts and .01 Ohm. I really don't want to get into the business of calibrating pieces of wire.

JWC



Try Mouser
http://www.mouser.com/search/Refine.aspx?Ne=254016+1447464&Ntt=*resistor*&Ntx=mode+matchall&Ns=P_SField&Mkw=resistor&N=1323038%20254378&Ntk=Mouser_Wildcards



COOL! Man I searched and searched on Google. So much to know, so little time!

JWC
Go to Top of Page

rafterman
New Member

Palmer
ak
USA

22 Posts

Posted - 09/29/2006 :  09:05:51  Show Profile
I'm interested. do you need beta tester ? i have a year of electronics.
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/29/2006 :  11:25:15  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by rafterman

I'm interested. do you need beta tester ? i have a year of electronics.



Yes, I will eventually. I just ordered parts for the uControllers last Friday evening, received them yesterday. I have soooo much to do to get the first controller out the door that a beta won't be for quite some time. I will keep you in mind though.

My intention is to do a lights controller first, for the simple reason that if I screw that up in any way I haven't downed the ride entirely.

My wife just brought a box with the little debug board that allows the development environment (programming side) to talk to the microcontroller - download programs to the controller, step through the program so I can watch lights light and stuff like that. That's the piece that lets me actually do anything with the controller.

I downloaded all of the tools, the 'C' compiler and all that last weekend. I actually ran a tiny program in the software emulator in assembler and in 'C' (toggling a port I/O pin on and off.

Next I need to use the proto breadboard I bought to assemble a uController, a bunch of LEDs on the port pins, and assemble a cable to let the controller talk to the debug board, and the debug board talk to my PC.

Just getting the first uController accepting and running a program may well take a week or so to figure out given I still have to do my work.

THEN the real work begins - learning how the controller works and how to program it, not to mention study up on what I need to do to drive MOSFETs from the uController. It's been 9 years since I did my last controller work, I haven't done any electronics since, and I have to relearn a lot of stuff!

I am excited to get going on this though. I do Microsoft Access and SQL Server database design and implementation consulting to earn a living and it is getting old. I need a new hobby to keep me sane.



JWC
Go to Top of Page

Scratch_6057
Apprentice Modder


GA
USA

56 Posts

Posted - 09/29/2006 :  11:51:05  Show Profile
quote:
Originally posted by jwcolby
. . .
THEN the real work begins - learning how the controller works and how to program it, not to mention study up on what I need to do to drive MOSFETs from the uController. It's been 9 years since I did my last controller work, I haven't done any electronics since, and I have to relearn a lot of stuff!
. . .

JWC



John,
Here is a link to a book "Practical Electronics for Inventors"
which gives enough info on a lot of different electronics concepts
to get going. The author explanes in laymens terms so you can get things working
without getting bogged down in details like how to design something like a "MOSFET".

http://www.amazon.com/exec/obidos/ASIN/0070580782

Mike L.
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/29/2006 :  13:22:55  Show Profile  Visit jwcolby's Homepage
quote:

John,


Here is a link to a book "Practical Electronics for Inventors"
which gives enough info on a lot of different electronics concepts
to get going. The author explanes in laymens terms so you can get things working
without getting bogged down in details like how to design something like a "MOSFET".

http://www.amazon.com/exec/obidos/ASIN/0070580782

Mike L.



Thanks for the link Mike.

Back in the 70s and 80s I repaired electronics down to the component. I was trained in the Navy to repair "mainframes" and their peripherals and did a 3 & 1/2 year stint on the aircraft carrier USS Kennedy, and then when I got out I did field engineering stuff, including repairing circuit boards in the lab. I then did some Engineering Tech kind of stuff, designing and building prototype printed circuits. Mostly digital stuff though I loved doing op amp stuff too.

About 1986 I switched to programming. I did a brief controller thing in 1995-1997 (down in Mexico) but no electronics since.

I still remember most of it but a brush up never hurts.

My biggest problem really will be learning the CAD system that allows me to create the schematics, and later to do the board layout and get the blank printed circuit boards made. Schematic CAD systems take some time to master and I haven't done any of that since about 1989.

If anyone out there does any of this stuff, don't hesitate to speak up.

So much to do, so little time.

JWC
Go to Top of Page

rafterman
New Member

Palmer
ak
USA

22 Posts

Posted - 09/29/2006 :  21:50:14  Show Profile
found this somewhere thought it could give some ideas
http://hammerhead.abilene.ttu.edu/~aarl/projects/beavis/beavis.pdf
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/30/2006 :  06:48:57  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by rafterman

found this somewhere thought it could give some ideas
http://hammerhead.abilene.ttu.edu/~aarl/projects/beavis/beavis.pdf



Nice article. I'll be reading that one.

Thanks.

JWC
Go to Top of Page

jacobs_dad
Journeyman Modder

oakville
ontario
Canada

229 Posts

Posted - 09/30/2006 :  20:11:04  Show Profile
AutoCad could be used for this. It is not designed for schematics so you will have to build up the library of symbols.

Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/30/2006 :  22:23:14  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by jacobs_dad

AutoCad could be used for this. It is not designed for schematics so you will have to build up the library of symbols.





I think I will be using Eagle by CadSoft. They provide a free version that will suffice for now and if it works well I will most likely move up. It is designed for Schematic and PCB layout.

JWC
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 09/30/2006 :  22:26:24  Show Profile  Visit jwcolby's Homepage
Well, it's been a huge weekend. Thursday and Friday I received the Atmel Dragon debug board and all of the parts I ordered. Using the breadboard and an ATMega32 uController I build up a barebones controller. I got the AVR Studio downloaded and the freeware WinAVR 'C' language installed and working through AVR Studio. I compiled and ran an assembler program and watched the pins toggle through the emulator. I then found and created a project for a little 'C' program named "Blinky", ran it and watched it run in the emulator - toggling output pins. I got the Dragon debug board hooked up and talking through the USB port. I then built a JTAG 10 pin cable to hook up the controller circuit to the Dragon and thus to the AVR Studio. I turned on all of the hardware and the AVR Studio can read the internals of the ATMega32 uController on the breadboard.

I then compiled the "Blinky" program to a hex file and apparently successfully uploaded the hex file to the uController. It wouldn't run, at least I can't tell that it is. I had set up LEDs on Port A and Blinky used Port D. So I changed the 'C' program (Blinky) to use Port A. Still no go.

Sigh.

It's 01:15 now and time to get some sleep, see what occurs to me in the morning. I suppose I will go back and throw in LEDs on the Port D pins and go back to the original Blinky to see if that works. If not... Hmm... not sure what.

I'm happy though, I have come a long way in a few short days.

EDIT!!! Blinky lives!!! Which means the controller is functioning!

So much to learn, so little time. But huge progress was made today.



JWC

Edited by - jwcolby on 09/30/2006 22:38:26
Go to Top of Page

Scratch_6057
Apprentice Modder


GA
USA

56 Posts

Posted - 10/01/2006 :  10:07:35  Show Profile
quote:
Originally posted by jwcolby
I think I will be using Eagle by CadSoft. They provide a free version that will suffice for now and if it works well I will most likely move up. It is designed for Schematic and PCB layout.

JWC



Yea I use Eagle (Freeware Version 4.11r2) for most of what I do, the thing you have to be aware of is that it doesn’t conform to some Windows conventions. For example you can “copy” a single part (element / component) on a schematic to your heart’s content, but if you want to select multiple parts and “copy” them you have to select the group, then “cut” and “paste”. When you “cut” a group the program leaves behind the originals and makes a copy in the “paste buffer” (clipboard).
When you paste it copies from the “paste buffer” into the schematic. IIRC the program originally was developed somewhere in Europe and started out on **nix platforms, ported to DOS, then windows so (for the windows user) it still retains some “QUIRKIENESS” (sp?).

A couple of places to find info / help for Eagle
http://tech.groups.yahoo.com/group/eaglecad/ and some info can be found in
http://tech.groups.yahoo.com/group/Homebrew_PCBs/ The first group is specific to Eagle but doesn’t get a lot of traffic, the second group is more geared toward PCB board production in general and Eagle is NOT a favorite program there but other programs are mentioned in the massages which would give more options if you find that Eagle is not to your liking.

The second group also has extensive info about PCB Prototype board using “Toner Transfer”. If your not aware Toner Transfer is a process that allows quick and simple in house PCB Prototype production by using a Laser Printer, glossy paper, and a heat source (household iron, or laminator) to fuse the toner to a copper PCB in order to act as a ETCH RESIST for circuit boards. It gives you a way to check things out before sending designs out to a board house for a production run, or quickly produce “ONE OFF” boards.

Mike L.

Edited by - Scratch_6057 on 10/01/2006 10:22:09
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/01/2006 :  17:35:40  Show Profile  Visit jwcolby's Homepage
Thanks for the links.

I used ORCad back in '89 / '90 but haven't done any CAD schematics since. I definitely need some help coming up to speed on this thing.

JWC
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/06/2006 :  14:37:31  Show Profile  Visit jwcolby's Homepage
In order to control the speed of the motors using a uController, I will be using a PWM signal. What this means is that a series of "pulses" of current will be sent to the motor. Another way to think of this is that voltage will be applied to the motor X times per seconds for Y thousandths of a second.

Think of a second being broken up into 10 equal "slices" - 1/10th of a second per slice. During those 10 slices of a second, I will turn on the voltage out to the motor anywhere from 0 to 10 "slices", in other words, 1 - 10/100ths of a second.

10 slices / second, each slice divided into 10 pieces.

Think of 1 as on, 0 as off.

00000000010000000001 etc. 8 more times = 1 second

applies voltage to the motor 1/100ths of a second, 10 times per second. The motor is barely on at all - in fact 1/10th on.

00000111110000011111 etc 8 more times = 1 second

applies voltage to the motor 5/100ths of a second, 10 times per second. The motor is 1/2 way on.

01111111110111111111 etc 8 more times = 1 second

applies voltage to the motor 9/100ths of a second, 10 times per second. The motor is almost all the way on - in fact 9/10ths on.


So... All 0s all the time, the motor is entirely off. All 1s all the time, the motor is always on. Anything in between is a percentage turned on.

Now, assume that you want to "ramp up" the motor, in order to apply torque gradually over time. My question here is "over how many seconds?

Let's assume zero torque to full torque in 1 second.

Given the scenario above, the 1st 1/10th of a second, current would be applied 1 slice:

1/10th |
0000000001

The second 10th of a second, current would be applied 2 slices:

1/10th | 2/10ths |
0000000001 0000000011

Etc. for the 3rd, 4th, 5th etc.

---1/10th--|--2/10ths--|--3/10ths--|--4/10ths--|--5/10ths--|
0000000001 0000000011 0000000111 0000001111 0000011111

As you can see, when we reach the 10/10th slice the motor will be on all the time

And from that point on, the power would remain on all of the time. Now, as the accelerator is released, the opposite occurs:

---1/10th--|--2/10ths--|--3/10ths--|--4/10ths--|--5/10ths--|
1111111110 1111111100 1111111000 1111110000 1111100000

1/100ths slices of voltage are gradually being "removed" and the total time that voltage is applied to the motor drops until one second later, no power is applied to the motor.

Understand that the number of intervals or slices will probably be higher than 100. In fact this will be determined by experimentation as to what really works. Turning the motor on / off at a low rate will cause buzzing so it might be up in the 2-4 thousand pulses per second, but the principal remains the same. Divide a second up into X slices (200) and divide each of those slices up into Y slices (10). Or 2000/10.

Applied in this way, the first number determines the total number of "cycles" and the second number determines the "granularity" of each cycle.

So, I need your vote on how long the ramp UP (accelleration) should be:

1) .5 second
2) 1 Second
3) 2 seconds
4) Some other value (what?)

And also how long the ramp DOWN should be (decelleration):

1) .5 second
2) 1 Second
3) 2 seconds
4) Some other value (what?)

My thoughts are that it should ramp up slower than ramp down, simply because we want to be able to stop quickly, but starting quickly is less important.

And would this depend on voltage? 1 second ramp up for a 12v system, 1.5 second ramp up for an 18v system, 2 second ramp up for a 24v system?

Your thoughts appreciated.

JWC
Go to Top of Page

rafterman
New Member

Palmer
ak
USA

22 Posts

Posted - 10/07/2006 :  03:10:22  Show Profile
Sounds like a good starting point "1 second ramp up for a 12v system, 1.5 second ramp up for an 18v system, 2 second ramp up for a 24v system" I don’t remember what uController you’re using but it would help to have an rs232 port to adjust the setting. Anyone know anything about brushless motors?
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en012037
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1523

Edited by - rafterman on 10/07/2006 03:11:40
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/07/2006 :  05:41:43  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by rafterman

Sounds like a good starting point "1 second ramp up for a 12v system, 1.5 second ramp up for an 18v system, 2 second ramp up for a 24v system" I don’t remember what uController you’re using but it would help to have an rs232 port to adjust the setting. Anyone know anything about brushless motors?
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en012037
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1523



I am using the Atmel series. For this one I am looking at the ATMega8.

http://www.atmel.com/dyn/products/devices.asp?family_id=607
https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=248330&pa=248330PS
http://www.atmel.com/dyn/resources/prod_documents/2486S.pdf

These processors are much nicer than the PICS, they can do large program memories without jumping through hoops etc. A very nice series.

JWC
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/11/2006 :  21:48:18  Show Profile  Visit jwcolby's Homepage
Just an update.

Tonight I got a simple one MOSFET circuit turning on and off a motor from these toys. NOT driving the gear box - I only have the motor hooked up to a 12v 1.5 amp power supply, not a battery. So it is just pulsing the motor on and off. I then hooked the gate of the MOSFET directly up to a pin of the ATMEGA32 uController which I had already programmed to blink a diode, so the uController is now turning on / off the motor about once per second.

At first I wasn't turning the MOSFET all the way on so it was operating in the non-linear (high resistance) region and heating up rather nicely. Once I solved that the ATMEGA32, running at 5v is nicely driving the MOSFET placed on the low side of the motor - the MOSFET applying ground to one leg of the motor, the other side of the motor tied directly to +12v for now.

The next step is to get the uController putting out a PWM waveform so that the motor is driven at some portion of full speed. Once I get that happening I will hook up switches to allow me to tell the uController to increase / decrease the speed by some % - change the percentage of on time in the PWM waveform.

I have P channel MOSFETS on the way which will allow me to build a half bridge which is a MOSFET on each side of the motor, one between the motor and +12v and one between the motor and ground. Once I get that working, then two of those becomes a full bridge and can cause the motor to go forward and backward depending on which half bridge you turn on.

As you can see, progress comes slowly, but it is happening!

I am happy to see the interest in the thread. Lots of folks reading it.

Stay tuned.

JWC

Edited by - jwcolby on 10/11/2006 22:05:26
Go to Top of Page

Scratch_6057
Apprentice Modder


GA
USA

56 Posts

Posted - 10/12/2006 :  05:29:16  Show Profile
What Mosfets are you intending on using? In the past couple of days,
I came across this (http://www.discovercircuits.com/DJ-Circuits/hbridge2.htm)
schematic “50 volts and about 10 amps” Max. Dropping the voltage should
increase the amperage, or use multiple FETs in each leg.
Roughly checking parts cost for single quantities the design (as is) comes out around
$12.00 per. for the IRFs in TO-220AB and the BS170 in TO-92 packages.

Edited by - Scratch_6057 on 10/12/2006 05:30:27
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/12/2006 :  06:49:04  Show Profile  Visit jwcolby's Homepage
I am using the IRFZ34N at the moment but will likely move up to a bigger part yet for production.

First the max voltage really isn't of interest (if it is high enough in the off state). 50V is fine. Make sure you place a fast high current switching diode across the motor to short the reverse emf spikes so they don't enter the power supply system.

Next, if you look closely at the specs, the max amperage at the max voltage ratings have nothing to do with anything real world. First of all, the max amperage is for a pulsed signal with N proportion of on time. Obviously if your kid is running flat out, the FET is on the whole time, so you must design for that "worst case". The derated current rating (always on) is usually about 1/5th of the pulsed rating. You can however (as you noted) put MOSFETS in parallel to double or even triple (or more) the current handling. I doubt that will be necessary but we will see.

My take on this is that each motor draws ~14 amps (at 12 v) so the MOSFETS need to be able to handle that without overheating. I will be using a separate driver circuit for each motor so that I can vary the power to the motors individually, so I really only need the driver circuit to be able to handle that 14 amps plus a safety margin. I will also be trying to measure actual power used in each motor so that if a motor stalls I can cut the current to that motor.

Notice that the actual power that the MOSFET itself dissipates is determined by its ON resistance. If driven all the way on, this is anywhere from .05 to .25 ohms, depending on the device selected. IIRC, for the IRFZ34N, the ON resistance is ~.04 ohm. Since power = I^2 x R, if the max steady state current is 14 amps (one motor, always on, flat out), the I^2 * R = 14 * 14 * .04 (for this device) = 7.84 watts. That is the power consumed by the MOSFET while acting as a switch. And of course "power consumed" is being dissipated as heat.

One issue to keep in mind is that the MOSFET doesn't instantly switch from OFF to ON (infinite resistance to no resistance). It has to go through a "non-linear" region where the MOSFET itself has some very real (and decreasing) resistance. So the MOSFET will consume MORE power when it is in this region, which is why it is critical to turn the MOSFET on as quickly as possible - drive it hard and fast! If the MOSFET takes too long turning on, then it spends considerable time as a plain old resister and can get quite hot!!!

So I am going with a largish MOSFET and in addition will be using heat sinks. I bought massive heat sinks and some smaller heatsinks, just so I could test both out. The last thing you want is the MOSFET shorting and applying voltage to the motor all the time.


JWC

Edited by - jwcolby on 10/12/2006 07:18:38
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/12/2006 :  20:02:24  Show Profile  Visit jwcolby's Homepage
Well, I found code for doing PWM on the exact part I am using - the ATMega32. Pulled it in, compiled and ran it and got a modulated LED. Hooked up the PWM signal to the MOSFET motor driver and voila, I have a motor being driven using a PWM signal!!! YEAAAAA. The program starts at a "low" speed, and steps up the pulse width over a couple of steps to "high speed".

So now I get to sit down and learn how it works, how it programs the counters and pins to do this stuff. Luckily this code is really pretty simple.

Today I got a static mat and bracelet so I don't fry my investment. I also got some other stuff such as a logic probe so I can see pulses happening, though not anything more than "yep, there is a pulse". I am doing this on a shoestring so I am looking for a cheap o'scope or even a PC based scope. I definitely need something more than a logic probe, but real scopes cost bucks!

I am very happy with the results so far. A couple of weeks ago I ordered the wrong motor / gear - the hex power coupler when my son's gator needed the plus power coupler. After testing with one of the motors that I bought the other day, I decided to hook the circuit up to the "real thing" with the gearbox attached. It works! the poor wall wart 12v 1.2 amp supply isn't happy but it also hasn't died from the overload so...

The MOSFETS OTOH are staying very cool, you can feel a bit of heat but certainly nothing to concern me yet. I have a couple of different heat sinks which I will be using.

Anyway, I also got a couple of hex switches so my next step is to get the switch wired in so I can set the speed by turning a switch. 16 speeds should be good enough for testing. A PWM signal has to be "tuned" to the motor. Luckily these toys all use the same types of motors, and the tuning is really a "ball park" thing. The current PWM is ~100 hz (according to the author) and according to an article I read, a more realistic value is probably between 1k and 4k hz. Too high and you get lots of RF components which turn to heat in the inductance of the winding. Too low and you get buzzing and inefficiency in driving the motor. So I need to play around with the frequency.

I am including a couple of pictures of the breadboard and my workbench. A little messy but I just started doing this uC stuff for this project about 3 weeks ago (?) and it is "good enough" to get where I am today.

The project is starting to take shape!



95.21 KB


95.67 KB


95.47 KB

JWC

Edited by - jwcolby on 10/12/2006 20:14:42
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/13/2006 :  22:29:03  Show Profile  Visit jwcolby's Homepage
Today I received the P channel MOSFets and got a half bridge working, complete with PWM control. Half bridge means that I have (manual) control over ONE direction, but with an identical circuit with inverted drive signals, I can drive the motor the other direction as well. I am using the SN754410 driver to get the fast switching and drive current required to switch the high current MOSFETS (in particular the P channel which requires more drive to switch quickly) as well as the turn on delay (I hope) so that I don't get +12v to Gnd shorts when I switch motor directions. In fact this is going to be under uC control anyway but it is nice to have the safety factor.

So far, the circuit consists of the uC, the SN754410 driver and 4 mosfets. The driver can handle another 4 MOSFETS for the other motor so eventually there will be 8 Mosfets, 4 for each motor.

So, tomorrow I hope to get the other half bridge wired, and maybe the uC outputting the direction signals on two pins. These two pins determine whether the the circuit goes forward, reverse, freewheels or locks (motor braking).

This is where things get hairy and where fast acting fuses become paramount. If I turn on both legs at once, I short +12v to Gnd. If I reverse direction while the motor is running... All of these scenarios need to blow a fuse instead of blowing my circuit or PS.

The program must ramp the motor up, ramp the motor back down before reversing direction, ramp the motor up in reverse, ramp the motor back down in reverse etc. We all know what happens if you just jam the toy from forward into reverse or vv. From here on out I get into programming more than electronics.

Once the program is debugged, then normal slow blow fuses will be in order for awhile while I wring the circuit and program out. Then I will probably go back to a circuit breaker as is in the toy now.

Once the circuit firms up, I also need to move the circuit from a breadboard onto a proto circuit board so I can look at mounting it in the toy. I will need real life conditions to really test the MOSFETS and get the heat sinking correct.

Lots o' fun.

JWC
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/17/2006 :  12:28:54  Show Profile  Visit jwcolby's Homepage
Got a really sweet schematic capture program (Tina for Windows Basic Version) for not too much money. Started capturing the whole thing to a schematic.

I went back and designed the HBridge from scratch (nothing there really) and then thought long and hard about how to drive the HBridge, and how to implement the logic for that.

Most HBridge drive circuits really are looking for a simple on / off / forward reverse. I am looking for a little more.

1) An active brake state (motor shorted to cause it to self lock).
2) A freewheel state, where the vehicle just coasts, motors not driven nor braked,
3) A PWM "slow down" state where the motor is pulsing the active brake state to actively slow down the vehicle.
4) A PWM Forward state.
5) A PWM Reverse state.

Thus I need a bit of logic in front of the H Bridge to implement these states. I wish I had the means to do Programmable Array Logic chips, this would be optimum. But I don't.

And of course my In Circuit Emulator (ICE) board bit the dust so now I am doing software emulations and just dumping the hex file to the uC to test while I wate for the ICE to be repaired. Sigh.

It's always something, and if it isn't that, it's something else!



JWC
Go to Top of Page

jacobs_dad
Journeyman Modder

oakville
ontario
Canada

229 Posts

Posted - 10/17/2006 :  12:40:06  Show Profile
good to see it coming along.

that's a pretty big board. It may be hard to hide that in some vehicles.

Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/17/2006 :  13:33:17  Show Profile  Visit jwcolby's Homepage
quote:
Originally posted by jacobs_dad
that's a pretty big board. It may be hard to hide that in some vehicles.



I'll have to go yard sailing to find some prototypes to experiment on.

All I have ATM is my son's Gator which has a ton of room under the dump bed in a compartment where the motors are placed.




JWC


Edited by - jwcolby on 10/17/2006 22:23:03
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/23/2006 :  21:40:15  Show Profile  Visit jwcolby's Homepage
In order to safely implement the various motor states required to drive the vehicle forward and backwards and apply the brakes, I will be utilizing a State Machine of sorts, where the motors are "doing something" and can only "do specific other things". The states as currently defined:

1) Freewheel - All motors can turn (no drive applied). This state is REQUIRED between all other states to prevent short circuit vcc-gnd due to turnoff delays in the FETs. This state will typically be very short, on the order of a microsecond or two.

2) Brake On - Motor shorted, lower drive FETs on. In this state, the two ends of the motor are shorted by the "lower" FETs (shorted through the ground path). Shorting the motor applies a very powerful brake (Stopped).

3) Brake PWM UP - Motor shorted by PWM signal, PWM ramping up towards stop, On duty cycle increasing. In this state, the motor is being shorted on / off, where the ON state is increasing in width. This gradually applies a full brake condition (decelerating).

4) Forward PWM Up - Motors driven forward, PWM applied, PWM ramping up, On duty cycle increasing. This is gradually applying an on state to the motors, driving the vehicle forward (accellerating).

5) Forward PWM Stable - Motors Driven Forward, PWM applied, PWM not changing duty cycle. Can only be entered from Forward PWM UP, or Brake PWM. In this state the vehicle is moving forward at a steady speed, or more correctly the power applied is no longer changing.

6) Reverse PWM Up - Motors driven reverse, PWM applied, PWM ramping up, On duty cycle increasing. In this state the vehicle is accelerating in reverse.

7) Reverse PWM Stable - Motors driven reverse, PWM applied, PWM not changing duty cycle. In this state the vehicle is moving at a steady speed in reverse, or more correctly, the power applied in reverse is stable.

Having defined the possible states of drive to the motors, it is now required to define which states can go to which other states.

Example 1:

State 2 (brake on) can only go to state 1 (freewheel - a "neutral gear state"), state 4 (accelerate forward) or state 6 (accelerate reverse). Moving to any other state from state 2 makes no sense or (in some state changes) could be dangerous.

Example 2:

State 4 (Forward PWM Up) can only go to state 5 (Forward PWM Stable) or state 3 (Brake PWM UP).

These state change rules are derived from common sense, i.e. you can't go from forward to reverse (you must go through braking), you can't go from reverse to forward (you must go through braking), you can go from forward accelerating to braking, you can go from forward accelerating to forward stable, you can go from reverse to braking, you can go from reverse acceleration to reverse stable etc.

The causes of the state changes will be varied. The accelerator pedal and the gear shift will be the primary inputs, but things like overcurrent / overheat can also cause a state change, and even things like battery voltage. As the battery voltage drops, the vehicle can be "speed limited" to conserve the battery to allow the vehicle to limp home.

These "states" are designed to safeguard the electronics, the motors and the gears (and the driver of course). By moving from the braked state to the forward accelerate state to the forward stable state, torque is applied gradually to the motors (and thus the gears). By only allowing moving from the forward or reverse (accelerate or stable) state to the braking state, the system is prevented from "jamming gears", and also applies both acceleration and deceleration (in all directions) gradually.

Comments welcomed.

JWC

Edited by - jwcolby on 10/23/2006 21:46:52
Go to Top of Page

allan
Journeyman Modder


victoria
Australia



254 Posts

Posted - 10/23/2006 :  22:05:59  Show Profile
Good luck with the prototype. Seems like a good idea, but I will be honest with you, much of it went over my head. But then again I still get confused between the words 'series' and 'parallel' when dealing with grouped batteries.
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/24/2006 :  07:00:28  Show Profile  Visit jwcolby's Homepage
A PWM motor controller has an H-Bridge circuit which is essentially a pair of MOSFETS driving each direction.


30.66 KB

Each of the four transisters have to be in specific states (on / off) in order to do useful work and in order not to destroy themselves. The point of using a state machine is that each state maps uController output pins to specific states (on / off / high / low), and since these uController output pins drive these transisters, the state machine state directly maps the state of the four transisters.

If the Forward T1 and Reverse T1 are both pulled High (disabled), then the motors will not (can not) be driven, because there is no path possible from ground to vcc. Notice that the T2 transisters can be on or off, it really doesn't matter, the motor cannot be driven if these two T1 transisters are turned off.

If the Forward T2 and Reverse T2 are both pulled Low (Disabled), then the motor will not be driven, for the same reason. And likewise, the T1 transisters can be turned on or off, it doesn't matter, the motor cannot be driven if these two T2 transisters are off.

This incidentally is the reason for the resistors on the input pins. If the module is installed and connected to the motors, but have no inputs, the resistors pull the T1 transister gates high (disable them) and pull the T2 transister gates low (disable them) so the circuit will be disabled entirely (freewheel). Virtually no current will be used in that case. I could also pull the T2 transisters high (instead of to ground) which would make the "unconnected" state an active brake.

If Forward T1 is driven Low (enabled) and the Forward T2 is driven High (enabled) then the motor will be driven forward since there is now a path for current to flow from vcc, through Forward T1, through the motor, through Forward T2 to ground.

If the Reverse T1 is driven low (enabled) and the Reverse T2 is driven High (enabled) then the motor will turn in reverse, for the same reason, but through the other pair of transisters.

If the Forward T1 and Reverse T1 are both enabled, then the motor will be shorted through the VCC leg, and active braking is applied.

If the Forward T2 and the Reverse T2 are both enabled, then the motor will be shorted through the ground leg, and active braking is applied. Active braking through the ground leg is the preferred path and the one we will be using.

If the Forward T1 and Reverse T2 are both active simultaneously, or the Reverse T1 and Forward T2 are both active simultaneously, then the VCC is shorted directly to ground through that transister pair, without passing through the motor. NOT GOOD. Given a sufficient current (a 12v battery is sufficient) this will destroy the transisters within a few 10ths of a second or less. Fuses are good!!!

What I am calling "Freewheel" is when all the transisters are DISABLED simultaneously, which will allow the motor to turn if force is applied to the shaft of the motor (turns into an untapped generator).

So as you can see from this, the trick to causing motion is to enable the correct pair of transisters and disable the opposite pair.

As I mentioned in my previous post, to move from any state to any other state, we "have to" go through "freewheel". We do this for the simple reason that Freewheel is the state where ALL TRANSISTERS ARE OFF. These transisters switch from Off to On and On to OFF at various speeds. If we do not turn all transisters off just very briefly, then we could enter a state where the ground leg was not finished turning off (for example) when the vcc leg was already turned on, and you could short vcc to ground. In most cases, this "transitional shorted state" is so brief (nano seconds to microseconds) that it will not destroy the transister directly, but it will cause the transisters involved in the short to heat up, and if it happened often it could case the transisters to overheat and eventually burn up.

The power MOSFET transisters switch states within a 20 to 100 nanoseconds (billionths of a second). The minimum time that any State Machine state can exist is 1 microsecond (assuming a 1 megahertz clock to the uController). Thus before we move from one state to another, we can set the "Freewheel" state for one clock cycle of the uController (one microsecond), then move on to the next step. This one microsecond Freewheel state allows all of the transisters to fully turn off before attempting to move to the next state, avoiding the "transitional shorted state".

So the state machine maps what the possible states are, what causes the current state to change, what state we are currently in, and finally what the state will change to if an input changes. The state machine then defines which output pins from the uC will be low and high for any given present state. We apply those pins directly to the H-Bridge, and voila, we move, brake, change speeds etc.

JWC

Edited by - jwcolby on 10/24/2006 17:34:31
Go to Top of Page

jwcolby
Apprentice Modder

Hudson
NC
USA

52 Posts

Posted - 10/24/2006 :  17:48:20  Show Profile  Visit jwcolby's Homepage
So now we know that with a fairly simple electronic circuit consisting mainly of 4 power MOSFETS, one motor can be placed into many different states, depending on which combination of transisters are on and which are off.


22.31 KB

The problem with this is that we really don't have anything that you couldn't achieve with simple wires or at the most simple relays.

What a uController brings to the table is the intelligence to do a few things.

1) The uController can give us the intelligence to prevent the motors from jamming from forward directly into reverse or vice versa.

2) By applying a waveform to one of the transisters we can apply "partial power". In otherwords, by setting up the "forward" state, but them modulating the signal driving either T1 or T2 (or both, but we wouldn't do that) we can cause the motor to turn (forward in this example) at a speed dictated by the percentage of "on time" of that wave form. That is known as PWM (pulse width modulation) and we all know this mechanism from fan controllers where we can vary the fan speed over a range, or even incandescent lights where we can vary the intensity over a given range.

Given the ability to modulate the power to the motor, we can create a "soft start" where the motor slowly applies power over a small time period, perhaps a second. By doing this we can linearize the torque applied to the drive gears. In the toys as they currently exist, the power is applied all at once. The manufacturer intentionally gives you crappy traction for this exact reason, so that you don't strip the gears.

We can also create a "soft brake" where we slowly but steadily apply the brake condition until the "Brake" state is applied and the motor is locked stopped.

3) The uController knows what the motors are currently doing and can make intelligent decisions as to what the motors should be allowed to do next. My son has had his toy for about 9 months now and he STILL jams from forward to reverse and vice versa. He just doesn't understand the damage he is doing and even if he did, he just doesn't think about what he is doing.

The uController knows that the vehicle is moving and what direction, and has a table of rules that it applies to any given situation.

"If moving forward and the gearshift says change direction, actively brake to a stop and then ramp the speed up in the indicated direction".

The indicated state table displayed above tells us what transister states cause what motor activity. The next piece of the puzzle is the table that says "from state A, you can only go to state D or state E". More specifically it will also tell us what CAUSES us to move from one state to another.

JWC


Edited by - jwcolby on 10/24/2006 18:22:01
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 Forum Locked
 Printer Friendly
Jump To:
 Powered By: Snitz Forums 2000 Version 3.4.05