Shop OBEX P1 Docs P2 Docs Learn Events
Mechanical Flower runs too fast — Parallax Forums

Mechanical Flower runs too fast

wolfdaddy33wolfdaddy33 Posts: 12
edited 2013-06-24 11:35 in BASIC Stamp
This is a mechanical flower I made from a vegetable steamer, a parallax standard servo, and basic stamp. ( original designer Vern Graner )

Mechanical Flower.jpg


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

Comments

  • Tracy AllenTracy Allen Posts: 6,662
    edited 2012-03-22 08:47
    That's funny. You could have a Peewees great adventure kitchen!

    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.
  • Ken GraceyKen Gracey Posts: 7,387
    edited 2012-03-22 08:53
    That's a fun little project. In keeping with Tracy's suggestion, how about making a skid-steer toaster oven that rolls around while opening and closing the door? There's a whole bevy of kitchen appliances waiting to be automated.
  • ercoerco Posts: 20,256
    edited 2012-03-22 09:18
    counter VAR Word

    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! :)
  • ercoerco Posts: 20,256
    edited 2012-03-22 09:20
    Ken Gracey wrote: »
    In keeping with Tracy's suggestion, how about making a skid-steer toaster oven that rolls around while opening and closing the door?

    Ken, your Flame Boe is diff-drive. It will toast (?) bread and deliver it. Close enough?
  • wolfdaddy33wolfdaddy33 Posts: 12
    edited 2012-03-22 09:42
    Thanks! The cool thing about this design is if it falls in the pool It turns into a mechanical jellyfish. :lol:
  • wolfdaddy33wolfdaddy33 Posts: 12
    edited 2012-03-22 15:59
    Well progress is being made on the bloom'n flower. I set a start point at 500 for the servo then went from 500 to 1000 @ a step of 1 or 2
    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
  • ercoerco Posts: 20,256
    edited 2012-03-22 16:33
    Should be very smooth. Check your battery. You're not driving your servo off the HW board's 9V battery, are you? Use 4xAA batteries for the servo, and connect the negative AA lead to the 9V negative (stamp ground).

    Silky smooth action.
  • wolfdaddy33wolfdaddy33 Posts: 12
    edited 2012-03-23 06:50
    erco wrote: »
    Should be very smooth. Check your battery. You're not driving your servo off the HW board's 9V battery, are you? Use 4xAA batteries for the servo, and connect the negative AA lead to the 9V negative (stamp ground).

    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
  • ercoerco Posts: 20,256
    edited 2012-03-23 08:43
    XLNT. And the STEP size controls the speed, that's fun to tweak. You can hard code that, or make it a variable. You could vary it with a pot (RCtime), or use an IR remote, too.

    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.
  • steve32steve32 Posts: 1
    edited 2012-03-23 21:58
    SWEET!! This has got to be one of the most creative things I've seen done in a long time!! Is there anyway you can post details on how to make this. or better yet can I buy a kit for it??

    Well done Sir.
    Steve
  • Vern GranerVern Graner Posts: 337
    edited 2013-06-24 11:35
    Wow! Talk about coming late to the party! Seems I missed this about... a YEAR ago?! Sorry! Hopefully you got the speed issue worked out.

    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
Sign In or Register to comment.