DCC++ BaseStation with WiFi (ESP)

Atani Feb 11, 2017

  1. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    good Arduino upload, and JMRI connects! :D

    ~Travis
     
    Scott Eric Catalano likes this.
  2. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Excellent! I am not sure how that shield should work for uploads, but you might be able to make it work by using the Uno in headless mode and jumper the ESP RX/TX pins to the Serial interface on the Uno board (pins 0,1) and that might make it work.

    In JMRI, open the message viewer and watch it for a few mins and confirm there are no entries about "unparsed" packets etc..
     
    Scott Eric Catalano likes this.
  3. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    from the DCC++ Traffic Monitor:
    ~Travis
     
    Scott Eric Catalano likes this.
  4. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Which JMRI are you on? Is it 4.7.1 or later? It looks like maybe something is still not quite 100% right on the ESP. I will need to dig into it further I think as part of the rework for the new html interface I am working on.
     
    Scott Eric Catalano likes this.
  5. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    4.6-R81496dc

    ~Travis
     
    Scott Eric Catalano likes this.
  6. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    OK, you should consider an upgrade if you can. A number of fixes went in to 4.7.1 and a few slipped to 4.7.2. I was also working with TwinDad on some adjustments for the multi power districts support so that JMRI would interpret the responses correctly.

    Sent from my ONE E1005 using Tapatalk
     
    Scott Eric Catalano likes this.
  7. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    ok, i will do that.

    ~Travis
     
    Scott Eric Catalano likes this.
  8. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    there, upgraded. i must say, the test version of JMRI loads quite a bit faster.

    these log items are expected, i assume?
    Code:
    17:49:01.040: [RX: iDCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD: V-2.0.0 / Apr  4 2017 04:45:16]  Base Station Status:
        Version: DCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD
        Build: V-2.0.0 / Apr  4 2017 04:45:16
    17:49:01.055: [RX: N0:SERIAL]  Comm Type Reply Type: 0 Port: N/A
    17:49:31.004: [TX: s]  Status Cmd
    17:49:31.012: [RX: N1:10.1<p0 MAIN]  Comm Type Reply Type: 0 Port: N/A
    17:49:31.028: [RX: ]  Unregonized reply:
        vals:
    17:49:31.043: [RX: iDCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD: V-2.0.0 / Apr  4 2017 04:45:16]  Base Station Status:
        Version: DCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD
        Build: V-2.0.0 / Apr  4 2017 04:45:16
    17:49:31.059: [RX: N0:SERIAL]  Comm Type Reply Type: 0 Port: N/A
    ~Travis
     
    Scott Eric Catalano likes this.
  9. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Mostly, I can see a truncation on the data the esp is sending out to JMRI. It is missing a closing > on status output. The ip is also cut off for some reason. If you connect to the esp serial monitor you can see the raw stream and it looks OK so I have a small bug somewhere still.

    Sent from my ONE E1005 using Tapatalk
     
    Scott Eric Catalano likes this.
  10. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    yeah, the Arduino Serial Monitor spits out:
    Code:
    <iDCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD: V-2.0.0 / Apr  4 2017 04:45:11><N0:SERIAL><N1:10.142.174.120>
    when i opened the serial monitor, the status from JMRI seems to have improved, i think:
    Code:
    18:00:01.312: [RX: iDCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD: V-2.0.0 / Apr  4 2017 04:45:16]  Base Station Status:
        Version: DCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD
        Build: V-2.0.0 / Apr  4 2017 04:45:16
    18:00:01.411: [RX: N0:SERIAL]  Comm Type Reply Type: 0 Port: N/A
    18:00:31.109: [TX: s]  Status Cmd
    18:00:31.117: [RX: N1:10.1<p0 MAIN]  Comm Type Reply Type: 0 Port: N/A
    18:00:31.127: [RX: ]  Unregonized reply:
        vals:
    18:00:31.141: [RX: iDCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD: V-2.0.0 / Apr  4 2017 04:45:16]  Base Station Status:
        Version: DCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD
        Build: V-2.0.0 / Apr  4 2017 04:45:16
    18:00:31.158: [RX: N0:SERIAL]  Comm Type Reply Type: 0 Port: N/A
    18:01:01.110: [TX: s]  Status Cmd
    18:01:01.136: [RX: N1:10.142.174.12<p0 MAIN]  Comm Type Reply Type: 0 Port: N/A
    18:01:01.136: [RX: ]  Unregonized reply:
        vals:
    18:01:01.149: [RX: iDCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD: V-2.0.0 / Apr  4 2017 04:45:16]  Base Station Status:
        Version: DCC++ BASE STATION FOR ARDUINO MEGA / BTS7960B BASED MOTOR SHIELD
        Build: V-2.0.0 / Apr  4 2017 04:45:16
    18:01:01.160: [RX: N0:SERIAL]  Comm Type Reply Type: 0 Port: N/A
    18:01:14.472: [RX: N1:10.142.174.12<iESP-reset]  Comm Type Reply Type: 0 Port: N/A
    18:01:31.110: [TX: s]  Status Cmd 
    kinda strange it requires the console to be open to startup fully. I had another project that did that, but i never really found the cause.

    ~Travis
     
    Scott Eric Catalano likes this.
  11. Simon Mitchell

    Simon Mitchell TrainBoard Member

    113
    105
    7
    I'm curious about this-does JMRI repeatedly send the <s> as a kind of heartbeat?
     
    Scott Eric Catalano likes this.
  12. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Yes that is precisely what it does. Over the ether etc (wifi) it also works to keep the connection alive. If JMRI sends a packet and does not get a response in time it can consider the connection dead and possibly reconnect (have t observed this myself yet)

    Sent from my ONE E1005 using Tapatalk
     
    Scott Eric Catalano likes this.
  13. TexasRailroader

    TexasRailroader TrainBoard Member

    90
    26
    7
    Does this work yet?
     
    Scott Eric Catalano likes this.
  14. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Yes it does. There are a couple missing pieces in the github version I still need to fix (missing libs for esp) and a lot more implementation that needs to be done for the web interface.

    But what is there does work. I have been too busy with life to do much on it lately unfortunately. I will try and get back on this soon though.

    Sent from my ONE E1005 using Tapatalk
     
    Scott Eric Catalano likes this.
  15. TexasRailroader

    TexasRailroader TrainBoard Member

    90
    26
    7
    I understand life interfering with hobby. Happens every day. Hard to find the time.
    So if the sketch shows error messages, the sketch will upload and work anyway?
     
    Scott Eric Catalano likes this.
  16. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Depends, likely not though. What sort of errors are you hitting? I know one in the async tcpip library or http library for missing method. That issue has been discussed above with a solution. I am going to be including the libraries in the distribution with the minor modification soon.



    Sent from my ONE E1005 using Tapatalk
     
    Scott Eric Catalano likes this.
  17. TexasRailroader

    TexasRailroader TrainBoard Member

    90
    26
    7
  18. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    That is true if you use a shield variety and/or can not use a serial cable to reset it to 9600 baud. It is a bit of a pain for sure, there are alternative SoftwareSerial libs that support higher speeds but I opted for using standard libs where possible. The Esp itself doesnt have a very extensive default library set unfortunately.

    As for the uno, I don't have one to test with currently nor one of the shields from China. I have a number of esp-01 and I have another esp that has a USB connection on it. I haven't done too much experimentation with that one yet other than it powers up and can see my network.

    Sent from my ONE E1005 using Tapatalk
     
    Scott Eric Catalano likes this.
  19. TexasRailroader

    TexasRailroader TrainBoard Member

    90
    26
    7
    The DCC++ sketch was originally written to accommodate a serial port or Ethernet connection. A wifi option was not programmed into the DCC++ sketch language. Since I do not write code, I may have to abandon my wifi shield efforts.
     
    Scott Eric Catalano likes this.
  20. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    The shield should work as long as you can lower the baud rate for the shield from 115200 baud. Anything under 57600 should be fine for the default software serial library. With the speed of the WiFi connection and the amount of traffic sent across to the base station going down to 28800 or 19200 shouldn't be a problem.

    I will try and get a shield and uno to work with but it will take time with shipping.

    Sent from my ONE E1005 using Tapatalk
     
    Scott Eric Catalano likes this.

Share This Page