PDA

View Full Version : Electronic speed control + BS2



Matt Battle
08-10-2006, 02:22 AM
Hello all,

I am about to run some tests to see how to control an electronic speed control with my BS2. I was wondering if there is anything I should watch out for before I start? I am figuring it should be the same as controlling a servo? Thanks guys.

Regards,
Matt

Post Edited (Matt Battle) : 8/9/2006 7:26:46 PM GMT

crgwbr
08-10-2006, 02:27 AM
hey, ESC's do control just like a servo; however, it is possible that they don't need to be refreshed every 20 ms.· This might not be right though; keep us posted if you find anything interesting.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life

studysession
08-10-2006, 03:09 AM
What all are you trying to do?

Matt Battle
08-10-2006, 03:37 AM
studysession said...
What all are you trying to do?

studysession,

What I want to do is make the motor that is connected to the ESC go forward for a few seconds and then back for a few seconds. I am just running some tests right now.

-Matt

studysession
08-10-2006, 03:40 AM
Cool - I have RC cars and want to learn how they use the ESC's for controlling the motors as well. I want to make my own for the BOE-BOT.

Matt Battle
08-10-2006, 04:37 AM
Eureka!!! With some tests I found out that the pulse width had to be above 800 for my ESC to recognize it. I tested from 800 to 1500. With 1500 not being a good idea because I drained the heck out of the battery. I am going to charge it for a few hours and run some other tests.

I also looked at the battery and it says it’s a 1200mah. I think I need to get an 1800-2000mah battery, if not higher, just so that I am not recharging this thing everyday.

Regards,
Matt

Post Edited (Matt Battle) : 8/9/2006 9:44:01 PM GMT

Bruce Bates
08-10-2006, 05:06 AM
Matt -

What you SHOULD find out from your empirical testing is the following, or something like it, depending on the exact ESC:

Some ESC controllers use PWM (pulse width modulation) [see the PBasic Manual or PBASIC Help File for details on the PWM command] and the (PBASIC PWM) DUTY and/or DURATION parameters will need to be "exercised" to see what the ESC will do.

Some ESC controllers use only a pulse width (PBASIC PULSEOUT command) and that will need to be "exercised" as to DURATION [see the PBasic Manual or PBASIC Help File for details on the PULSEOUT command].

NOTE-1: The DURATION parameters for BOTH commnas will vary based on the exact PBASIC Stamp you are using.

NOTE-2: Although I doubt you'll run into one, SOME specialized ESC's permit a "reverse" feature. These are generally used on marine R/C vehicles. If you find yourself with one of these, there will be some "STOP" (some frequency/duty/etc) which delineates FWD from REV (forward from reverse) and that above or below that STOP point represents faster in the given direction (FWD or REV).

Let us know how you make out, and what kind of ESC you are using.

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->

Matt Battle
08-10-2006, 05:42 AM
Hey Bruce,

The ESC that the R/C I have came with is the LM-406FB. I did a Google and came up with a lot of non-English websites. That is okay because I am thinking of going with a more durable, better brand ESC anyways.

I will post updates as I do more tests and learn more about the ESC.

Regards,
Matt

P.S. I have the BS2-IC Rev. C stamp.

Post Edited (Matt Battle) : 8/10/2006 8:45:52 PM GMT

Matt Battle
08-11-2006, 03:44 AM
Update: Today I didn't work on my ESC much but it seems that it likes to go forward more then backwards. Maybe because of the ESC I have can only go forward or that I am not writing the code right and don't fully understand how to control the ESC. The reason I say this is because I can make the ESC drive the motor backwards, but once I tell it to drive the motor forward it doesn't like to go backwards any more.

-Matt




' {$STAMP BS2}
' {$PBASIC 2.5}

counter VAR Byte

DO
'Forwards
FOR counter = 1 TO 100
PULSOUT 12, 850
PAUSE 20
NEXT

'Backwards
FOR counter = 1 TO 100
PULSOUT 12, 650
PAUSE 20
NEXT

'Left

'Right

LOOP

END

studysession
08-11-2006, 04:13 AM
I assume you plug it into your board just like a servo since wires are the same?
Thanks

Matt Battle
08-11-2006, 07:01 AM
Hello,
Using the same code I plugged in a servo and got the results I was looking for; turning CW and CCW over and over. So from that I am going to say it has something to do with the ESC and how it receives or interprets the pulses.

Regards,
Matt

Update: Remembering what crgwbr said about how some ESCs don't need to be refreshed every 20 ms, I tried 200ms and it seems to work. I get a jerking motion from the ESC but it does go forward and backwards. Now I just have to figure out how fast I need to send pulses to it.

Post Edited (Matt Battle) : 8/11/2006 12:10:37 AM GMT

studysession
08-11-2006, 07:14 AM
Cool - thanks for the update. When you get the refreshes figured out, will you post them?

Matt Battle
08-12-2006, 05:51 AM
studysession,

