How to use an Adafruit 16-Channel PWM HAT with a Raspberry Pi to Control Sixteen Servos

  Рет қаралды 28,820

Core Electronics

Core Electronics

Күн бұрын

Пікірлер: 75
@tishinpadilla100
@tishinpadilla100 2 жыл бұрын
"Very Satisfying." That hat close-up footage is very good.
@whitneydesignlabs8738
@whitneydesignlabs8738 2 жыл бұрын
Great tutorial and great code. Thanks for the help. Got this board up and running and testing with a servo in minutes.
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Glad you found our guide helpful. Happy making! 👍
@syedhasanaskaririzvi3659
@syedhasanaskaririzvi3659 2 жыл бұрын
The final code can be shortened by using loop. In setup section above the while loop we can have one for or while loop for variable say i to go from 0-15. Then we can just put one line and instead of number put i. Same in while loop we can have 2 loops one for the n where we can use this n as t/n and in that loop we can have a nested loop for value say j to go from 0-15. And now just replace whole with only 3 lines and place j instead of number. And there you have it. A reduced code with same functionality. Though hat's off to the creators and for well explained tutorial 🔥
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Cheers for your work mate 🙂! As soon as I have a second to regroup and sharpen up this tutorial I'll dive in and update the code.
@ozcanison
@ozcanison 2 жыл бұрын
What about moving multiple servos at the same time, instead of in sequence?
@Core-Electronics
@Core-Electronics 2 жыл бұрын
You absolutely can move multiple servos at the same time. Just remove any time delays (sleep) and they will all operate simultaneously.
@Videogame9559
@Videogame9559 2 жыл бұрын
Hi would do this with controlling it with flysky receiver and audunio or raspberry pi any help please
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Heyya mate, this guide here will give you the run down on controlling hardware attached to a Raspberry Pi using an RC Controller - github.com/samfok/remote_receiver_tutorial I reckon that will be a proper help 😊
@thedude2897
@thedude2897 2 жыл бұрын
I have a ghostbusters trap that someone made. Has a chip in it and servos for the doors. They don't work right. So I can't just swap them out? I'd have to reprogram the new ones?
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Depends on the condition of the servos. If they have three wires coming off them and look functional you may not even need to swap them out. If they are small 9 grams servos like the ones in the above video you could definitely connect it up with a similar Raspberry Pi system. If the servos are larger/higher voltage you should take a look at this guide to see the process to work with them - core-electronics.com.au/guides/control-servo-raspberry-pi/
@ahmedsherif6110
@ahmedsherif6110 Жыл бұрын
Is there any way to use PCA9685 with AVR? Cause I've tried hard to write a driver to it, but I faild.
@Core-Electronics
@Core-Electronics Жыл бұрын
Check out this right here, should get you right into the thick of driving servos - github.com/prestonsn/PCA9685-Multi-Channel-Servo-Controller-Driver-for-AVR-ATmega
@johnconnor6735
@johnconnor6735 2 жыл бұрын
is it possible for a raspberry pi to control a larger motor, like a windshield wiper motor or larger dc motor that can aid in helping a disabled person walk as long we we power it seperatley?
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Absolutely champ come check this product over here, there some different variants worth checking out - core-electronics.com.au/catalog/product/view/sku/POLOLU-5051 - You will be setting them up in a very similar workflow as the above video. You'll be able to control some pretty serious motors with those HATs (just check all the spec sheets) and I adore your project idea 😊 would love to see how it comes out.
@cx3268
@cx3268 2 жыл бұрын
S0 for example, told to go to 0 position. Mill the motor try to hold it at 0 position if force is presented to rotate it? OR does the controller release power to that servo after it gets to its position. OR can you tell it to release power to hold position for any one of those servos?
@Core-Electronics
@Core-Electronics 2 жыл бұрын
The servos will hold their position. You can tell the servos to 'deactivate' once it has reached a certain angle in code,which will then allow you to rotate the servo manually without crunching gears, if you so desire.
@shailigupta4086
@shailigupta4086 2 жыл бұрын
May you tell about how to program if we want to run 5 servomotor simultaneously.
@antitialaman7301
@antitialaman7301 2 жыл бұрын
Hello 😊 I'm stuck, I have my Raspberry Pi Zero, my PCA9685 and my servo, but the servo doesn't move. I think maybe you need extra power, maybe it's not enough with just Pi Zero, I don't know if you can confirm this for me. Because I imported the libraries and used your code and I didn't have any errors. Another idea is... The pca9685 was sold to me broken (but it has a red light whren it is comnected).
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Could be a number of things, come write up a post at our forum with some pictures of your set up and I'll best be able to help 😊 - forum.core-electronics.com.au/
@manyasterisks
@manyasterisks 11 ай бұрын
Would it be possible to use this to tune motor RPM to chromatic note frequencies?
@floridian080
@floridian080 2 жыл бұрын
Great tutorial, thank you. Is there a hat with built in potentiometer(s) that could be used to control the servos? Otherwise potentiometer control would require a chip such as mcp3008 and the libraries to work with it.
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Thank you 😊 a Raspberry Pi HAT with a Potentiometer and Servo Control doesn't instantly spring to my mind. Perhaps a Servo Tester would be a product worth checking out.
@GunnerAl9
@GunnerAl9 10 ай бұрын
I'm confused on how the code you wrote gets from the Pi board into the Adafruit 16 Channel Servo Breakout Board? Does the sketch changes get loaded onto the processing board automatically as you change them, or is that a save command in the program. I have no experience in coding and I have to modify some servo movements for my R2D2 Droid for the halo projector lights. A great video, I learned a lot. Good verbal speed and very clear voice. Thank you.
@chattarikapollaor2973
@chattarikapollaor2973 2 жыл бұрын
Hi Tim, I am wondering that instead of using Adafruit 16-Channel PWM / Servo HAT for Raspberry Pi - Mini Kit, can I use another servo driver which is the PCA9685 and go with the same of your code and method/process that you have made to control multiple servos? looking forward to your advice ^^ Thank you
@Core-Electronics
@Core-Electronics 2 жыл бұрын
That Adafruit 16-Channel I2C HAT with that PCA9685 should be a perfect drop in. The Python code should function exactly the same 😊
@RolandsZeltins
@RolandsZeltins 2 жыл бұрын
Thank you for awesome, video. I couldnt get in my country any Raspberry Pi model except that with keyboard Raspberry Pi 400 My qesution is, how do I align, correctly pins using GPIO Ribbon Cable for Raspberry Pi Model A+/B+/Pi 2/Pi 3/Pi 4 - (40 pins)? Because side what goes in Raspberry Pi 400 is marked and goes in only one way, buy other side I can plug in bouth ways in Adafruit 16-Channel PWM / Servo HAT for Raspberry Pi - Mini Kit Need help.
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Heyya mate, Raspberry Pi 400 are sweet (and actually have a higher overclock (2.2GHz) than the other Raspberry Pi boards. If you look on the back of the case near the GPIO it actually has labels saying | Pin40 | and | Pin1 |. From this you can look at the normal pin out for a Raspberry Pi 4 like in the video and figure out the orientation. This guide will help too - core-electronics.com.au/guides/raspberry-pi-generations/
@oskarmozdzen2697
@oskarmozdzen2697 2 жыл бұрын
Can I control 6 7,4V servo motors with this controller?
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Works with any servo that can be powered by 5V and take 3.3V logic level signals.
@alexwu8502
@alexwu8502 11 ай бұрын
Hi Tim at Core Electronics, I am Alex. I currently doing the work at my workplace. I am trying to find ways to use the Raspberry Pi System to make 6 or 8 servomotor running . I have a question as the information listed below: 1. I know you told me that you used the Adafruit 16 channel PWM Servohat to make more than 2 servomotor running. How many gpio pins do I need to make more than 2 servomotor running with the PWM servohat ? 2. Is it necessary for me to connect all the pins from the PWM servohat to the Raspberry Pi Model 3 Computer Board?
@Core-Electronics
@Core-Electronics 11 ай бұрын
Hey Alex, 1. The servo HAT uses I2C, meaning that it only needs those 2 pins regardless of if you are controlling 2 or 16 servos. 2. You wont need to connect all the pins, but as it is a HAT it is designed to be connected to all the pins. If you need to access some more pins on the Pi, the hat has some pinouts of the Pi's pins on top of it. Cheers!
@AnthonySherritt
@AnthonySherritt Жыл бұрын
This is terrific! I have my eye on doing animatronics. What would be a good library for sequencing/tweening servo settings?
@kavorka8855
@kavorka8855 Жыл бұрын
Hi, I didn't see you controlling all at the same time. I mean, simultaneously. Did you try that yourself? Thanks!
@mike0rr
@mike0rr 2 жыл бұрын
So does this shield just reduce the amount of wires needed to control several servos using I2C, or does it do more. I was mostly wondering if this still uses software to control the servos or if it's hardware. Just overthinking things and looking into getting rid of servo jitter on a project.
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Both software and hardware. If you use this HAT you will be able to eliminate servo jitter.
@si9lix6
@si9lix6 2 жыл бұрын
Thanks for the video, helped me a lot! Just one question: It looks like the hat uses all the GPIO pins of the Raspberry Pi. Does this mean I can‘t do anything else with the Pi like for example connect an IMU?
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Glad to hear 😊 this Hat uses the GPIO pins mainly as a physical support. It actually only uses 2 GPIO pins for communication. All the other pins are free to be used for other electrical tasks (like an IMU) and can be best accessed if you use a GPIO Stacking Header like the one I have linked here - core-electronics.com.au/gpio-header-for-raspberry-pi-b-extra-long-2x20-female-header.html
@martinled7493
@martinled7493 2 жыл бұрын
Hi. This is a very detailed video thank you for that. I'm done with the soldering part and have put the hat on my pi. But do you know if it can run one servo without additional power to the hat? and only use power from the pi? I want a portable setup to control the servo on my RC car :)
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Cheers for your kind words 😊 perhaps if you only want to control a single Servo come check out this guide here - core-electronics.com.au/guides/control-servo-raspberry-pi/
@martinled7493
@martinled7493 2 жыл бұрын
@@Core-Electronics You are very welcome. made it work last night 😊 attached a USB voltage regulator (4.7 V) on the hars GND + 5+ and plug'd it in to the usb ports of the PI and it works great! Do you know where to find python code, to get intruction to W=forward S=backwards A=Left D=rigth? :) ill share a video to you when its done. Your basic script works fine and tilts the front tires to each side, with an 3 sec delay. now i need the ERC to controll the throttle and speed. again thanks for the video! :)
@Core-Electronics
@Core-Electronics 2 жыл бұрын
If you want to control your Servo like this hit up this Pan-Tilt HAT guide with Raspberry Pi - core-electronics.com.au/guides/pan-tilt-hat-raspberry-pi/ I know at first that might seem a bit random, but the mechanisms behind the Pan-Tilt HAT are just servos. The second Python example runs has a process inside it that control the two servo using keyboard inputs 😊 which is right up your alley. With that framework there you will be able to change it for your situation.
@martinled7493
@martinled7493 2 жыл бұрын
@@Core-Electronics ill take a look at it, thank you so much for the help. a last question. do you know if its possible to control the DC motor through the ERC cotroller with the HAT? an what code would work, to control the speed. You should also make a vido with an Rc car :P Kind regards
@martinled7493
@martinled7493 2 жыл бұрын
kzbin.info/www/bejne/aGamqoCBm5qXfac
@ihmSelbst
@ihmSelbst 2 жыл бұрын
Can it runs 16 Motors at the same time?
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Absolutely!
@Shiven34567
@Shiven34567 2 жыл бұрын
Would this work with regular DC motors
@Core-Electronics
@Core-Electronics 2 жыл бұрын
DC motors are PWM devices, so you would be able to hack together a solution, however I would recommend using something more readily made for the job, like the Adafruit DC Stepper Motor HAT which you can learn more about here - core-electronics.com.au/guides/raspberry-pi/raspberry-pi-dc-stepper-motor-guide/ Also keep in mind that Continuous Servos work with this Servo HAT and act very similar to DC Motors.
@Shiven34567
@Shiven34567 2 жыл бұрын
Thanks
@Shiven34567
@Shiven34567 2 жыл бұрын
How many motors can I control using this and if it's stackable how many would I need to control 8 dc motors
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Heyya mate, with the Adafruit DC & Stepper Motor HAT you can control 4 DC Motors. This HAT can be stacked up to 32 times letting you control a whopping 128 DC Motors! Everything you need to run one can be learned here 😊 core-electronics.com.au/guides/raspberry-pi/raspberry-pi-dc-stepper-motor-guide/
@Shiven34567
@Shiven34567 2 жыл бұрын
Thank you so much I will get one.
@Didanihaaaa
@Didanihaaaa 2 жыл бұрын
Good job. I have a question. I want to rotate the servo and once it done I want to clean the pin. I see that is done in GPIO by calling stop method however I am not sure how to stop using adafruit hat. My experience shows that the servos tend to gitter while trying to stop at a constant position. thanks for help.
@Core-Electronics
@Core-Electronics 2 жыл бұрын
I created a guide on Controlling Standard Servos with a Raspberry Pi which should help you along - core-electronics.com.au/guides/control-servo-raspberry-pi/ In that guide I address the jittering and how to minimise it when not using a Servo HAT like in the above video.
@robertoamaya6980
@robertoamaya6980 2 жыл бұрын
Amazing I want to write a app python for this.
@Videogame9559
@Videogame9559 Жыл бұрын
Hi would this work motor control board shim or hat small one
@abu8422
@abu8422 Жыл бұрын
Can I also control 16 12V DC motors ??
@Toni73RU
@Toni73RU 11 ай бұрын
А сколько максимум серво моторов можно подключить?
@krishnakanthajith2350
@krishnakanthajith2350 2 жыл бұрын
Could you tell me how we can chain two pca9685 using this python library
@Core-Electronics
@Core-Electronics 2 жыл бұрын
I haven't got a quick guide to show you but this fellow does using An Arduino and two pca9685 - kzbin.info/www/bejne/rGLJkHh6fbtmb5I If you take his script and see how each device is being referred to in the script (along with how to write a script that can deal with the extra PCA9585) then you should be well on your way. Also always feel free to ask these more complicated questions on our Forum - forum.core-electronics.com.au/latest
@redpandarules3793
@redpandarules3793 2 жыл бұрын
Hello! Thank you for the tutorial! One of the most well explained ones I found! I managed to get 16 servos running, but I would like to go even further (Big project) If I were to connect a second board in (SLA, SDA) continuation, then the 2 boards would have different addresses. How would this change the code? Is there a way to select the address when initializing the ServoKit function? Thank you for your time and the tutorial again!
@Core-Electronics
@Core-Electronics 2 жыл бұрын
Excellent question and thanks for your kind words 😊! These HAT boards all communicate using I2C and you can alter their address by soldering some jumpers found on the top of the board. You can see exactly what I mean here - learn.adafruit.com/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi/stacking-hats In scripts, you can create a new object for each HAT with | pwm = PWM(0x40) | and | pwm = PWM(0x60) | Where 0x40 is the default HAT address and 0x60 is a custom one made by soldering that jumper on the top.
@redpandarules3793
@redpandarules3793 2 жыл бұрын
@@Core-Electronics Thank you very much for your response!
@urkoolabarria4163
@urkoolabarria4163 2 жыл бұрын
Looks great. I have the material to build something similar synchronizing the sound with the movements. Where could I find a document with all the steps starting from 0? I need to read it slowly as a total beginner Thanks!
@Core-Electronics
@Core-Electronics 2 жыл бұрын
I love that idea! This video here is a great introduction to controlling servos, when it comes to capturing sound to activate servos I have seen it done very basically with an Arduino Uno - www.instructables.com/Audio-Sensor-Servo-Reactive-Motion/ Come write up a post outlining your project goals at our Forum and we'll best be able to help 😊 forum.core-electronics.com.au/
@Core-Electronics
@Core-Electronics 2 жыл бұрын
I also found this but its a touch scary - kzbin.info/www/bejne/aX_WpJJolNeqmqc
@jayeshpatil754
@jayeshpatil754 7 ай бұрын
sudo pip3 install isn't working
@ZenHulk
@ZenHulk 11 ай бұрын
all i have is 6 or 7 volt servos and there is no help anywhere on planet earth
@lex-ig7qu
@lex-ig7qu 7 ай бұрын
Have you tried H Bridges?
Raspberry Pi Pico: Inputs & Servo Control
17:20
ExplainingComputers
Рет қаралды 134 М.
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 24 МЛН
The Ultimate Guide to using Motors in Robotics (including ROS, Raspberry Pi)
25:56
Why did Raspberry Pi make their own SSD?
12:58
Level 2 Jeff
Рет қаралды 262 М.
Raspberry Pi Pico W LESSON 36: Control a Servo With MicroPython
36:02
Raspberry Pi 5: Getting Started
24:43
Jeff Geerling
Рет қаралды 518 М.
Raspberry Pi Servo Motor Control - No Jitter!
13:52
Gary Explains
Рет қаралды 55 М.
Control 16 Servos Using A PCA9685
18:22
Toms Trains and Things
Рет қаралды 75 М.
Connect Up To 992 Servos To An Arduino, Using I2C
7:47
Michael Klements
Рет қаралды 71 М.