Adding Wireless Connectivity to DCC++ Mega Base Station

LMSFan72 Jan 20, 2019

  1. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    That got it! Connected! Thanks Mike.

    What is the impact of not having the code MDNS.addService("dccpp", "tcp", 2560);
     
  2. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    Just saw you'd already answered it. Thank you for all the help so far
     
  3. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    Sorry Mike, whilst I am remembering - is it possible to send serial commands from Platformio/VS Code? Currently I drop outside to ArduinoIDE and use serial monitor.
     
  4. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Not likely security related, the esp8266 shouldn't have any problems with security. The problem was with the command given..

    But with a properly flashed and working (so far) esp you should be able to plug it into the Arduino and have it just work. Set the values in Config.h and upload the Arduino code. You may need a TTL converter for 3v3 vs 5v but maybe not with the esp-12e.

    Sent from my ONEPLUS A5010 using Tapatalk
     
  5. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    virtually no impact, JMRI supports looking for a DCC++ base station via mDNS but the naming is different and from what I've seen not very consistent or usable (I haven't looked at it in a while though). So you will need to enter a hostname (defined here) and if you are on an mDNS capable system (Win10?, rPI, Linux, Mac, etc) you can add ".local" and JMRI will resolve it to the base station IP via mDNS.

    Sadly no, PIO doesn't allow inputs in the serial monitor. Using Arduino IDE or an external terminal program (even telnet!) would be preferable.
     
  6. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    OK, so I just reflashed the Mega. I still get nothing on the serial monitor for that when COMM_INTERFACE==4, but i do when 0 or 1. Seems to me that something isn't working on that setting?
     
  7. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    This is what I get on a serial monitor when I set COMM_INTERFACE == 0:

    <iDCC++ BASE STATION FOR ARDUINO MEGA / ARDUINO MOTOR SHIELD: V-2.0.0 / Jan 26 2019 21:50:12><N0:SERIAL>

    but nothing at all when COMM_INTERFACE == 4.
     
  8. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    and you are using the base station copy from my repo?
     
  9. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    Hi, Mike, yes, from the link you included at the start of this thread
     
  10. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
  11. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Also the output when on COMM_INTERFACE == 4 being nothing is indicating that it is not reaching the "init" messages, it is trying to talk to the ESP and getting stuck in that phase.
     
  12. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    Ah-ha. I may be in TX0 and RX0 (mine are just labelled TX and RX) not pins 18 and 19. I have used a level converter. I will check later and try again. Many Thanks
     
    Atani likes this.
  13. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    If you want to use TX0 and RX0 you can but you would need to define it in Config.h and you would not be able to interact with the base station on the serial connection.

    Sent from my ONEPLUS A5010 using Tapatalk
     
  14. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    I have taken out the level shifter and now it seems to work - it connects and then I get a whole series of other letters and numbers. I will power up the shield later and test it out with JMRI
     
    Atani likes this.
  15. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    Thanks for all the help Mike. I haven't yet connected the power for the track but I can connect with JMRI and I can see it respond. I also reconnected the TTL, having proven it worked on 5V, so it's workig with the level shifter at 3.3V now too.. Tomorrow I will add an LCD to it and hopefully run a loco!
     
    Atani likes this.
  16. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    Attaching wiring diagram for others in the future
     

    Attached Files:

    Atani likes this.
  17. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    Pretty happy with tis. I have control. However, I am seeing some error messages on the JMRI console....Does anyone have any idea on the significance?

    2019-01-28 08:54:07,910 dccpp.DCCppReply ERROR - DCCppReply value index too big. idx = 1 msg = a 0 MAIN [AWT-EventQueue-0]
    2019-01-28 08:54:07,911 jmrix.AbstractMRTrafficController WARN - notify: During reply dispatch to jmri.jmrix.dccpp.DCCppMultiMeter@139982de [AWT-EventQueue-0]
    java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:592)
    at java.lang.Integer.parseInt(Integer.java:615)
    at jmri.jmrix.dccpp.DCCppReply.getCurrentInt(DCCppReply.java:765)
    at jmri.jmrix.dccpp.DCCppMultiMeter.message(DCCppMultiMeter.java:39)
    at jmri.jmrix.dccpp.DCCppTrafficController.forwardReply(DCCppTrafficController.java:85)
    at jmri.jmrix.AbstractMRTrafficController.notifyReply(AbstractMRTrafficController.java:284)
    at jmri.jmrix.AbstractMRTrafficController$RcvNotifier.run(AbstractMRTrafficController.java:1223)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
     
  18. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    That means jmri doesn't like one of the responses from the base station. I'll dig into the jmri code and see what is going on. Can you capture the raw output via the traffic monitor?

    Sent from my ONEPLUS A5010 using Tapatalk
     
  19. LMSFan72

    LMSFan72 TrainBoard Member

    118
    18
    9
    From the timestamp it looks like it is a current sense problem:
    Traffic Monitor

    15:53:23.217: [RX: a 0 MAIN] Current: / 1024
    15:53:23.223: [RX: a 0 PROG] Current: / 1024
    15:53:23.228: [RX: X] No Sensor/Turnout/Output Reply

    System log:

    2019-01-28 15:53:23,217 dccpp.DCCppReply ERROR - DCCppReply value index too big. idx = 1 msg = a 0 MAIN [AWT-EventQueue-0]
    2019-01-28 15:53:23,222 dccpp.DCCppReply ERROR - DCCppReply value index too big. idx = 1 msg = a 0 PROG [AWT-EventQueue-0]
    2019-01-28 15:53:23,222 jmrix.AbstractMRTrafficController WARN - notify: During reply dispatch to jmri.jmrix.dccpp.DCCppMultiMeter@2f4948e4 [AWT-EventQueue-0]
    java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:592)
    at java.lang.Integer.parseInt(Integer.java:615)
    at jmri.jmrix.dccpp.DCCppReply.getCurrentInt(DCCppReply.java:765)
    at jmri.jmrix.dccpp.DCCppMultiMeter.message(DCCppMultiMeter.java:39)
    at jmri.jmrix.dccpp.DCCppTrafficController.forwardReply(DCCppTrafficController.java:85)
    at jmri.jmrix.AbstractMRTrafficController.notifyReply(AbstractMRTrafficController.java:284)
    at jmri.jmrix.AbstractMRTrafficController$RcvNotifier.run(AbstractMRTrafficController.java:1223)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
    2019-01-28 15:53:23,223 dccpp.DCCppReply ERROR - DCCppReply value index too big. idx = 1 msg = a 0 PROG [AWT-EventQueue-0]
     
  20. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Which JMRI version are you on?
     

Share This Page