As you can see in the code below I have my pause for forwards set to 100 and the pause for backwards set at 200. There is little to no signs of jerkiness, so I am happy with the results. Just a heads up though. This works for my ESC but it might not work for yours. So you might have to play around with the numbers too until you find ones that work. I am still working on the code to get the car to turn right and left fully while it is going forward or backwards. Once I get that I will post the code. The only problem I came across is that I have power from the BOE and power from the ESC going into the motor which I expect cannot be a good thing. So I might be doing some hacking tomorrow.

Regards,
Matt




'Forwards
Forwards:
FOR counter = 1 TO 100
PULSOUT 12, 825
PAUSE 100
NEXT
RETURN

'Backwards
Backwards:
FOR counter = 1 TO 100
PULSOUT 12, 630
PAUSE 200
NEXT
RETURN

studysession
08-12-2006, 08:37 AM
Thanks!@

Matt Battle
08-18-2006, 06:50 AM
Hello,

Does anybody have any good links to some tutorials on voltage comparators? Especially on the LM339? When I Google it mostly that comes up are links to buy them or Op-amp links. Thanks guys and girls.

Regards,
Matt

Chris Savage
08-18-2006, 10:00 PM
Really the best educational material I have seen on this chip was by Forrest M. Mims III....Radio Shack used to carry these books, but I don't think they carry many of them anymore.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

Matt Battle
08-19-2006, 03:25 AM
Chris,

Do you remember the name of it? It seems that amazon has a good collection of his books. Thanks

Matt

Chris Savage
08-19-2006, 07:08 AM
Matt,

·· The Engineers Notebook II had a lot of information on it.· But there were also several mini-engineers notebooks as well.· Some specialized to various things.· For example, there was one for 555 timer ICs and another for Op-Amps.· I looked at my old Engineers Notebook II.· I hope this helps.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

PJ Allen
08-19-2006, 09:08 AM
The LM339 Datasheet itself has, as I recollect, two dozen or more circuits.· In fact, I'm Attaching them.

Chris Savage
08-21-2006, 09:38 AM
Thanks PJ...With so many circuits in the Mims books I don't think I ever opened the datasheet for that one!· =)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

RDL2004
08-22-2006, 08:35 AM
I don't know exactly how many of those Radio Shack "Engineer's Mini-Notebook" there were originally, but some are still available in a newer edition.

It looks like several of the originals have been combined into a series of just four books. I'm pretty sure these are basically just reprints. This is the 555, Op Amp, and Optoelectronic mini-notebooks combined:


