Arduino, CMRI and JMRI - Part 2 - Adding Outputs

Поділитися
Вставка
  • Опубліковано 18 жов 2024

КОМЕНТАРІ • 75

  • @shanestrains4724
    @shanestrains4724 Рік тому

    This whole series has been immensely helpful to me. Thank you for sharing the Arduino sketches, taking the time to make these tutorials and posting them.

  • @scottthompson7605
    @scottthompson7605 3 роки тому +1

    Another fantastic video. I didn’t realize there was so many different ways to control lights. Your tutorials are so easy to follow. I got more rolling stock today, i’m looking forward to building my first layout. Ive watched so many UA-cam tutorials over the last few months trying to learn everything I need to know. This channel is my joint first favorite.

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому +1

      Thanks Scott! I really appreciate that. You're definitely doing it the right way round, learn what you need to know and then get stuck in building the layout. You'll save yourself time and money doing it this week. Let me know how your build progress goes 👍

  • @anatoliidudko7029
    @anatoliidudko7029 3 роки тому

    Thanks for not forgetting about mimic panel. Can't wait to see the video. Can stop saying that your video tutorials are the best I was able to found on youtube.

  • @tomhsclass2674
    @tomhsclass2674 3 роки тому

    Hey Rob,
    I've built the dcc++ base station, it was a great success!
    Also managed to do the combined sensor and servo hub; I had 3 servos, some led's and a relay module connected! I set them up in layout editor simulating point control with frog polarity change( a pair of points changing simultaneously) and mimic board led's, oh and a sensor triggering an led! And finaly, I managed to run the back and forth sketch!
    Amazing!!!
    Thanks again
    best regards
    Tom

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому +1

      Hi Tom! Love comments like this. Sounds like you've totally nailed it 👍😀👏👏

  • @alanlomax1271
    @alanlomax1271 3 роки тому +1

    Great video! I just found this channel in the last few days and well let's just say my Amazon order is in the post! Can't wait to get started.

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому

      Thanks! 👍 Let me know how you get on. This Arduino stuff can be a bit addictive, you'll be automating everything.

    • @alanlomax1271
      @alanlomax1271 3 роки тому

      @@LittleWicketRailway Wilco. Automation has been my job for 35+ years (12 inch to the foot scale) and now that I am retired - of course it will migrate over to the railway!
      In the past I have tinkered with PIC microcontrollers and lately the raspberry Pi but this Arduino is just so 'plug and play' it looks like Lego for automation! Your videos have opened my eyes to it so thanks once again.

  • @modelrailwaytheeasyway9743
    @modelrailwaytheeasyway9743 3 роки тому +2

    This script works perfectly for me thanks this is being installed into the layout at the moment and it’s has been tested with 11 servos and 10 infrared sensors so far. Will be reading the micro switches built into the 3D printed servo mounts in the next few days so this code will come in handy. May run out of pins on the arduino Mega lol so think the next video will be very interesting for next steps. Keep up the great work.

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому +1

      Thanks John, glad to hear it's all up and running for you, I best get cracking on that next video then! 😃

    • @modelrailwaytheeasyway9743
      @modelrailwaytheeasyway9743 3 роки тому

      @@LittleWicketRailway I take it you are going to go down the bus road to get more arduinos connection rather than using usb. This seems to be getting a lot of interest in other UA-cam channels. Esp32s are a good alternative to arduino not sure about the latest ones though. I have used one to control a water top of system using Matt which works well. Look forward to the next instalment.

  • @masterdplos2689
    @masterdplos2689 2 роки тому +1

    Felicidades Rob. Increíble trabajo. Te he estado siguiendo y en serio tus videos sobre Arduino/JMRI/CMRI me han sido de gran ayuda. Muchas gracias!! 👏👏👏👏 Espero que en un futuro cercano nos digas como hacer un booster DCC con Arduino.
    Congratulations Rob. Incredible job. I have been following your channel and your Arduino/JMRI/CMRI videos have been very helpfull. Thank you very much! 👏👏👏👏 I hope that in the near future you tell us about making an Arduino DCC booster.

    • @LittleWicketRailway
      @LittleWicketRailway  2 роки тому

      Thanks! I'm building a DCC booster from MERG. I'll look into Arduino based boosters, but I'm a bit nervous when it comes to boosters because there's the potential for high power.

  • @maxlarsen1468
    @maxlarsen1468 3 роки тому +1

    Nice and clear! just need part 3 then im ready to start my layout.

  • @hantercans
    @hantercans 3 роки тому +1

    Thanks Rob... another great aid to refer to.

  • @dannydzware2023
    @dannydzware2023 3 роки тому +2

    Thanks a lot. Great explanation.
    What would you suggest how to connect light signals?
    Is there a better way than dcc?

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому +1

      I still don't have the perfect answer for this. If you want simple on/off light signals then you can connect them to output pins on here. If you want to fade the lights then you'll need Pulse Width Modulation. I'm looking at addressable LEDs which be a better solution. I need to decide relatively quickly as I want light signals on my future layout.

  • @ichs
    @ichs 3 роки тому +2

    Fantastic work Rob. One question I have is switching polarity on electro-frog turnouts when using servos via cmri/jmri (I don't think you've mentioned this?). Could this be done using the relays as in this video?

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому +2

      Hi Iain! Thanks!
      I don't currently have electrofrog points, so don't speak with any real experience here, but I would think a SPDT switch mounted next to the servo would be better than a relay. The MERG servo mounts have space for these and I'm sure other mounts will too. The common connection goes to the frog and the rails are on either throw. As the servo arm moves it activates the microswitch and flips the polarity.
      My reasons for not using relays would be:
      - They're more expensive than switches
      - Greater chance of cause a short if they fail, activate before servo does
      - They require a current to stay active. If lots of points are active then that's quite a bit of current.
      - They make a clicking noise
      - They would require connections to the Ardunio requiring wiring and output pins
      The other option I need to look into would be electronic "frog juicers" that detect a short circuit and rapidly flipthe polarity before the base station trips. My gut feel is that I'm against anything that needs a short circuit to occur for it to function because generally short circuits are to be avoided. The commercial units are also quite expensive and I don't know what the DIY options are like.

    • @ichs
      @ichs 3 роки тому +2

      @@LittleWicketRailway Thanks Rob that’s a very considered and helpful answer. I have seen the micro switch mounted option and suspect I’ll go that route, I guess it seemed a bit too ‘mechanical’ with the chance for wear over time?
      Thanks again, your tutorials on this are the best on UA-cam.

    • @RogerDiscombe
      @RogerDiscombe 3 роки тому

      @@LittleWicketRailway Rob. I can only re-iterate what Iain and others have written. I have found your videos very interesting and very easy to follow. Amazing stuff! (Why don't other people split their videos into chapters?)
      I am writing this as I had exactly the same query as Iain about switching the polarity of electrofrogs. Having seen my videos I have decided to go down the DCC and eletrofrog route.
      Haing now seen your videos I have also decided to use Arduinos.
      I would be interested to hear if you do any work on electrofrogs.
      Many thanks
      Roger

  • @colintelfer2756
    @colintelfer2756 2 роки тому

    HI Rob, i have progressed from the videos where you have seperate sensor hub and servo driver to the combined, finally got part one to work, had a break and came back excitedly to find the set up from the end of video 1 Arduino, JMRI and CMRI wouldn't work on reopening JMRI, is there some reinitialising process todo to "reconnect" the arduino to the JMRI? all the settings fo rthe turn out and sensor are there, any suggestions?
    Regards
    Colin

    • @colintelfer2756
      @colintelfer2756 2 роки тому

      I deleted the entries and re entered the details for the sensor, and it worked however once again on closing down and restarting jrmi it doesn’t work.

  • @chrissharp6845
    @chrissharp6845 3 роки тому +1

    Thanks for the bigger font size in the IDE. I can read it now. Are you going to try creating a RS485 bus for the CMRI nodes? I've been looking into this, but have yet to give it a go. If you are using a different system I will just as curious. Cheers

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому

      That's the plan 😁 kit's all arrived, just got to plug it all in. I'd also like to experiment with what makes the best node. Nano, uno or mega with or without a sensor shield. Not worked with nanos much.

    • @chrissharp6845
      @chrissharp6845 3 роки тому

      @@LittleWicketRailway I have a garden railway, so the distances between devices is an issue, thus my interest in RS485. I also have tramway which I'm going to add detection and automation to. It's on four baseboards (with a 5th on the way). I'm thinking that one Nano per baseboard, with just 4 wires (DCC and RS485) connecting each board. Baseboards would need a rectifier+regulator circuit to provide power to the Arduino from the DCC power bus, or I run a 12v bus in another 2 wires. Good luck with your project.

  • @oceancity1042
    @oceancity1042 3 роки тому

    So far so good, I am looking at adding more than one servo, can you give guidance to what lines in the sketch require to be amended / added . If this has been covered previously apologises but can you give a reference .
    Regards
    Robert

  • @macg9940
    @macg9940 2 роки тому

    A great video with helpful tips. Instead of using one output per LED, I would find it helpful to use LED pixels with WS2812 controllers (Neopixel Daisy Chain). This would allow different colours (for signals or a busy signal on a panel) and reduce the cabling to a minimum.

  • @scottthompson7605
    @scottthompson7605 3 роки тому +2

    Would you consider making a Video about adding a H bridge to the Arduino to increase the amperage? A lot of people seem to be struggling with the limitations of 2 to 3 Amps typically available on most motor shields. I think a H Bridge can theoretically go up to a maximum of 40 Amps (more likely about 20 Amps max)

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому +1

      Hi Scott, you mean like a booster for the DCC signal? It's not something that I'm looking into at the moment. Building a booster that could handle 5 Amps for example, might not be that hard. However, building a booster that can handle 5 Amps and includes proper short circuit protection to prevent damage to locos or worse fires is a lot harder. I wouldn't feel comfortable suggesting anything that might not be safe. DCC++ has short circuit protection built into and, as you say, the motorshield is current limited, so I feel that's pretty safe.
      If you're really comfortable with DIY electronics then check this out www.trainelectronics.com/DCC_Arduino/DCC_Booster/ It looks to have current sensing built into the code which suggests that it will detect shorts, but it's not my project and I've not tested it.
      Or MERG do a booster kit that you can self assemble which definitely includes short protection.

    • @scottthompson7605
      @scottthompson7605 3 роки тому

      @@LittleWicketRailway Yes that’s right I was talking about boosting the DCC signal to enable running more trains. I didn’t consider the additional short circuit protection I would need so thanks for suggesting it. The links you provided have also been very useful.

  • @alexs5700
    @alexs5700 3 роки тому +1

    top work as per usual cheers rob

  • @biloxiflee
    @biloxiflee 3 роки тому

    Great job, I've been catching up on all your arduino vids as I am doing my early research before starting my prototyping for my soon to begin layout. In was not considering JRMI until I started watching your vids. A few questions if you don't mind.
    I plan to use 3 light block signals for the many blocks I am designing. My original idea was using many nano's connected together to utilize sensors and logic to control the block lighting when a train enters a block and while it is in the block and exits to the next block. You mentioned JRMI, in this video, could control lighting based on multiple sensors, Does that mean there is logic to have a signal go red upon entering a block and passing a sensor and stay red until the train passes the next sensor and return the original signal to green?
    I also plan to use dwarf signals to identify the switch positions as well as simultaneous led's on a control panel. I may automate servos on turnouts eventually but will have switches on my panel to do that outside JRMI as well.
    Is there any comprehensive "training" vids on JRMI you know of. Thanks again for your great work into this area. I see world's of possibilities upcoming.

  • @davebareham1075
    @davebareham1075 Рік тому +2

    As always Rob, great video BUT I can't seem to get JRMI to recognize the IR sensors changing state from inactive to active. Are there any troubleshooting options on the DCC++ basestation so I can see the traffic coming in from the meg. I've using a v1.3 sensor shield - does that make any difference? If I create a sketch on on the 2560 I can see the sensor triggering locally so I am fairly confident the 2560 and the sensor shield are working. Many thanks if anyone can give me any clues - ta
    UPDATE: I left the project and came back to it later. I followed the options for CMRI and everything now works fine :) Happy days!

    • @LittleWicketRailway
      @LittleWicketRailway  Рік тому +2

      Glad it's working 😃, but strange that it didn't work for you first time 😕

    • @davebareham1075
      @davebareham1075 Рік тому +1

      @Little Wicket Railway probably because I didn't have a scooby what I was doing :)

  • @jimpurney2927
    @jimpurney2927 3 роки тому +1

    I am new to your channel and model railroading. I watched your videos on using and setting up servos with jmri and was successful in duplicating Your process and am going to implement into my layout. Now with these new videos I am planning on obtaining a sensor shield and try to use these new techniques. I have a question, can you use switches connected to the sensor shield to control a turnout with the switch and jmri ( manual mode using a control panel along with computer control via jmri)

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому

      Hi Jim! I'm still planning on doing a video on how to use a push button control panel with JMRI to have points change and the position be displayed on a mimic panel and within JMRI. I don't think that would be too difficult.
      99% of things are possible with Arduino and JMRI, it just depends on how comfortable you are doing a bit of coding and using the tools in JMRI. Everyone will want something slightly different for their layout, but hopefully I'll come up with something that most being can use, adapt and improve upon 👍

    • @jimpurney2927
      @jimpurney2927 3 роки тому

      @@LittleWicketRailway Thanks for the quick response, as I said my comments I am new to this but am willing to try new things. The electronic part using Arduino is very interesting I am finding it a bit of a learning curve. Looking fwd to your upcoming videos

  • @johnbrogan6583
    @johnbrogan6583 Рік тому +1

    have you tried to experiment with the code on a second set up?

  • @jimm675
    @jimm675 3 роки тому +1

    Great videos, keep them coming! Can I ask what size your layout is, thinking about a similar design for my own and like to get an idea of what would fit. Thanks

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому

      Hi Jim, thanks 👍 It's 4ft wide and about 10ft long (some of that is hidden behind the back scene). There are a lot of things that I will do differently for the rebuild. I'm still planning on making a video on these mistakes, but the 2 biggest ones were:
      - 4ft is too wide. I can't reach the other side without crawling under the layout, squeezing up between the layout and the wall and reaching over the back scene. In future I won't go wider than 3ft.
      - The hidden section is too complex and inaccessible. If you're going to have a hidden section that can't easily be accessed then you need to make is super simple so that nothing can go wrong.

  • @markstabb7253
    @markstabb7253 3 роки тому +1

    Not sure if its me being dumb but when I try to create the light LT01 in JMRI using 1101 I get a doesn't match system name error. Any ideas?

  • @brendanhannon1577
    @brendanhannon1577 3 роки тому +1

    Hi Rob, I have been away from the project for a while, but, I am back now. I have one problem I hope you may have come across. Everything works fine in the initial setup, however, when I close the application down and restart I have to reinput the configure nodes each time despite having saved them previously. The node is visibly present on startup but I need to delete and reinput to get the system working again. Many thanks for any advice you may offer.

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому

      Hi Brendan, have you managed to fix this yet? Is "enable polling on startup" ticked for the node?

    • @brendanhannon1577
      @brendanhannon1577 3 роки тому

      @@LittleWicketRailway Hi Rob, unfortunately not yet, I have ticked the box, but once I close PanelPro and restart I need to reenter the C/MRI node to get it working. When it is working it is perfect.

    • @MartinCarames
      @MartinCarames 3 роки тому

      Hi Rob, I have the same issue that Brendan.
      wen open Jmri and node is configured the sensor is in unknown state. I figured if delete the node and make again the sensor works Fine. but wen I close the jmri. the next time I use jmri the node left work again. and is frustrating. every time I use jmri make the node. I trying put in the sketch in serial connection (19200, 8n2) for take the difference between serial protocol and jmri use serial. take from the page of madleech.
      and the issue still occurs.
      I note that the poll from node wen make a new node is much more rapid than wen node is not read. and note in the blinking led. working is fast, don't working is more slow. I see to in cmri monitor.
      is so strange. Thanks in advance.
      Grettings.
      Martín.

    • @brendanhannon1577
      @brendanhannon1577 3 роки тому +1

      @@MartinCarames Hi Martin, I have tried part 3 of this series which has resolved my issue. I now connect through an RS485 and it seems to retain the sensor and switch information after a restart. I am still not sure why the first option did not work. Brendan.

    • @MartinCarames
      @MartinCarames 3 роки тому

      @@brendanhannon1577 Thanks Brendan. I will try this option. Thanks Again.

  • @brendanhannon1577
    @brendanhannon1577 3 роки тому +1

    Brilliant, thank you.

  • @LawrenceEggering
    @LawrenceEggering 3 роки тому +1

    Well done.

  • @johncloar1692
    @johncloar1692 3 роки тому +1

    Thanks for sharing!

  • @martinrandall3735
    @martinrandall3735 3 роки тому +1

    The bit (pun intended) I'm not sure I'm understanding is where the 32/64/128 'bits' are coming from in CMRI? In terms of Input and Output pins.
    Other than that I must highlight your presentation style. You've got very clear audio and video camera quality. Breaking up the video into chapters really does help.

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому +1

      Thanks Martin! The number of 'bits' are set when you create the CMRI node. There are different types of nodes, some of them have a fix number of input and output bits. However, some like the node we're using in the video have 'slots' for cards. The cards can either be input cards or output cards and each card has some 'bits' on it. In the video the cards I'm using have 32 bits on each card. I've got 2 input cards (64 input bits) and 4 output cards (128 output bits). For this type of node you can change the number of input/output cards and bits available. The CMRI node summary table shows the number of input/output bits for each node. Have a play around with the node options.
      The addresses of the bits are 4 digits. The first digit is the number for the node and then the three digits after it points to the specific bit. So the address for bit 1 on node 1 is 1001, the address for bit 7 on node 3 would be 3008, bit 104 on node 8 would be 8105, etc.
      You can have an input on address 1001 and an output on 1001 which can get a bit confusing because the address are the same, but JMRI knows that one is an input and one is an output from which table the object is in (e.g. a sensor is an input, a light is an output).
      Does that help?

    • @martinrandall3735
      @martinrandall3735 3 роки тому

      @@LittleWicketRailway Sort of, I think I'm getting lost in the 'cards' area. If I understand - physically you've got the Mega shield with it's three strips of pins. You are logically defining a strip of pins as card (either input or output) within the Arduino sketch?
      It feels a little odd to be defining something up in the 128-bit range when there's not that many physical pins.
      I'm waiting for my own Mega + shield to arrive so I'm sure I'll understand more when doing it practically.
      Looking forward to seeing if you can get multiple nodes working, it'd be good to be able to use a node to do all the LED outputs for a mimic panel mounted on a wall.

  • @jerrydowell5962
    @jerrydowell5962 3 роки тому +1

    What am I doing wrong?
    When I follow all of the steps and bring up panel pro click to setup cmri it is not an option only dcc++

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому

      Hi Jerry, in the preferences section under the connections menu you should have the but "+" symbol at the top which will allow you to create a new connection. Then select CMRI from the drop down list.

    • @jerrydowell5962
      @jerrydowell5962 3 роки тому

      @@LittleWicketRailway thanks

  • @TravelinginMiniature
    @TravelinginMiniature 2 роки тому

    This is the answer to my dreams, controlling lights with a fast clock. Now how do I combine this with Just Plug system by Woodland Scenics? Hmmmm

  • @jerrydowell5962
    @jerrydowell5962 3 роки тому +1

    when i compile the sketch above i get the following error msg stray '\302' in program

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому

      Hi Jerry, apparently this means there is a character in your sketch that the IDE doesn't recognise. Apparently this is common when a sketch is copied from a web page because there can be invisible characters. Below this error it might show you the offending line of code. Try deleting and re-tying this line.

  • @jerrydowell5962
    @jerrydowell5962 3 роки тому +1

    Ignore my comment about error /302
    Redownloaded the sketch and the error went away

  • @jerrydowell5962
    @jerrydowell5962 3 роки тому +1

    also msg exit status 1

    • @LittleWicketRailway
      @LittleWicketRailway  3 роки тому

      I think this is linked to the same /302 error, between these two lines it might show you the line of code that is causing the error.