Servo Motor Control for Model Railways Part 2 of 3 - Servo Point Motor

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 พ.ค. 2024
  • This is the second part in a three part guide on how to connect servo motors to an Arduino and control them using JMRI in order to throw points or operate semaphore signals on a model railway.
    This will work for both analogue and digital layouts and is a step towards layout automation.
    It's also very cheap compared to other methods of operating points such as using digital accessort decoders, capacitor discharge units (CDUs) and solenoid motors.
    Links to other parts of the series:
    Part 1 - • Servo Motor Control fo...
    Part 3 - • Servo Motor Control fo...
    Calibration and Servo Sketch Files: github.com/LittleWicketRailwa...
    Links to resources needed in tutorial:
    JMRI software - www.JMRI.org
    MERG - www.merg.org.uk
    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
    Chapters:
    00:00 - Introduction
    01:48 - Safety
    02:11 - Components & Tools
    04:21 - Step 1 - Upload calibration sketch
    05:47 - Step 2 - Mount servo and connect to point
    06:48 - Step 3 - Calbrate range of motion
    10:32 - Step 4 - Modify and upload sketch
    11:38 - Step 5 - Download and install JMRI
    12:39 - Step 6 - Connect Arduino to JMRI via CMRI
    13:51 - Step 7 - Create turnout in turnout table
    15:05 - Step 8 - Setup turnout in layout editor
    16:59 - Summary
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    Tonight I installed and tested my first servo for turnout control, following you tutorial! I’ve been watching this tutorial over and over since you published it, trying to build up the nerve to do it. And, I was thisclose to not trying. Turns out it wasn’t that hard or expensive at all. Twelve more turnouts to go. Thanks for the awesome tutorial!

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

    I always wanted to know how to connect an Arduino to JMRI and control a servo. Thanks for the great info!

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

    Thanks for the fantastic tutorial. I got my servo turnouts configured with C/MRI following your 'Servo Motor control' part 1 and 2.

  • @JohnSmith-bz7yd
    @JohnSmith-bz7yd ปีที่แล้ว

    one of the best and most useful channels of the internet
    thank you Rob for making my journey into the world of digital so easy and amazing at the same time

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

    AWESOME, simply AWESOME. I have tried and quit trying this for the last 3 years, you sir are AWESOME, thank you so much

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

    This is my first go with JMRI, I've managed to control a servo motor from a simple layout/panel on the JMRI interface thanks to your instructional videos, can't wait to have a go at some more advanced stuff! Thanks Rob! I particularly like the way you can jump to the part of the video that you need! Brilliant!

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

    Well explained, look forward to part 3 .
    Regards Robert

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

    A great tutorial Rob going to watch No3 later well impressed, thanks for sharing your knowledge with us.

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

      Thanks appreciate that. It's been a steep learning curve for me this year and I found all this stuff pretty intimidating to start with so wanted to share. I can't take much credit for designing the software or systems, I've just tried to pull it all together into one place. I wish I'd known about servos before I installed the solenoids with accessory decoders!

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

      Hi Rob I bought a project layout that had servo's on, but individual controllers, trying to sort the wiring out is a nightmate as there was no wiring diagram. Seriously thinking of starting again and going the way you have shown. Probably be quicker and I will not whats what. Your channel just popped up in my reccomend list, pleased it did, intend to work my way through your orher playlists as well. Cheers Steven

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

    Another great video, Rob. I've followed all your videos and now been able to add a reverse loop using a cheap twin relay as an output triggered with a logix attached to sensors in JMRI following this video. I wouldn't have been able to do any of this without your tutorials. Fantastic stuff.

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

      Thanks Andy! Glad to know it's being put to good use!

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

      This stuff is addictive!

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

      This is very similar to what I'm now looking to do, after being inspired by Rob's videos. The servo motors look great but the bit that's missing for me is polarity switching on all my electrofrog points. I'm looking into attaching a relay board (probably lots of them!) and modifying the script (although there may already be one out there) to switch the frog polarity when the turnout is thrown.

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

    Very well done and well explained. You are a good teacher.

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

    Many thanks for the work you put into your excellent videos. You are one of a handful TH-camrs who have showed me new ways to do things that will revolutionise the way my layout will run. I signed up for MERG for their block detector, and I will be using DCC++ and C/MRI with Arduinos on my re-creation of Grimsby and Cleethorpes in the 1960s. I could not afford the kind of operational electronics I want using commercial DCC. Now I get to spend those $100s on lovely locos and rolling stock instead of on the invisible plumbing to make them run.

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

      Love hearing this 😃 Hope you enjoy playing around with all the new tech

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

      @@LittleWicketRailway oh for sure. I already have a couple of Nanos, I ordered a PCA9685 and 10 servos and I will start on Cleethorpes station tomorrow.

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

    inspired by your calibration sketch, i've built a battery powered version with the arduino nano, potentiometer and a 0.9in oled, makes setting up the points very easy. Great series of videos, am working on a nano cmri node as well now based on your CMRI network videos.

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

      This sounds amazing! Would you be happy to share your creation? Full credit to you obviously👍I think a lot of people would find this useful.

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

    Excellent tutorial - followed it to the letter and it all worked fine (apart from the bits that I didn't follow first time around - probably and age thing).

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

      Thanks! Haha, following the instructions first time, where's the challenge in that? 😂

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

      Whilst appreciating that your aim is to automate as much as possible, I would like to set up a servo on a set of points that is operated by push button. Can your sketch be adopted to use a push button and if so can you provide any coding or pointers. Thanks

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

    I think our inner geeks are aligned! Although yours is far more advanced than mine😄. I seriously must have a go at this. Fantastic how to guide. Well done buddy and thank you.

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

      Haha, you are not alone! Turns out there are plenty of us geeks out there and a lot of them are far more advanced than I am! Thanks for watching 👍

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

    Great series. Learnt so much.. love to have you on my channel in the near future

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

    Hi Rob Just got onto your videos about using servo motors for points - great stuff. This is certainly a better way to go than solenoid motors, and you don't get that cannon fire sound going off. One thing though, is there a way of slowing down the motion of the servo's?

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

    Great tutorials! Many thanks!

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

    Rob your videos are really useful & I'm about to setup my control this way but wondered what do you use to house the Arduino & servo control board?

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

    Great tutorial...thanks :)

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

    Thanks Rob for your video's, very helpful - however I would like some help please. Setup 1st servo - no problem - that's working my 1st turnout / Point - happy days.
    Now added 3 more servo's, changed the number of servo's in the 'Servo' script to 4 and run it. Followed same procedure for adding Nodes using the sequence option is CT1001, CT1002......
    Problem is only No 1 works - any clues as to what I have done wrong please?

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

    Mensa test comes to mind , but very interesting

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

    Hi Rob. I am newish to modelling and COMPLETELY new to JMRI, CMRI and Arduino.
    I've been watching your videos and have decided this is the way I want to go to control my layout. I have "built" the DCC++ controller and am now looking at controlling points, signals and lighting. My signals are currently controlled by a "Megapoints" controller and I would like to keep this as I like the "bounce". Could I use a MOSFET connected to the Arduino to act as the switch connected to the Megapoints controller? If so, how would I wire this up?
    Lastly (for now :-) ), would it be possible to modify the turnout and sensor sketch to adjust the speed of the servo, to get it to act more like a "Tortoise" point motor?
    Really enjoying your highly instructional videos!

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

    Forget the calibration, use flexible piano wire rather than stiff wire and set up the servo so that the flex of the wire absorbs any over-movement of the servo arm.

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

    Fantastic Rob Thank you. Got it all going well, looking forward to learning how I can slow the movement down to a more realistic speed. I do remove the springs in the points so they move slowly rather than 'click' over. I'm sure it will be just line in the sketch somewhere??????? Cheers Mate. Reg from Oz

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

      Hi Reg, it's up to you with the springs, I know a lot of people take them out as it makes things smoother, but once they're out they can be a nightmare to get back in and I know Hornby don't sell spares if you lose them.
      If you want to slow the motion of the servo down then you'll need to introduce a loop. Check out this video where we use a simple loop to control the fade on an LED which is basically the same principle. th-cam.com/video/rJhZK-XgEec/w-d-xo.html
      If you've got a lot of servos connected to the same Arduino then you might need to code your sketch in a clever way such that the whole system doesn't have to wait until the servo has finished moving to do anything else. Multi tasking on the Arduino is an interesting subject, more info here - learn.adafruit.com/multi-tasking-the-arduino-part-1

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

    Hi nice video, do you know any board for dynamixel motor (MX series) may be similar as the PCA9685 board that works well for servo motors. currently, I can run the dynamixel servo using the OpenCM9.04 or dynamixel shield with arduino UNO, but I would like to control MX motor with arduino nano. Thanks in advance if you have any information about it and apologies, I know this is not related to the video.

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

    Excellent video! How do I get a copy/file of the Arduino sketch? Any help will be greatly appreciated.

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

    Very nice tuto: the first time i understand how JRMI works with your many examples. An other congratulation about your pure English which is comprehensive for a frog eater!
    To make test do you have a reference for DIY simple block occupation (DCC+).
    Regards.
    Pierre

  • @plymouthrovadventures.646
    @plymouthrovadventures.646 ปีที่แล้ว

    Hi Rob. A question... What is the Library #include used fore ?? Thanks so much.

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

    Followed this tutorial, got a little bit lost. Found out the hard way that all arduino files need to be in the same directory., so I had to do a bit of housekeeping. Also had to take off DCC++ as only one USB port left. Seems to work so far. Looking forward to part 3.

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

      I've just seen your post on part 3. Glad you got it working, hopefully it wasn't too frustrating. You can use additional external USB ports if you're running low on connections, but it needs to be a powered system.

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

    Hi great videos, thanks. I need to add 16 servo points. I want to save them in numerical order but have no idea on how to achieve this using Arduino and JMRI - I’ve done some digging but can’t final anything - can you help at all please? Thanks, Rik.

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

    Do you have or intend to have a video on setting up a Dcc++ TrainEx loco roster for loading onto an android phone?

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

    Rob,
    Where can I get that white plastic servo mount. I assume it has provision for a micro switch for feedback status of the turnout>
    Bob S - Cleveland, OH

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

    Love watching your videos. I’m new to the hobby could you tell me when you measure a 15inch radius bo you measure from the inside rail or the outside rail or from the middle of the track it’s self .thank you

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

      Hi Kevin, for Hornby curves the radius is measured to the centre of the track, between the two rails, but I'm not sure about other manufacturers. 15 inches in cm is 38.1 and that's close to being a 1st radius Hornby curve which has a radius of 37.1cm. If you google track geometry then you'll probably find some useful diagrams. What type of track are you using?

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

      Thank you very much.your videos are well put together .

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

    Hi Rob, thanks for explaining all this in such an easy to follow way.. Unfortunately I can't read the scetches you're using to activate the servo as I'm watching your videos on my phone & the text is just too small, but what I'd like to know is can you change the speed of the servo throw so that it operates at a slower more prototypical speed rather than snapping across??

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

      Hi Stu, yes you can, check.this out: th-cam.com/video/6sAGNx8bkQU/w-d-xo.html. I'll see if I can add the sketches to the description or to my github for you, might take me a few days though.

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

    Rob love your video's. I do have a question for you. On your servo set up is there a way to show the actual position on your turnout in JMRI without throwing every servo before you start running.

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

      Thanks Rick. You can tell JMRI the position of the turnouts using feedback sensors. These are usually microswitches fitted to the side of the point motor (example here - th-cam.com/video/_xQefWpiklU/w-d-xo.html). Pros of fitting feedback sensors are that you're always sure the servo has moved into the correct position and you don't have to set them all on start up. Cons it's extra effort because you need the switches, wiring and sensor inputs. You can get fancy servo which have position feedback built in, but these are quite expensive and I've never used them.

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

      @@LittleWicketRailway I just had a thought. I should be able to add a non looping routine at the very start of the Arduino code to preset the turnouts to any position that I prefer to start with. I just need to work on my C++ programing skills before I do that. I will also need to work with JMRI to set a starting position that matches the Arduino code position. Again thanks so much for the help!

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

      @@rickcaldwell7154 you can write scripts in Python that JMRI wil run automatically on start up or on the click of a button that will do what you've suggested. Check out www.jmri.org/help/en/html/tools/scripting/ex_set_turnouts.shtml

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

      @@LittleWicketRailway Rob thanks so much that will do the trick!

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

    hi rob any chance you can do a video using peco pl10 point motors please . As i have large ready built layout with more than 50 peco point motor and don't wish to change thanks

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

    Hi Rob, really it is best to put a loop, z, or omega in the servo connection rod. Does the Arduino code stop sending pulses after a while? If it doesn't and you have the servo set too tight, the servo will sit there consuming high current trying to get the servo to goo to a position the linkage and set point won't be able to achieve. Have a look at the MERG Servo 4 for info.

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

      Hi Greg, agreed, should have done that here, normally my motors are mounted vertically under the board, so there's side flex in the wire. You can also "disconnect" the servo at the end of the moment, but I didn't in this code.

  • @JohnWilson-tt2vp
    @JohnWilson-tt2vp ปีที่แล้ว

    On my layout I want to control each of my points by a switch for each, I am also using Arduino and a PCA9685 board along with servo fitted to each point, can you advise me of what type of switch I need and provide the software I need to make the Arduino work, here's hoping that you can help as I have watched all your video's but they do not specify what I need. Hoping you can help
    John Wilson

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

    Still going through these technology videos. I assume you're using Conductive Frog points. Would it be possible to setup a MicroSwitch to be activated by the server to change frog polarity?
    Keep up these awesome videos! Giving me a lot of confidence while coming back to the hobby!

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

      Hi! I used Hornby points on my old layout which were insulfrog, so I didn't have the polarity issue. My next layout will use electrofrog. You could definitely setup a micro switch to control polarity. This subject is on the ever growing video subject list.

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

    Excellent ideas shown here. I wonder if there is any way to convert this to use the outputs from a Shuttle controller? I have a simple layout which has two points, one each end which can then shuttle three sets of stock from end to end. It is fully analogue and needs to be stand alone, no PC's anywhere near!.. The points are CDU driven when a change of state happens. It is the Blocksignalling PTS1 unit. I guess I need to say when a voltage appears on this line (Say input 1) throw and when a voltage appears on another line (input 2) reset to original position.. Anyone help please?

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

    you could take the spring out of the point and slow the servo down, so that you have a realistic movement on the point.

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

      Yeah! On the next layout I definitely plan to slow the points down to a realistic speed. Hopefully because the servos are so powerful I won't need to remove the spring which might be a bit of a faff.

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

    That Wonderfull I now have my first on working but I would like to control the speed of the throw I have tried working with the WMF but it seems not to be helping is there some code that could be added to control the speed?
    Regards Derek

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

      Hi Derek! Congratulations on getting it up and running. You need to add a loop to the code that changes the position of the servo. I think there's an example of a loop at the end of the coloured light video. The same type of loop used to fade the light can slow the point movement. Let me know if you can't find it and I'll try to dig out the code.

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

    Your video is interesting and full of information, thank you.
    I do have concerns about implementing this, however. I'm not convinced that I want to use a PC computer to operate my model railroad. It seems to me a PC would be a distraction. I would use servos controlled by the Arduino to operate the points, but would rather use push buttons to control the servos.
    The Arduino only has 6 analog inputs for push buttons. My knowledge of the Arduino is limited - is there a board I could add to increase the number of analog inputs?
    Just out of curiosity, has anyone ever used a Raspberry Pi to run JMRI?
    Thanks.

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

      Hi Ned. Totally get that computer control isn't for everyone. Check out the setup in this video (th-cam.com/video/_xQefWpiklU/w-d-xo.html) which is push button operation alongside JMRI, but you could ditch JMRI out.
      An Arduino mega with a sensor shield gives you loads of inputs and PCA9685s give you loads of outputs. You can link multiple Arduinos and PCA9685s together for as many inputs/outputs that you need.
      You can also run JMRI on a raspberry pi rather than your actual PC, then access it via phones/tablets.

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

      @@LittleWicketRailway Thank you for your prompt and knowledgeable reply.

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

    Very informative. The subject matter was clearly explained. I guess part 3 will cover the speed at which the servo moves to make the point action more realistic ?

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

      Thanks! Part 3 is using the servos to control semaphore signals. I wasn't going to cover the speed of the point change or adding bounce to the semaphores, mainly because I don't have anything prepared at the moment and I'm so far off that level of realism on the rest of the layout right now. Might need a part 4...
      Also, I usually need the points to change as quickly as possible because I'm terrible at remembering to set them and only realise at the last minute 😂

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

      @@LittleWicketRailway But with a fully automated systems with the IR sensors etc you shouldn't need to forget to set a point :)
      I'm sure there would be a variable in that code that sets the rate the PPM signals increase by for the given frequency of the frame rate? - so should be fairly easy to code

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

    Hi Rob
    Great video watched on my smartphone. How do you insert/ upload the calibration sketch.
    Thanks
    Andy

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

      Hi Andy! You upload the calibration sketch to the board first, find the servo positions and they you have to reupload the servo sketch with those positions in them. I know it's not an ideal solution having to upload sketches multiple times, but it's a process you should only ever need to do once for each servo and then it's sorted forever.

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

      HowDo you download the calibration sketch as it does not show in the description below thank you
      Great series and easy to follow many thanks Barry

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

      @@barrygreenwood7674 the calibration sketch is in the same area as the main sketch in the GitHub repository: github.com/LittleWicketRailway/ServoControl/blob/master/Calibration.ino

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

    Sorry I am struggling to upload the calibration file. How do I do this?

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

    Rob... this tutorial is fantastic! I am a novice at best with Arduino but have been trying to learn. I have tried for years to find a tutorial that showed how to use servos for point motors (turnouts for us yankees) and connect them to JMRI, this was just what I needed. I havent had much luck with DCC++, my decoders (Soundtraxx) would not work correctly with it and like I said I am not very good with arduino code and therefore not good at troubleshooting the issues with DCC++. as a result I have gone back to connecting JMRI through my Digitrax system (which I already have and it works fine for me). The question I have is: can I connect this turnout control through JMRI with a Digitrax system and not DCC++?
    I would appreciate any guidence that you could give me on this,
    Thank You
    Paul

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

      Hi Paul! Thanks!
      I can't say for certain as I haven't tried it myself and I've never used DigiTrax, but I think that should work. JMRI can have multiple connections to different systems. Keep your turnouts on the CMRI addresses and use DigiTrax for your loco control.

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

      @@LittleWicketRailway
      Thanks for your reply. I actually figured it out. When I watched your video it was kinda late at night and I was tired and not processing everything. I woke up the next morning and connected it... it works great.
      Thank you
      Paul

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

    Hi Rob. Great videos as always. Having difficulty with the calibration sketch - keeps on giving me an error message that .h is not found. can run the upload but when going to adjust the servo phase, nothing happens. any suggestions? cheers

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

      Hi Chris, think you're missing a header file. Is it "xyz.h" missing or just ".h"?

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

    Hi Rob, Great tutorials. I've completed Part 1 and considering I'm 71 and this is my first experience with Arduino and JMRI I am quite proud of myself but you have lost me on step 2.I can copy your piece of code but do not know how or where to paste it. Am I pasting it in the sketch we did in part 1 if so how and where? Please forgive the ignorance but I really want to complete this tutorial.

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

      Hi rob just echoing @IBOFSGUBK comment. I am also confused where to find the calibration bit. I completed part 1 now stuck

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

    Rob, when I verify the sketch I keep getting a series of errors. 'Serial' does not name a type Any clue as to what I've got going on?

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

    Hi Rob
    Thanks for the reply.
    Do you just copy and paste your calibration description ? Where abouts do you upload the sketch to
    Many thanks
    Andy

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

      Hi Andy, download the calibration sketch from Github, open it in the Arduino IDE and upload it to the Ardunio in the same way you upload the main sketch.

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

    Just subbed found this all fascinating ,I went down the route of block signalling product with point indication leds a nightmare to wire up ,maybe this would have a challenge. Regards Fred the dc dinosaur. ps great for all the young guys who are dcc and tech orientated . Pps 1 only use an iPad Pro

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

      Thanks for watching 👍 I think whichever method you go with the wiring is a nightware, although I am looking at how easy it is to start using some wireless components.

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

    Like Martin below I am struggling getting your calibration sketch. I'm probably thick as 2 planks. Video 1 went faultlessly, but unlike the test sketch in V1, there is no button to just say download to my PC. I've tried cut and paste into a new Arduin IDE file but when that compiles I get error messages. I'm new to all this, and have no doubt any body. Basically how do I get your Calibration Sketch into my library?

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

      Hi Simon, are you able to copy the code from here into your Ardunio software? github.com/LittleWicketRailway/ServoControl/blob/master/Calibration.ino
      You'll need to save it and then should be able to verify and upload just like in video 1. Let me know how you get on.

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

      Fixed. Hope this makes sense, but my IT son helped me based on what Martin's problem was. To help others:
      As I could find no way to directly down load your sketch I cut and pasted the text of your sketch into a blank file in the IDE editor. When I saved this, it gave the libraries folder as the default location. My son said that was the problem and needed to set up a folder called sketches (say) and save it in there. As soon as I put it in there the and did upload all the errors went away. (Apparently my son said they were only warnings because the sketch was in the libraries folder.)

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

      @Simon Turner Thanks for sharing, I bet other people have had this issue 👍 Thanks to your son for sort it all out!

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

    Good video this looks like a great solution to expensive servo options. Would you be willing to share your stl files for mount? I can print them

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

      Thanks! I'm afraid that's the MERG (www.merg.org.uk/) servo mount and I don't have access to the STL files. It looks like there are a few good options on Thingiverse though if you search for "servo point motor".

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

    Hi Rob, I'm 76 years young and really new to JMRI and Arduino's so how would I add more servos into the sketch and into JMRI?

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

      Im stuck at this bit too, tried uploading individual sketches renaming them and putting the idividual movement values in each time, and tried inputting each servo on 1 sketch but no joy, can only get the first servo working?

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

    Sweet I got it working kind of, when I use the final sketch I don't get the same result on the servos as I do with the calibration. It's like it's lacking power and does not switch between close and throw like it does when I am calibrating. Has anyone else run into this issue?

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

      Ended up being my power system, once I got that fixed and recalibrated and updated the sketch bam it all worked. Great video! Lesson learned to always keep my voltage tester handy in the layout room.

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

    Great series's, as a newbie to model railways and Arduino I've got the the part of uploading the main sketch and I am probably a bit slow but I can't see the " lists below" I found the previous one after reading the comments, can someone point me in the right direction please.

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

      Hi Nigel, are you looking for the links to the sketch and other video etc.? These are in the description under the video. These are the links to the other parts in the series:
      Part 1 - th-cam.com/video/ayOoUkdjHtg/w-d-xo.html​
      Part 3 - th-cam.com/video/iif6l52lLks/w-d-xo.html
      Apologies if I've misunderstood.

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

      Ah!! yes found them, didn't realise there was a drop down at the bottom, I'll get the hang of it (hopefully )

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

    I have struggled through Part 1 and Part 2 up to 'servos' sketch. This I cannot get to upload without the error 'redefinition of void setup()'. It is probably due to my lack of knowledge, but I managed to solve other problems. Can someone help please as I have been unable to find a solution. I have in excess of ten points that I would like use Arduino to control, so any help will be appreciated.

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

      Hi @rogerfairall3640. I have the same problem, like you I have lots of points to do . But I just can’t get over this error, I have been on it for three days now, even going on to the Arduino forum, I see you posted a yr ago, have you managed to get it working

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

    I can't find 'test turnout' in the edit

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

    Where did you get the Servo Bracket?

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

      Hi David, that is from MERG (www.merg.org.uk/), but I'm sure there must be other options out there.

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

      @@LittleWicketRailway Thanks. I really enjoy your channel you have got a lot of useful information. My son and I are looking to do a new MR layout using the same techniques you go through. We may have an easier time doing the coding, I have been a developer for 37 yrs and he has been programming Arduino for the last 10 years.

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

      @@davidallen803 you guys will have no problems with that much experience between you!

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

    On trying to verify and/or uploading the compilation sketch I get error messages
    as below. From Github, as your link, I chose Add File via Uplink for Calibration and then copied and pasted the code into the Arduino IDE. I then ran verify and obtained all the error mesages and also tried Upload and again received all the messages. What am I doing wrong? The error messages are too long for this comment but they seem to revolve around redefinition of 'Adafruit_PWMServoDriver pwm' and highlights a line of code that is #include
    Regards
    Martin Wilkins
    Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Arduino Uno"
    C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\marti\OneDrive\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=2341_0043 -ide-version=10813 -build-path C:\Users\marti\AppData\Local\Temp\arduino_build_624433 -warnings=none -build-cache C:\Users\marti\AppData\Local\Temp\arduino_cache_668360 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\marti\OneDrive\Documents\Arduino\calibration\calibration.ino
    C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\marti\OneDrive\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=2341_0043 -ide-version=10813 -build-path C:\Users\marti\AppData\Local\Temp\arduino_build_624433 -warnings=none -build-cache C:\Users\marti\AppData\Local\Temp\arduino_cache_668360 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\marti\OneDrive\Documents\Arduino\calibration\calibration.ino
    Using board 'uno' from platform in folder: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\arduino\avr
    Using core 'arduino' from platform in folder: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\arduino\avr
    Detecting libraries used...
    "C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\marti\\AppData\\Local\\Temp\\arduino_build_624433\\sketch\\calibration.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
    Alternatives for Wire.h: [Wire@1.0]
    ResolveLibrary(Wire.h)
    -> candidates: [Wire@1.0]
    "C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\libraries\\Wire\\src" "C:\\Users\\marti\\AppData\\Local\\Temp\\arduino_build_624433\\sketch\\calibration.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
    Alternatives for Adafruit_PWMServoDriver.h: [Adafruit_PWM_Servo_Driver_Library@2.4.0]
    ResolveLibrary(Adafruit_PWMServoDriver.h)
    -> candidates: [Adafruit_PWM_Servo_Driver_Library@2.4.0]
    "C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\libraries\\Wire\\src" "-IC:\\Users\\marti\\OneDrive\\Documents\\Arduino\\libraries\\Adafruit_PWM_Servo_Driver_Library" "C:\\Users\\marti\\AppData\\Local\\Temp\\arduino_build_624433\\sketch\\calibration.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
    Alternatives for CMRI.h: [madleech-ArduinoCMRI-d5d4a1e]
    ResolveLibrary(CMRI.h)
    -> candidates: [madleech-ArduinoCMRI-d5d4a1e]
    "C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\libraries\\Wire\\src" "-IC:\\Users\\marti\\OneDrive\\Documents\\Arduino\\libraries\\Adafruit_PWM_Servo_Driver_Library" "-IC:\\Users\\marti\\OneDrive\\Documents\\Arduino\\libraries\\madleech-ArduinoCMRI-d5d4a1e" "C:\\Users\\marti\\AppData\\Local\\Temp\\arduino_build_624433\\sketch\\calibration.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
    Alternatives for Auto485.h: [madleech-Auto485-3ff0421]
    ResolveLibrary(Auto485.h)
    -> candidates: [madleech-Auto485-3ff0421]

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

      Hi Martin,
      Any time you see the line "#Include" the sketch is pulling in code from a library. I think the error is saying that you're missing the Auto485.h library.
      Just double check that you've done this step from video 1 which installs the 2 libraries that you need: th-cam.com/video/ayOoUkdjHtg/w-d-xo.html

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

      @@LittleWicketRailway Rob, the files are all installed but the sketch will still not verify or load. Is there a folder structure that I should be using? where are all these files held?
      Martin

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

    Great videos. I have managed to drive my trains with arduino, JMRI and my iPhone. The servos for the turnouts work fine, but at the end of the race they don't disengage and are constantly making noise. With the normal arduino code I know how to stop them, but not with the CMRI code.

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

      Hi Miguel, there should be a way to disconnect the servos at the end of the move to stop any jittering. It's not something I've looked into or tried, but I've read that the following code is effectively a disconnect (pwm.setPWM(servoNum, 0, 0);) or you might be able to solve it using hardware (learn.adafruit.com/adafruit-arduino-lesson-14-servo-motors/if-the-servo-misbehaves).

  • @shuntdaddy8301
    @shuntdaddy8301 8 หลายเดือนก่อน +1

    HI ROB
    How do I get the calibration set up ? I have opened the Arduino program (mines IDE 2.2.1) and the first part works fine now I’m stuck on part two the calibration bit 🙁. Am I missing something

    • @ShaneGaffey-hd4ng
      @ShaneGaffey-hd4ng หลายเดือนก่อน

      Same here ,I'm getting a fault
      Exit status 1
      Compilation error: redefinition of 'void setup()'
      Can't see what's wrong

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

    Exhausted and Confused? I have been through this so many times I've lost count. All 4 servo's work using the calibration script but when I run the Servo script and modify it for 4 servo's only the 1st servo works whatever I do. To the extent swapping out Arduino.
    This is the revised Servo script, if anyone can throw some light on this it would be appreciated. (FYI - I am using Arduino IDE 2.2.1).
    #include
    #include
    #include
    #include
    #define CMRI_ADDR 1
    #define DE_PIN 0
    #define numServos 4 //The number of servos connected
    Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(); //setup the board address 0
    Auto485 bus(DE_PIN); // Arduino pin 2 -> MAX485 DE and RE pins
    CMRI cmri(CMRI_ADDR, 24, 48, bus);
    int Status[numServos]; //Create a table to hold the status of each turnout, signal, etc.
    int Throw[numServos]; //Create a table to hold the throw value for each servo
    int Close[numServos]; //Create a table to hold the close value for each servo
    void setup() {
    Serial.begin(9600);
    bus.begin(9600);
    pwm.begin();
    pwm.setPWMFreq(50); // This is the maximum PWM frequency
    //SET THE THROW AND CLOSE VALUES FOR EACH SERVO BASED ON THE CALIBRATION PROCESS

    //Servo connection 0 - point motor
    Throw[0] = 1300;
    Close[0] = 1600;
    }
    void loop(){
    cmri.process();
    for (int i = 0; i < numServos; i++) {
    Status[i] = (cmri.get_bit(i));
    if (Status[i] == 1){
    pwm.writeMicroseconds(i, Throw[i]);
    }
    else {
    pwm.writeMicroseconds(i, Close[i]);
    }
    }
    }
    -------------------------------------------------------------------------------------------------------------------------------------------------

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

      Could you let me know if you got this working? I can calibrate but when I add the servo sketch and add it to JMRI I can't get any of the servos working.

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

      @@joshuasrandomness999 I found the problem, jump to the next part of the video ie '3' and you should be able to work it out. for each servo you need to enter the relavent information ie
      //Servo connection 0 - point motor
      Throw[0] = 1300;
      Close[0] = 1600;
      //Servo connection 1 - point motor
      Throw[1] = 1300;
      Close[1] = 1600;
      //Servo connection 2 - point motor
      Throw[2] = 1300;
      Close[2] = 1600;
      Etc
      Hope that this helps?

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

      @@lestaylor7767 Thanks I already had that in my code. But still not getting them to work consistently. When I did get them to move they didn't move like they did when I calibrated them. They moved just a little bit, I'll keep trying different things. I appreciate your response.

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

      Got it! Ended up being an issue with my power supply, at times it would work, and other times nothing. Fixed that and now it's all working beautifully.

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

      @@joshuasrandomness999 Great news - onwards and upwards. I know how these issues are very frustrating and time wasting.