Linking Multiple PCA9685 Servo Driver Boards

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 มิ.ย. 2024
  • This follows on from the three part guide on how to connect servo motors to an Arduino using a PCA9685 servo driver and control them using JMRI. You can see the first video in the series here - • Servo Motor Control fo...
    To use more than 16 servos you'll need to link multiple PCA servo driver boards together. A few people asked me how to do this so I've put this guide together which shows how to set up the hardware and modify the sketches from the previous tutorials
    Links to servo tutorial series:
    Part 1 - • Servo Motor Control fo...
    Part 2 - • Servo Motor Control fo...
    Part 3 - • Servo Motor Control fo...
    Calibration and Servo Sketch Files to be modified: github.com/LittleWicketRailwa...
    Links to resources:
    AdaFruit Website - learn.adafruit.com/16-channel...
    Arduino software - www.arduino.cc/
    Auto485 library - github.com/madleech/Auto485/
    CMRI Library - github.com/madleech/ArduinoCMRI
    Ebay and Amazon Affiliate Links
    (Full disclosure, as an Amazon Associate and Ebay partner I earn from qualifying purchases through these links and this helps to support the channel)
    Arduino Uno:
    amzn.to/2ODZoTO
    ebay.us/HYHkvP
    Servo Driver Board (PCA9685):
    amzn.to/2NoTKo3
    ebay.us/rVpaAJ
    SG90 Servos:
    amzn.to/2N3uzY4
    ebay.us/Xvuu72
    Variable Voltage Power Supply:
    amzn.to/3b4wtj9
    26AWG Servo Cable:
    amzn.to/3daEp55
    ebay.us/L1q3FE
    Crimping Tool:
    amzn.to/3tRJXHE
    ebay.us/XE2Dxl
    Jumper Wires:
    amzn.to/2N574Os
    ebay.us/Ujpvxn
    Chapters:
    00:00 - Introduction
    01:36 - Step 1 - Solder connection to board
    02:56 - Step 2 - Address PCA9685 board
    04:36 - Step 3 - Setup test system
    05:04 - Step 4 - Update calibration sketch
    06:01 - Step 5 - Update sketch and connect to JMRI
    09:35 - Summary

