ESP32 Command Station

Atani Dec 10, 2017

  1. PaulS

    PaulS TrainBoard Member

    16
    6
    7
    Hello Mike, back again (as expected...), while trying to figure this all out, something went wrong and I was getting ASyncTCP.h error messages while compiling.

    I removed the DCCppESP32-master project re-loaded the original s/w and all went back to normal, except... I was able to change the loco address in the index.html file the first time I tried (originally 123 and changed I it to 4805), but now I can no longer change the loco address (it's stuck at 4805), that is: change the value (Atom Platformio) in the index.html file in the data folder, save and download to the ESP32. Unfortunately, the address does not appear changed in the web browser. I've tried writing the modified html file directly using the command ">platformio run --target loadfs" which seems to work but to no avail (no error messages), the loco address doesn't change.... ? Note: the loco 4805 receives commands from the browser and responds correctly. Any idea where to look for the sol'n...?

    Any help is really appreciated.
    Best Regards,
    Paul
     
  2. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    do you have the build output? the base station doesn't use spiffs so that is not necessary or supported on master. It sounds like the index header file is not being regenerated as part of the build.

    There was a recent release of arduino-esp32 which broke AsyncTCP (expected) and a new release of AsyncTCP about a day later. Make sure you are using AsyncTCP 1.0.3 and arduino-esp32 1.0.1 (PIO shows this as espressif32 1.6.0).
     
  3. PaulS

    PaulS TrainBoard Member

    16
    6
    7
    Hi Mike, thanks for the prompt response. Went back and checked if AsyncTCP library was installed (listed) in Platformio, and it wasn't (although I could see the library in: C:\Users\pauls\Documents\PlatformIO\Projects\DCCppESP32-master\.piolibdeps\AsyncTCP_ID1826), ... so installed it in Platformio, and now I am able to change loco addresses again. ... I'm a bit at a loss with where these libraries are located ...

    On a completely different note: I've come across ESP-NOW for bi-directional communication between ESP32's, would you consider this a plausible solution for an "ESP32 hand-held throttle" to "ESP32 base-station" link ? I like throttles with switches and knobs (pots) rather than the phone/tablet experience.

    Best Regards,
    Paul
     
  4. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    I haven't explored the esp-now functionality yet but I also don't see a need for it right now. If you want to have a physical throttle with buttons etc you can do that today!

    Take a look at https://github.com/atanisoft/DCCppThrottle this uses a Nextion as the interface but you could use it as a basis for a physical throttle with buttons/knobs/etc. Everything is sent via http requests back to the base station.

    Next month I'll have a new release of the base station and it will also have native support for LCC, including the draft spec for Traction (covers locomotives), and that is another interface that you could leverage.

    Sent from my ONEPLUS A5010 using Tapatalk
     
  5. PaulS

    PaulS TrainBoard Member

    16
    6
    7
    Ooops, spoke to early, back to not being able to change loco address (just that one time). Tried changing code (actually info text to serial port) in DCCppESP32.cpp to ensure it was compiling, and still no luck. Not sure where to look now...?

    BR
    Paul
     
  6. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    something isn't right, it sounds like something either is not compiling correctly or it is not sending it to the device...
     
  7. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    I’ve been holding back on some comments so as not to delay the progress that Mike/Norm have been making … Firstly, ESP-NOW , it seems, would alleviate a lot of serial communication errors and simplify a hand held throttle …. As far as physical knobs (pots) for throttle control goes, it has always been my preference as even on a 3.2” Nextion the throttle slider does not offer efficient control. Asking Mike to add rotary encoder code has been at the top of my request list since we started.
     
  8. RCMan

    RCMan TrainBoard Member

    271
    132
    12
    I have been observing model railroaders comments on existing throttles designs, either home-brew or bought.

    Reasons:
    Phones and tablets do not give you feedback or accuracy. distracted by the complexity of the display
    Encoders give feedback but not good on telling you the speed or if you are at zero.
    Toggle switches for direction or center off are to many steps not needed to operate the trains.
    Direction buttons not better than a toggle switch.

    The best design seems to be the rotary dial with center off with De-tent.
    Feedback on a display showing the speed setting is needed.
    should be a one handed device and that frees up your other hand to do something else. Just for keeping the train under control.
    Wireless is a big plus when something goes wrong. you do not have to fine a tethered throttle and try to fix, stop or power down the layout.

    This was observed from a Christmas display that had 3 different DCC systems/displays.
    Club members where not familiar with any of the systems so there is no bias on the comments. Instructions where made for each system to help the club members understand how to turn on/off each system and how to make sure the setting to run each display are correct.

    None of the three system won hands down, just the comments from talking to the members.

    Just my opinion.
     
    Atani likes this.
  9. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    I've wondered if a 'motorised fader' could be used as a speed control. I don't know if a rotary device is available (which I would prefer) but the slider would be next best. Basically you could manually adjust the loco speed, and when switching to another cab, the slider would automatically physically move to the correct position....
    https://www.sparkfun.com/products/10976
     
  10. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    I have found that a rotary encoder for acceleration with integrated push button for direction control is the best solution from what is available at the present time. I have made several throttles this way and find it most convenient.
     
    Atani likes this.
  11. RCMan

    RCMan TrainBoard Member

    271
    132
    12

    Can you show us a picture of your throttle?
     
  12. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    A selection for your perusal .... :)
    Edit: Not sure why the pic came in upside down the original isn't ... have at it
     

    Attached Files:

  13. PaulS

    PaulS TrainBoard Member

    16
    6
    7
    Hello Mike, was checking today for possible reasons the loco numbers were not updating on new downloads to the ESP32. I ended up commenting out the statement:

    #build_flags=-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE

    in the platformio.ini file and surprise ... the loco numbers updated correctly after downloading (removing the commenting out brought back the problem). Not sure why this corrected the problem, but I think I'll leave it at that ... (besides, much more info on the compiling process is presented).

    Thanks again for the help,
    Paul
     
  14. PaulS

    PaulS TrainBoard Member

    16
    6
    7
    Further to my comment on the ESP-NOW use for wire-less hand-held throttles, ESP-NOW uses WiFi but does not need the local network (direct link between MasterESP and PeerESP's) without the need for any HTML code (or browser/JMRI). Also the connection does not close after a transmission, remains open until the s/w closes the connection (comm latency is very low). Apparently, up to 20 simultaneous connections are possible (although I've read 10 as the max limit also), but either way, quite a few of these ESP-NOW based throttles could be in use together. My goal is to have a really (cheap) simple throttle anyone can use with minimal fuss.

    I'll certainly check out your Nexiton solution (I have one arriving anytime now...), thanks for the link.

    Cheers,
    Paul
     
  15. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    That is very curious... that should have no impact on the runtime other than printing more details to the serial output. Perhaps something is causing issues in that. In any case, that line is not needed for general operation and should not be set likely to anything higher than INFO.

    That would make it interesting for sure, the problem I can see is you would be limited to only the text based protocol of DCC++ which isn't a problem for most use cases. You could connect and keep a connection open the same as JMRI does and the base station should not close it.

    But I'll dig into the ESP-NOW and see what it would take to support it. Perhaps it could be configured in the future as an option.
     
  16. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    So I wanted to share an update on the DCC++ESP32 project status as there hasn't been many updates in a while and no release for around a year!

    I've been working with @NormHal and @esfeld on a few major enhancements to the currently released code and also introducing a few of my own, which I'll share below...
    • Nextion 3.2" display directly connected to the DCC++ESP32 Command Station. @NormHal is responsible for this one almost entirely on his own, I've helped with some of the interfacing code and solving a few odd bugs here and there. But this will allow you to control many aspects of the Command Station:
      • up to three locomotives
      • interact with turnouts
      • create/delete new turnouts..
      • At some point possibly even interact with the programming track
    • RemoteSensors, these are a special type of sensor that doesn't need to be physically connected to the command station in order to be reported as a sensor input. This feature came from Dan Worth (can't seem to tag him).
    • LCC support, this is still in progress but right now you can control track power via LCC events. More is coming for this after I release v1.2.0 and fix one really ugly bug in the DCC++ESP32 Command Station.
    • LocoNet, this is experimental at this time and is mostly untested as I don't have any LocoNet devices (still on backorder). This likely will not be present in v1.2.0 release unless I can get some external verification that it is functional.

    Those are only a few of the features that are coming, the biggest of which is likely a toss up between the Nextion interface and LCC support natively within the DCC++ESP32 Command Station.

    I'm working on stabilizing the code and fixing a few remaining bugs, but the current plan is to have a release out next weekend. If you want to try the latest code you can pick it up from the development branch on GitHub. If you try this and find bugs please post them and I'll see what I can do to fix them before the release.

    I'm also working on a custom PCB for the DCC++ESP32 Command Station that will integrate the following components: ESP32 (TTGO-T1), MCP2551 (CAN Transceiver, for LCC), 2xRJ45 jacks (LCC CAN bus interface), L298 H-Bridge (OPS & PROG output), OLED screen and possibly a Nextion. I'm also going to get a case put together to house all of these components and eventually make it available for others (PCB + parts or assembled), but more on that after I get the PCBs created/test/etc.
     
    jrob3rts likes this.
  17. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    And a picture of the prototype for the PCB... This is configured using a Pololu MC33926 Motor Driver Carrier as I was testing that for updating the documentation. But the final PCB will be with an L298 IC.[​IMG]

    Sent from my ONEPLUS A5010 using Tapatalk
     
  18. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    279
    195
    12
    Really cool progress and the addition of the LCC is a big plus. Could I also suggest you put a good current sense module in there as well such as MAX471.

    Looking forward to the PCB. Would love to help test/troubleshoot.
     
  19. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    The esp32 can handle the current sense from the L298 natively with only a resistor to GND and an Op Amp (which is optional even).

    Or are you thinking of something else for the current sense feature?

    The v1.2.0 LCC support is very limited at this point but as soon as I fix one major bug relating to LCC integration it will be a lot more full featured. The bug that is in the code now will show up if you attempt to open the CDI in JMRI with track power enabled. Thankfully there isn't anything of value in the CDI yet but that will change soon.

    Sent from my ONEPLUS A5010 using Tapatalk
     
  20. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    279
    195
    12
    From what I have experienced and read the L298 current sense is somewhat unreliable. It certainly is on some of the original motor shields I've tried but maybe this isn't generally true.

    Thanks once again for all your great work on this.
     
    Last edited: Feb 11, 2019

Share This Page