BS2 and Motor controller not talking
rapter
Posts: 9
Hi
I am trying to use a BS2 to control Deventeck MD22 motor controller. I am able to run my motors using RC control without a problem, but I can not seem to get the BS2 PULSOUT command to run motors. I am using the servo connectors ( white wire ) at 12, and 13 on the BOE ver. C. I do have a common ground between MD22 and BS2. Any suggestions would be greatly appreciated.
Thanks Ed
I am trying to use a BS2 to control Deventeck MD22 motor controller. I am able to run my motors using RC control without a problem, but I can not seem to get the BS2 PULSOUT command to run motors. I am using the servo connectors ( white wire ) at 12, and 13 on the BOE ver. C. I do have a common ground between MD22 and BS2. Any suggestions would be greatly appreciated.
Thanks Ed
Comments
Please post your code so we can see where the problem might be…
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
' {$STAMP BS2}
' {$PBASIC 2.5}
a·· VAR·· Byte
FOR a = 1 TO 200
· PULSOUT 13, 900
· PULSOUT 12, 900
· PAUSE 20
·NEXT
· END
That certainly looks like valid code to move a servo, so it should work if your controller accepts servos pulses. That code will end fairly quickly. I wonder if you should try DO…LOOP instead of the FOR…NEXT loop. A quick question…does the controller calibrate the off position to the first pulses it receives?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Using the MD22 with popular controllers
One the easiest ways of connecting the MD22 to a standard controller, such as the BS2 Stamp, is to use RC Servo mode. Select normal (independent) or differential mode on the switches before powering the module. Now you can use the PULSOUT command to simulate the servo pulse and control the motors. The pulse needs to vary between 1mS (full reverse) to 2mS (full forwards) with 1.5mS being the center off position. Unlike servo's, which require the pulse to be repeated every 20mS or so, the MD22 need only be sent a new pulse when you want to change speed. With no pulses being sent it simply continues at the current speed. The timing parameter will vary depending on the controller. Here are some popular examples - all tested by us.
Thanks Ed
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
I have a 24 volt (2- 12 volt batteries) system. I have 3 voltage regulators (1-9volt, 1-6volt, 1-5volt). I am controlling 2 0-24volt motors through the controller. The motor controller uses 5 volts from 5volt regulator for logic. I also use the 5 volts for the RC receiver. I use 9volts for the BOE. RC receiver disconnected from system when using BOE. All systems have common ground.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
I'm not sure you answered Chris's question which appears below:
Chris asked -
"You said you had a common ground and the signal wire, but where do the motors and/or the controller get their power from?"
You replied -
"I have a 24 volt (2- 12 volt batteries) system. I have 3 voltage regulators (1-9volt, 1-6volt, 1-5volt). I am controlling 2 0-24volt motors through the controller. The motor controller uses 5 volts from 5volt regulator for logic. I also use the 5 volts for the RC receiver. I use 9volts for the BOE. RC receiver disconnected from system when using BOE. All systems have common ground."
In tabular form, your answer looks something like this:
Device or System······ Voltage···············Source
·····
·········
Motor Controller -
· Logic······················ 5.0· VDC······· Separate regulator #1
· Power/Motors·········· 0-24 VDC······ Straight from battery?
RC Receiver···············5.0 VDC········Separate regulator #1
BOE························· 9.0 VDC········ Separate regulator #2
Unknown··················· 6.0 VDC········ Separate regulator #3
It's unclear where the motors or the motor controller (one or the other, I would think) are getting their power from. It's understood that the grounds are common.
Regards,
Bruce Bates
"The Motor Ground and the Logic Ground are internally connected on the Module."
(Also, it seems you should not need to run a BS2 loop (or for/next) with the pulseout commands to the MD22. The MD22 is supposed to do the "looping" itself, once given a single pulseout command --continuing to hold that position (or to rotate at that speed/direction) until a new pulseout command is received.)
PAR
First I must apologize for my lack of knowledge in the electronics field. I am 67 and recently retired and trying to teach this old dog new tricks. So if I do not use the correct lingo just let me know and I will try to reword. That said here are some pictures of where I am at now.
It all works fine with the RC receiver but when I change to the BOE nothing .
I know I should not have to continue sending pulseout but when single pulse did not work I tried the for next loop.
·
·
Post Edited (rapter) : 4/12/2007 6:46:21 PM GMT
If you are using the correct pulsout values, as it seems you are, then consider the following as possible problems:
- are you trying to pull more than 8 amps or so peak to each motor? This controller is rated 5A per motor, though peaks can be higher before it locks up
- make sure the blue 4 position dip switch on the controller is correctly set to RC mode AND CHOOSE YOUR TIMEOUT mode -- if you do not have the timeout mode turned on, then you do not have to refresh your servo pulses with the stamp. If you do have timeout mode on, then you will need to send continous servo pulses every 20 ms or so. See the documentation at www.robot-electronics.co.uk/htm/md22tech.htm. That said, check which version of firmware you have for the controller -- the timeout was introduced with version 9 maybe a year ago.
- make sure the controller is properly wired to avoid a ground loop. You need to do one of the following three things:
1. use separate battery for logic, separate battery for motors (sounds like you don't want to do this)
or
2. follow wiring scheme as given for a single battery and the MD03 -- www.robot-electronics.co.uk/htm/md03tech.htm. It's a different controller, but Gerry at Devantech recommends this scheme for the MD22 as well. This pulls your logic supply ground through the controller. I have done this on single supply, and it works, but sometimes the controller will lock under heavy changing loads
or
3. follow wiring scheme shown here http://forums.parallax.com/attachment.php?attachmentid=43706 and discussed here http://forums.parallax.com/showthread.php?p=610598. I have had *great* results with this scheme -- no logic ground on the motor controllers.
Lastly, not quite sure what kind of Stamp you have, but running this controller with I2C commands instead of servo pulses is really nice.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
Post Edited (Zoot) : 4/12/2007 7:47:44 PM GMT