element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Multiple servo control...setting expectations
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 36 replies
  • Subscribers 383 subscribers
  • Views 4019 views
  • Users 0 members are here
  • arduino_code
  • code
  • servo_motor_control
Related

Multiple servo control...setting expectations

colporteur
colporteur over 1 year ago

image

Can six servos all operate independent using and Arduino and PCA9685 PWM driver?

I am creating an model railroad barn yard animation scene. Six different animal perform movements using SG90 servos.

The cows in ellipse A tails moves left to right.

The cow in ellipse B moves its head left to right

The cow in ellipse C moves its head up and down

The pig in ellipse D moves it head up and down

The pig in ellipse E moves its head from left to right.

The modeller has asked that all animals perform motion at the same time. Cow tails swing. Cow heads move and pigs heads move. Each animal would complete a pattern. i.e. Cow C dips it head to gather feed and then raises it head to chew. 

I'm confident I can create the servo action to simulate the motion individually. I'm not so sure if this is possible simultaneously.

I stuck on the concept of a thread. If the cows tails are moving that has to stop for the other animals to move.

Can some Arduino aficionados provide me some guidance? Is it possible to do this all with one Arduino or does it have to be broken down to be done by one or more Arduino?

  • Sign in to reply
  • Cancel

Top Replies

  • colporteur
    colporteur over 1 year ago +11
    community.element14.com/.../IMG_5F00_2571.MOV Here is a short video using the code shabaz provided. I made a few tweaks in array values to get the desired effect.
  • shabaz
    shabaz over 1 year ago +7
    Hi Sean, It can certainly be done with a single Arduino as mentioned by others, but it takes a different code structure than just the basic loop. The luxury method would be to use a real-time operating…
  • michaelkellett
    michaelkellett over 1 year ago in reply to colporteur +6
    Slightly scary - I keep expecting one to take its first step ! MK
Parents
  • colporteur
    colporteur over 1 year ago

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

    Here is a short video using the code shabaz provided. I made a few tweaks in array values to get the desired effect.

    • Cancel
    • Vote Up +11 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett over 1 year ago in reply to colporteur

    Slightly scary - I keep expecting one to take its first step !

    Slight smile

    MK

    • Cancel
    • Vote Up +6 Vote Down
    • Sign in to reply
    • Cancel
  • colporteur
    colporteur over 1 year ago in reply to shabaz

    My thought is a JQ6500 with a few mp3 files. I have to learn very little to accomplish that.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • beacon_dave
    beacon_dave over 1 year ago in reply to Workshopshed

    Nice. The Magnorail setup uses a clear disc against the road surface as a drive wheel for animating the legs.  

    image

    With two discs, you get four leg drive...

    image

    Perhaps add a drive belt to keep them in sync though otherwise it could be 'Ministry of Silly Walks' time.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 1 year ago in reply to colporteur

    I had a quick go at it anyway, with a Pi Pico, just out of curiosity, I'll write it up in a blog post in case it's of any interest.

    The code implements a load of trigger inputs (8 for now, but more could be added), and whenever any of them goes low (this could be swapped around to detect triggers going high) then a particular sound is played out, and simultaneous sounds can be played (and simultaneous sounds from the same type of animal too).

    I tried it with some animal sound recordings found on a random website, it sounds like something from Dr Dolittle, when a load of animals are making their noises simultaneously!

    I didn't know what animals to use, so I've got cat, dog, hen, rooster, sheep, pig, cow, snake and goat and wolf : ) I should have added a horse I guess! Anyway I'll write up how to add any custom sound.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 1 year ago in reply to shabaz

    Blog is here:

     Triggered Sound FX: On-the-Fly Sound Mixing with Pi Pico  

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • beacon_dave
    beacon_dave over 1 year ago in reply to colporteur

    There is a more compact four leg version:  Slight smile

    https://upload.wikimedia.org/wikipedia/commons/c/c3/Strandbeest_walking_with_four_legs.gif

    but then you have balance issues.

    Perhaps you can improvise a little - if you can restrict the viewing angle then you only ever need to make one side look authentic. e.g. if the cow is walking down the side of a barn, fence or something, then people won't ever see the other side of the cow apart from the legs.

    Another approach might be to have the cow supported by a transparent upright which runs along a slot in the baseboard. The legs then just have to move convincingly and not actually walk. So you can perhaps use something simpler like the MagnoRail bicycle technique to create some leg movement.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps over 1 year ago in reply to beacon_dave

    Should the cows panic and run away when a train passes by?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • beacon_dave
    beacon_dave over 1 year ago in reply to Jan Cumps

    I'm awaiting the AI version where the cows autonomously decide to stop the train, get on, and then ride around the track with their heads stuck out of the windows.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • beacon_dave
    beacon_dave over 1 year ago in reply to colporteur

    If you have a horse pulling a cart or something, then the cart gives you stability, driving wheels, and more space for mechanisms, so perhaps could drive the horse's legs remotely via linkages hidden in the harness ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • colporteur
    colporteur over 1 year ago in reply to beacon_dave

    Your magnorail link has generated interest. I'm off the hook on the farm scene.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • beacon_dave
    beacon_dave over 1 year ago in reply to colporteur

    Credit should go to Workshopshed . I just fell down the rabbit hole to see how it worked. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • beacon_dave
    beacon_dave over 1 year ago in reply to colporteur

    Credit should go to Workshopshed . I just fell down the rabbit hole to see how it worked. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube