I have watched this video several times, and I am getting brave enough to try. I am not sure what sketch I should use. I found 2 on your project folder, and neither seems to match with the one on camera. I hope you are still notified when new comments arrive. I have watched dozens of your videos and am subscribed. Thanks Tom.
This is a great tutorial Tom. Very easy to follow. I have now made a mimic panel incorporating the Arduino Meg Pro and the PCA 9685 running 15 servos, SPST Switches and 2x2-pin bi-colour LEDS (One for Thrown and the other for Closed) and it works like a charm. Thanks again for the Tutorial, and keep up the great 👍 work
Great info Tom, I have been looking for months on how to set this up, your video and sketch are the best tried it and it works. Subscription worth every penny. Bob from Lubbock TX
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.second, how to mod this same servo for 360-degree rotation so we can control using PCA9685
Multiple servos running simultaneously are controlled in the code. Check out my other videos. These servos are only for 180 degree rotation. You would have to purchase 360 degree servos.
Great job Tom as usual. Could you supply a schematic or wire diagram on how to wire the switches and LEDs up to the Arduino and the PWA9685 to use for turnouts. Athe the present time I am using TVD Octo lll's.and a Quad LN. 🙂
Really great Tom... I finally got round to trying your sketch and found a bit confusing then realised that Final and Test were in same sketch that I downloaded, but works a treat just need adjust movement angle and the modify for 16 sets of points ... and a Happy New Year 2020...
hello, dear grandpa Tom, could please tell me how you power pca9685 cause I am new in Electronics and trying to power it using my lipo battery with XT60, it seems like you power it using some converter, but it's unclear, could you please tell me what's your way of powering, thank you, and you did a good job and really appreciate your job
@@TomsTrainsandThings Absolutely. I'm using two Mega one for DCC and another for the servos as I needed many digital pins for reading switches on a switchboard. Now I use a Processing sketch were I have my layout and click on the turnouts.
Thank you. Do you have a wiring diagram or something that shows how to add the push button or switch and LEDs to the breadboard and connect them to the arduino?
The sketch and Frirzing diagram is on my web page along with all my other Arduino lessons and projects. You can find the link in the description of this video.
Interesting Video Tom, I can think of a number of places to use this and not all would be turnouts. Got me thinking would the PCA9685 be capable of activating a Kato turnout.
I'll have to update the web page link on the video. I got rid of the old web site back in December. Working on a new one, have a few of the sketches on the Project page. More to come soon. Tomstrainofthought.com
Hi Tom, Interesting video. Do you know of a way to control the individual 16 servos separately with a push-button or switch, and if so, how can we obtain and compile the code? It looks like this video gets to that point, but I don't understand the detail. Thank you.
I want to have a crap ton of operating wig wags, Griswold signals and semaphores, this is probably the more affordable approach as those switch machines can break the bank
Tom, could you possibly show us how to completely wire, and code the Arduino and the PCA9685 with pushbuttons and LED position indicator lights on a control panel ? I have 29 turnouts, and servos, and would sure like to know how to make it all work. Thanks Tom !
Have you looked on my web site? That will point you in the right direction. The way you wire your mdel railroad is up to you. Everyone does it differently.
I have Kato turnouts, and I have an ideal about using an arduino, a motor shield AND a multi relay board, with each relay a turnout and the MS will provide the power to operate .
You can eliminate the motor shield. It needs external power to operate. The same external power you can hook up to the relay board. The motor shield can only control 1 motor per channel, it's not needed in your situation.
Nicely presented, Tom. Thanks for showing us how to get 16 going. In practice would you have to have 16 toggle switches to throw for turn outs which makes sense but what about crossing gates for roads? Do you have to throw a switch to put them down or will you have a sensor that sees the train coming up and puts the crossing gate down upon approach or will you have to throw a toggle switch to do so?
Great project great video but please explain where to connect the toggle switches in the arduino or schematic will be helpful I need to install 15 turnouts
Thank you Luis. Go back and watch the video at 0:27 I tell you where you can find the explanation. The web address is in the Description under Contact Info. I have most of my Arduino projects on the web page.
Toms Trains and Things Thanks for the fast response I made 1 servo work without any problems But I’m new to write code sketches and all that so I don’t know how to add 12 more servos to my arduino So I’m lost
In the example sketch on my web page I show two servo/switch routines in the if/else statements. Copy and paste the contents of these two statements and change the numbers involved. The first statement uses "0" the next one uses "1" Continue with the same numbering convention until you have the desired button/LED combos that will fit on an Uno. You will also need to declare the Pins for LED's, Buttons & Button State at the beginning as in the example. The Uno is limited by the available pins but more can be used on a Mega. Like I said in the video, I will show how you can increase the number of available pins on the Uno via a shield or module. I just received the module in the mail so I'll be doing a video on that shortly.
The power drawn comes from the external powwr you supply to your servos. The PCA9685 only supplies a signal to the servos. To determine the max current for the device, I suggest contacting the manufacturer.
So everyone is showing using a PCA9685 to drive up to 16 servos or more if you daisy-chain them. But you're limited to how many buttons you can plug into the Arduino to act as inputs. How do you overcome that limitation?
You can run 16 servos on each pca 9685. You can also use a pce 8555 for pb there are many different devices you can use with I2C to increase inputs & outputs
interesting video. How do I add more switches/buttons on a Uno to control separate turnouts, or do I have to go to a Mega to do that ? I'm still learning this. :)
Tom, I like this code for the 16 Servo Board, but I'm wondering if there is a way to slow the speed of the servo down, to throw the turnouts a little slower.
use a smaller angle (full/10), pause, increase the angle (add 1/10), pause, repeat until full angle is reached. time to pause (aka sleep) is decided by you, that should do it ! /10 can be higher if you want it smoother
Great video, very informative. My question is, the from the diagram, you can run 16 servos on the PCA9685 but it looks like the UNO board will run out of room for the LED lights before that. Is it possible to run the LED's off another PCA9685? Also, do you prefer the 2 pin bicolor or 3 pin bicolor LEDs? New to this so sorry if questions have been answered before. Thanks
There are other shields and boards similar to the pca9685 that can add additional capacity to the Uno that are also I2C devices. I will be doing another video to demonstrate this in the future. I have several of the boards that can accomplish this but not had the time to do it. As far as bicolor LED. I prefer using the 2 pin, but in this application, the 2 pin requires a reversal of polarity which you can not do in this application. Either 2 separate LEDs or the 3 pin need to be used for this.
@@TomsTrainsandThings what boards do you have or would recommend for the LEDs? I plan on having 10 turnouts run with servos as shown in your video with a Red/Green 3 pin LED at each to indicate direction. Thanks!
@@TomsTrainsandThings One other question, does the UNO run off the 5V that also powers the servos on the PCA9685 or is another power source needed for the UNO, like USB? Thanks!
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
Even with 1 servo on the PCA9685. Using the PWM pins on the Arduino limits you to just 1 maybe 2 at the most. I wouldn't put anything else on that Arduino since you're pushing it;s amperage limit. Try what I have on this video: th-cam.com/video/xT98CcJdpHI/w-d-xo.html
Here is a video on controlling a servo with an Uno; th-cam.com/video/w3DL-H0fzmY/w-d-xo.html In order to control more than 1, you would need an external power source for the servos to drive them.
Great video Tom. I'm getting started with DCC++ and hope to use servo actuated turnouts. Do you know if the Walters LLC Switch Machines are compatible with the Arduino PCA9685?
Don't have any, but what I've seen, it has it's own control system with decoder. Short answer would be no. The PCA9685 along with the code in the Arduino takes the place of the components on the Walthers unit.
Although the PWM is set with a 12 bit value, it does not mean there are 4096 steps of control. At a frequency of 50hz you get 25MHz/(50Hz * 4096) ≈ 122 steps. This is a far cry from the advertised 4096 steps!
Calculate the total amp draw of all the servos and use a power supply capable of handeling it. Servos drw very little amperage if your using the 9g or smaller.
Hi Tom, how do you control the servo speed with this pca9686? Because I am using this for a school project and the speed has to be lower to be stable. Maybe you could tell me how to find it?
Hi Tom Enjoyed your tutorial. I have successfully built my own dcc++ using an arduino and a motor shield and can run and program engines on my test track. Now to step 2 I want is use JMRI to switch my servos using an uno and a pca9685. I was looking for the adafruit sketch you mentioned in your tutorial, however could not find it. Would you be able to direct me as where to find it? Thanks Geoff
Tom, would you know of any tutorials that will connect JMRI to an arduino uno and PCA9685? Would prefer to control servos direct from my pc thus eliminating need for a panel, wiring, led lights, and switches.
Hello. Your channel is Very informative and done well. I just got back into the hobby about 6 months ago. I'm at the stage where I'm about to build my layout. My question is,, do you think it's possible to incorporate this exact setup into JMRI? If it is not possible, then your button way will be my approach. Also I cannot find your modified script. I only have the download from Adafruit. Thanks
Yes you do. The PCA 9685 can handle the extra amperage needed for additional servos, the Mega can not handle more than 1 servo safely even though it has many more output pins. It's still limited to the available total amperage. If you can use servos with a Kato turnout .
This looks like a lot going on but it looks like you got it down pat thanks for taking the time to share this video I know I'm in the process of deciding which switch motor to go with should it be the tortoise Cobalt or these RC motors it's a hard decision to make the tortoises you need to solder or buy an extra piece so you don't have to solder you want to get one year warranty with it. The kobold you get lifetime warranty with everything no soldering involved then we have the RC motors what's your cheat but all the extra stuff you have to buy make them work does not seem worth it I'm looking at about 36-40 turnouts just on my way out very hard to decide which way I want to go. so again thank you for taking the time to make this video and sharing it with us
Each pca9685 will operate 16 servo motors and they can be stacked where you can operate over 900 servos. All of them can be operated with one Arduino Uno or Mega which can be purchased for $22 for the original or less than half that for a clone which I use on all my projects. Since the technology is open source, any manufacturer can make the Arduinos. There is also a board for the inputs where you can increase the capacity of the Arduino to handle more inputs such as switches and LEDs. Initial cost for the Arduino method if you purchase all name brand items; Less than $50. Servos can be obtained for under $2 pc. Tortoise switch machines have a 9 year warranty and are located in the US. They rarely fail Cobalt has a lifetime warranty and located in Au & UK See my video comparing the two switch machines: th-cam.com/video/j-NPoi3gLQo/w-d-xo.html
Hi tom, how would you connect an on/off (SPST) toggle switch? would you keep the same as a push button with a 220ohm resistor (I am connecting 8 switches for 8 servos)?
Your best bet is to go on the Trainboard forum: www.trainboard.com/highball/index.php There are many modelers that do coding 24/7, they may be able to answer your question. Remember, the Arduino micro-controller is designed to perform 1 task at a time. Although you can stack tasks, there will be somewhat of a delay in performance. I use multiple Arduino's throughout my layout.
Hello Tom. Where is the arduino code of this example? It's very good!! If you can put the link here it would be great. Greetings and thank you very much for sharing.
Hello Tom. I was searching your website and I did not find the code for this project. Would you be so kind as to pass me the link or send it to me by email? Thank you very much greetings from Argentina. dj.jav1@hotmail.com
Ok. Thank you. But where is the most important part that explains wiring and for control panel? To be honest everything else is pretty easy to find online. I would be appreciated if someone could explain me how to wire control panel with this setup and where to find code for it. Thank you in advance.
@@TomsTrainsandThings thanks..., module is broken for sure.., if this 16ch servo shield can handle just about 5v, how about16ch servo driver shield (that stack in to arduino uno) can handle more than 5v?
@@TomsTrainsandThings Really hope we will get your website soon. I am very new into this hobby but it looks like nobody else explains how to control servos with 9685 + LED's and toggle switches. Everybody else use JMRI directly. So I desperately waiting for your new website to get wiring diagram and other info to build same system. Thank you again for your great youtube channel.
The good thing about Arduino is the availability of code especially from other manufacturers, all one has to do is copy & past instead of writing your own code. If it works, don't knock it. I see Define and other terms used all the time in code. It works either way!
Tortoise uses an independent power source or operated through DCC devices not compatible with this subject. The point was the length of the cable tested.
@@TomsTrainsandThings I should have asked if the waveforms used to drive the Tortoise and the servo are similar to each other. This would make your tortoise test result useful. Perhaps I should try some tests. Thanks.
@@TomsTrainsandThings calculated how? All I got is the spec sheet that says limit angle 200°+/-1° and centering divisions 1°. I tried random numbers and it just sounded like it was grinding so I stopped messing with it before I broke it. Where are you getting numbers to "calculate"? PLEASE
Tom thank you your videos are a great resource especially for the beginners or the technical and programming challenged like myself. This is a great video I have been searching for this exact solution for my switch control! I am also looking at the 16 Channel Relay Board Module for Arduino as an option for controlling my switches up 32 I think. 00Rail made a video on this option but I am trying to work out how to put it together for more than 1 switch! The link to their video is th-cam.com/video/-ATOKGPQgkk/w-d-xo.html. Again thank you for the great resources and keep up the fantastic work mate! Regards Darren from Australia!
I have watched this video several times, and I am getting brave enough to try. I am not sure what sketch I should use. I found 2 on your project folder, and neither seems to match with the one on camera. I hope you are still notified when new comments arrive. I have watched dozens of your videos and am subscribed. Thanks Tom.
Thank you James. The ones in the project folder is the final sketch
This is a great tutorial Tom. Very easy to follow. I have now made a mimic panel incorporating the Arduino Meg Pro and the PCA 9685 running 15 servos, SPST Switches and 2x2-pin bi-colour LEDS (One for Thrown and the other for Closed) and it works like a charm. Thanks again for the Tutorial, and keep up the great 👍 work
Thank you so much, glad it was helpful in getting you where you needed to build your own.
I know you posted years ago, but i love it! Thank you for your great work.
Glad you enjoy it!
Nice explanation and finally a downloadable code without an error
Glad it helped
good job Tom. it's always the little details that make a difference and you delivered them clearly. Thanks.
Your welcome Joe
Great info Tom, I have been looking for months on how to set this up, your video and sketch are the best tried it and it works. Subscription worth every penny. Bob from Lubbock TX
Glad it helped Bob! Thanks for your support.
Ah shoot! I have the PCA9684. I’ll come back later when I upgrade. Well explained Tom.
One short this time. Maybe next time. Thanks Mark. Say Hi to Donald for me!
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.second, how to mod this same servo for 360-degree rotation so we can control using PCA9685
Multiple servos running simultaneously are controlled in the code. Check out my other videos. These servos are only for 180 degree rotation. You would have to purchase 360 degree servos.
@@TomsTrainsandThingsi will check out the other videos then, thank you for your reply 🙂
Great job Tom as usual. Could you supply a schematic or wire diagram on how to wire the switches and LEDs up to the Arduino and the PWA9685 to use for turnouts. Athe the present time I am using TVD Octo lll's.and a Quad LN.
🙂
Really great Tom... I finally got round to trying your sketch and found a bit confusing then realised that Final and Test were in same sketch that I downloaded, but works a treat just need adjust movement angle and the modify for 16 sets of points ... and a Happy New Year 2020...
Glad you figured it out.
Thanks Tom. I wanted to see if I could use two PCA9685’s. One for the servos and the other for The LED’s?
Never attempted to run both servos and LED's on the same device, but I see no problem with servos on one and LED's on another.
Great stuff Tom, getting into this Arduino thing and your videos are really helpful.
Thanks
Mark (UK)
Glad I could help Mark.
hello, dear grandpa Tom, could please tell me how you power pca9685 cause I am new in Electronics and trying to power it using my lipo battery with XT60, it seems like you power it using some converter, but it's unclear, could you please tell me what's your way of powering, thank you, and you did a good job and really appreciate your job
That is precisely what I've been using in my turnout.
Works great
@@TomsTrainsandThings Absolutely. I'm using two Mega one for DCC and another for the servos as I needed many digital pins for reading switches on a switchboard. Now I use a Processing sketch were I have my layout and click on the turnouts.
Thank you. Do you have a wiring diagram or something that shows how to add the push button or switch and LEDs to the breadboard and connect them to the arduino?
The sketch and Frirzing diagram is on my web page along with all my other Arduino lessons and projects. You can find the link in the description of this video.
@@TomsTrainsandThings Hello Tom, almost everything clear, only would like to know the value ( Ohm ) of resistor you used in the circuit
Interesting Video Tom, I can think of a number of places to use this and not all would be turnouts. Got me thinking would the PCA9685 be capable of activating a Kato turnout.
Thanks Owen. The PWM signal can control RGB LEDs, Servos, and spped on a DC motor. Anywhere any of these are used is a possibility.
Revisited this video, lots of great information. One problem, I tried to download the code and the page was not available.
I'll have to update the web page link on the video. I got rid of the old web site back in December. Working on a new one, have a few of the sketches on the Project page. More to come soon. Tomstrainofthought.com
Hi Tom, Interesting video. Do you know of a way to control the individual 16 servos separately with a push-button or switch, and if so, how can we obtain and compile the code? It looks like this video gets to that point, but I don't understand the detail.
Thank you.
Have you checked my web page that complements this video, this goes a little further with updated code! tomstrainofthought.com/projects/pca9685/
I want to have a crap ton of operating wig wags, Griswold signals and semaphores, this is probably the more affordable approach as those switch machines can break the bank
Servos are the way to go. I used 9 gram servos in this demonstration, but a better fit for wig wag or signals would be 3.7 grams.
Thank you , very well explained
Not able to open code link given in description .Please help me .
Thanks. I have a new web site, still under construction, but putting code in as needed
tomstrainofthought.com/pca9685/
Tom, could you possibly show us how to completely wire, and code the Arduino and the PCA9685 with pushbuttons and LED position indicator lights on a control panel ? I have 29 turnouts, and servos, and would sure like to know how to make it all work. Thanks Tom !
Have you looked on my web site? That will point you in the right direction. The way you wire your mdel railroad is up to you. Everyone does it differently.
I have Kato turnouts, and I have an ideal about using an arduino, a motor shield AND a multi relay board, with each relay a turnout and the MS will provide the power to operate .
You can eliminate the motor shield. It needs external power to operate. The same external power you can hook up to the relay board. The motor shield can only control 1 motor per channel, it's not needed in your situation.
Nicely presented, Tom. Thanks for showing us how to get 16 going. In practice would you have to have 16 toggle switches to throw for turn outs which makes sense but what about crossing gates for roads? Do you have to throw a switch to put them down or will you have a sensor that sees the train coming up and puts the crossing gate down upon approach or will you have to throw a toggle switch to do so?
Crossing gate video will be out shortly. You just have to add the servo without the pca9685 to a sketch I already did for the crossing gates.
Do you have a book? You have the best videos!
No book, just videos.
Great project great video but please explain where to connect the toggle switches in the arduino or schematic will be helpful
I need to install 15 turnouts
Thank you Luis. Go back and watch the video at 0:27 I tell you where you can find the explanation. The web address is in the Description under Contact Info. I have most of my Arduino projects on the web page.
Toms Trains and Things
Thanks for the fast response
I made 1 servo work without any problems
But I’m new to write code sketches and all that so I don’t know how to add 12 more servos to my arduino
So I’m lost
In the example sketch on my web page I show two servo/switch routines in the if/else statements. Copy and paste the contents of these two statements and change the numbers involved. The first statement uses "0" the next one uses "1" Continue with the same numbering convention until you have the desired button/LED combos that will fit on an Uno. You will also need to declare the Pins for LED's, Buttons & Button State at the beginning as in the example. The Uno is limited by the available pins but more can be used on a Mega. Like I said in the video, I will show how you can increase the number of available pins on the Uno via a shield or module. I just received the module in the mail so I'll be doing a video on that shortly.
Thanks for the video. What's the maximum current this thing can handle? My servos need about 1.5 amps each.
The power drawn comes from the external powwr you supply to your servos. The PCA9685 only supplies a signal to the servos. To determine the max current for the device, I suggest contacting the manufacturer.
@@TomsTrainsandThings The PCA9685 is just the controller chip on this board, right?
@@safatkhan676 Yes, this is a breakout board for the chip, first offered by Adafruit
@@TomsTrainsandThings Thanks for the informative video and responses.
Hi! Very useful video. One question: can you also integrate frog polarity switching? Thank you
Yes, by adding a relay to each turnout.
This is great for how to get the arduino on Mrr. How about using digit ax DCC to control the input.
I have other videos on that!
So everyone is showing using a PCA9685 to drive up to 16 servos or more if you daisy-chain them. But you're limited to how many buttons you can plug into the Arduino to act as inputs. How do you overcome that limitation?
You can run 16 servos on each pca 9685. You can also use a pce 8555 for pb there are many different devices you can use with I2C to increase inputs & outputs
👍👍👍
Thank you! Very well explained!
Glad it was helpful!
Have you ever attempted an Arduino/JMRI controlled turntable?
No, but there are many others on TH-cam that have done the turntable with Arduino. Not so sure about with JMRI
@@TomsTrainsandThingsThanks!
interesting video. How do I add more switches/buttons on a Uno to control separate turnouts, or do I have to go to a Mega to do that ?
I'm still learning this. :)
DFRobot makes a shield where you can add more I/o to your device. I discuss this in several of my other videos
www.dfrobot.com/product-1009.html
@@TomsTrainsandThings thanks, I'm trying to find it amongst your dozens of helpful videos. :)
Tom, I like this code for the 16 Servo Board, but I'm wondering if there is a way to slow the speed of the servo down, to throw the turnouts a little slower.
I haven't found a way yet. I have to keep trying. That's been ask by many.
use a smaller angle (full/10), pause, increase the angle (add 1/10), pause, repeat until full angle is reached.
time to pause (aka sleep) is decided by you, that should do it ! /10 can be higher if you want it smoother
Great video, very informative. My question is, the from the diagram, you can run 16 servos on the PCA9685 but it looks like the UNO board will run out of room for the LED lights before that. Is it possible to run the LED's off another PCA9685? Also, do you prefer the 2 pin bicolor or 3 pin bicolor LEDs? New to this so sorry if questions have been answered before. Thanks
There are other shields and boards similar to the pca9685 that can add additional capacity to the Uno that are also I2C devices. I will be doing another video to demonstrate this in the future. I have several of the boards that can accomplish this but not had the time to do it. As far as bicolor LED. I prefer using the 2 pin, but in this application, the 2 pin requires a reversal of polarity which you can not do in this application. Either 2 separate LEDs or the 3 pin need to be used for this.
@@TomsTrainsandThings what boards do you have or would recommend for the LEDs? I plan on having 10 turnouts run with servos as shown in your video with a Red/Green 3 pin LED at each to indicate direction. Thanks!
@@TomsTrainsandThings One other question, does the UNO run off the 5V that also powers the servos on the PCA9685 or is another power source needed for the UNO, like USB?
Thanks!
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
Your probably over driving the servos past the limit. Even though they state 0 to 180 they may not go that far.
What if I only need 5 Servo need to use this driver? which is better to use arduino PWM pins or servo driver PWM pins?
Even with 1 servo on the PCA9685.
Using the PWM pins on the Arduino limits you to just 1 maybe 2 at the most. I wouldn't put anything else on that Arduino since you're pushing it;s amperage limit.
Try what I have on this video: th-cam.com/video/xT98CcJdpHI/w-d-xo.html
Do you have a sketch to control only 4 videos with leds using only an Uno without having to spend money on the pc9685?
Here is a video on controlling a servo with an Uno; th-cam.com/video/w3DL-H0fzmY/w-d-xo.html
In order to control more than 1, you would need an external power source for the servos to drive them.
Hi Tom thank you for this video very usefull for me. But tell me please how to I modify the servo speed?
Thank you. You can find more on this subject in some of my other videos.
Great video Tom. I'm getting started with DCC++ and hope to use servo actuated turnouts. Do you know if the Walters LLC Switch Machines are compatible with the Arduino PCA9685?
Don't have any, but what I've seen, it has it's own control system with decoder. Short answer would be no. The PCA9685 along with the code in the Arduino takes the place of the components on the Walthers unit.
@@TomsTrainsandThings Thanks for the quick reply. I have one on order to play with, so I'll give it a go when it arrives and report back.
@@larryo4480 Thanks
Although the PWM is set with a 12 bit value, it does not mean there are 4096 steps of control. At a frequency of 50hz you get 25MHz/(50Hz * 4096) ≈ 122 steps. This is a far cry from the advertised 4096 steps!
Hello sir, What is the safest way in using power supply assuming there's 32 servos running together at the same time,? Thank you.
Calculate the total amp draw of all the servos and use a power supply capable of handeling it. Servos drw very little amperage if your using the 9g or smaller.
@@TomsTrainsandThings thank you~
Het there! I'm starting with arduino for my new layout and this has been really helpfull!! thanks
Glad I could help
@@TomsTrainsandThings actually, I'm doing the translation for Spanish subtitles of one your videos. Meanwhile I'm learning a lot!
Thank you for doing that!
Hi Tom, how do you control the servo speed with this pca9686? Because I am using this for a school project and the speed has to be lower to be stable. Maybe you could tell me how to find it?
Try a short delay in the code under the line pwm.set, this may slow down the rotation.
Hi Tom
Enjoyed your tutorial. I have successfully built my own dcc++ using an arduino and a motor shield and can run and program engines on my test track. Now to step 2 I want is use JMRI to switch my servos using an uno and a pca9685. I was looking for the adafruit sketch you mentioned in your tutorial, however could not find it. Would you be able to direct me as where to find it? Thanks Geoff
A link to my web page is in the description, it's under /projects
@@TomsTrainsandThings Thank you Tom...found it...now to get to work
Tom, would you know of any tutorials that will connect JMRI to an arduino uno and PCA9685?
Would prefer to control servos direct from my pc thus eliminating need for a panel, wiring, led lights, and switches.
Hello. Your channel is Very informative and done well. I just got back into the hobby about 6 months ago. I'm at the stage where I'm about to build my layout. My question is,, do you think it's possible to incorporate this exact setup into JMRI? If it is not possible, then your button way will be my approach. Also I cannot find your modified script. I only have the download from Adafruit. Thanks
I found your scripts on your website. Thanks
Hello, is there any function that removes the voltage of one of the outputs of the PCA9685? It's to keep them from vibrating.
Thank you.
If your servos are vibrating, your driving them past their limit. Reduce the Max & Min figures. I show hoe to do that in another video.
Hello Tom, How many Farad is capacitor on PCA9685
470uF
With Arduino mega I dont need this extra accessory? Can I control Kato turnouts with this?
Yes you do. The PCA 9685 can handle the extra amperage needed for additional servos, the Mega can not handle more than 1 servo safely even though it has many more output pins. It's still limited to the available total amperage. If you can use servos with a Kato turnout .
Tom Thanks but I got NCE figured out, to old to go make changed.
Your welcome Arthur.
Hi Tom, Good job, I learnt a lot from this. I have a question, how do I get JMRI to talk to the PCA9685 and control turnouts?
Thanks Chris, glad I could help. JMRI is an entirely different discussion. I may cover it later on in another video.
Yea same here. I'd like to use an Arduino Mega to control DCC++ l298p shield with addition to the pca9685 all from JMRI
@@funcraft3605 see my comment to you on the other video.
@@TomsTrainsandThings which is the video where you speak how to drive PCA9685 from JMRI? you have too many videos .. please help
How do I use JMRI with this? Thanks
Haven't tried this with JMRI. This is a solution without JMRI.
This looks like a lot going on but it looks like you got it down pat thanks for taking the time to share this video I know I'm in the process of deciding which switch motor to go with should it be the tortoise Cobalt or these RC motors it's a hard decision to make the tortoises you need to solder or buy an extra piece so you don't have to solder you want to get one year warranty with it. The kobold you get lifetime warranty with everything no soldering involved then we have the RC motors what's your cheat but all the extra stuff you have to buy make them work does not seem worth it I'm looking at about 36-40 turnouts just on my way out very hard to decide which way I want to go. so again thank you for taking the time to make this video and sharing it with us
Each pca9685 will operate 16 servo motors and they can be stacked where you can operate over 900 servos. All of them can be operated with one Arduino Uno or Mega which can be purchased for $22 for the original or less than half that for a clone which I use on all my projects. Since the technology is open source, any manufacturer can make the Arduinos. There is also a board for the inputs where you can increase the capacity of the Arduino to handle more inputs such as switches and LEDs. Initial cost for the Arduino method if you purchase all name brand items; Less than $50. Servos can be obtained for under $2 pc.
Tortoise switch machines have a 9 year warranty and are located in the US. They rarely fail
Cobalt has a lifetime warranty and located in Au & UK
See my video comparing the two switch machines: th-cam.com/video/j-NPoi3gLQo/w-d-xo.html
Hi tom, how would you connect an on/off (SPST) toggle switch? would you keep the same as a push button with a 220ohm resistor (I am connecting 8 switches for 8 servos)?
Same as you would a push button. I used a PB in this demonstration because I didn't have an SPST sw to fit the breadboard.
Thank you for your help, great videos.
This is awesome, thank you very much for the video!
Thanks Joe, glad I can help.
Hi - I have an Arduino Mega successfully running DCC++. How do I get it to run the PCA9685 at the same time?
Your best bet is to go on the Trainboard forum: www.trainboard.com/highball/index.php
There are many modelers that do coding 24/7, they may be able to answer your question.
Remember, the Arduino micro-controller is designed to perform 1 task at a time. Although you can stack tasks, there will be somewhat of a delay in performance. I use multiple Arduino's throughout my layout.
@@TomsTrainsandThings Thank you.
Nice video, thanks :)
Glad you liked it!
Hello Tom. Where is the arduino code of this example? It's very good!! If you can put the link here it would be great. Greetings and thank you very much for sharing.
All code for my projects are on my web page
Hello Tom. I was searching your website and I did not find the code for this project. Would you be so kind as to pass me the link or send it to me by email? Thank you very much greetings from Argentina. dj.jav1@hotmail.com
tomstrainsandthings.com/projects/
Ok. Thank you. But where is the most important part that explains wiring and for control panel? To be honest everything else is pretty easy to find online. I would be appreciated if someone could explain me how to wire control panel with this setup and where to find code for it. Thank you in advance.
using ohmeter i rfound that the vcc and GND is connected ,,also the v+ (before i connect to anything) is my driver i sbroken already?
Sounds like you have a short.
@@TomsTrainsandThings thanks..., module is broken for sure.., if this 16ch servo shield can handle just about 5v, how about16ch servo driver shield (that stack in to arduino uno) can handle more than 5v?
@@TomsTrainsandThingsyes it is short,then i removed the capacitor and the module is not short...,
@@lokivsfortune Not sure why you had a capacitor in there. I did not show a capacitor in the diagram or video.
I could not open your website. When are you going to share the code?
I shut down the web page at the end of December due to issues with the provider. Another one will be up in the near future.
@@TomsTrainsandThings Really hope we will get your website soon. I am very new into this hobby but it looks like nobody else explains how to control servos with 9685 + LED's and toggle switches. Everybody else use JMRI directly. So I desperately waiting for your new website to get wiring diagram and other info to build same system. Thank you again for your great youtube channel.
ok what about the power supply? why do no one says what kind of power supply use for this.
5vdc power supply
Thanks
Glad to help!
Why do you use #define instead of const?
That code is from Adafruit as noted in the header. A lot of her older code uses Define, probably because of "C"
@@TomsTrainsandThings const is preferred
www.arduino.cc/reference/en/language/structure/further-syntax/define/
The good thing about Arduino is the availability of code especially from other manufacturers, all one has to do is copy & past instead of writing your own code. If it works, don't knock it. I see Define and other terms used all the time in code. It works either way!
is your web page coming back?
As soon as I get my new house in order and have time to search for a new provider.
@@TomsTrainsandThings thanks!
How long can you make the servo cable?
I haven't tested the cables for the servos but I did a test on a 30+ ft length of Cat 5 cable for Tortoise switch machine and there was no issues.
@@TomsTrainsandThings I have never used a tortoise what is the drive signal?
Tortoise uses an independent power source or operated through DCC devices not compatible with this subject. The point was the length of the cable tested.
@@TomsTrainsandThings I should have asked if the waveforms used to drive the Tortoise and the servo are similar to each other. This would make your tortoise test result useful.
Perhaps I should try some tests. Thanks.
The tortoise takes DC, the servos take PWM
Where do you get the min/max numbers?
The min & max adjusted value have to be calculated. I show how in one of my Arduino Made Easy videos.
@@TomsTrainsandThings calculated how? All I got is the spec sheet that says limit angle 200°+/-1° and centering divisions 1°. I tried random numbers and it just sounded like it was grinding so I stopped messing with it before I broke it. Where are you getting numbers to "calculate"? PLEASE
@@amelliamendel2227 have you watched my servo video in the series Arduino Made Easy? It explains it there.
@@TomsTrainsandThings I found it thank you for making these videos
I need to strengthen my base. Then I can safely build my layout
I need to rebuild mine. I'm going to build me a module or two!
Have you got software training..
Self tought!
oh boy, for the project that I'll be working on yeah this is going to come in handy for building 193 countries (in G scale, O and OO/HO).
Glad it was helpfull
Has anyone tried adding Bluetooth to this?
Not that I'm aware of. Wifi, but not bluetooth
Tom thank you your videos are a great resource especially for the beginners or the technical and programming challenged like myself. This is a great video I have been searching for this exact solution for my switch control! I am also looking at the 16 Channel Relay Board Module for Arduino as an option for controlling my switches up 32 I think. 00Rail made a video on this option but I am trying to work out how to put it together for more than 1 switch! The link to their video is th-cam.com/video/-ATOKGPQgkk/w-d-xo.html. Again thank you for the great resources and keep up the fantastic work mate! Regards Darren from Australia!
Glad I could help. I"ll check out this video shortly.
Glad I could help. I"ll check out this video shortly.