PDA

View Full Version : BS2 and Motor controller not talking



rapter
04-12-2007, 02:14 AM
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

Chris Savage
04-12-2007, 02:46 AM
rapter,

Please post your code so we can see where the problem might be…

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

rapter
04-12-2007, 03:05 AM
My code

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

a·· VAR·· Byte

FOR a = 1 TO 200

· PULSOUT 13, 900
· PULSOUT 12, 900
· PAUSE 20
·NEXT

· END

Chris Savage
04-12-2007, 03:54 AM
rapter,

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

rapter
04-12-2007, 05:57 AM
I tried the do loop no change but here is a copy from the MD22 tech sheet.

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.

http://forums.parallax.com/attachment.php?attachmentid=73980

Thanks Ed

Chris Savage
04-12-2007, 07:25 AM
Well, the only other suggestion I can make without knowing details of this controller of its requirements is regarding power. You said you had a common ground and the signal wire, but where do the motors and/or the controller get their power from. An R/C receiver would supply power to the device if connected directly. Does it require power from the source?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

rapter
04-12-2007, 07:42 AM
Hi
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
04-12-2007, 08:33 AM
Well, other than trying two different I/O pins, I am fresh out of ideas on that controller. =(

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

Bruce Bates
04-12-2007, 03:02 PM
rapter -

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

PAR
04-12-2007, 10:22 PM
Bruce Bates said...
rapter -

I'm not sure you answered Chris's question which appears below:
.... It's understood that the grounds are common.

Also, it's not clear whether you may have a ground loop interfering with things. The MD22 documentation states:
"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

rapter
04-13-2007, 01:40 AM
Hi
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.



http://forums.parallax.com/attachment.php?attachmentid=46572



·http://forums.parallax.com/attachment.php?attachmentid=46573

·http://forums.parallax.com/attachment.php?attachmentid=46574

Post Edited (rapter) : 4/12/2007 6:46:21 PM GMT

Zoot
04-13-2007, 02:40 AM
I use the MD22 with a Stamp and a single battery. GREAT motor controller. And that's a really interesting looking 'bot.

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 (http://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 (http://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

rapter
04-14-2007, 02:00 AM
Thanks for the info. I wired the BOE and motor control to different bat and BS2 now controls motors with no problem. Your help is greatly appreciated by this inexperienced bot builder.