Shop OBEX P1 Docs P2 Docs Learn Events
ServoPal connection to 3 pin header — Parallax Forums

ServoPal connection to 3 pin header

garyggaryg Posts: 420
edited 2012-06-27 13:41 in BASIC Stamp
I recently purchased a ServoPal.
I'm attempting to get the ServoPal to operate my servo.
I'm using a BS1 module on a test board that I built.

The ServoPal has a double row header designed to plug into a Parallax BoeBot.
I only have one 3pin header on my test board.

I am unable to get any response out of the ServoPal.

I've attempted to make my setup and initialization of the ServoPal compatible with the BS1 controller.
However, I get no response to my servo.

I've attempted below to paste the logic I'm attempting to use into this message.

A few questions:
1 - Do I need to power both sides of the female pins on the ServoPal in some manner?
2- Does it appear that my program logic is moving in the correct direction?
3- Will a BS1 module be capable of driving the ServoPal?

Thanks for any advice/suggestions

Garyg



SYMBOL PalI = PIN1 'Define ServoPal control signal pin.
INPUT 2 'Pushbutton

'INPUT PalI should watch the signal pin of the ServoPal until it is properly powered up.
INPUT PalI 'Make sure ServoPal is not being driven.
IF PalI = 1 THEN ClearServoPal 'Wait for ServoPal to power up.
'ClearServoPal should initialize the servopal to not drive anything for now.
ClearServoPal:
LOW PalI 'Set PalI pin1 to an output and hold it low
PAUSE 1000 'Wait for 1 second
HIGH PalI 'Raise pin1 to high so it's ready to send servo driving info.
'to the ServoPal.
'The above thing starting with INPUT PalI should make the ServoPal ready to use.
Main:
IF PIN2=0 THEN TURNONLED
GOTO Main
TURNONLED:
HIGH 5
setthepotvalue:
FOR position = 1 TO 1000 'drive the servo for 20 seconds - 50=1sec.
POT PotPin, Scale, Level 'The Pot Pin is PO which is pin 7 on the BS1 module.
'The scale is rescaled from original POT TEST,
'B2 is the memory location of the Pot level value,
levelstorage=B2 'levelstorage is memory location W2
IF W2<114 THEN Minimum 'Minimum servo position = 114 when Finger is DOWN
IF W2>190 THEN Maximum 'Maximum servo position = 190 when Finger is UP
GOTO Driveservo
Minimum:
levelstorage = 114 'Minimum servo position (Finger DOWN), can't be done in If Then statement.
GOTO Driveservo
Maximum:
levelstorage = 190 'Maximum servo position (Finger UP) 190, can't be done in If Then statement.
GOTO Driveservo

Driveservo:
'start of servo drive logic.
PULSOUT PalI, levelstorage ' position servo anyplace within the 180 degree range.
'PULSOUT 1, levelstorage 'try to turn on the other servo driver.
PAUSE 30 ' 30ms pause
'Pause for at least one or two cycles of the ServoPal before updating again.
NEXT
PULSOUT PalI, 500 ' turnoff the servoPal output 0
TOGGLE 5
'end of servo drive logic.
GOTO main

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-06-24 16:02
    I'm not a Basic Stamp expert, but it sure looks like you're using BS2 code to control your BS1.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-06-24 20:54
    The PULSOUT statement timings are different for the BS1. I think the units for the BS1 are 10us rather than the 2us of the BS2. You have to adjust all the PULSOUT statements. Look closely at the ServoPAL documentation. I believe the Vdd connections are tied together on the ServoPAL and the Vss connections are tied together. If you're not using the Alarm input, you don't have to connect that side of the ServoPAL. You should be able to control a single servo with a ServoPAL. I don't know if the BS1 is fast enough to put out the two control pulses within 1ms that's necessary to control the 2nd servo. Don't be surprised if it doesn't work, but give it a try.
  • garyggaryg Posts: 420
    edited 2012-06-25 10:24
    Thanks Mike
    BS1 is 10us units.
    I've looked very closely at the ServoPAL documentation.
    According to the documentation the ServoPAL can be used on the BOE.
    I looked up the schematic and it does show that the VSS / VDD connectios exist in parallel on the board of education.

    My plan will be:
    1- Write a minimal program with no frills.
    2- Convert the pulsout timing so that it is consistant with the BS1
    3- WireWrap short circuit the RED pins and BLACK pins.
    4- Load the program and check the results with O-Scope.

    I'll post the results on this thread.

    Thanks
    garyg
  • Mike GreenMike Green Posts: 23,101
    edited 2012-06-25 10:36
    Give it a try. The minimum timing for a PULSOUT on the BS2 is about 220us. The BS1 is supposed to be about 1/2 the speed of the BS2 for the simplest statements, so it's reasonable to expect that it will execute a PULSOUT roughly in a minimum of 500us which is close enough to handle two servos with the ServoPal. Make sure to have the two PULSOUTs one after the other with no statements in between.

    I would hold off on messing with the Red and Black pins. First see if it works.
  • garyggaryg Posts: 420
    edited 2012-06-26 15:29
    I found a level of success in getting my BS1 to drive two servos using my 3 pin header via ServoPAL!

    I followed my simple program plan and
    attempted to get the ServoPAL to work using only 3 pins.

    I tried both sides of the ServoPal
    1st I plugged in the Servo1, vdd, Gnd side without success
    Then
    I plugged in the Servo0, vdd, Gnd side without success.

    With the O-Scope probe connected to the Servo0 side, I could see the signal appearing to be transferred through
    the ServoPAL but the ServoPAL would not output a signal.

    After a few hours of trying different values in the signal timing without success, I thought I would try
    Shorting the female side of the ServoPal at the GND and Vdd points on both sides of the ServoPAL.

    EVERYTHING STARTED WORKING!

    I tried uploading the Code that I used for testing the ServoPAL on my BS1

    I would like to try the alarm function but am wondering;

    Is the ServoPAL capable of driving an LED, or do I need to use one of my BS1 inputs to take the Alarm signal
    and drive an LED?
  • Mike GreenMike Green Posts: 23,101
    edited 2012-06-26 20:09
    The ServoPal is made with an ATTiny13 microcontroller and the Alarm pin is just one of the I/O pins. This should be able to drive an LED as long as you limit the current to maybe 10mA or less.
  • garyggaryg Posts: 420
    edited 2012-06-27 13:41
    Thanks for all your help.
    I feel confident that I can now use the ServoPal in my upcomming projects.
    garyg
Sign In or Register to comment.