This is the best video on this subject.. everybody else just uses the example and does not explain how to break it down and use it for your own project… subbed and like your teaching method
I see that you made this a while ago but I want you to know it's still of great value. I love being able to follow your coding and by producing the same results I'm finally figuring out how to best use the PCA9685 for my robot project.
I hope it is useful to you. this video is Version 1 (V1) but this series goes up to V5 and in each I have shown different tips, codes and tricks that might be useful to you. The inks to those videos should be in the description. good luck.
Thank You for the great tutorial. I just subscribed to your YT channel, I will be watching every one of your tutorials.. Please, keep feeding us your knowledge and expertise
Aloha RJ, I know this is video is awhile back and just watched it today 2024 and I have learned a lot! Thank you so much for sharing your video. I have donated to support you.
this the most detailed PCA9685 video out there, which also explains what each pin to beginners like me. thank you so much. 1. would it possible for you to make a video of how to control multiple servos at once rather than running one at a time using PCA9685? 2. how to mod this same servo for 360-degree rotation so we can control using PCA9685
You are welcome. I am glad you found it useful. 1-I have the request from so many people. I will make it when time permits 2-the 360 servo is totally different kind of servo. This module can't be used for that purpose. You may watch my videos on 360 servos here th-cam.com/users/robojaxTVsearch?query=360
Many thanks dude! I was going to become desperate :D I wanted to build servo controled points for my model railroad and every tutorial I found was way to complex. Your explanation was easy and the bare minimum to understand the shit :D Again many many thanks. You saved my night sleep ;)
Wow thank you so such for this video, I am new to the world of the Ardrunio and I am trying to build automatic blast gate control system for my wood shop. This video has helped me with the servo shield.
Papa Robojax, you can add the _adafruit pwn servo driver lib_ through the *Arduino IDE.* Within Arduino IDE add .zip libraries to your included libraries by going to the menu bar: _Sketch/Include Library/Add .ZIP Library..._ and then navigating to the folder you have the _.zip driver lib._ Makes things a bit easier, when you just drop the .zip file on the desktop, and add it thru the IDE, instead of digging through the IDE folders manually.
thank you mama 1085243, I prefer putting it manually becuase it would be in the same folder as the "arduino" and in the future you can copy all together. but if you use the menu, it will go under the "my document" which I don't prefer. I have mentioned that from time to included it using the menu like this video th-cam.com/video/7RQ8QoJWhpY/w-d-xo.html or this th-cam.com/video/L6ekl2ABcuY/w-d-xo.html
Hey, this video really helping in my project, but I don't understand, why there is 450 address pulse (150-600). But in my imagination, servo work for 180 degree rotation, and I think it has 180 address or multiple by 180 (180, 360, 540, etc), 450 can"t divided by 180.
Hi, The value is "pulse width" and it depends on the MCU (Arduino) frequency. so I figured it out what pulse width would work best with Arduino. If you use different MCU, it would be different. By the way I have V2 of this video. The link in the description.
Thanks for the video. How do you turn more than 1 servo at the same time? Edit: Oops didn't see the video where you controlled more than 1 servo at the same time. Thanks, keep it up.
amazing video....very well explained !!I'll be chaining 20ish of these guys together.... however (correct me if i'm wrong ) i've heard you can't run Led's and servos at the same time on this board ( one or the other) ... as all channels share a common frequency...
you are welcome. Few weeks back I published my Arduino course worth $200 on Udemy. Arduino Step by Step Course (over 100 lectures) Starts here robojax.com/L/?id=338
This is a great tutorial! Thank you for being so thorough! Can you do a video tutorial on powering multiple pwm boards with one power source? Using your 4 board example, how to power 64 servos, 4 pwm boards with one power source.
Sir, I have watched this video several times now and it really helps. I'm using a nano connected to the pca9685, is there any way of smoothing out the movement of the servo arm? Thank you.
*** Update: The issue was that I am using MEGA. For MEGA SCL and SDA have designated pins It works now*** Firstly great video. I am running into a problem. My servos are not moving at all when they are connected to PCA9685. I tested it by directly connecting to Arduino and it works. I also have 5v outside power supply for PCA. I did trouble shoot everything that I can think of but running out of ideas. What could it be? Any input is appreciated.
I don't have the code with me know, please use provided code or check latest videos on this th-cam.com/channels/kcBSig_Iu4ZnAIeCeG1TVg.htmlsearch?query=pca9685
you are welcome. This video is Version 1. I've got V2 with different code demonstration, V3 with 32 servo and V4 to control them over WiFi the link is under the description of the video.
@@robojax amazing I'm subscribing :D 1. can I use a raspberry pi to send signals instead? 2. Is there something that goes up down instead of rotating like those servo?
PCA9685 has registers that can communicate using I2C protocol. 1-you have to look at datasheet to know how to read and write using raspberry pi. 2-I am not sure if I understood it correctly, but if you want up and down, isn't that you just rotate to the left or right and it will go up and down? thank you for subscribing.
I’m working with an Arduino Uno R4 WiFi and a PCA9685 PWM driver module to control a servo motor. Although the Arduino IDE indicates that the code is running correctly and attempts to move the servo, the servo motor itself does not respond or move. This issue persists even though the code is properly uploaded and the Serial Monitor shows that the IDE is executing the code. Here’s what I’ve checked: I2C Connections: I have connected SDA and SCL from the PCA9685 to the corresponding SDA and SCL pins on the Arduino Uno R4 WiFi. I’m unsure if SDA and SCL should be connected to pins A4 and A5, respectively, but I’m using the dedicated SDA and SCL pins on the Uno R4 WiFi. I2C Device Detection: I used an I2C scanner code to detect devices on the bus, but nothing appears in the Serial Monitor. This suggests that the PCA9685 may not be detected on the I2C bus. Power Supply: I’m concerned about whether the PCA9685 and the servo motor are receiving sufficient power. Code Functionality: The code is designed to control the servo motor via the PCA9685 module. The code seems to be working as expected when run manually, but the servo motor does not move.
it depends on the type of servo motor and how many you use. measure the current of one servo motor when load is connected to servo motor for example you measured the current to be 0.5A and you wan to use 10 servo then 0.5x10=5A to be save get a power supply with at least 6A or 7A.
Thank you it was very useful! I still can't figure out how to reduce the speed of the rotation because the delay() function is not effecting it.. Can you help me out? Thank you very much!
Thank you so much for this amazing video. What would you recommend one do if he wanted to connect 18 servos. Is there anyway to connect two of these boards together for the extra channels?
Thanks. you have question or needed custom code, this is Version 1 or V1, there are 4 more versions of this module. link is below this video or just search my channel . Cheers. and yes, your subscription is great help. Thanks
@@robojax I am having issues with the Hiletgo PCA9685 servo controller. I have checked everything with the multimeter, have the proper external power, checked the wiring, and checked each servo, so I believe the issues to be related to software. I have used both the HCPCA9685, PCA9685, and the Adafruit version, but neither seem to be working. Is there any that you suggest for this brand?
I'm following this, using a bench PSU to power via the central power inputs, but even just raising the PSU to 2 volts starts to feed 250mA current, if i head toward 5V the PSU maxes out at 2 amps. What could be wrong, i've triple-checked wiring etc ?
the amount of current depends on number of servo motors and types. some servo motors need more and some less. measure current of ONE servo motor while running and connected to the load or word it does. then multiply it to the number of servo motors. if you still get higher current, then either one or more servo motor is damaged or the servo motor has lower rated voltage.
@@robojax You too sir, i don't know how it is in Canada, but the live data from the UK is in complete disagreement with government policy, which has now killed over 40K old age pensioners in care homes. I am on the war path.
I have wired my arduino Uno R3 the same as you to the PCA9685. I get no power to the either boards but when I put power to the arduino both boards light up. I have also hooked my arduino Mega in the same way and the same happens.
Hi, perhaps you are connecting it incorrectly. Please watch it again or what other version of this module th-cam.com/channels/kcBSig_Iu4ZnAIeCeG1TVg.htmlsearch?query=pca9685
Great video! A lot of details and well explained! So i will need 2 batteries in order for this to work, one for the UNO and one for the PCA9685 right? Both 5V. Thanks!
@@robojax So I need just 1 5V battery and then i connect the battery to which one of the boards? I think i misunderstood... Thanks for the asnwer and for the help! :)
@@robojax I watched it twice man, it's not you it's me :) i get confused when you talk about 2 batteries for 2 boards. Being a beginner in hardware AND english, this is not easy for me. Hope i will find an answer! Thanks for all the learning material! :)
I have two batteries each one is 7.4 V, should I connect one of them to the arduino and the other to the PCA? Also is using 3.7 V battery for PCA to control 12 motors enough or not?
For arduino the dc adapter input can accept up to 12V. For the PCA connect power exactly the same as your servo motors voltage. If servo is 9V then connect 9V for example.
Thank you for your videos! It's clear and useful! Good work! I'm working on a project with 27 servo, all works! I would like to run all the servo at the same time but with different speed and degrees (random sweep)... I've no solution for the moment with the Loop fonction "for"... Any ideas?
@@robojax Thanks for your reply! I saw all the videos, but I don't find easy solution for running all motors in random programmation (degrees and speed)...
Marvelous explanation with simple language. I just wanted to know whether I can use PCA9685 to control 3 servo motors, 10 LED's (only ON/OFF) with the help of may be 2 or 3 buttons (ON/OFF switches)? If so, could you please give some guide lines as to program (Sketch). Thanks in advance.
Hello, you can connected LED or servo does not matter. You've watched Version 1 (v1) of this series, there are V2 to V4 the link is in the description where you see more options and ON/off push button.
Hello, 1-measure the total current for your servos and connected a power supply accordingly. this I have connected a 5V power supply that could up to 60A but you don't need that. you need whatever you measure when the servos are running under the load. 2-You are watching Version 1 (V1), I have 3 more versions of videos of this module link is in description. Always check description I have it it for ESP32. Or search my channel for more cool projects. Here is how to find Specific TH-cam Video in a channel bit.ly/findTH-camVideo
@@robojax Thank you! For powering a couple of servos (not too much load), can I used like 4 C batteries, at least to start with? Maybe use something like a buck converter to increase current, if needed?
Hi, I have watched the other servo videos. Nothing shows how to control the pca board with a voice module. I thought If I removed the code for the push button switch (v3 video) I could code it using the OE Pin. Or am I looking at the problem all wrong. Confused myself.
Hi, of course I don't have any video related to voice control. But I have shown how to control with a signal or push button. just use the method and use the singal from voice module.
Having a peculiar problem with my recently bought PCA9685 (same as the one you demo with low power mosfet). WITHOUT connecting to any external controller yet, i plug ext power 4.8V (from fully charged 4 NiMH AAA batteries holder) to the green block. No servo connected yet. Tested with multimeter ON ALL the V+ ... only getting 1.7V and not 5V. Then using multitester.. tested on the MOSFET and capacitor, but got about 5V. Any reason why?
Amazing video, however my servo motors are not rotating. I'm using an arduino mega 2560 and the code uploads but nothing happens after. I have ordered an arduino uno in hopes it will work. I'm not sure why my mega 2560 isn't able to control it?
@@robojax Thank you for responding. I followed all the steps you took. The only difference is i'm using a mega 2560 and the adafruit library I downloaded is on 1.8.13 instead of yours which is on 1.8.0. For example you only have 2 #defines in your code but the one i downloaded has 5 #defines. Under #define SERVOMAX 600 it says #define USMIN 600
@@robojax I used robojax code and it still did not work, I also tried retyping it which didn't do anything. I also tried a different set of code but nothing happened. Im starting to think there is something wrong with my pca9685, I guess ill keep trying different things. Thanks again for your help!
Hey very good video, but I have a question. Do you know why the board has a capacitor? Or could you explain for which situation I would need one? My board came without one.
when servos STARTs and stop this sudden start causes the power supply voltage to drop a little and if you have capacitor connected to the power supply which is already charged, it resists the voltage drop by supplying power to the board. .
this is Version 1 and I have 4 more videos on this. But to control servo I have tones of videos. Learn from those and implement it here. learn how to Search for a Particular video in a channel here th-cam.com/video/OhkUceBWcHs/w-d-xo.html
I have put it on the title. I use Microcontroller called Arduino. If you don't know Arduino, here is 2 minuets video from my Step By Step Arduino course th-cam.com/video/-6qSrDUA5a8/w-d-xo.html
I got one of these devices today, I wired it all up but for some reason it burned up my servo, I tried 2 more but each one got damaged. I'm not risking another, any idea how this could have happened? I connected the data lines correctly and used an external power source of 5v so nothing was out of the ordinary. Any suggestions.
You might have connected the Positive and negative terminals in revers. Other than very rare but possible that servos are rated for less than 5V may be 3.3V.
Do you have any idea on how could i supply the 5V to the PCA9685 board considering the fact that i need it to put it in a portable 3d printed robotic hand....? I hope you cand help me with this. Great video !
Hello (first hello or hi), measure the current for one servo while the servo is motor working and moving the load (under the load). then multiply the amount by the number of servo motors. Then get 5V power module.
HI. I would like to use servo motors on my model railway for points and level crossing gates, uncoupler Etc. but can you initiate each servo individually by a switch. So it would go in one direction by switch and stay there until I press the switch to return rather than by a timer. I was thinking of using on-off-on switches. also do you need to keep them plugged into the computer after the positions are set. If possible to do this could you tell me how to do it. I am not knowledgeable in electronics so it would have to be explained simply. Thanks
Hi, this video is version 1 there are 4 more videos and I have used many ways to control the servos. Please check them. Yes you can control with switches.
I set the PWM for a servo to 90, and it started to continuously spin around, do you have any explanation for this? I was trying to find the minimum PWM value.
run of servo. measure the current or find the datasheet and see what is the maximum current, then multiply it by 16 and get a power supply equal or greater that . for example if you found that the current is 0.5A,, then 0.5x16=8A so use 8.5A or higher power supply with 5V output.
im trying to figure out how to reverse a servo so that I can use 2 servos for a joint, one will be operating backwards. So its position will be negative to the standard PCA9685 code. Is it really as simple as using negative degrees? like -45 to -135? How would I do it using python/opencv in visual studio code?
The minimum and maximum I found on my servos causes the rotation to be slightly more than 180 degrees, like around 195. Can I adjust the minimum or maximum so the rotation can be closer to 180? Will it matter that I'm not using absolute minimum or maximum?
How do I connect two pca9685s and configure them to work? There is a problem with addressing and nobody has ever shown how 2 pieces work with each other. When work only 1 PCA - no problem but when "begin pwm2" arduino program stopped. This is the simplest piece of code which, for example, will light the led on channel 1 in PCA9685 No. 1 and the second led on channel 4 PCA9685 No. 2 If you are able to do this you will become my MASTER :)
Hi, thanks for the video. I need to know if there is any way to disable the current on a servo with this librar y after it makes a move. I am using 15 servos and they make a lot of noise and vibrate. I think this would be a way to eliminate it. Thank you
Hi, servos are independent. They just get PWM signal and other than that you can't have any other control. you can have delay between the pulse you send if you add it in the loop. other than that you can't do within Arduino. There should special servos where you could read the current and set the limit. But these servos are very simple.
@@robojax Thanks for your answer. My idea is to do something similar to the dettach function in the servo.h library and stop the servo from receiving voltage.
This video shows me, again, why I should continue hating Arduino. The servos working limits are between 1 ms and 2 mS. If you know what the Arduino is doing in the background you will be able to set the limits immediately in the program. But unfortunately with an Arduino nobody knows, neither wants to know, what is really happening.
Thank you for your explanation. I am curious as to why you used "delay" instead of "millis" as this only allows one servo sequentially. Is the power enough for multiple servo operations??
millis is number of milliseconds since the program started. I just needed the program to give certain time delay to show movement and then start another one. The servos I used were without load and it was enough. But if you make all servos do something, then the load will increase.
Hello, I modified the code to control 4 sections of motors and control a group of MeArms. Each time the movement is adjusted by 1 degree, the motor still shakes and heats up. Is this normal?
@@robojax I understand, I try, but I read online that my friends may explain the problem of insufficient current. I am using a 5V1A power supply, and I do n’t see how you supply power in the video. (Ps I ’m a student from Taiwan, using Google Translate Please inform me if the syntax is not smooth, thank you)
Hello, if you paid attention to the video, it should be no problem. just power the board with 5V and power up your servo with the 7.4 or any other different power.
Hi, I have a question: If I have 4 servos that needs 7.2V and 1A, and I use a power supply of 10V 6A (V+), the board will give to each servo the voltage and current that it needs, or I have to use resistances than reduce 10V to 7.2V?
Hi, how are you? I am having problems, with my pca9685, when adding a ninth servomotor it became slow and as it is difficult for it, I have a transformer for gamers, so that the amperage would not be a problem, when removing the ninth servomotor, the motors will be blocked, the pca9658 damaged?
Hi, amazing videos loads of details and easy to follow. Was hoping you can help me. I’m using a PCA9685 to control 10servos. I want to be able to control the loop of the 10servos but a voice control module. Using a nano both modules on the i2c. I have the dfrobot offline voice recognition module. I need help with coding and wire diagram. There is nothing on the web. Please can you help.
Hi, this is Version 1 (V1) and there are 3 more Versions V2, V3 and V4 and I have shown multiple ways to controt them. Links in description. Those might help you.
Thanks for the tutorial, can you clarify the part of connecting more than modules together, and how we can configure that in the code to reach servo 17,18 ,etc..
I was wondering... do you need to use any other component to protect the arduino from the "blowback" voltage of the servos? Is this driver already protecting the arduino? Thanks
Can you show, how we can control servo motors using PCA 9685 servo driver and a Radio Controller(Flysky CT6B)...? We are facing so much problems on this issue..😥😣
Why do you need to use this with Flysky? The input for this is totally different. FlySky has its own receiver and depending on the number of channel you can control devices. I am not sure if you can find 16 channel TX and RX.
this module is being controlled using I2C communication. I have not tested but you can should be able to connected two Arduino and control it . Using I2C you can connected 128 devices in parallel.
This is the best video on this subject.. everybody else just uses the example and does not explain how to break it down and use it for your own project… subbed and like your teaching method
Glad it was helpful! Thanks.
Thank you so much! This is one of the most well made tutorials I've seen for Arduino guides.
You are very welcome. I am glad you found it useful.
I see that you made this a while ago but I want you to know it's still of great value. I love being able to follow your coding and by producing the same results I'm finally figuring out how to best use the PCA9685 for my robot project.
I hope it is useful to you. this video is Version 1 (V1) but this series goes up to V5 and in each I have shown different tips, codes and tricks that might be useful to you. The inks to those videos should be in the description. good luck.
Good info. Lots of detail. You provided a foundation for anyone to start operating servos successfully from day one.
Thank you.....
You are very welcome.
Thank You for the great tutorial. I just subscribed to your YT channel, I will be watching every one of your tutorials.. Please, keep feeding us your knowledge and expertise
Thanks for subbing!
@@robojax The code doesn't work in PlatformIO, but I'll adjust it to work,
Has to do with: for( int angle =0; angle
Never head of PlatformIO
Aloha RJ, I know this is video is awhile back and just watched it today 2024 and I have learned a lot! Thank you so much for sharing your video. I have donated to support you.
You are so welcome! Thanks for your donation. I appreciate it.❤️
this the most detailed PCA9685 video out there, which also explains what each pin to beginners like me. thank you so much.
1. would it possible for you to make a video of how to control multiple servos at once rather than running one at a time using PCA9685?
2. how to mod this same servo for 360-degree rotation so we can control using PCA9685
You are welcome. I am glad you found it useful.
1-I have the request from so many people. I will make it when time permits
2-the 360 servo is totally different kind of servo. This module can't be used for that purpose. You may watch my videos on 360 servos here th-cam.com/users/robojaxTVsearch?query=360
Nice work Ahmad. The tuning of the servoswas well explained.
Many thanks dude! I was going to become desperate :D I wanted to build servo controled points for my model railroad and every tutorial I found was way to complex. Your explanation was easy and the bare minimum to understand the shit :D Again many many thanks. You saved my night sleep ;)
Sir thanks I rechecked the program and saw all 4 video of your I have sucussfully progranmed my bipend robot thanks for the help
All the best
Tq sir
you are welcome.
Wow finally and automated one that you don't have to use a controller to make it move
Excellent tutorial - very well prepared and presented. Thank you for making and sharing this video and your code.
You are welcome. I am pleased you found it useful.
Excellent video! Thank you so much for sharing this!
Glad it was helpful!
thank you, the experiment in the video teach me slowly and easy to understand.
You are welcome!
This was an excellent video, exactly what i needed!! Thank you!
You are welcome. I am glad you found it useful.
Wow thank you so such for this video, I am new to the world of the Ardrunio and I am trying to build automatic blast gate control system for my wood shop. This video has helped me with the servo shield.
You are welcome. Good to hear that. Please share.
By the way I am a big fan of your channel.
Thank you very much for being my fan.
Merci. Très apprecié. From Québec, Canada
Thanks very much for that. I was about to give up on the adafruit library, now it makes sense
Glad I could help! This is Version 1. there are V2, V3 and V4. The links are in description.
I'm thinking I want to build a servo madness bot. Good video
Superb explanation in very details. Thank you so much.Excellent job.
You are welcome.
This is a gem, keep up the good work sir.
Thanks. I will. Make sure to watch v5 which all wireless
Awesome video, building up from the foundations.
Appreciate it!
It was worth every minute now I can built my robot
Good luck
Thanks man! you made a lot of things clear!
Papa Robojax, you can add the _adafruit pwn servo driver lib_ through the *Arduino IDE.*
Within Arduino IDE add .zip libraries to your included libraries by going to the menu bar: _Sketch/Include Library/Add .ZIP Library..._ and then navigating to the folder you have the _.zip driver lib._ Makes things a bit easier, when you just drop the .zip file on the desktop, and add it thru the IDE, instead of digging through the IDE folders manually.
thank you mama 1085243, I prefer putting it manually becuase it would be in the same folder as the "arduino" and in the future you can copy all together. but if you use the menu, it will go under the "my document" which I don't prefer. I have mentioned that from time to included it using the menu like this video th-cam.com/video/7RQ8QoJWhpY/w-d-xo.html or this th-cam.com/video/L6ekl2ABcuY/w-d-xo.html
Hey, this video really helping in my project, but I don't understand, why there is 450 address pulse (150-600). But in my imagination, servo work for 180 degree rotation, and I think it has 180 address or multiple by 180 (180, 360, 540, etc), 450 can"t divided by 180.
Hi, The value is "pulse width" and it depends on the MCU (Arduino) frequency. so I figured it out what pulse width would work best with Arduino. If you use different MCU, it would be different. By the way I have V2 of this video. The link in the description.
Thanks for the video. How do you turn more than 1 servo at the same time?
Edit: Oops didn't see the video where you controlled more than 1 servo at the same time. Thanks, keep it up.
amazing video....very well explained !!I'll be chaining 20ish of these guys together.... however (correct me if i'm wrong ) i've heard you can't run Led's and servos at the same time on this board ( one or the other) ... as all channels share a common frequency...
I am glad you found it useful. Thank you
سلام
ممنون اقای مشیری بابت ویدئو تون
من دنبال کنندتونم
وعلیکم السلام. تشکر از اینکه از مشترکین مجرایم (کانالم) هستید. خوشحالم که ویدیو را مفید یافتید.
سلام علیکم. مجرا (کانال) فارسی علم و فن را راه اندازی کردم: لطفا به دوستان تان خبردهید و حمایتم کنید.
www.youtube.com/@ilmofan
Very good instruction. Thanks
you are welcome. Few weeks back I published my Arduino course worth $200 on Udemy. Arduino Step by Step Course (over 100 lectures) Starts here robojax.com/L/?id=338
This is a great tutorial! Thank you for being so thorough!
Can you do a video tutorial on powering multiple pwm boards with one power source? Using your 4 board example, how to power 64 servos, 4 pwm boards with one power source.
You are welcome. I have in my "to do list" to make video with 32 servo which viewer learn to add more. I am not sure when.
Robojax looking forward to it.
@@robojax do it please I love your build 😘 YOU ARE AMAZING MAN
Is it possible to use a smartphone to wirelesly control (With Bluetooth and Wi-Fi ) 16 servos with this board?
Yes. possible. I am working on it, subscribe so you get notification once video is upload.
Can you guve an example of an adequate power source for the module?
Sir, I have watched this video several times now and it really helps. I'm using a nano connected to the pca9685, is there any way of smoothing out the movement of the servo arm? Thank you.
*** Update: The issue was that I am using MEGA. For MEGA SCL and SDA have designated pins It works now*** Firstly great video. I am running into a problem. My servos are not moving at all when they are connected to PCA9685. I tested it by directly connecting to Arduino and it works. I also have 5v outside power supply for PCA. I did trouble shoot everything that I can think of but running out of ideas. What could it be? Any input is appreciated.
hi, here are the pins for Arduino Mega. www.arduino.cc/en/reference/wire
Very informative, thank you!
You are welcome.
thats a wonderful explanation. but with the original servo example, only one servo is moving but others are not, why is that so?
I don't have the code with me know, please use provided code or check latest videos on this th-cam.com/channels/kcBSig_Iu4ZnAIeCeG1TVg.htmlsearch?query=pca9685
Great work thank you so much! I have a project that needs 100 servo and need to somehow chain these
you are welcome. This video is Version 1. I've got V2 with different code demonstration, V3 with 32 servo and V4 to control them over WiFi the link is under the description of the video.
@@robojax amazing I'm subscribing :D 1. can I use a raspberry pi to send signals instead? 2. Is there something that goes up down instead of rotating like those servo?
PCA9685 has registers that can communicate using I2C protocol. 1-you have to look at datasheet to know how to read and write using raspberry pi. 2-I am not sure if I understood it correctly, but if you want up and down, isn't that you just rotate to the left or right and it will go up and down? thank you for subscribing.
@@robojax oh hey thank you very much for the reply. I'll look into that. What I needed was an actuator. I am learning from scratch. :)
Very interesting. Now I beginning to like building one robot.
Happy robot building.
I’m working with an Arduino Uno R4 WiFi and a PCA9685 PWM driver module to control a servo motor. Although the Arduino IDE indicates that the code is running correctly and attempts to move the servo, the servo motor itself does not respond or move. This issue persists even though the code is properly uploaded and the Serial Monitor shows that the IDE is executing the code.
Here’s what I’ve checked:
I2C Connections:
I have connected SDA and SCL from the PCA9685 to the corresponding SDA and SCL pins on the Arduino Uno R4 WiFi.
I’m unsure if SDA and SCL should be connected to pins A4 and A5, respectively, but I’m using the dedicated SDA and SCL pins on the Uno R4 WiFi.
I2C Device Detection:
I used an I2C scanner code to detect devices on the bus, but nothing appears in the Serial Monitor. This suggests that the PCA9685 may not be detected on the I2C bus.
Power Supply:
I’m concerned about whether the PCA9685 and the servo motor are receiving sufficient power.
Code Functionality:
The code is designed to control the servo motor via the PCA9685 module. The code seems to be working as expected when run manually, but the servo motor does not move.
Thank you for a great video! What is the best power source to get 5v?
it depends on the type of servo motor and how many you use. measure the current of one servo motor when load is connected to servo motor for example you measured the current to be 0.5A and you wan to use 10 servo then 0.5x10=5A to be save get a power supply with at least 6A or 7A.
Thank you it was very useful! I still can't figure out how to reduce the speed of the rotation because the delay() function is not effecting it.. Can you help me out? Thank you very much!
Thank you so much for this amazing video. What would you recommend one do if he wanted to connect 18 servos. Is there anyway to connect two of these boards together for the extra channels?
you are welcome. this is just version 1 V!, I 've V2, V3 and V4 of this up showing you everything you many options. check the link in the description
lovely organized, cheers!
Thanks. you have question or needed custom code, this is Version 1 or V1, there are 4 more versions of this module. link is below this video or just search my channel . Cheers. and yes, your subscription is great help. Thanks
@@robojax I am having issues with the Hiletgo PCA9685 servo controller. I have checked everything with the multimeter, have the proper external power, checked the wiring, and checked each servo, so I believe the issues to be related to software. I have used both the HCPCA9685, PCA9685, and the Adafruit version, but neither seem to be working. Is there any that you suggest for this brand?
Nice explanation, but the mapping of angles is not from 0 to 180 but from about -20 to 190 degrees. you have to measure the angles.
Thank you. The standard is 0 to 180 and depending on the quality and specs of servo it might be not exact.
thx very much, helpfull in year 2020 too.
you are welcome.
I'm following this, using a bench PSU to power via the central power inputs, but even just raising the PSU to 2 volts starts to feed 250mA current, if i head toward 5V the PSU maxes out at 2 amps. What could be wrong, i've triple-checked wiring etc ?
My PCA9685 is dead, problem solved!
the amount of current depends on number of servo motors and types. some servo motors need more and some less. measure current of ONE servo motor while running and connected to the load or word it does. then multiply it to the number of servo motors. if you still get higher current, then either one or more servo motor is damaged or the servo motor has lower rated voltage.
@@robojax Thanks for taking the time to respond Ahmad, have a good weekend :)
you are welcome. Stay safe.
@@robojax You too sir, i don't know how it is in Canada, but the live data from the UK is in complete disagreement with government policy, which has now killed over 40K old age pensioners in care homes. I am on the war path.
Well done! Thanks!
Is it possible to only connect the pwm signal wire and power the motor with seperate higher current power source (for larger motors)?
Yes you can.
Robojax awesome. Thanks for the reply.
fantastic video, Super Helpful!
Thank you.
I have wired my arduino Uno R3 the same as you to the PCA9685. I get no power to the either boards but when I put power to the arduino both boards light up. I have also hooked my arduino Mega in the same way and the same happens.
Hi, perhaps you are connecting it incorrectly. Please watch it again or what other version of this module th-cam.com/channels/kcBSig_Iu4ZnAIeCeG1TVg.htmlsearch?query=pca9685
Great video! A lot of details and well explained!
So i will need 2 batteries in order for this to work, one for the UNO and one for the PCA9685 right? Both 5V.
Thanks!
NO. if you use battery then ONE 5V for both. I mentioned separate 5V because people connect the 5V from Arduino to this.
@@robojax So I need just 1 5V battery and then i connect the battery to which one of the boards? I think i misunderstood... Thanks for the asnwer and for the help! :)
You are welcome. If say anything else, it means I would have to type whatever I said in the video. Please watch it without skipping.
@@robojax I watched it twice man, it's not you it's me :) i get confused when you talk about 2 batteries for 2 boards. Being a beginner in hardware AND english, this is not easy for me. Hope i will find an answer! Thanks for all the learning material! :)
I have two batteries each one is 7.4 V, should I connect one of them to the arduino and the other to the PCA?
Also is using 3.7 V battery for PCA to control 12 motors enough or not?
For arduino the dc adapter input can accept up to 12V. For the PCA connect power exactly the same as your servo motors voltage. If servo is 9V then connect 9V for example.
Thank you for your videos! It's clear and useful! Good work! I'm working on a project with 27 servo, all works! I would like to run all the servo at the same time but with different speed and degrees (random sweep)... I've no solution for the moment with the Loop fonction "for"... Any ideas?
you are welcome. This is Version 1 (V1) and there are V2, V3 and V4 with different examples. Please watch those.
@@robojax Thanks for your reply! I saw all the videos, but I don't find easy solution for running all motors in random programmation (degrees and speed)...
Marvelous explanation with simple language. I just wanted to know whether I can use PCA9685 to control 3 servo motors, 10 LED's (only ON/OFF) with the help of may be 2 or 3 buttons (ON/OFF switches)? If so, could you please give some guide lines as to program (Sketch). Thanks in advance.
Hello, you can connected LED or servo does not matter. You've watched Version 1 (v1) of this series, there are V2 to V4 the link is in the description where you see more options and ON/off push button.
@@robojax Thanks Mr Shamshiri for your help.
i see servos move individualy each time. But can be moved all of them at the same time?
I have created V2 of this video where you can control all other once. The link is in the description. I have made V3 with 32 servos.
Great video! Thank you.
Questions:
1. What do you use to supply power to the servos (current)?
2. Can I use the same code on ESP32?
Cheers!
Hello,
1-measure the total current for your servos and connected a power supply accordingly. this I have connected a 5V power supply that could up to 60A but you don't need that. you need whatever you measure when the servos are running under the load.
2-You are watching Version 1 (V1), I have 3 more versions of videos of this module link is in description. Always check description I have it it for ESP32. Or search my channel for more cool projects. Here is how to find Specific TH-cam Video in a channel bit.ly/findTH-camVideo
@@robojax Thank you!
For powering a couple of servos (not too much load), can I used like 4 C batteries, at least to start with?
Maybe use something like a buck converter to increase current, if needed?
Hi, I have watched the other servo videos. Nothing shows how to control the pca board with a voice module. I thought If I removed the code for the push button switch (v3 video) I could code it using the OE Pin. Or am I looking at the problem all wrong. Confused myself.
Hi, of course I don't have any video related to voice control. But I have shown how to control with a signal or push button. just use the method and use the singal from voice module.
Having a peculiar problem with my recently bought PCA9685 (same as the one you demo with low power mosfet). WITHOUT connecting to any external controller yet, i plug ext power 4.8V (from fully charged 4 NiMH AAA batteries holder) to the green block. No servo connected yet. Tested with multimeter ON ALL the V+ ... only getting 1.7V and not 5V. Then using multitester.. tested on the MOSFET and capacitor, but got about 5V.
Any reason why?
Can we control 2 or more servo at a time plz answer my question it will be very helpful to me
Hello, yes we can. please see the link in the description to V2, V3 and V4 of this video. I have tones of examples.
Ok sir thank you very much for your response sir
Amazing video, however my servo motors are not rotating. I'm using an arduino mega 2560 and the code uploads but nothing happens after. I have ordered an arduino uno in hopes it will work. I'm not sure why my mega 2560 isn't able to control it?
It should work with mega. You have be doing something wrong. I am not sure .
@@robojax Thank you for responding. I followed all the steps you took. The only difference is i'm using a mega 2560 and the adafruit library I downloaded is on 1.8.13 instead of yours which is on 1.8.0. For example you only have 2 #defines in your code but the one i downloaded has 5 #defines. Under #define SERVOMAX 600 it says #define USMIN 600
Please download the library from robojax.com as the library might have been changed.
@@robojax I used robojax code and it still did not work, I also tried retyping it which didn't do anything. I also tried a different set of code but nothing happened. Im starting to think there is something wrong with my pca9685, I guess ill keep trying different things. Thanks again for your help!
Hey very good video, but I have a question. Do you know why the board has a capacitor? Or could you explain for which situation I would need one? My board came without one.
when servos STARTs and stop this sudden start causes the power supply voltage to drop a little and if you have capacitor connected to the power supply which is already charged, it resists the voltage drop by supplying power to the board. .
Can you control the servo connected to the board with a potentiometer? Is there a tutorial?
this is Version 1 and I have 4 more videos on this. But to control servo I have tones of videos. Learn from those and implement it here. learn how to Search for a Particular video in a channel here th-cam.com/video/OhkUceBWcHs/w-d-xo.html
One more help please tell me can i provide power through battery in servo motor controller if we used then please tell which type of battery i used
Please watch V2 and V3 of this video. I have mentioned extra details there and the amount of current for my servos.
How does this work? Do you have a Controller or something?
I have put it on the title. I use Microcontroller called Arduino. If you don't know Arduino, here is 2 minuets video from my Step By Step Arduino course th-cam.com/video/-6qSrDUA5a8/w-d-xo.html
@@robojax ok but did you controlled with the codes?
Wow, you have not watched the video and posted comment. I can’t believe this
I got one of these devices today, I wired it all up but for some reason it burned up my servo, I tried 2 more but each one got damaged. I'm not risking another, any idea how this could have happened? I connected the data lines correctly and used an external power source of 5v so nothing was out of the ordinary. Any suggestions.
You might have connected the Positive and negative terminals in revers. Other than very rare but possible that servos are rated for less than 5V may be 3.3V.
is it possible to not connect the VCC to the Arduino and use an external power supply to supply PCA9685?
Please watch. I've explained it very well.
Do you have any idea on how could i supply the 5V to the PCA9685 board considering the fact that i need it to put it in a portable 3d printed robotic hand....? I hope you cand help me with this. Great video !
Hello (first hello or hi), measure the current for one servo while the servo is motor working and moving the load (under the load). then multiply the amount by the number of servo motors. Then get 5V power module.
HI. I would like to use servo motors on my model railway for points and level crossing gates, uncoupler Etc. but can you initiate each servo individually by a switch. So it would go in one direction by switch and stay there until I press the switch to return rather than by a timer. I was thinking of using on-off-on switches. also do you need to keep them plugged into the computer after the positions are set. If possible to do this could you tell me how to do it. I am not knowledgeable in electronics so it would have to be explained simply. Thanks
Hi, this video is version 1 there are 4 more videos and I have used many ways to control the servos. Please check them. Yes you can control with switches.
@@robojax Thank you
I set the PWM for a servo to 90, and it started to continuously spin around, do you have any explanation for this? I was trying to find the minimum PWM value.
please watch V2 of the video for more examples you may find the reason. the code itself is not doing it, you must have modified the code.
I am using 16 mg996r servo motor with pca9685 will you please tell me what is the best power supply for it..??
run of servo. measure the current or find the datasheet and see what is the maximum current, then multiply it by 16 and get a power supply equal or greater that . for example if you found that the current is 0.5A,, then 0.5x16=8A so use 8.5A or higher power supply with 5V output.
im trying to figure out how to reverse a servo so that I can use 2 servos for a joint, one will be operating backwards. So its position will be negative to the standard PCA9685 code. Is it really as simple as using negative degrees? like -45 to -135? How would I do it using python/opencv in visual studio code?
I have series of video with many codes. This is version 1 or V1 , please see v2, v3 or v4 yo see if one of them is working for you
The minimum and maximum I found on my servos causes the rotation to be slightly more than 180 degrees, like around 195. Can I adjust the minimum or maximum so the rotation can be closer to 180? Will it matter that I'm not using absolute minimum or maximum?
Of course you can adjust it. This video is version 2 , you may watch V1 videos o see how I have done it.
How do I connect two pca9685s and configure them to work? There is a problem with addressing and nobody has ever shown how 2 pieces work with each other.
When work only 1 PCA - no problem but when "begin pwm2" arduino program stopped.
This is the simplest piece of code which, for example, will light the led on channel 1 in PCA9685 No. 1 and the second led on channel 4 PCA9685 No. 2
If you are able to do this you will become my MASTER :)
I have mentioned in the code. Watch the video again. Do not escape.
Hi, thanks for the video. I need to know if there is any way to disable the current on a servo with this librar y after it makes a move. I am using 15 servos and they make a lot of noise and vibrate. I think this would be a way to eliminate it. Thank you
Hi, servos are independent. They just get PWM signal and other than that you can't have any other control. you can have delay between the pulse you send if you add it in the loop. other than that you can't do within Arduino. There should special servos where you could read the current and set the limit. But these servos are very simple.
@@robojax Thanks for your answer. My idea is to do something similar to the dettach function in the servo.h library and stop the servo from receiving voltage.
when sign is turn OFF, the current should be zero. Attached /detach only assigns pin and does not send any signal to servo.
This video shows me, again, why I should continue hating Arduino.
The servos working limits are between 1 ms and 2 mS. If you know what the Arduino is doing in the background you will be able to set the limits immediately in the program. But unfortunately with an Arduino nobody knows, neither wants to know, what is really happening.
this is not problem of Arduino. this is issue with the module and how it sends PWM to the output.
@@robojax
Of course it is not a problem of the Arduino as a hardware. It is a problem of the black box style Arduino is used.
Hi , can u guide me for a project .. it will be really helpful
Hi, this is Version 1 (V1), there are V2, V3 and V4 of this. Check the links in description or search my channel.
@@robojax Hi, I have few questions, regarding power supply
Thank you for your explanation. I am curious as to why you used "delay" instead of "millis" as this only allows one servo sequentially. Is the power enough for multiple servo operations??
millis is number of milliseconds since the program started. I just needed the program to give certain time delay to show movement and then start another one.
The servos I used were without load and it was enough. But if you make all servos do something, then the load will increase.
Do you have to solder the pins onto the 16 channel board?
there is no soldering in this project. do exactly as I have shown. Unless your project is somewhere which is shaken a lot to solder it.
Thanks for the great video! Will the same make and model servos have the same settings?
You are welcome. Yes. they do.
can i connect the pca9685 to 4 AA batteries of 1.5V each (6V total power supply) to supply power to the module?
I just check the datasheet here on page 1 cdn-shop.adafruit.com/datasheets/PCA9685.pdf and the chip can tolerate up to 5.5V. 6V will kill it.
thank you so much!
only one question - question about speed control is still relevant - how to do it?
You are welcome. Each servo has pre-determined speed (quality and price) and can't be set.
@@robojax yes, I know.
i mean may be that library (or may be you can advice another) have methods for solving that typical issue
@@robojax hey :)
if I can use loop for pulse increasing? for ex:
pwm.setPWM(0, 0, cnt++);
... or that kind of trick will bring delays?
I have a problem. In my script it says that Adafruit_PWMServoDriver.h could not found
very simple then you have not installed the library.
Hello, I modified the code to control 4 sections of motors and control a group of MeArms. Each time the movement is adjusted by 1 degree, the motor still shakes and heats up. Is this normal?
If the motor shakes, something is wrong or your have modified the value in the code. Please start with new code and see
@@robojax I understand, I try, but I read online that my friends may explain the problem of insufficient current. I am using a 5V1A power supply, and I do n’t see how you supply power in the video. (Ps I ’m a student from Taiwan, using Google Translate Please inform me if the syntax is not smooth, thank you)
Very good... Impressed... Good job... If i want add same 9g servo 4 pc for my rc plane how much current i have to supply to the board?
Thank you. For each servo the idle current at 5V is 100mA and 500mA in stall mode. Read more here: www.addicore.com/FS90R-Servo-p/ad314.htm
those servos are absolutly awful, don't buy them
Like they say - excellent, thanks
You are welcome.
Hello ! Really nice tutorial ! I was thinking, can I use this driver to drive multiple high torque servos, which usually operate at 7.4V ?
Hello, if you paid attention to the video, it should be no problem. just power the board with 5V and power up your servo with the 7.4 or any other different power.
Hi, I have a question: If I have 4 servos that needs 7.2V and 1A, and I use a power supply of 10V 6A (V+), the board will give to each servo the voltage and current that it needs, or I have to use resistances than reduce 10V to 7.2V?
This board does not change the voltage or current. You would have to use a servo with proper voltage source for it.
Is it possible to use low voltage super mini servos with this board?
The size does. It matter. Just check the voltage of the servo. It should work if it is the same voltage.
@@robojax These are the specifications
1.7g Low Voltage Micro Digital Servo
Weight: 1.7g
Connector: mini JST 1.25mm
Voltage: 3.7V
Torque: 0.065±0.01Kg.cm @ 3.7V, 0.075±0.01Kg.cm @ 4.2V
Speed: 0.07±0.01S/60° @ 3.7V, 0.05±0.01S/60° @ 4.2V
Hi, how are you? I am having problems, with my pca9685, when adding a ninth servomotor it became slow and as it is difficult for it, I have a transformer for gamers, so that the amperage would not be a problem, when removing the ninth servomotor, the motors will be blocked, the pca9658 damaged?
Hi, if you use Serial.print, that makes it slow. remove all printing via serial. adding or removing servo motor should not affect this.
Can you stil use the original PWM ports on the arduino, next to the 16 pwm's on the servo controller?
of course. you can. that is the beauty of this module.
@@robojax Thanks, couldn't figure it out right away, but you're right! :)
Hi, amazing videos loads of details and easy to follow. Was hoping you can help me. I’m using a PCA9685 to control 10servos. I want to be able to control the loop of the 10servos but a voice control module. Using a nano both modules on the i2c. I have the dfrobot offline voice recognition module. I need help with coding and wire diagram. There is nothing on the web. Please can you help.
Hi, this is Version 1 (V1) and there are 3 more Versions V2, V3 and V4 and I have shown multiple ways to controt them. Links in description. Those might help you.
Cheers I will look at these also.
Thanks for the tutorial, can you clarify the part of connecting more than modules together, and how we can configure that in the code to reach servo 17,18 ,etc..
I think this explains my question
learn.adafruit.com/16-channel-pwm-servo-driver/chaining-drivers
You are welcome.
@@BasselIssa Excelente Bassel Issa. Muchas gracias por tu aporte. Saludos.
I was wondering... do you need to use any other component to protect the arduino from the "blowback" voltage of the servos? Is this driver already protecting the arduino? Thanks
No you don't need it. There is already components inside the servo.
Okey, thank you! And great tutorial
Can you show, how we can control servo motors using PCA 9685 servo driver and a Radio Controller(Flysky CT6B)...?
We are facing so much problems on this issue..😥😣
Why do you need to use this with Flysky? The input for this is totally different. FlySky has its own receiver and depending on the number of channel you can control devices. I am not sure if you can find 16 channel TX and RX.
thank you so much this video helps alot
You are welcome Fadi. Ahmad from Canada.
Hi, i want to control a servo motor with two different arduino boards, can this module do this ?
this module is being controlled using I2C communication. I have not tested but you can should be able to connected two Arduino and control it . Using I2C you can connected 128 devices in parallel.
Can we use it as Genral input output
if you know that the output is PWM signal, then yes. But if you just need extra 16 ports, then use MCP23017 and I will make video, God willing.
Thank you so much sir.
You are very welcome. Please subscribe. It is appreciated.