Timer, Op Amp, and Optoelectronic Circuits & Projects (http://www.amazon.com/gp/product/0945053290/sr=8-3/qid=1156209657/ref=pd_bbs_3/104-4911071-1731931?ie=UTF8)

If that link doesn't work, just search Amazon for Forrest Mims, or go to forrestmims.com

Bean
08-22-2006, 09:01 AM
Here are the ones I have, along with the radio shack catalog number:
555 Timer IC Circuits 276-5010
Op Amp IC Circuits 276-5011
Optoelectronics Circuits 276-5012
Basic Semiconductor Circuits 276-5013
Digital Logic Circuits 276-5014
Communications Projects 276-5015
Science Projects 276-5018
Environmontal Projects 62-5019
Magnet and Magnet Sensor Projects 62-5020
Sensor Projects 62-5026

There are gaps in the numbers so I assume there are more...

Bean.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com (http://www.hc4led.com)

Low power SD Data Logger www.sddatalogger.com (http://www.sddatalogger.com)

"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·

RDL2004
08-22-2006, 10:56 AM
Formulas, Tables, and Basic Circuits 276-5016
Schematic Symbols, Device Packages, Design and Testing 276-5017

The second one still has a $1.49 Radio Shack price sticker on it :)

I must have gotten side-tracked from electronics and such for a while back then, because I don't have any of the ones after these two.

Matt Battle
08-28-2006, 06:37 AM
Hey guys,

I have been banging my head on my desk over and over for the past week or so because I can't seem to figure which voltage comp to use or how to use them properly. As you all know I am trying to make an ESC for my Boe-Bot. I am trying to make one that will go forward and backwards but I don’t know if I need a dual or quad voltage comp for this. I know I can use a h-bridge but that means I would have to use two pins from the BS2. I might use one for now until I can figure out how ESC use voltage comps to control motor directions. Any insight on this and will I can go to learn more about them? Thanks guys and girls.

Regards,
Matt

PJ Allen
08-28-2006, 09:00 AM
Dual or quad?· A dual op-amp has two op-amps in it, a quad has four -- no mystery here.

What is it you want to use a voltage comparator for, guy?

In the case of LM339, a splendid IC, made especially for·+V & GND (single-ended) use:·if·the voltage at the +input is > than the voltage at the -input, then the output goes to supply/+V; similarly, if the voltage at the -input is > than the voltage at the +input, then the output goes to GND.

Comparators are used as level detectors --·a varying voltage, the input or signal,·is compared to a Reference / Threshold voltage and the output will result accordingly.

Comparators are not used as linear amplifiers, like for audio amplifiers.· They're kind of like a transistor switch with a programmable gate voltage.

Post Edit -- picture attached




Post Edited (PJ Allen) : 8/28/2006 3:02:48 AM GMT

southernbob
08-29-2006, 12:42 AM
The motor controller used in the Scribbler robot has some good features. It just neeeds
1 pulse to go forward or reverse·or to vary the speed. A pulse duration of 2000 is STOP,
1000 is full speed reverse and 3000 is full speed forward. Values in between can be used
as intermediate speeds. A neat feature is that after giving the speed/direction pulse
another pulse can be given for how long to do the selected operation. A pulse duration
of 1400 gives 1 second of operation and 3000 gives 5 seconds of operation, Here is an
example from Scribbler code.

·' Turn right for 1 second
· PULSOUT MotorRight, 1500··· '1/2 speed rev on right motor
· PAUSE 1
· PULSOUT MotorRight, 1400··· 'maintain 1/2 speed rev for 1 second

· PULSOUT MotorLeft, 2500···· '1/2 speed fwd on left motor
· PAUSE 1
· PULSOUT MotorLeft, 1400···· 'maintain 1/2 speed fwd for 1 second
The PAUSE 1 instruction between the 2 PULSOUT instructions apparently allows
this operation.

Is there a schematic of the Scribbler motor controller available or is it a propriertary design?
The only schematic I can find just shows a motor controller BLOCK with no
details. Does Parallax make a motor controller with these features?

Matt Battle
08-29-2006, 04:21 AM
PJ Allen said...

…What is it you want to use a voltage comparator for, guy? …



Hey PJ Allen,

Its not that I want to use a voltage comparator, it’s that a lot if not all of the schematics I have seen for ESC have either a dual or quad in them some where. I was just wondering if that is used for switching the polarity between negative and positive to make the motor go forward and backwards? If so how? I think that is my main hurdle right now in getting the ball rolling on my ESC. Seriously, if it comes down to it I guess I can give up two I/O pins on the BS2 for an h-bridge but how effective is that? How much power is wasted through heat?

Regards,
Matt

PJ Allen
08-29-2006, 08:12 AM
Why don't you buy one of these·-- http://www.robotobjects.com/scripts/prodView.asp?idproduct=67 -- and save yourself more than a spot of bother?

It's a kit, you can make it, it'll be effective, and maybe you can·finally get it together instead of all this hemming & hawwing·self-sabotage stuff and stop·laying landmines before yourself.

[ And I mean that in the nicest way. ]

Kaos Kidd
08-29-2006, 10:58 PM
LOL@PJ....
(the self-sabotage... )

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-------------------------------------------------------------------------

Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd
-------------------------------------------------------------------------

·

Matt Battle
08-30-2006, 01:17 AM
PJ Allen-

What would I learn from the kit? I would still be in the same predicament that I am in now and that is not understanding how to build an ESC. My main goals for my first mini project will be shifted towards the programming aspect in the up coming weeks so with that in mind I can’t spend the next few weeks to month racking my brains over trying to build an ESC.

Matt

PJ Allen
08-30-2006, 09:15 AM
Matt Battle said...
What would I learn from the kit?
More than anything from "hacking" that broken Roomba.· And where'd that go?·
Roomba, LM339, ESC, 1000 miles at sea in the Atlantic Ocean, dual or quad, catsup or ketchup... all this "stuff".
Cripes.

Matt Battle
08-31-2006, 12:45 AM
PJ Allen said...

More than anything from "hacking" that broken Roomba. And where'd that go?
Roomba, LM339, ESC, 1000 miles at sea in the Atlantic Ocean, dual or quad, catsup or ketchup... all this "stuff".
Cripes.



PJ Allen,

Hey I got alot of parts from that roomba and a good platform to maybe do something with. You are right though, if I want to meet my goals it might be in my best interest to buy "kits" instead of parts and if I have time learn from the kits instead of throwing things together and go hmm why didn't anything happen.

Matt

Mike W
08-31-2006, 06:21 AM
Matt

I was working with a ESC that I purchased from Tower Hobbies It was just a forward controller but one thing that I discovered is that the servo plug that you supply the signal to control the ESC back feeds the positive (red) lead from the batteries used to power the motors. I disconnected the red wire from the plug and just used the signal and ground to control my ESC.

Hope you find this helpfull

Mike W

Matt Battle
09-01-2006, 03:01 AM
Mike W

Yea, I figured that was happening with the ESC I had. I believe it has to do with the BEC that a lot of ESCs have. This is one reason I am trying to redesign one so besides supplying positive power through the line it will be receiving positive power through the BOE and should eliminate the need for two batteries or a y adapter split between the BOE and the ESC.

Matt

Matt Battle
09-05-2006, 05:34 AM
Hey everybody,

Here are the specs for the 540 motor that I am using:
• Voltage Range: 12.0V
• Normal Voltage: 7.20V
• Normal Load: 19.6mN.m (200g.cm)
• Speed at No Load: 15,800 RPM
• At normal load speed: 14,000 RPM
• At normal load current 6.0A

Unfortunately, the L298 Compact Motor Driver will not be able to handle the amps the motor will be throwing at it. I have some IRF620 that can handle 6.0A a piece so I guess I will be using them. I can't use 4 of them in the H-bridge can I? I have to use two IRF620 and its counterpart? Does anybody know which that is? Thanks.

Regards,
Matt