User avatar
demonclaw
Posts: 16
Joined: Wed Jun 08, 2016 11:05 pm

ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 4:41 am

I'm trying to make a tail for a costume to do this I want to use a pi zero v1.2 with a Pca9685 https://www.tindie.com/products/land_bo ... d-rpi-mdi/ and mpu6050 on the I2C bus to make the tail move more realistic and can mov with my body but I don't know the first thing about coding on the raspberry pi. I have found a video of how the servos will move using the Mpu6050 and a pca9685 https://m.youtube.com/watch?v=fqdC4Y1CrxY but the guy in the video didn't post the code anywhere as to help me for a jump off point. So if anyone can help me with the code that will be nice or atleast teach me how to make a rough code to make this work.
Raspberry Pi owned.
B+, Zero, and Pi 3

User avatar
karrika
Posts: 1124
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 6:50 am

The controller card you were planning to use uses the Adafruit_PWM_Servo_Driver.py

The link to the Github code seems to be dead. There is a wiki page describing the controller card.

You could take a look at the https://learn.adafruit.com/adafruit-16- ... spberry-pi page to get an idea of how to use python with servos.

The important thing is how to create the costume. Where do the wires go to create realistic movement. Even without electronics you can do some amazing effects by connecting the wires to non-obvious body parts.

As an example you can control levitation of objects by connecting wires behind your ears . If you nod your head a bit down and rise up the object hanging from an invisible wire will levitate. The rest is up to using your magic hands that are free to do anything.

User avatar
DougieLawson
Posts: 39120
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 8:04 am

Have a read of Dr. Lucy Roger's tales (or is that tails) of the Isle of Wight dinosaurs at Blackgang Chine.
https://www.google.co.uk/search?q=lucy+ ... +dinosaurs

Lucy is on twitter, if you need to contact her.

Lucy drives her dinos using Node-RED and MQTT.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 8:22 am

demonclaw wrote:I'm trying to make a tail for a costume to do this I want to use a pi zero v1.2 with a Pca9685 https://www.tindie.com/products/land_bo ... d-rpi-mdi/ and mpu6050 on the I2C bus to make the tail move more realistic and can mov with my body but I don't know the first thing about coding on the raspberry pi. I have found a video of how the servos will move using the Mpu6050 and a pca9685 https://m.youtube.com/watch?v=fqdC4Y1CrxY but the guy in the video didn't post the code anywhere as to help me for a jump off point. So if anyone can help me with the code that will be nice or atleast teach me how to make a rough code to make this work.
You won't need the PCA9685, the pi can run servos from every GPIO pin using Joans excellent PIGPIO to modulate a PWM signal, just alter the PWM setting to change the servo output.

You should provide two separate power outputs, one for the servos and another for the Pi or you might lose the pi to brownouts when you move the servos.

Don't forget to link the grounds of the two power supplies.
Doug.
Building Management Systems Engineer.

User avatar
demonclaw
Posts: 16
Joined: Wed Jun 08, 2016 11:05 pm

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 4:17 pm

BMS Doug wrote:
demonclaw wrote:I'm trying to make a tail for a costume to do this I want to use a pi zero v1.2 with a Pca9685 https://www.tindie.com/products/land_bo ... d-rpi-mdi/ and mpu6050 on the I2C bus to make the tail move more realistic and can mov with my body but I don't know the first thing about coding on the raspberry pi. I have found a video of how the servos will move using the Mpu6050 and a pca9685 https://m.youtube.com/watch?v=fqdC4Y1CrxY but the guy in the video didn't post the code anywhere as to help me for a jump off point. So if anyone can help me with the code that will be nice or atleast teach me how to make a rough code to make this work.
You won't need the PCA9685, the pi can run servos from every GPIO pin using Joans excellent PIGPIO to modulate a PWM signal, just alter the PWM setting to change the servo output.

You should provide two separate power outputs, one for the servos and another for the Pi or you might lose the pi to brownouts when you move the servos.

Don't forget to link the grounds of the two power supplies.
the problem is if you drive servos right from the pi it makes them Jitter and make a lot of noise because of the pwm is made in the software so when ever you have another program needing more processor it will interrupt the pwm which will cause the servo to make ear splitting sounds.
Raspberry Pi owned.
B+, Zero, and Pi 3

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 4:23 pm

