Can a STAMP do this
Kinectricity
Posts: 6
in BASIC Stamp
Hi everyone. I've been lurking for a while and decided to finally take the plunge. I'm wanting to apply motion to a sphere and make it move very similar to an owl's head. So 3 motions involved. Rotation, say 180º max, Tilt backwards and forwards say 45º and Tilt sideways to left and right again 45º max. It would need to be both a sequential movement and a combined movement and totally random interspersed with various periods of inactivity, so think owl.
What I have from my junk drawer is a Board of Education Rev B, 2 Basic Stamps BS2e Rev D, some servos 0.1sec/60degree 1.4 kg/cm torque. a bunch of various resistors and capacitors.
What I DON'T have is any programming skills or knowledge. I've been playing around trying to program the stamps with what I think are some possibilities but getting nowhere fast. Maybe I'm approaching this all wrong and need something a bit more sophisticated than the Stamp.
So any help would be really appreciated and maybe save me a lot of time going in the wrong direction.
Thanks
What I have from my junk drawer is a Board of Education Rev B, 2 Basic Stamps BS2e Rev D, some servos 0.1sec/60degree 1.4 kg/cm torque. a bunch of various resistors and capacitors.
What I DON'T have is any programming skills or knowledge. I've been playing around trying to program the stamps with what I think are some possibilities but getting nowhere fast. Maybe I'm approaching this all wrong and need something a bit more sophisticated than the Stamp.
So any help would be really appreciated and maybe save me a lot of time going in the wrong direction.
Thanks
Comments
A Stamp can do only one thing at a time. In this case, it has to output a 0.5 to 2.5ms control pulse to each of the three servos in turn in a 20ms cycle. During the left over time (12.5ms) in each cycle, your program has to figure out the next positions for the subsequent cycle ... not hard to do. Typically your program keeps a "current position" for each servo (a number from 250 to 1250) and an increment / decrement value for the position. Each cycle the current position is used in a PULSOUT statement to generate the control pulse, then the increment / decrement value is added to the current position limited by the bounds you place on servo position (use MIN and MAX operators). After that, your program would generate a random number and use that to figure out what to do next.
As far as I can tell all the servos are "standard" servos as the max amount of movement I have managed to get is about 100º.
Here's what I've been playing with.
'{$STAMP BS2e}
'{$PBASIC 2.5}
counter VAR WORD
DO
DEBUG "Pulse width increment by 8", CR
FOR counter = 500 TO 1000 STEP 6
PULSOUT 15, counter
PAUSE 10
DEBUG DEC5 counter, CR, CRSRUP
NEXT
DEBUG CR, " Pulse width decrement by 4", CR
FOR counter = 1000 TO 500 STEP 4
PULSOUT 15, counter
DEBUG DEC5 counter, CR, CRSRUP
NEXT
DEBUG CR, "Repeat", CR
LOOP
Another
'What's a Microcontroller - ServoTestbs2
'Test the servo at three different position signals
'{$STAMP BS2e}
'{$PBASIC 2.5}
counter VAR WORD
DO
DEBUG "Center 12 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 15, 500
PAUSE 20
NEXT
DEBUG "counter 10 o'clock", CR
FOR counter = 1 TO 500
PULSOUT 15, 500
PAUSE 20
NEXT
DEBUG "Clockwise 3 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 15, 500
PAUSE 20
NEXT
DEBUG "Center 12 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 15, 750
PAUSE 20
NEXT
DEBUG "All Done."
LOOP
END
All from the "What's a controller? book from Parallax
I cannot find any way to stop the rotation. It just performs like a windshield wiper.
Altering PULSOUT values just seems to alter speed not the distance.
Thanks again
Here is some code I used to test a pan and tilt mechanism for an Owl head.
I believe I was using the Servocity Pan and Tilt system at the time:
https://www.servocity.com/spt100
Do remember that some Stamp Basic statements (including PULSOUT) have timing values that vary depending on the Stamp model. Look at the chapter in the Stamp Reference Manual on the PULSOUT statement for details.
He mentioned that he's not a programmer and that he needs to blend servo movements. The "new processor" block in Blockly would make this really easy to program.
Ken Gracey
A turntable of some kind for rotation could be on the bottom with a continuous servo geared down or pulley arrangement.
On top of that you have the tilt (nod) servo which may or may not need to be geared. If not, the standard servo would do. So far you have a standard "elevation over azimuth" telescope mount.
Finally you have the tilt sideways which likely could be a standard servo with the owl mounted directly on the shaft.
A BS-2e can easily handle three Parallax servos with 75% of its time available to decide what to do next.
Once again many thanks to all, you guys are great. Now for some serious construction
https://www.servocity.com/spt200
The owl head was just at 2 lbs, so you need to use the servos they recommend. Those small 9 gram ? servos will not cut it.
I've used the program and connected 2 servos but the amount of movement on both of them is very small, less than 5º. Also there are no long pauses on the pan. Is there any way to pause the pan for something like 2 minutes?
Here's the prototype. The body can be made bigger to accommodate a tilt and pan mechanism plus servos and batteries with a slide switch underneath. Head is 5" diameter and is solid wood. Weighs 12 ounces but can be hollowed.
I tried to upload a small video but unfortunately the forum doesn't allow it. I would definitely like to make the pan move in bigger increments up to 180º right now the max seems to be about 15º
Thanks
Check your batteries because servos use a lot of power especially when they are trying to maintain their position.
In the old days you needed to modify a servo to make it rotate continuously but today you can buy servos that were built for continuous rotation.
What is the rating of your power supply and is it regulated?
You could drop the voltage using a voltage divider or diodes but using batteries or a 6V REGULATED power supply is much simpler.
A: There is nothing a Stamp can't do.
As you have found, Kinectricity!