PDA

View Full Version : Help with a serial motor controller



Bootsy
02-06-2010, 07:52 AM
Hey guys!
I'm trying to use a serial motor controller (http://www.parallax.com/Store/Accessories/MotorServoControllers/tabid/160/CategoryID/35/List/0/Level/a/ProductID/491/Default.aspx?SortField=ProductName%2cProductName) but it won't run for more than a little while and when it does run, it doesn't follow the commands I send it. Does anyone know how to use this or can anyone help me? Thanks!

Here's my code:




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

controller PIN 14
reset PIN 15
HIGH controller
LOW reset
HIGH reset

DEBUG CLS, "start"
PAUSE 150
DEBUG CLS, "Startup done"

'SEROUT 14,84, [$80, 0, 0, 0]
DEBUG "1"
PAUSE 25
DEBUG "2"
SEROUT 14,84, [$80, 0, 3, 0]

DEBUG CLS, "stopped"

'PAUSE 1000

DEBUG CLS, "GO!"

SEROUT 14,84, [$80, 0, 0, 127]
DEBUG "3"
PAUSE 50
DEBUG "4"
SEROUT 14,84, [$80, 0, 3, 0]
DEBUG CLS, "done send"
PAUSE 10000
DEBUG CLS, "done 5"
PAUSE 2000
DEBUG "stop"
END



and here's how I've configured it:


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

controller PIN 14
reset PIN 15

HIGH controller
LOW reset
HIGH reset

PAUSE 200


SEROUT 14,84, [$80, 2, 2]

LOW reset
PAUSE 1000
END

Mike Green
02-06-2010, 07:58 AM
You need to tell us what controller you're using. They're all different. If it's a Parallax controller, indicate the part number. If it's someone else's, you at least have to provide a link to the documentation.

Bootsy
02-06-2010, 08:01 AM
The controller is linked above (click "serial motor controller"). But I think the part number is 30052.

Thanks, though.

Mike Green
02-06-2010, 08:08 AM
OK, it's the Pololu Micro Dual Serial Controller. How do you have it hooked up? If it works properly for a little while, there's probably a power problem. Have you looked at the troubleshooting tips in the documentation?

Bootsy
02-06-2010, 08:25 AM
I don't have it in front of me, so I can't make up a diagram, but I will post one shortly.
I suspect as well that it is a power problem, but why would that make it not respond to my commands and persist in running the motors at full forward at all times. The troubleshooting tips just said to check if it was overheating for these symptoms, but it isn't warm at all.

Mike Green
02-06-2010, 10:32 AM
It all depends on how it's all hooked up. If the controller or the Stamp doesn't have adequate power, it may reset.

Bootsy
02-06-2010, 12:17 PM
Ok, I'll have a diagram on Monday when I'm back at school.

Bootsy
02-19-2010, 03:06 AM
Sorry for the delay, here's how it's hooked up. I have a feeling that you're right about not having adequate power.

_________________________________
| |
| Serial Controller |
| |
| 1 2 3 4 5 6 7 8 9 |
------------------------------------------------
| | | | | | | | |
Power VDD P14 P15 Motor1 Motor2
+ - + - - +

Thanks!

Bootsy
02-19-2010, 03:09 AM
That totally didn't work. : (
Pin 1 -> Battery +
Pin 2 -> Battery -
Pin 3 -> VDD
Pin 4 -> P14
Pin 5 -> P15
Pin 6 -> Motor 1 +
Pin 7 -> Motor 1 -
Pin 8 -> Motor 2 -
Pin 9 -> Motor 2 +

I am using only one battery pack for the stamp, controller and motors. Is that an issue? If I never want to reset the controller, could Pin 5 -> VDD too?
Thanks!

JD
02-19-2010, 09:49 AM
Bootsy,

Do you think you could take a picture of your setup and put it up? From the connections you have described it sounds correct, the syntax would need all 4 bytes sent to control the Pololu; $80, 0 is always needed, and then the next two bytes are motor/direction and speed. The reset pin is nice to have in operation so I would suggest connecting it to Vdd.

Pololu Sample:
SEROUT CONTROLLER, 84, [$80, 0, motor_and_direction, speed]

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

