Model Railway Automation using JRMI Dispatcher and Simple Signal Logic

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ค. 2024
  • In this video we bring to together the systems we built in the previous videos (DCC++ base station, sensor hub, block occupancy detection and servo control) to start automating a simple layout.
    Links to previous videos:
    DCC++ Base Station: • Model Railway Digital ...
    Sensor Hub Part 1: • Model Railway Sensors ...
    Sensor Hub Part 2: • Model Railway Sensors ...
    Block Occupancy Detection: • DCC Block Occupancy De...
    Servos Part 1: • Servo Motor Control fo...
    Servos Part 2: • Servo Motor Control fo...
    Servos Part 3: • Servo Motor Control fo...
    This is probably the simpliest way to implement automation using the JRMI built in tools. However, the subject of automation is vast and there are lots of ways of achieving it, this is just a demonstration of a particular set of tools in a signal piece of software.
    We cover three types of automation from basic signalling that would work on an analogue layout (using appropriate block occupancy detection) under manual control to full computer automation.
    1) Simple Signal Logic - which will automatically set signal aspects based on the turnouts and blocks they protect.
    2) Using dispatcher to allocate blocks to a train and automatically set signals and turnouts along the route for us to manually drive along.
    3) Using dispatcher to take control of a train and automatically drive it between two locations whilst controlling points and signals.
    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
    Arduino Mega:
    amzn.to/3poEBQK
    ebay.us/Zl3sDT
    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
    IR Sensors:
    amzn.to/2LQJmVF
    ebay.us/rnR5wn
    Servo Wires (male to male):
    amzn.to/3alIrFS
    ebay.us/HfgTaO
    26AWG Servo Cable:
    amzn.to/3daEp55
    ebay.us/L1q3FE
    Crimping Tool:
    amzn.to/3tRJXHE
    ebay.us/XE2Dxl
    Chapters
    00:00 - Introduction
    02:47 - Steps
    03:51 - Step 1 - Setup the Layout
    06:14 - Step 2 - Setup JMRI
    18:58 - Step 3 - Simple Signal Logic (SSL)
    23:42 - Step 4 - Using Dispatcher with Manual Control
    32:24 - Step 5 - Using Dispatcher with Automated Trains
    39:49 - Conclusion
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @terrybailey2769
    @terrybailey2769 5 หลายเดือนก่อน +1

    Thank you, that is one of the best descriptions of dispatcher I have seen.

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

    Great stuff! Keep them coming🚂.

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

    Thanks for the quick response to my question.
    I have enjoyed all of your TH-cam video’s
    Keep up the good work

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

    Thank you. Your videos have been something of a revelation to me over the last day or two. Despite being a JMRI user, I'd never looked into block detection or automation because of how expensive it seemed to be. I'm a bit of a tech geek and have countless Raspberry Pis and Arduinos lying around so am half way there already and really quite excited to get stuck in, once I have a new layout up.
    You've brightened up what was otherwise a pretty miserable week, most of which I've spent tucked up in the most extreme eaves of my loft, trying to fit insulation. In an unseasonal heatwave. Seeing what's possible from your videos has given me that extra bit of impetus to get up there and get it finished though. It'll be worth it!

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

    Really enjoying your video's on automation Rob learning all the while. Great series.

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

    Excellent vid Rob, really well explained yet also not overly dumbed down! Subbed and liked :)

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

    Very good video. Many thanks 🙏

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

    Brilliant, thank you.

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

      You're welcome. Sorry it took so long to get this out.

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

      Little Wicket Railway worth the wait, so comprehensive

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

    amazing - thank you!

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

    very educative video well done keep up the good work

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

    Fantastic video. Most instructive. I look forward to learn more. Thank you.//Anders.

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

    Ht Rob. Being new to this, there's a lot to take in all in one go. Consequently, several readings are required in order to be sure of what I need to do, what I need to buy and what I need to spend in order to obtain an end result that is understandable, cost effective and .....above all, WORKS! I like the way you present the growth of a control system, especially with the modified "Technology" format: it makes things far easier to pinpoint - Great Stuff. Thanks Steve

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

    Amazing content.

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

    Brilliant introduction to JMRI Automation. Shows a lot of flexibility and possibilities. Well narrated as usual! :)

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

      Thanks for watching! I discovered that I really struggle to say "implement automation", I kept saying "implement automentation"!?! 🙄

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

      @@LittleWicketRailway Hi Rob. Have been mulling it over for a couple of days when you mentioned in this video not using a debounce delay for the micro-switch. Technically it would be best to use a debounce for the switch as well considering the potential for a incorrect reading from the switch flicking states whilst being activated. Although the likelihood is low it could still happen - a delay of 1/10th second (100 milliseconds) is more than ample. I would also use the debounce for both the 'on' and 'off' state of the switch.

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

      @@robertblackburn6719 I think you're right, wouldn't hurt to have a short delay and would eliminate any potential flickering. I suppose there's also a time delay between the switch deactivating and the point actually moving into position, so you could use the delay to reflect that. More important if you've slowed the servo down for a more realistic switching time. Wouldn't want the computer sending the express flying through before the blades were in position.
      Althought if you've got flickering then it suggests that something needs to be physically adjusted, either the switch has moved on the mount or the point isn't going through the full range of motion.

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

    "Never going to flicker 'cause it's a switch" - Switch bounce is the reason for having the de-bounce delays in the first place. Physical imperfections on the contacts of a switch always cause a certain amount of bounce as the contacts either make or break contact, due to tiny sparks forming between microscopic peaks on the contact surfaces. On an oscilloscope you'll see it as a bit of noise as the switch is operated. Doesn't hurt to use 10 milliseconds or so of de-bounce delay to avoid problems. But another really useful video. Have been watching all your arduino based projects with great interest.

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

    Nice video. Working on my layout, and have most of it wired up with block detection and switches. Will automate once the signals are in.
    This is helpful to see first hand results from using the options.

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

      Thanks for watching, I hope you get it all up and running soon 👍

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

    Great video and explaning.
    HC Treintje Herman Belgium.

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

    Thanks!

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

    Thanks Rob. Great stuff. A couple of bits I will have to do to understand better. Like others have said switch bounce suppression would be good. I will look to do this exercise virtually using the simulator, MERG ,and Digitrax over TCP in the systems. The simulator lets me set things up and add physical bits by changing the system name of an entity as I go along. MERG - as that will be my Layout control bus. Digitrax over TCP as I have chosen the Digikeijs DR5000 and the DR5088RC to give me 16 Railcom detection zones for the staging yard (converted to transponding by the DR5000). Train Tracking as you showed in your later video will follow things around. As CBUS will look after switch bounce, I could do as you did for those sensors - no delays. Thanks again.

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

    Hi Rob. great videos, You inspired me to start building my railroad, thanks for all your great videos very informative. I would love for you to do a video on how to build a speedometer to
    check locomotive speed. keep up the good work Cheers..

  • @user-gw9bb8th6b
    @user-gw9bb8th6b 8 หลายเดือนก่อน

    Dear Rob
    This is my first time writing to you.
    Please forgive me for asking this question in poor English from Japan.
    Now that I am 65 years old and retired, I finally have the time to seriously work on JMRI.
    So, I discovered Rob's videos about two years ago and have been watching them with Japanese subtitles.
    So, I'm trying to create autonomous driving using JMRI, but I can't quite understand it and it doesn't work well.
    The operating environment of the railway model is
    1.The size is HO, and several vehicles are equipped with DCC sound decoders.
    2.The command station uses Ecos50200.
    3.The rail is made by KATO. Digitrax DS51K1 is attached to the turnout.
    4.I am connecting to Ecos50200 using s88-N Train Detector (16 sections).
    5.I am using JMRI Ver5.4 on my PC and connecting it to Ecos50200 using a cross cable.
    Now comes the question.
    1. When the DS51K1 is attached to the turnout, the S88-N detects the S88-N even though there is no vehicle on it. Is this a problem?
    2. Rob's video, the signal is explained using SSL, but what would happen if SML was used? This is a slightly more complicated case where multiple points are connected.
    3. I don't think it's possible to directly connect turnouts with Layout Pro, but the track segments that go between turnouts will become blocks, but you can create sections and services (no s88-N detection). Are you having problems when installing?
    4. It is possible to manually move the vehicle by setting it in Dispatcher, but the vehicle startup function key will not turn on automatically. The screen shows "Running", but the vehicle does not move. Could you please tell me what the problem is?
    5. In the future, will it be possible to set up signals, turnouts, and lighting with Ecos50200 and Arduino?
    I have asked a lot of questions, but could you please explain to the best of your knowledge?
    thank you.
    From koyabu

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

    Hi Rob. Thanks for a great set of videos. I have set up the movement sensors for my layout, and wanted to add the feedback sensor to the points. I can see form the video that there are only 2 cables coming from the micro switch. Could you tell me how you have connected this to the sensor hub? Many thanks.

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

    Great video series Rob. Very informative, thanks.
    One thought: from the TrainController manual, you are strongly advised to have the points in no block - i.e. they're just wired to the bus directly, not through a current sensor. Would that advice hold true for JMRI too, or do the points need to be in a detectable block? (If they do, I've got some rewiring to do :( )
    Cheers!

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

    Fantastic series. Have you automated the entire layout? A video of that implementation even if it was an overview would be cool.

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

      Hi Chris. I had automated my old layout, but this was before I started sharing information on TH-cam, so it wasn't in the same way that I've described in my videos.
      On my old layout I used IR sensors rather than block occupancy current sensors. Instead of using the built in JMRI automation tools I wrote custom python scripts that I would run in JMRI. These set routes and controlled train throttles based on timings, positions of points and when sensors further down the track had last been activated. The scripts would also "listen" out for certain sensor activations and use these to turn sounds on/off. I made life really quite difficult for myself, knew there must be a better way of doing things, hence the videos.
      I know it's not ideal, but all the trains and points in this video (th-cam.com/video/xBlwivX0rpg/w-d-xo.html) were running under the automated scripts. If I'm honest the IR sensor/script system was very unreliable. If a sensor didn't activate properly, a point motor didn't fire when it was meant to, a train derailed, a loco overran a stop sensor, a short occurred, etc. then there was likely to be a disaster.
      Block occupancy current sensors, RFID tagging, servo point motors, JMRI automation tools, etc. all make things more reliable and easier to control. The new layout will be built with these improvements. The build is currently delayed because I'm trying to decide where/if I want RFID readers and how I want to implement it.

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

      @@LittleWicketRailway Thanks Rob. Cute little video. Interesting you initially used JMRI scripting to automate your layout. I have a couple of follow on questions if you don't mind. Did you research LCC vs. C/MRI and Traincontroller or iTrain vs. JMRI? I am leaning towards C/MRI and JMRI for both cost and the ability to do some electronics and coding. I am still in the research phase. I'm looking forward to the build out of your new layout.

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

    Great series of videos help me a lot. I can get a automatic dispatcher to run my train, however the second time i go to run it, the signals are not allowing the train to run, i.e set to red when i check the SSL i notice on the points signals the values of the sensor it is protecting now includes the forward and reverse direction sensors ! when i clear 'all' of them i can run again in Automatic mode from dispatcher, but the forward and reverse sensors are added back into the SSL for the turnouts , which seems to set the lights red and prevent the engine moving. Any thoughts ? Thanx

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

    Great video.
    Next... how about a video on timetabling train movements, so users could set up a full hands-off running session? :-D

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

      The dream is to be able to program a schedule into a file with timings, decoder addresses, start block, end block, etc. and feed that into JMRI dispatcher. I'm 99% sure it's possible, but it's not a tool that's built into JMRI, it would need to be coded and I'm to great at coding. My brother on the other hand is pretty good at coding, so I might be asking him for a favour...

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

    I'm loving the video's and this is all new to me, but some question have popped up. Can I use a separate DCC to to drive the trains and still be able to control the routing? Also, can I setup stuff like grade crossings, and traffic signals ?

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

      Hi Ron! You can pretty much do whatever you want. On my previous layout, I split the DCC signal into 2 and has one going to the track and one to the accessories (points, signals, uncouplers, etc.). I also had a switch that allowed me to change the track from digital to analogue. Because the DCC feed to the accessories was separate I could run an analogue loco on the track, but still control the accessories using DCC and JMRI. Thanks for being a member!

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

    I really like your videos. All very well explained and easy to understand. In this video you are using 3 Arduino's (1 for servo's, 1 for sensors and 1 for driving the loc). In JMRI preferences, i see 1 DCC++ and 1 CMRI connection, each using a single COM port. How is the third Arduino connected to JMRI ?

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

      Hi Tom, the 3rd Arduino has the sensor shield on it and works using a script that is run in JMRI. The COM port for that Arduino is specific in the script. There's no connection setup in JMRI. However, I've since moved onto connecting this sensor shield Arduino as a CMRI node for two reasons. 1) it means you don't have to run a script in JMRI and 2) it's easier to access the pins which can be used as inputs and outputs.

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

    Fantastic series of videos on Arduino, well done
    If I have 3 Arduinos (1 for sensors, 1 for servos and 1 for control) can they be connected to my USB on the computer via a USB spliter or do I need 3 USB ports on the computer?

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

      Hi Ian, think you emailed me about this, but just to confirm as I think a few people might also be interest, yes you can use a USB hub/splitter, but it would need to have a separate power supply, something like this: amzn.to/3ohIx69

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

    Thanks for a wonderfull instructionvideo on automation in jmri. I was just wondering if you could exchange the end stop ir-censors to the same current sensors as the blockdetection has?

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

      I'm not sure and I don't have my test layout setup at the moment. I'm pretty sure that you don't have to enter forward/reverse stopping sensors, they're optional. If you leave them blank then the automation either ends once the final block is detected or when the final block is detected and the previous block is clear. So if you just want the automation to end once the loco is in the final block then leaving the stopping sensors blank might do the trick. Obviously the risk is that your train might not be in quite the right position, you'd only know it was somewhere in the block.

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

      Ok, thank you for answering. I will see if it works when I've put up my testtrack.

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

      @@LittleWicketRailway I have added virtual end switches using LogixNG. The input is then the block sensor and I use a delay to activate the virtual end sensor.
      One issue is that you need to check the state of the block sensor again when the delay is finished to avoid wrong states.
      Another issue is to use Always execute in the logix.

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

    How about 2 or 3 locomotives in doble track, and the middle there is a Double X-Over ?. About signal, My plan is using 3 aspect signal which is the signals at the station are manually controled by the switch button. But, the signal at To-the-station track is special because going-straight signal and going-turn signal are different, Red and Green on the top with 2 diagonal white LEDs that differentiate will going turn or will going straight.
    How to make it by using JMRI ?. I didn't get that logic to build that.. :(

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

    I am new to this arduino , does one arduino board run everything ? I.e trains ,points, signals, sensors, or do you have to have one arduino for each system?

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

    Suppose you had a sensor at both ends of your Turntable Bridge and you wanted to be able to automatically move a locomotive out of the roundhouse and onto the main. Could dispatcher do that or is logic the way to go?I have two Wifi sensors MS600 and MS601. I would need either sensor to detect a locomotive coming onto the turntable and stopping when the locomotive gets on the turntable. The Heljen turntable is DCC controlled and I suspect JMRI can keep track of the head and tail of the bridge. The two sensors were added by me and designed by a good friend.

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

      I think you would need to write a script for this. I don't think dispatcher would be able to handle setting the bridge position automatically.
      Script writing isn't too hard. Controlling trains and "Listening" for changes in sensors is easy.

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

    First time seeing this software but oh my, I can see why it’s free 😂
    The UI interface is appalling. I’m assuming the other paid alternatives are much better?

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

    i have a question if i have engine throttle on one uno with motor shield which connects to track
    a second mega with sensor hub and several sensors
    a third mega with the servos
    how does each mega and uno communicate with jmri running on pi connected to uno to update the track layout from layout editor?

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

      Hi Jerry, I'm running JMRI off a laptop rather than a Pi so it might be different, but I've got a powered USB hub for my 3 Arduinos. Windows then allocates each board with an individual COM port. Then you can set each connection in JMRI.

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

    For blocks that aren’t a dead end, (for example a loop layout) would you need the infrared sensors still? Or say if you wanted the train to stop at a station or industry you’d have to have a sensor and or an action to use with it to say pause the train?

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

      For a loop if you tick the restart when done box in Dispatcher and put in a delayed start that might work (I've not tried it), otherwise you could put in an action to pause the train within the transit.
      Without a stopping sensor sensor I think the train would just stop as soon as JMRI saw that the final block was occupied and it was clear of the preceding block. That might be fine, especially if the last coach/wagon on the train was being detected, but it could also mean that the train didn't stop fully in the plaform or in the correct place.

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

      You can tell Dispatcher to stop a train a few seconds after it has entered a section or block. This can be tweaked so your train stops where you want it to, without the need for spot sensors. You can program other effects including changing the speed, handy if you want to accelerate after your train has cleared the platform. That said, getting everything right so dispatcher works is very very difficult.

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

    Hi. Can you write a program using arduino to automate a point to point setup with automatic return, using motor driver and sensors? can any viewers do this?

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

    Hi. I have been trying to find some servo mounts for the micro servos you have been using in your automation videos but have been unable to find any online. Do you have any info on them? Cheers

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

      I've been using ones available through MERG or 3D printing my own, so I'm not bought them from anywhere else. I'll do some investigating for you.
      How many do you need?

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

    Would this work for Lego trains?

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

    Hi Rob, me again lol.
    If I don't have any physical signals can I just use all virtual to control automation.
    Cheers

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

      Yes, all signals can be virtual if you want, JMRI just needs to have all the required signals in place for the automated logic to work. The virtual buffer stop signals are the ones I always forget to add. I think if most modellers tried to accurately signal their layouts then it would look very cluttered.
      If you're starting to get into signalling then it's also worth checking out Signal Mast Logic as well as Simple Signal Logic which is shown in the video.
      And remember to save your files in different versions occassionally as the signalling logic can very easily go wrong, especially if you need to delete a turnout, block or signal which is being used as part of the logic. The file can say it's corrupted and refuse to open. That's when it's good to have a working version to go back to. If you do ever get a "corrupt" file then don't panic, it's fixable using notepad if you know where to look.

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

      @@LittleWicketRailway cheers Rob. Very good advice about saving under different named, I've been saving everything under test layout so nothings separate, bad idea.
      I've just come across another problem, I have micro switches set to 2 point servos. Both show up and change in the sensor table. When I set the feedback option to one sensor and sensor number one of the points just constantly changes and the other goes back to its previous state after you change it. Will have another go tomorrow night see if I've done something wrong.
      Thanks for the reply.
      Steve

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

    Hi Rob - Just watched the videos about block detection & sensors using JMRI. As ever brilliant videos with excellent presentation & clear explanations. I was inspired by your Digital controller, so I built one & this works so well. I did ask if you had built a wireless system without the need for a PC & a router.....
    Using the excellent DCC++EX website I built a system using a MEGA with a L298P motor driver shield & a separate ESP01s device (acts as an access point(AP) similar to a router) connected to RX1 & TX1 on the MEGA. Using Engine Driver App on an Android phone & WiThrottle on an iPhone. By changing the channel in the Command Station sketch config.h file I have this working without any problems. I then bought a MEGA with an ESP8266 (acting as an AP) device on-board & again using either Engine Driver or WiThrottle I now have this working. The connection between phone & the ESP sometimes drops out but quickly recovers. Again, many thanks for your excellent videos.

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

    If you wished you could do away with the micro switch. I've been trying a few things my self based on your CMRI code. I noticed that the servos always get reset to the same state on boot up of the whole system. Hence the state of the servos is always known. After a bit of thought, I modified the Arduino code to include a virtual sensor to "feedback" the state of the servo. See code sample below: -
    // PROCESS SERVOS
    // Assume servos start on bit 0 which corresponds to output address 1001
    for (int i = 0; i < numServos; i++) {
    Status[i] = (cmri.get_bit(i));
    if (Status[i] == 1){
    pwm.writeMicroseconds(i, Throw[i]);
    if (i == 0) {
    // set above comparison to the number of the turnout servo
    cmri.set_bit(8, 0); //Bit 8 = address 1009 in JMRI, Virtual Sensor 9
    }
    }
    else {
    pwm.writeMicroseconds(i, Close[i]);
    if (i == 0) {
    // set above comparison to the number of the turnout servo
    cmri.set_bit(8, 1); //Bit 8 = address 1009 in JMRI, Virtual Sensor 9
    }
    }
    }
    Straight forward enough, just set the virtual sensor to either 0 or 1 depending on servo position, and set up the new sensor in JMRI linked to the turnout. You can then use the micro switch for frog polarity switching. It works really well.