Introducing DCC++ ---a complete open-source DCC station and interface

Gregg Aug 25, 2015

  1. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    No link, I've modified it. Change the extension to .html and open in notepad to enter your IP. It's not a big file, entry is just down a little from the top.

    Regards. Steve

    Clicking this link auto downloads in chrome, as I just found out after 6 attempts to view. Doh..
     

    Attached Files:

    Last edited: Apr 5, 2016
    sboyer2 and Scott Eric Catalano like this.
  2. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Very cool, Steve - thanks!

    dave
     
    Scott Eric Catalano likes this.
  3. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Dave,

    Just occurred to me that I can post stuff on the fly like that.

    So here's the development version of the latest front page. Again just change the extension and enter you own IP.

    Should work for the server code as essentially its a text file. Coming next post. With a few instructions.

    Please note, it will need to be placed in a folder with the same dependency files as the current official release. Or that same folder if you want to keep every thing together.
     

    Attached Files:

    Last edited: Apr 6, 2016
    sboyer2 and Scott Eric Catalano like this.
  4. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    The new Loco Roster enables fast input of your favourite loco's. It's a bit basic at the moment and for now it has to be used to enter your loco addresses for registration on the server.

    You must have a connection to do this and in later versions the code will warn when you are not connected. Hope the rest is self explanatory, just click the T1 or T2 to register.

    To populate with your own numbers just change the value="YOUR NUM HERE" entries right in the middle of these sections of code




    <div class="row bg-4">
    <div class="col-md-3 visible-md visible-lg">
    </div>
    <div class="main col-md-6 myBtnCol">
    <div class="col-xs-2">
    <div class="container">
    </div>
    </div>
    <div class="col-xs-2 text-center">
    <div class="container-fluid">
    <button class="btn btn-primary btn-sm" id="loco1T1" type="button" onclick="document.getElementById('Cab1').value = document.getElementById('loco1').value;Cabmod1()" >T1</button>
    </div>
    </div>
    <div class="col-xs-4" text-center>
    <div class="container-fluid">
    <input type="text" class="form-control" id="loco1" value="1023" placeholder="" style="width:80px;height:40px;font-size: 24px;">
    </div>
    </div>
    <div class="col-xs-2" text-center>
    <div class="container-fluid">
    <button class="btn btn-primary btn-sm" id="loco1T2" type="button" onclick="document.getElementById('Cab2').value = document.getElementById('loco1').value;Cabmod2()" >T2</button>
    </div>
    </div>
    <div class="col-xs-2">
    <div class="container">
    </div>
    </div>
    </div>
    <div class="col-md-3 visible-md visible-lg">
    </div>
    </div>

    The above represents a single 'row' of the roster, you can copy/paste and modify as many entries as you like above my default 5. But do get the indents to match or things will go pearshaped.
    Select right from the very edge of the page and you should be ok. Note, Indents are not reproduced here for some reason so don't copy/paste this.

    Server code for this below. Change extension to .ino this time
     

    Attached Files:

    Scott Eric Catalano likes this.
  5. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Dave,

    To test the new 'Sync' feature, get a session set up with loco address's, a direction set to reverse, with power on and the throttles set somewhere off 0.
    Refresh the page to kill the connection. (I'll include a button to give this option later) Don't use Exit/Reset to do this or memory will clear to default.

    Once refreshed, hit connect and watch the monitor. It's fast and I've included delays on the client side. See the timings in Chromes Dev Console, select Network tab and click the IP address entry.

    Before your eyes the controls will be back where you left them before disconnection.

    Closing is also now done properly when you hit Exit/Reset.

    Enjoy.

    Steve.

    Edit: Oh and if you'd like a personalised copy of the Dev page, post me a roster list and the IP and I can do one for you.
     
    Last edited: Apr 5, 2016
  6. David Taylor

    David Taylor New Member

    7
    8
    1
    Well that was easy. Only two mistakes hooking up the power supply to the motor board and one melted wire [​IMG] Just dumbness on my part. I'd say I'm lucky I didn't let the smoke out of various ICs or the decoder.

    Rather than solder my one decoder into my one loco I put together a test harness with an '8 pin socket' bodged up from some female headers, a couple of LEDs to simulate head/tail lights, and a couple more female headers to plug the motor into and it worked no worries!

    So next step is to solder the decoder into the loco and connect some track and see what happens.

    Looking forward to getting back to my comfort zone of software now I know it works! I hate soldering things together on those prototype boards.

    Awesome work on this Gregg. Really impressed.

    Regards,
    David.
     
    Scott Eric Catalano likes this.
  7. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Dave
    I am still trying to get my ESP8266 test set up to work before loading UK Steves sketch. In trying to upload any sketch from the Arduino IDE ESP 8266 examples I keep getting "espcomm_sync failed" errors plus espcomm_open failed, espcomm_upload failed. I have tried with a separate 3v power supply and new USB cable (after google research). Did you run into this in the beginning? Looking for some insight ...I have more ESP 8266 units coming in case the one I have is bad and causing the problem
     

    Attached Files:

    Scott Eric Catalano likes this.
  8. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi Steve,

    I'm guessing your setup is all correct and you know how to get the ESP into flash mode. If that is the case then the problem is with the Arduino IDE not 'seeing' the ESP correctly, at least it was for me when I encountered similar errors.
    I can only suggest that you make a final check in the IDE under Tools and confirm that your ESP Board is selected as you would with the Uno for example and also that the connection is pointing to the correct USB port.

    If you've done all that and it still doesn't work then we'll move to plan B. I'll post a solution if you need one.

    Steve.
     
    Scott Eric Catalano likes this.
  9. jbsorocaba

    jbsorocaba TrainBoard Member

    47
    33
    13
    Hi Dave
    One question: Every DCC system have a protection against shorts. I dont know how Arduino can do this. ( or I dont got it. )
    Could you please explain me ?
     
    Scott Eric Catalano likes this.
  10. David Taylor

    David Taylor New Member

    7
    8
    1
    Well, my Arduino didn't survive today's short in the power supply wires :( Luckily I had another mega I could use. I've now cut the VIN bridge on the underside of the motor shield and am hoping this helps next time. I didn't think my laptop survived either but luckily it came back to life after a few hours.

    Perhaps a fuse wouldn't hurt too.

    I think the software uses the current monitoring to cut power to the track if there is a short there, indicated by a high current use reading.
     
    HVT and Scott Eric Catalano like this.
  11. mikegillow

    mikegillow TrainBoard Member

    116
    117
    13
    The recommended motor shields have current sensing that can be used to monitor how much load is being drawn. The server station code monitors the output of the current sense pin on the motor shield. If I recall correctly, there are a couple of variables in the server station code that can be modified based on which motor shield you are using. One helps the code interpret the value being read from the current sense pin and another sets the 'trip point' where the server station code decides an overload is occurring and shuts down the motor shield output.
    Certain motor shields like the Pololu have short circuit protection built into them that shuts them down outside of the server station code's control. Other motor shields may not have the current sensing feedback support that is required for the function to work.
    If you are having an issue where short circuits are not being detected, I would suggest posting details of your setup in the 'motor shields' thread.

    Mike
     
    HVT and Scott Eric Catalano like this.
  12. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Good day, all - I spent some time this morning trying to get an eBay clone Arduino Uno to work with an older Windows XP laptop - these units would not install automatically or with the drivers that come with the Arduino software.

    After some dead ends I found a proper driver that works -

    I also found a version of Java that will install under XP that will work with JMRI.

    My notes are here:

    http://trainelectronics.com/DCC_Arduino/JMRI_DCC++underXP/index.htm

    dave
     
    HVT and Scott Eric Catalano like this.
  13. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Dave
    What a pleasure to see a response in the serial monitor showing a scan of my wifi networks. The problem was not my board setup but my computers comm port issues ...... once I got that sorted out my set up worked. So then I moved on to UK Steves sketch as posted on your web site. Before uploading to a complete stack (uno-motor shield-ESP8266) I tried to compile the sketch, which I copied and pasted into the IDE .... I get an error: "missing terminating ' characters" ..... is the sketch on your site the latest iteration or has UK Steve posted a newer version somewhere? FOUND IT! ... downloaded CCppWebsocketserver.ino from github and it compiled with no problem ....... now I am ready to assemble everything and move on. Thank you. What is the purpose of the diode on Tx out .... and is it really necessary? (specs of diode?)
    Steve F
     
    Last edited: Apr 8, 2016
    Scott Eric Catalano likes this.
  14. jbsorocaba

    jbsorocaba TrainBoard Member

    47
    33
    13
    Hi Mike
    Thank you for the explanation....Now I understood .
     
    Scott Eric Catalano likes this.
  15. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi Steve,

    The diode serves to protect your ESP from an excessive voltage on the data return line. Your ESP is a 3v3 device as opposed to Arduno's 5v.
    TX out from ESP is ok without additional components as arduino will register a logic high from around +2.2v, but RX in from arduino is at 5v logic high.
    Many say you need to shift this down to 3.3v just to be safe from harming your device. I'm not sure how Dave B's diode achieves this, on my set up I have a 220 ohm resistor in series and a 3.3v zener diode after that dropping to ground.

    Steve.
     
    Last edited: Apr 8, 2016
    Scott Eric Catalano likes this.
  16. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Steve
    Do you have a quick schematic of your setup showing the resistor and diode connections? It would be a big help. Thank you
    Steve F
     
    Scott Eric Catalano likes this.
  17. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12

    Got my info here http://jamesreubenknowles.com/level-shifting-stragety-experments-1741.

    Check out
    Strategy #2: Zener Diode

    and read about how the result was better with 220 ohm. Scope trace included in the write up. Worked for me.

    Steve.
     
    Scott Eric Catalano likes this.
  18. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Steve
    Thank you, Got it ..... and I see how the 220 ohm resist improved the trace. Before I start soldering please verify: I need three connections between the ESP 8266 and the Uno/Motor shield Base Station stack .....
    Shield GND to ESP GND ..... Shield RXD to ESP TXD ...... Shield 5V (with Zener to ground) to 220ohm Resist to VCC on ESP.
    Steve F
     
    Scott Eric Catalano likes this.
  19. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Nope, the diode and resistor go in the Shield TXD to ESP RXD line as the logic high (serial data @5v) is what is what we are lowering.

    Steve.
     
    Scott Eric Catalano likes this.
  20. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    OK, I thought that we were lowering the voltage in ....... So we do Shield TXD to resist (with zener to Ground) to ESP RXD and then for power we pull 3.3V from the shield to VCC on ESP ........ Thank you, that's why I didn't start soldering :)
    Steve F
     
    Scott Eric Catalano likes this.

Share This Page