Bootsy
02-23-2010, 03:24 AM
Ok, photos attached. I hope they work, its hard to take good pictures of tiny things.
Thanks, guys (and/or girls)!

Mike Green
02-23-2010, 04:13 AM
It's always a dicey proposition using the same battery pack for motors and controllers (unless it's a really big battery). Motors put a large peak drain on the battery and, if the battery has anything other than a really low internal resistance, the output voltage will sag under load, maybe enough to cause the Stamp or motor controller to reset. Motors also generate a lot of electrical noise which gets back into the power supply and can cause an attached Stamp or motor controller to reset. It's possible to add some filtering to the power going to the Stamp and motor controller to filter out the noise and maybe protect against transient drops in supply voltage, but, in the end, it all depends on battery capacity.

JD
02-23-2010, 04:50 AM
Bootsy,

Unfortunately those pictures didn't help a great deal; but Mike brings up a really good point. What type of battery do you have?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

Bootsy
02-23-2010, 06:34 AM
Yeah, the pictures weren't the best quality. I'm currently using a 4XAA pack for powering the entire setup. I'm going to switch the motors over to their own 9V battery and see if that helps.

Thanks as always.

JD
02-23-2010, 07:50 AM
Bootsy,

Good idea; if that doens't work, swap the 9V and the 4 AA supplies. The 4 AA's have more juice than the 9V battery, the motor will pull more current than the BS2 circuit.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

Bootsy
03-03-2010, 05:59 AM
Ok, so we now have Pin 1 on the serial controller connected to the + on a 9V and Pin 2 to the -, but it still does not respond. Now, however, it does not move at all.
Checking with the volt-meter, we are getting 4.18 volts on the reset pin. Is that low enough to cause it do drop?
Thanks!

PJ Allen
03-03-2010, 06:32 AM
[Are the Grounds/V_ss/Batt- all connected together?]

Bootsy
03-03-2010, 06:45 AM
Since I'm using two battery packs, VSS is connected to the stamp ground which is part of the AA pack circuit. The ground from Pin 2 is going to the Batt - on the 9V circuit.
Other than that, I'm sorry but I don't quite understand your question.

JD
03-03-2010, 07:41 AM
Bootsy,

The question was to verify that you had a common ground amongst all the power supplies. Which would mean, do you have all the grounds connecting together? That would give the project a reference to ground regardless if the source is from the 4-AA or 9V.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

Bootsy
03-03-2010, 11:40 AM
So, I should connect the ground to VSS to both Bat - ?

PJ Allen
03-03-2010, 08:53 PM
Aye.

All battery packs and power sources should be connected to the same Ground.

Bootsy
03-03-2010, 09:21 PM
Ok, thanks, that might do it.

Bootsy
03-04-2010, 06:08 AM
Thanks a lot! It now runs when we tell it to, and stops when we tell it to. But it doesn't turn for us.
We've established that it is configured in one motor mode by commenting out one serout command. It follows motor 0 and 1, but outputs to both motors.
We tried running the configuration program with an LED connected like they recommend to see if it's being configured right, but the LED does not light up when plugged in either way on either Pin 8 or 9.
Any ideas?
Thanks a bunch, though, you guys have been a huge help already.

PJ Allen
03-04-2010, 06:39 AM
So, it was a missing Ground. Thought so. It's always (always) The Fundamentals.

I'm not a Pololu-meister, somebody else may have an insight on your Ops question/s.

JD
03-04-2010, 07:16 AM
Bootsy,

The variable for the motor/direction should range from 0 - 3; giving a motor and direction selection for each motor. Replace the command that is sent to the Pololu with the following command, and what are your results?

SEROUT IOPIN, 84, [$80, 0, 0, 127]
SEROUT IOPIN, 84, [$80, 0, 1, 127]
SEROUT IOPIN, 84, [$80, 0, 2, 127]
SEROUT IOPIN, 84, [$80, 0, 3, 127]

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

Bootsy
03-05-2010, 04:52 AM
Thanks for all of your help. I've got it working now. I don't know why it wasn't turning before. I may have had a glitch in the code that I fixed. I think that's all I need for now. Everyone here has been very helpful and very supportive.
Thanks!