Mechanical Flower runs too fast
wolfdaddy33
Posts: 12
This is a mechanical flower I made from a vegetable steamer, a parallax standard servo, and basic stamp. ( original designer Vern Graner )
can be seen at http://www.youtube.com/watch?v=5GTHwk1Wg7E
The project in mind is to use a ping sensor to activate the flower when closed and have LED's fade on and off with a heartbeat sound, the flower would then slowly open to bloom, and if a person stepped closer to the flower the ping sensor would activate the flower to close rapidly as if it was scared.
I have been able to operate the servo to open and close the flower ( vegetable steamer ) using standard code from the book. However I have not been able to get the flower to bloom and open slowly. I am looking for a very natural linear movement to bring my flower to life.
I am just a few weeks into Basic Stamp and this is my very first project. Any help would be most appreciated I have a great deal to learn,
Thanks Wayne
'{$STAMP BS2}
'{$PBASIC 2.5}
' program to open vegetable steamer (mechanical flower)
' original made by vern Graner
' servo connected to vss,vdd,and pin 0
' program will test servo for smooth opening of vegetable steamer
counter VAR Word
Flowerservo:
FOR counter = 1 TO 100 ' Loop for 2 seconds
PULSOUT 0, 1000 ' Servo counterclockwise
PAUSE 20
NEXT
FOR counter = 1 TO 100 ' Loop for 2 seconds
PULSOUT 0, 500 ' Servo clockwise
PAUSE 20
NEXT
GOTO Flowerservo
can be seen at http://www.youtube.com/watch?v=5GTHwk1Wg7E
The project in mind is to use a ping sensor to activate the flower when closed and have LED's fade on and off with a heartbeat sound, the flower would then slowly open to bloom, and if a person stepped closer to the flower the ping sensor would activate the flower to close rapidly as if it was scared.
I have been able to operate the servo to open and close the flower ( vegetable steamer ) using standard code from the book. However I have not been able to get the flower to bloom and open slowly. I am looking for a very natural linear movement to bring my flower to life.
I am just a few weeks into Basic Stamp and this is my very first project. Any help would be most appreciated I have a great deal to learn,
Thanks Wayne
'{$STAMP BS2}
'{$PBASIC 2.5}
' program to open vegetable steamer (mechanical flower)
' original made by vern Graner
' servo connected to vss,vdd,and pin 0
' program will test servo for smooth opening of vegetable steamer
counter VAR Word
Flowerservo:
FOR counter = 1 TO 100 ' Loop for 2 seconds
PULSOUT 0, 1000 ' Servo counterclockwise
PAUSE 20
NEXT
FOR counter = 1 TO 100 ' Loop for 2 seconds
PULSOUT 0, 500 ' Servo clockwise
PAUSE 20
NEXT
GOTO Flowerservo
bs2
524B
Comments
PULSOUT 0, 1000 ' Servo counterclockwise
That commands the servo to move all the way to one end, and
PULSOUT 0, 500 ' Servo clockwise
tells it to move all the way to the other end. The program does not have any in-between. What you need is a program that loops gradually from 500 to 1000 and back.
Parallax has a lot of educational material on using servos. Look at Andy's What is a Microcontroller to get started. Stamps in class Robotics.
Flowerservo:
FOR counter = 500 to 1000 step 2 ' adjust step value for speed
PULSOUT 0, counter
PAUSE 20
NEXT
FOR
[Now you insert code to make it go the other way]
NEXT
GOTO Flowerservo
And let's see a video!
Ken, your Flame Boe is diff-drive. It will toast (?) bread and deliver it. Close enough?
however, the movement is very choppy. I'm sure there is a slick way too give a smooth motion to the servo at slower speeds.
Any thoughts??
Thanks Wayne
Silky smooth action.
Spot on! A rookie mistake, but then I fully admitt to being a rookie.
I will post a video upon tweaking, hopefully after the weekend.
Thanks Wayne
Another thought: flowers tend to open & close by sunlight. You could have a photocell or phototransistor measure ambient light and use that to control the servo position. More light= more open. Then just using an overhead light with a dimmer would make the flower respond.
Well done Sir.
Steve
For reference, in case someone else searches for/finds this thread, here's the article on how to make the flowers:
http://www.notepad.org/articles/09-PowerFlowers.pdf
And a POC video of it in action:
http://youtu.be/Ydkk4-6FsWk
I attached three different versions of the source code to run the "Power Flower" as well. The BS1 does simple movement, the BS2 code uses a PING)) sensor to control the flower's motion and the BS2P code adds in control of a Rogue Robotics uMP3 player for sound. I cant for sure say that any of the code attached here is fully operational as I haven't reviewed it in years AND I believe I was iterating while developing and I don't think I ever got to a fully-working 1.0 on the BS2 or BS2P versions, but they should give you a good place to start. Hope this helps! :-D