DCC++ Hardware - Throttles

KE4NYV Jan 25, 2016

  1. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    I just finished up putting together some notes on the little radio unit that I have been evaluating, the HC-12 -
    My notes are here:

    http://trainelectronics.com/Arduino/HC-12-Serial_Radio/

    My tests are very encouraging and the next step is to use a pair of them to break the wire that connects my new throttle and the DCC++ controller.

    dave
    [​IMG]
     
  2. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
  3. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    A video that shows the configuration of the HC-12 wireless serial link and its use with the DCC++ wireless throttle is now on YouTube



    dave
     
    papahnash, HVT, KC Smith and 4 others like this.
  4. Scott Eric Catalano

    Scott Eric Catalano TrainBoard Member

    205
    57
    6
    I cannot wait to add this to my system.....how about multiple wireless throttles?
     
    esfeld likes this.
  5. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Scott - the existing design is for one throttle. It might take some software modifications to the DCC++ system to support more than one. The other possibility is to add a "Listen before sending" routine to each throttle that would see if the frequency was clear before transmitting.

    Let me think on that for a time.....

    dave
     
    Last edited: Jun 6, 2016
    HVT, Scott Eric Catalano and esfeld like this.
  6. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi Scott

    That would certainly be possible if you used WiFi (ESP8266) instead.
    The Server would do the Client sorting and buffering to avoid data collisions, and the code is already out there.
    With a little imagination Client throttles could be active with the DCC++ Base Station in the same way that my Html concept works.
    You connect, ask for the status <s> the throttle updates and your good to go.
    Add a rotary encoder instead of the potentiometer to fully exploit loco switching.
    Put the whole code on the ESP and there's no need for the Arduino.
    That means less power consumption.
    And you can run them with other controllers at the same time as such as JMRI, Gregg's Controller and why not throw in a WebThrottle too. :)
    Add ESP OTA and you can even flash firmware updates instantly over WiFi from your PC.

    All this is doable right now.


    Steve.
     
  7. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Steve - I do believe that the ESP8266 is not a bad way to go but I prefer the range and simplicity that I have realized with the HC-12.

    I think more folks will be able to have success with the simpler approach.

    thanks

    dave
     
    HVT and Scott Eric Catalano like this.
  8. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Indeed Dave,

    Simple is good, and I like the simplicity of your approach. I was just pointing out to Scott - who seems to be looking away from that approach - that there is an
    already an alternative should he wish to pursue that goal. I may even do the proof of concept if I can find the time.

    Steve.
     
    HVT and Scott Eric Catalano like this.
  9. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Steve - FYI, I opted for the potentiometer for speed control after some rather frustrating experiments with the rotary encoder libraries - If I can find a satisfactory library I may use an encoder.
    The pot is also simpler to implement and easier to understand. The advantage to the rotary encoder is the ability to remember the speed and direction for each of the 4 locos as one switches between them

    dave
     
    HVT and Scott Eric Catalano like this.
  10. Scott Eric Catalano

    Scott Eric Catalano TrainBoard Member

    205
    57
    6
    I agree dave....I am more into the less is more approach....I have a home layout that I use Digitrax with and its not hooked to a computer...some guys like JMRI/WII throttles etc....I have enough throttles for people to use so I am not worried about that......the demo layout with the wireless throttle using DCC++ is awesome to use and show people and that is my intention....once you've gotten everything settled and are satisfied let me know so I can start ordering parts....and I would be most interested in your laser cut enclosures I will pay for those in a heart beat.
     
    HVT likes this.
  11. Steve S

    Steve S TrainBoard Member

    95
    22
    8
    That's a nice looking hand unit, Dave. Does the pot have a stop at the center-off position, or do you have to look at the readout to see that it's at zero? Also, do rotary encoders have any sort of stops, either at zero or at the max/min? If they don't, I think that would make them difficult to use because you'd have to keep looking at the display to see what it's set to. One of the reasons people give for preferring knobs over cell phones is that they don't like having to look down at the phone's screen.

    Steve S
     
    Scott Eric Catalano likes this.
  12. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Scott - I'll be happy to cut you a case for whatever it costs me for materials - shouldn't be more than $10.00 - I'll send you an email when I have things finalized.
    I also have a few of the circuit boards I used should you need that, too.
    dave
     
    Scott Eric Catalano likes this.
  13. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Steve - the pot does have a detent at the middle position making it easy to feel zero and stop the train.
    Rotary encoders DO NOT have any tactile indication of a particular position. If I get the rotary encoder working I may add a buzzer that can beep when you get to zero speed. It could also beep differently at max speed or when you change direction - or I could go for broke and add the talking gizmo!
    dave
     
    Scott Eric Catalano likes this.
  14. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Dave,

    I've had a look round, and it seems the best approach for a rotary encoder would be to just write a routine into the sketch and not bother with libraries.
    Have a look at these links - working examples for which you probably have the parts.
    http://www.allaboutcircuits.com/projects/how-to-use-a-rotary-encoder-in-a-mcu-based-project/
    http://practicalusage.com/arduino-using-a-rotary-encoder/
    http://www.instructables.com/id/Improved-Arduino-Rotary-Encoder-Reading/

    You'll note most go for an interrupt solution, and try to save some runtime for the rest of the job, which on a throttle project
    could be quite a bit of code.

    Steve.

    Edit: The third link started at the wrong page, now corrected.
     
    Last edited: Jun 7, 2016
    Scott Eric Catalano likes this.
  15. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Thanks for the links, Steve - you are right about libraries - I bailed out on them last night and got somewhat reliable results in a test routine - the issue I have now is skipping counts when I turn the know rapidly - sometimes it works and sometimes it does not.

    I think I'll try the methods in your links next -I also have to experiment with some hardware debouncing --- never any lack of projects!

    stay tuned!

    dave
     
    HVT and Scott Eric Catalano like this.
  16. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Good day, all - I have been experimenting with the wireless throttle and have come across a very interesting condition that I can't fully explain

    A question was asked about connecting multiple wireless throttles to the same DCC++ base station. My first thought was that it would not work as the commands would either interfere with each other or (even worse) would mix together creating meaningless data.

    In spite of my misgivings, I did give it a try as I have two wireless throttles and, much to my surprise, both throttles worked and each one controlled a different engine without issues.

    The setup had two throttles (both set to the same frequency), one DCC++ unit with a wireless unit (also set to the same frequency) and a 4th wireless unit connected to a serial port on my PC so that I could observe the output that was generated.

    This document: http://trainelectronics.com/DCC_Arduino/DCC++/Throttle/TwoThrottlesOutput.pdf
    shows the output that I captured. As you can see there are complete and separate data strings for both locomotives (one was on address 03 and the other on address 1451)

    While more testing needs to be done it appears that, somehow, the receiver completes receiving a complete packet before listening for another..... Interesting!

    dave
     
  17. Scott Eric Catalano

    Scott Eric Catalano TrainBoard Member

    205
    57
    6
    All DCC Wireless systems use one frequency to talk between wireless throttles and base stations...the same is true for wireless devices such as laptops and access points...all use the same frequencies....as far as packets go....you are talking to 2 different "addresses" so the packets destined for that address gets delivered and vice versa
     
    HVT likes this.
  18. zephyr9900

    zephyr9900 TrainBoard Member

    34
    51
    2
    Dave, thank you for finding the HC-12 transceiver! The great thing to me is that the Arduino doesn't know/care it is there. No Arduino libraries or special pins to consider. That makes my task of adapting the MotoMama motor shield much easier, because I can now go back to using pin 2 for the DCC signal. With the SPI interface for the RFM69 transceiver I was planning to use, pin 2 is MISO so I couldn't use it for DCC signal. I've updated my MotoMama daughterboard design (shield-shield?) and will fab it up tonight.

    Randy
     
    Scott Eric Catalano likes this.
  19. zephyr9900

    zephyr9900 TrainBoard Member

    34
    51
    2
    Scott, does that mean that if there are several wireless commercial DCC systems in use at a model train show, and two layouts have a common loco address, say, 1712, that there could be crosstalk?

    Randy
     
    Scott Eric Catalano likes this.
  20. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    That is good to hear, Randy - it is quite a nice unit and I have plans for a number of other (non-railroad) projects that will use it - I have another 8 of them on the way!

    dave
     
    Scott Eric Catalano and HVT like this.

Share This Page