demonclaw wrote: ...
the problem is if you drive servos right from the pi it makes them Jitter and make a lot of noise because of the pwm is made in the software so when ever you have another program needing more processor it will interrupt the pwm which will cause the servo to make ear splitting sounds.
That is not the case when hardware timed PWM is used. pigpio, servoblaster, and others use hardware timed PWM.

User avatar
demonclaw
Posts: 16
Joined: Wed Jun 08, 2016 11:05 pm

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 4:24 pm

karrika wrote:The controller card you were planning to use uses the Adafruit_PWM_Servo_Driver.py

The link to the Github code seems to be dead. There is a wiki page describing the controller card.

You could take a look at the https://learn.adafruit.com/adafruit-16- ... spberry-pi page to get an idea of how to use python with servos.


Good to know that the get-hub is dead for it.
karrika wrote: The important thing is how to create the costume. Where do the wires go to create realistic movement. Even without electronics you can do some amazing effects by connecting the wires to non-obvious body parts.

As an example you can control levitation of objects by connecting wires behind your ears . If you nod your head a bit down and rise up the object hanging from an invisible wire will levitate. The rest is up to using your magic hands that are free to do anything.
Well that is all great and all but I would not like to have wires going all over to to make a it move. I have seen people do it but I would like a self contained thing that does it for me with out buying fishing line or wire to do this project. Plus I have this little Pi sitting around so I want to use for a project and this seems to be a simple one but I'm new to programing on a PI.
Raspberry Pi owned.
B+, Zero, and Pi 3

User avatar
demonclaw
Posts: 16
Joined: Wed Jun 08, 2016 11:05 pm

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 4:28 pm

joan wrote:
demonclaw wrote: ...
the problem is if you drive servos right from the pi it makes them Jitter and make a lot of noise because of the pwm is made in the software so when ever you have another program needing more processor it will interrupt the pwm which will cause the servo to make ear splitting sounds.
That is not the case when hardware timed PWM is used. pigpio, servoblaster, and others use hardware timed PWM.
Okay is there a way of mixing that with mpu6050 to get the movement I need? Is there an example I can look at?
Raspberry Pi owned.
B+, Zero, and Pi 3

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 4:47 pm

I don't have a MPU6050 example. The code you use at the moment should still work.

For a pigpio servo example see http://abyz.co.uk/rpi/pigpio/examples.h ... vo_demo_py

pigpio also offers a pipe interface (as does servoblaster). If that means nothing to you it simply means that you can control a servo by opening a file and writing values to it.

User avatar
demonclaw
Posts: 16
Joined: Wed Jun 08, 2016 11:05 pm

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 5:42 pm

joan wrote:I don't have a MPU6050 example. The code you use at the moment should still work.

For a pigpio servo example see http://abyz.co.uk/rpi/pigpio/examples.h ... vo_demo_py

pigpio also offers a pipe interface (as does servoblaster). If that means nothing to you it simply means that you can control a servo by opening a file and writing values to it.
does servoblaster support the zero? The pigpio looks like it might work but I have never programmed in python before.
Raspberry Pi owned.
B+, Zero, and Pi 3

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 5:56 pm

servoblaster should support all Pi models.

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 5:58 pm

What programming language are you planning to use?

User avatar
demonclaw
Posts: 16
Joined: Wed Jun 08, 2016 11:05 pm

Re: ANIMATRONIC TAIL HELP NEEDED

Tue Nov 15, 2016 6:49 pm

joan wrote:What programming language are you planning to use?
What ever I can to get it to work.
Raspberry Pi owned.
B+, Zero, and Pi 3

User avatar
demonclaw
Posts: 16
Joined: Wed Jun 08, 2016 11:05 pm

Re: ANIMATRONIC TAIL HELP NEEDED

Wed Nov 16, 2016 2:12 am

To make what I want to do down to simple thing to do in code is when the MPU6050 is tilted in one way the servo goes that way but when it is tilted the other way servo goes the other way. I need it to work with 2 servos. What I have seen in the different programming languages and the way to do this is in ether python or C. The way it is c is faster but I don't really care which language it is in all I need is a jump off point to get me started.
Raspberry Pi owned.
B+, Zero, and Pi 3

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: ANIMATRONIC TAIL HELP NEEDED

Wed Nov 16, 2016 9:14 am

If you have the servos I suggest you connect them to the Pi and try the Python example I gave. I know it is not beginner friendly code but you should be able to gain some understanding of what is happening.

Return to “Automation, sensing and robotics”