ESP32 Command Station

Atani Dec 10, 2017

  1. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    When you get it, double check what pin is wired to A0 and A1. You may need jumpers to send these to usable pins (any over 30).

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano likes this.
  2. Curn

    Curn TrainBoard Member

    751
    497
    31
    My ESP32Duino board showed up. It looks to be the exact same one that is shown on the ESP32DCC++ Git Hub Wiki (Black Uno board with Wemos logo). Used a DeeK-Robot motor shield with the A,B Break Disable and Vin traces cut. Pins A0 connected to A2, A1 connected to A3. (Having these connected or not doesn’t seem to make a difference so maybe my ESPDuino isn’t the exact same).

    I had no significant issues getting things set-up. Used Atom text editor to run PlatformIO IDE on Unbuntu 16.04. Had to install Clang as a prerequisite. Already has Python installed. Updated config.h with my wifi network/password. Compiled and uploaded it uploaded without issue. Showed up on my router's IP table as "espressif". I was able to launch the web interface by entering the IP address in the browser. I'm going to edit index.html to include the addresses of my more common engines as default.

    Installed JMRI 4.11.3 and was able to set-up the system as DCC++ with Ethernet connection. Used the IP address, Connection Prefex: D, and Connection Name: DCC++.

    I'm able to run trains by the web interface, JMRI desktop, or from IOS-Withrottle or Andrioid Engine Driver apps using the JMRI WiThrottle server. It doesn’t look like those apps can connect directly to the ESP32DCC++ system.

    I was able to program a decoder in JMRI (Changing Decoder Address)

    Issues:

    I am unable to read CVs. Locomotive moves forward, but JMRI gives error 308, "No acknowledgement from locomotive" Tested using a Digitrax DZ126IN decoder.

    Possibly related to not reading the current: The overload (short) protection doesnt seem to be working. If I short the tracks the track power stays on.

    Are A0-A2 (DCC_SIGNAL_PIN_PROGRAMMING 18) and A1-A3(DCC_SIGNAL_PIN_OPERATIONS 19) supposed to be the current sensing pins? and if my board is different, what is the best way to determine which pins I should be jumping to, or configuring in config.h?

    All in all, a very well put together program. Nice work Atani!

    -Matt
     
    Scott Eric Catalano and Atani like this.
  3. Curn

    Curn TrainBoard Member

    751
    497
    31
    Update: I figured there are only 6 analog pins so if I just start testing different ones I would probably find the right combo. Jumping A0 to A4 and A1 to A5 seems to have fixed the issue. I can now read CVs and the overload protection works on both channels. I can also program on the main which I was never able to do with DCC++ so that is also an improvement.

    I don't need the raspberry pi any more and I already have a Retropie. Maybe I will make another Retropie and give it away as a gift.
     
    Scott Eric Catalano and Atani like this.
  4. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Excellent work. It sounds like the pin mapping on your board is slightly different than the ones I have seen. If you can check the board for a silkscreen pin map and post it I can add it to the wiki.

    The key to current sense is making sure that only pins 32 and above are used for analog reads. The esp32 has two analog converters and one is used for WiFi and the other is free for our usage. Most uno layout boards put A0 and A1 pins to the WiFi connected ADC. Thus the jumpers..

    What I am hoping you find with a silkscreen is that you are using pins 36+39, which may be labeled as SVN and SVP. Or perhaps without the S.

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano likes this.
  5. Texas Tim

    Texas Tim TrainBoard Member

    53
    52
    9
    Scott Eric Catalano likes this.
  6. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    not quite, the pins would need to be modified in Config.h to send the signal to the pins on the shield.

    Here is the Config.h entries you should use to start with:
    Code:
    #define MOTORBOARD_ENABLE_PIN_MAIN 5
    #define MOTORBOARD_ENABLE_PIN_PROG 23
    #define DCC_SIGNAL_PIN_OPERATIONS 19
    #define DCC_SIGNAL_PIN_PROGRAMMING 18
    
    These are written assuming you are using an Uno layout on the ESP32, if not you can adjust as needed. Hopefully this will help you get it working.

    However, there is one other caveat with this shield, current sense may not work, so you may not have the ability to read CVs or protect against overcurrent (shorts) without modifications to the board.

    Some details are available in this thread: http://www.trainboard.com/highball/...ing-dcc-with-a-keyes-fundumoto-shield.103803/

    In the image below are the two pins we are concerned with, we need to ensure these are mapped to one of the Analog pins in the lower right of the board. If they do not map over it should not be too difficult to add a jumper and possibly a voltage divider. The marked pin on the bottom is motor A and the one on the top is motor B.
     

    Attached Files:

    Scott Eric Catalano likes this.
  7. Curn

    Curn TrainBoard Member

    751
    497
    31
    The board's silk screen is kind of bad and hard to read. I used a multimeter to trace back to the ESP-WROOM-32 chip to determine which board header went to what chip pin. See the attached images for chip pin-out diagram that I used to identify the headers.

    The board was purchased on Amazon as a Diymore TTGO ESP32 UNO R3 D1 R32 Development Board (ASIN:B0775WFN9P)
    The antistatic packaging had a bar-code of "X001NGI0ZN" that looked to be an Amazon inventory sticker that was applied over the original label. The original label had a bar-code of "012570" and an inscription of "A111 05-12".

    Looking back at the hardware Wiki, the motor shield photo shows A0>A2 and A1>A3 jumpers, and the paragraph below the ESPDuino card says the same, however the table text down below says A0>A4 and A1>A5 which matches my board. I think there might be a discrepancy in the Wiki.

    PinLabels.png
    ESP-WROOM-32-pinout.png
    IMG_7738.jpg
    IMG_7739.jpg

    Matt
     
    Scott Eric Catalano likes this.
  8. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    @Curn, jumpering to A2 and A3 on the wiki assumes shifting the analog channels as well, I will update that to be clear. Using A4/A5 is fine as well and lines up with the defaults.

    Thanks for very detailed pictures and tracing. I will download and add these to the wiki as soon as I can.

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano and Curn like this.
  9. Curn

    Curn TrainBoard Member

    751
    497
    31
    Glad to know I only misunderstood the wiki. I would hate to think that there are actually two variants of an identical looking board out in the wild.
     
    Scott Eric Catalano likes this.
  10. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    It wouldn't surprise me if there are more variants on this sort of board out there unfortunately. I have updated the Wiki this morning with a few more notes on this board. I will need to update the image of the Deek-Robot shield at the top of the page as the jumpers are not quite right without modifications as listed in the table now.

    I am also thinking of splitting https://github.com/atanisoft/DCCppESP32/wiki/DCCppESP32-Hardware into two pages, one for the ESP32 boards that are compatible and another for motor shields, we are getting to a point where we have a number of compatible of both now.

    I also want to start collecting schematics for the connections for non-Uno style boards so that the entire process is well documented for anyone to pick up and run with.

    Also would people be interested in a pre-packaged version of the base station? Something like an ESP32 + Motor Shield + OLED/LCD/Nextion(coming soon)? Perhaps in a packaged unit style similar to one of the commercial units.
     
    Scott Eric Catalano and Curn like this.
  11. RCMan

    RCMan TrainBoard Member

    271
    132
    12
    Yes, please. Also would like to see a table of ESP32 models and the differences between them. Form,Fit & Function.
     
    Scott Eric Catalano and Atani like this.
  12. Kerwin50

    Kerwin50 TrainBoard Member

    17
    17
    7
    Scott Eric Catalano likes this.
  13. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Yes it should. This appears to be the same as the esp32 devkit c board. The analog pins you will want to use by default are in the top left corner of the board in the picture. You will want a standalone motor shield to connect to this, one with current sense or one that you can add it to.

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano likes this.
  14. Kerwin50

    Kerwin50 TrainBoard Member

    17
    17
    7
    Ok I just ordered it.
    The motor shield that I have is the L298NH
    Hopefully we can make it work.
     
    Scott Eric Catalano likes this.
  15. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Do you have a picture of it?

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano likes this.
  16. Kerwin50

    Kerwin50 TrainBoard Member

    17
    17
    7
  17. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Scott Eric Catalano likes this.
  18. Curn

    Curn TrainBoard Member

    751
    497
    31
    My ESP32 board seems to have fairly limited WiFi range. Maybe 30 feet from the router. The router is receiving signal from the ESP32, but the board isn’t picking up the routers authentication acknowledgment if it’s too far away. The other devices I have, including the Raspberry-Pi, don’t have these connection issues so I know it’s not a router issue. If this is normal I will try adding a larger antenna. If I have a dud board, I will get another. Is this a normal range for these boards?
     
    Scott Eric Catalano likes this.
  19. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    It depends on the board and antenna placement. I have seen great reception on some and others are very poor. If I were to get more boards I would get ones that have the external antenna connection and add the small standalone antenna to it.

    If I have a packaged setup it would have an antenna similar to a WiFi router has likely.

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano and Curn like this.
  20. John Flanagan

    John Flanagan TrainBoard Member

    45
    6
    7
    I setup a server and (foolishly) attempted to use WiThrottle on my Iphone. I didn't realize that there are three protocols; plain text, web services, and JMRI Throttle communications. WiThrottle uses the JMRI protocol. Is the thought that web services supersedes that protocol? It here a need for the JMRI protocol but no one to code it?

    BTW, the plain text interface has an issue at about line WiFiInterface.cc line 90. The continue should be a break. As it is all slots are populated with the first connection and others fail.

    John
     
    Scott Eric Catalano likes this.

Share This Page