ความคิดเห็น • 52

  • @davebareham1075
    @davebareham1075 ปีที่แล้ว +1

    Really good article Rob - I was messing around with multiple PCA9685 boards and wondered how they were set up in JMRI and this answered the question!

  • @brucewoods9377
    @brucewoods9377 3 ปีที่แล้ว +1

    You have a great way of presenting your tutorials! Makes it very easy to follow, understand and replicate

  • @garyvr6887
    @garyvr6887 3 ปีที่แล้ว +3

    Greater work you teaching a old man new things

  • @gjdanco4260
    @gjdanco4260 3 ปีที่แล้ว +1

    Again, another well done video...easy to understand and follow. Also, all my servos worked right after I uploaded code and created turnouts in jmri...Many thanks.

    • @LittleWicketRailway
      @LittleWicketRailway  3 ปีที่แล้ว +1

      Excellent! Love hearing feedback like this! 👍

    • @gjdanco4260
      @gjdanco4260 3 ปีที่แล้ว +1

      @@LittleWicketRailway Rob...now to set up wireless nodes using NRF2401 modules. The plan is to set up small touchscreens around the layout running jmri panel pro and changing the points with the touch on the screen rather than create control panels with miles of wires and switches...the joy of this is if my layout changes, a simple few entries in jmri layout editor and voila...up to speed....interested? I'm a big fan...keep up your good work...cheers...Geoff

    • @LittleWicketRailway
      @LittleWicketRailway  3 ปีที่แล้ว

      @@gjdanco4260 this sounds amazing and I'm definitely interested, but you're way ahead of me. I'm also in the position where I don't want miles of wires, so I was going to look into ESP32 wireless modules and try using MQTT as a way of communicating with them.

    • @gjdanco4260
      @gjdanco4260 3 ปีที่แล้ว

      ​@@LittleWicketRailway Hi Rob...there is a fellow here in Canada who has a youtube channel called dronebot workshop. What he has done is experiment with nrf2401 technology by building a remote car and controlling it with nrf2401. From what I am reading he likes the nrf2401 basically because it is bulletproof and can be used in long range applications. This might work for Model railroads. I could set something like this up and have others including yourself help operate the railroad from far away. Railroads themselves use technology where a dispatcher could be hundreds or thousands of miles away from where the train is. With jmri this might be a good thing...for instance, Im not sure where you are located...I am assuming United Kingdom could dispatch trains on my railroad in Canada....think of the possibilities. Operationally, I would think it better to rely on radio signals than have multitudes of wire and switches in a custom built control panel...then things change and you want to add a track or two and all your work building the control panel is out the window...yet with a computer screen a few changes are minor and within a short period of time you are back up and running with an updated panel. Anyways, I will put the link to his site below as well as a link to my model railroad site so you can get an idea of what I am up to. Thanks again for your great videos.
      th-cam.com/video/lhGXAJj8rJw/w-d-xo.html
      facebook.com/AllisonPassModelRailroad

  • @0blessed01
    @0blessed01 ปีที่แล้ว

    Hi Rob. Great video. I'd like to slow down servo movement. I try to implement add the code you presented in other video about changing servo speed but it didn't work. How can add this feature in 2nd part code? I appreciate you help. Thx

  • @wrrail4428
    @wrrail4428 3 ปีที่แล้ว +1

    Great Videos, I like the format and the links, very clear and easy to understand. One question; I wanted to use colour signals, can you suggest a control mechanism, I am hoping that there would be a simple Arduino method similar to servo control. Thank you.

    • @LittleWicketRailway
      @LittleWicketRailway  3 ปีที่แล้ว +1

      Thanks! Apparently it's possible to use the PCA9685s to control LEDs, someone else asked about this. I'm going to have a play with this in the next couple of weeks and see how easy it is to get it working with JMRI. I've not used light signals before, so this will all be new to me.

    • @wrrail4428
      @wrrail4428 3 ปีที่แล้ว +1

      Thank you, I am looking forward it

    • @LittleWicketRailway
      @LittleWicketRailway  3 ปีที่แล้ว +2

      I knew nothing about colour light signals, but after reading up, I've just set up 4 LEDs to work like a UK 4 aspect signal and got it working with the servo drivers. I set it up as a signal mast in JMRI and it's working perfectly. I'll post something next week, got a couple of videos in the pipeline that I need to get out first.

    • @wrrail4428
      @wrrail4428 3 ปีที่แล้ว

      Thank you very much, I am looking forward to viewing it and your other new videos

  • @mattsynth
    @mattsynth 3 ปีที่แล้ว +2

    Another great post, thanks. Would there be a way to link the servos, JMRI and facia toggle switches all together as one system. I believe I can use the toggle switches as sensor’s in JMRI.

    • @LittleWicketRailway
      @LittleWicketRailway  3 ปีที่แล้ว

      You mean like have an actual physical switch to control a servo (e.g. throw a point or change a signal) as well as being able to click in JMRI?
      You can set the switch up as a sensor in JMRI, just like the microswitch on the point motor in the servo video. You could then use Logix to link that sensor to the turnout (or whatever that servo is connected to).
      My concern would be that you could have a scenario where JMRI is attempting to activate the servo in the software and this is conflicting with the position of the toggle switch.

    • @mattsynth
      @mattsynth 3 ปีที่แล้ว +2

      @@LittleWicketRailway Take a look at “Megapoints Controllers” on TH-cam. This person has made his own company doing just that. The buttons he has are real nice with built in led feedback. It is all too confusing to me so I may have to use his system if I decide to go that way. I just hooked up (2) pca9685 today thanks to your video. Thank you once again.

    • @LittleWicketRailway
      @LittleWicketRailway  3 ปีที่แล้ว

      I had a quick look at the Megapoints Controller site, looks like some really interesting stuff. Also, I was watching a video from McKinley Railway (th-cam.com/video/FrTPYf3XyoI/w-d-xo.html) they have a panel at their London station where they appear to be able to have both computer and human control (8:55 in video). It looks like they're able to isolate the computer when they want to manually control something. It's not clear if the computer can do automatic route setting of the points or just train control, but is that the type of thing you're looking for? I'm also not sure what software they're using and how much they've had to customise it to get that override in place.

  • @paulwillis866
    @paulwillis866 3 ปีที่แล้ว +1

    Hi Rob. Many thanks for this.
    I notice that in your counter, you stop at 16. In the original sketch you stopped at numServos, but I can't see where you've commented on this change in the tutorial.
    Thanks

    • @LittleWicketRailway
      @LittleWicketRailway  3 ปีที่แล้ว

      Hi Paul!
      Thanks for watching.
      I used numServos originally when there was only 1 board and a few servos connected because I didn't want the code loop going through all 16 connections unnecessarily. It made the code marginally more efficient when it only looked at the connections being used.
      However, where there are multiple boards all 16 positions are likely to be used on at least the 1st board, so I dropped the numServos variable and had the code loop through all 16 positions on all the boards. Didn't want to accidentally skip some servos.
      Hope that makes sense.

    • @paulwillis866
      @paulwillis866 3 ปีที่แล้ว +1

      Hi Rob.. Thanks for the swift reply. I was in the process of connecting 3 boards, and making the servos to the third board move slowly for N gauge semaphone signals. I think I incorporated all the little snippets! Anyway, it works, so thank you. I slowed the movement rate up by decreasing the counter increment and putting a 5mSec delay in the loop. Seems to work fine.

    • @gjdanco4260
      @gjdanco4260 3 ปีที่แล้ว

      @@paulwillis866 interested in what you are doing as I too would like to slow my servos. Would you be kind enough to share your code?

    • @paulwillis866
      @paulwillis866 3 ปีที่แล้ว +2

      @@gjdanco4260 Many thanks for your interest.
      I am sure there are many elegant ways of doing this, and it would be best to start from Robs coding to make the servos on your extra boards move normally.
      I then adjusted the rate of movement on board 3 with the following code:
      //Board 3
      Status[i+32] = (cmri.get_bit(i+32));
      if (Status[i+32] != PreviousStatus[i+32]){
      if (Status[i+32] == 1){
      for (int j = Close[i+32]; j = Close[i+32]; j=j-1) {
      pwm3.writeMicroseconds(i, j);
      delay(5);
      }
      }
      PreviousStatus[i+32]=Status[i+32];
      effectively making the servo count up and move to each position incrementally, with a 5millisecond delay between each position.
      Hope this helps.
      Interested to see other comments

    • @paulwillis866
      @paulwillis866 2 ปีที่แล้ว

      @TonyRogerson
      Many thanks for your contact and apologies for the delay in replying.
      Your error message is almost certainly because you did not declare the variable PreviousStatus.
      If you look carefully at Rob's revised code, it is an extra variable declared early on in the coding. The link to the modified coding is in the video description above.
      Hope this is helpful

  • @luiscardenas182
    @luiscardenas182 3 ปีที่แล้ว +1

    Hi, amazing video. I wonder if that circuit can handle 12v servos ?

    • @LittleWicketRailway
      @LittleWicketRailway  3 ปีที่แล้ว

      Hi Luis, I believe that you can use 12V for the servo power supply (learn.adafruit.com/16-channel-pwm-servo-driver?view=all) see the section on power 👍

  • @rossord
    @rossord ปีที่แล้ว

    Hi Rob. Can you let me know where to find the Servos_2 sketch you use at 6 mins in?

  • @leswillis6463
    @leswillis6463 8 หลายเดือนก่อน

    Hi Rob your guides are superb but I have got a slight glitch I cannot get past linking multiple servo driver boards . I have checked and checked but it keeps saying void loop ( ) error expected } at end of input I put the braces bracket at the end and then changed it to next line with no luck. It identifies line 123 which is where the bracket is. Any help would be great please. Thanks

  • @michaelzaminer4550
    @michaelzaminer4550 2 ปีที่แล้ว +2

    Does it matter if I connect them the other way around, so that the side with the soldering is connected to the other side with the soldering and the side without is connected with the other one ?

    • @LittleWicketRailway
      @LittleWicketRailway  2 ปีที่แล้ว

      Hi Michael. When you say soldering do you mean for the change of address on the boards? I don't think it should matter what order they are connected in.

  • @dthead
    @dthead 2 ปีที่แล้ว +1

    Thankyou for your videos ! Wondering wit this PCA9685 how far between the arduino and the first board, and between each PCA9685 if linking them ?

    • @LittleWicketRailway
      @LittleWicketRailway  2 ปีที่แล้ว

      Good question. Quite far I would think. What distance are you thinking?

    • @dthead
      @dthead 2 ปีที่แล้ว +1

      @@LittleWicketRailway 10ft between the arduino and the first pcs9685, then another 6ft to a 2nd.

    • @LittleWicketRailway
      @LittleWicketRailway  2 ปีที่แล้ว +1

      @@dthead I think that should be fine. I had a quick Google and on the forums others have achieved this.

  • @davebareham1075
    @davebareham1075 ปีที่แล้ว +1

    I've built a sensor board and turnout control using a little wicket guide but what if I wanted to add led signals to the same project ? Can it be done or would it be simpler to use (for example) a separate uno (with a pca9685) and a CMRI connection ?

    • @LittleWicketRailway
      @LittleWicketRailway  ปีที่แล้ว +1

      You can add signals to the same project using another PCA9685 (need to change the frequency of the board for the LEDs) and CMRI th-cam.com/video/rJhZK-XgEec/w-d-xo.html

  • @klaasmastenbroek773
    @klaasmastenbroek773 6 หลายเดือนก่อน

    great video but i cannot find Calbrate_Multi_PCA9685. Where can i find this?

  • @senyanekit
    @senyanekit หลายเดือนก่อน

    Any ideas why the servo does not respond to signals?

  • @rossord
    @rossord 2 ปีที่แล้ว +1

    I have successfully calibrated 10 servos on PCA9685 board 1. However, I cannot seem to calibrate any of the 11 servos on board 2 which is daisy chained. I have modified the board address to 0x41 on the calibration sketch, but irrespective of the servo number I select, servo 10 on board 1 gets recalibrated! All indications suggest the both boards are correctly connected. Any comments gratefully received.

    • @LittleWicketRailway
      @LittleWicketRailway  2 ปีที่แล้ว

      Have you addressed the 2nd board using the solder connections on the PCA9685?

    • @rossord
      @rossord 2 ปีที่แล้ว

      @@LittleWicketRailway Hi Rob. Yes I have soldered across the gap and checked continuity.

    • @rossord
      @rossord 2 ปีที่แล้ว

      I am isolating the original PCA and connecting the second one directly to the Arduino. I have readdressed the sketch back to 0x40. At present, although power lights are illuminated, no response to calibration sketch. Looks like a dud PCA, but I will investigate further.

    • @rossord
      @rossord ปีที่แล้ว

      Hi Rob. Can you let me know where to find the Servos_2 sketch you use at 6 mins in?

  • @kennedyparnell8559
    @kennedyparnell8559 2 ปีที่แล้ว +1

    I added 2 more servo driver boards to this project for a total of 5. I am losing communication after the 3rd board with JMRI. I can turn on all the signals via the code so I know it is the communication with JMRI.
    I am assuming the problem is with the nodes in JMRI.
    Any help? Thanks!

    • @LittleWicketRailway
      @LittleWicketRailway  2 ปีที่แล้ว

      Hi Kennedy. Are you using multiple PCA9685 boards connected to a single CMRI node or multiple CMRI nodes each with their own PCA9685 boards?

    • @kennedyparnell8559
      @kennedyparnell8559 2 ปีที่แล้ว

      @@LittleWicketRailway Just one CMRI Node. After some digging it looks like I may need to change the Node type to CPNODE to increase the output bits. It makes sense the communication is dropping off after the 3rd board. 3 Boards is 48 outputs.
      Does anything have to be changed in the code when I change the node type?
      Thanks!
      Kennedy

    • @kennedyparnell8559
      @kennedyparnell8559 2 ปีที่แล้ว

      I figured it out. Change node type to “CPNODE” then add as many cards as needed until you get the correct number of out bits. Then match these in and out bits in the code for arduino.

  • @scruffysautorepairandmore-2213
    @scruffysautorepairandmore-2213 4 หลายเดือนก่อน

    I can not see how you modified the sketch its completely blurry. Also doesn't seam to have a modified download that I can look at and study.