ESP32 Command Station

Atani Dec 10, 2017

  1. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Could they be 30nF capacitors? That could certainly affect the board operation if they are....
     
    Scott Eric Catalano likes this.
  2. Atani

    Atani TrainBoard Member

    1,470
    1,769
    37
    We can try adjusting the attenuation a bit, try swapping ADC_ATTEN_DB_0 to ADC_ATTEN_DB_11 in MotorBoard.cpp. This might help with the higher amperage board, with the Arduino board it doesn't make a big difference as the the shield is going off of the analog reference voltage which is ~1.1vdc. So this may need to be adjusted based on board type if this fixes it.
     
    Scott Eric Catalano likes this.
  3. Atani

    Atani TrainBoard Member

    1,470
    1,769
    37
    on both of mine they are 103 103 303 303 103 103 303 303. Looking at the ones that @David Bodnar has on his website it looks like they are a mixed set of 103 and 303.
     
    Scott Eric Catalano likes this.
  4. Shdwdrgn

    Shdwdrgn TrainBoard Member

    251
    182
    14
    I'm not sure how you can tell the placement of the 303's without seeing how the circuit board is laid out? And even so, it doesn't explain why I can't measure anything across the 303s. If they are actually resistors then I should be able to measure the resistance across them.
     
    Scott Eric Catalano likes this.
  5. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Scott Eric Catalano and Atani like this.
  6. mijnmodelbaan

    mijnmodelbaan New Member

    7
    5
    4
    Hi Mike,

    Got the system up-and-running. Thanks for the help with the Arduino IDE stuff. There is however a problem when I try to create a static IP; somehow this isn't working with my ESP board (and I only have one at the moment, so can't compare). It looks like a timing or sequential problem, not sure yet. Can get it working by deleting a line from WiFiGeneric.cpp, but that's not the way to go. Do you know if someone else has/had problems creating a static IP?
     
    Scott Eric Catalano likes this.
  7. Atani

    Atani TrainBoard Member

    1,470
    1,769
    37
    I am glad that you were able to get it mostly working. What sort of issue are you seeing with static IP? I haven't seen any issues with static IP myself, you might try on the "s88" branch as it is going to be merged to master very soon and has a few other fixes.

    I also saw the two enhancements you sent on GitHub, thank you! Both of those are items that are on my TODO list, the LocoNet one though I will need some help with as I don't have any LN hardware to work with. If you are able to help lets sync up on PM and I will get the integration going as soon as v1.1.0 is released (likely this week)
     
    Scott Eric Catalano likes this.
  8. mijnmodelbaan

    mijnmodelbaan New Member

    7
    5
    4
    I've raised an issue with Espressif about this: it has to do with the 'WL_IDLE_STATUS' of the ESP which seems to differ when setting-up a static or dynamic client. Might be structural or just a certain production batch ESPs. There are other people with the same problem so for now I'll just remove the line.

    The LocoNet stuff is for me a problem as well. I just went into retirement and are picking-up the model railroad hobby again and now orientating on which way to go with the electronics. Found some interesting stuff/sketches for Arduino and ordered parts to build a LN shield, but that's not an 'official' LN product so it might work or not and therefore not really suitable for testing. Although I hope it will work fine in the end so I can start designing PCBs for detectors and decoders. Don't know anyone with LN stuff either, too bad, but maybe someone else might be able to help with this.
     
    Scott Eric Catalano likes this.
  9. Atani

    Atani TrainBoard Member

    1,470
    1,769
    37
    Ok, I looked at the various LN libraries and many of them would conflict on the ESP32 so a bit of development will be required to set up support for it.

    For sensors and detectors the s88 branch has support for S88-n sensor devices and has been tested with three chains of 64 sensors (I think that is the right count) and no issues were found. I will have an S88 Arduino detector up on GitHub under https://github.com/atanisoft/DCCBlockDetector soon. I have been busy with a few other tasks and work so I have not had time to finish testing of the detector. My detector is based around Current Transformers and an ADS1115 ADC board connected via I2C. Each Arduino ProMini will support up to eight blocks and feed back to the base station via S88-n. I am also looking at how to setup an I2C bus around the layout using Arduino ProMini boards as slave devices for digital outputs as well as MCP23017 boards that offer 16 IO channels. I haven't figured out yet how I want to setup my layout's signal system yet but it will be based around a combination of these devices.
     
    Scott Eric Catalano likes this.
  10. Atani

    Atani TrainBoard Member

    1,470
    1,769
    37
    Version 1.1.0 has been released, this contains all fixes to date for JMRI and BTS7960 boards as well as adds official support for S88-n.

    https://github.com/atanisoft/DCCppESP32/releases/tag/v1.1.0

    This release also includes a tested copy of the index.html as a header file for Arduino IDE usage.

    Thanks to @NormHal for the extensive testing of S88-n support and finding a number of JMRI incompatibilities.
     
    Scott Eric Catalano likes this.
  11. Texas Tim

    Texas Tim TrainBoard Member

    53
    52
    9
    • I might have missed some posts here. But is there an instruction on how to connect the ESP32 to the motor shield ?
    • Is there a recommended ESP32 should I get? I got the HiLetgo ESP-WROOM-32 from Amazon, but I could not see the USB port from my MAC.
    many thanks!
     
    Scott Eric Catalano likes this.
  12. Atani

    Atani TrainBoard Member

    1,470
    1,769
    37
    This is mostly dependent on the ESP32 board and the Motor Shield you are using. I have put a few pictures on this page: https://github.com/atanisoft/DCCppESP32/wiki/DCCppESP32-Hardware That cover a number of the common motor shields and boards.

    That is mostly a matter of preference, there are a few to avoid as they don't have many Analog pins that are usable but virtually every ESP32 board out there has at least two analog pins that are usable.

    From looking at the board you have, it looks very similar to the ESP32 Development Board that is on the Wiki. As for seeing it on the Mac, I am not certain but there is very likely a USB driver of some sort that is required. I don't have a Mac so I unfortunately can not help too much on that.
     
    Scott Eric Catalano likes this.
  13. Texas Tim

    Texas Tim TrainBoard Member

    53
    52
    9
    Thanks for the quick replied.

    I have ordered this (http://a.co/9ev7683) yesterday and should arrive tomorrow here. Hopefully, this one can be seen on my Mac.

    I also have the Arduino Motor Shield. Pardon me for very newbie in ESP32/Arduino in general. The ESP32 board is much narrower than the motor shield, and how do I plug / connect the two?

    BTW, I use CLion IDE & PlatformIO to build this. Very cool works you done here. Thanks!

     
    Scott Eric Catalano likes this.
  14. Atani

    Atani TrainBoard Member

    1,470
    1,769
    37
    You will need an adapter board of some sort. Here is one example that I will be using. I haven't decided if the adapter will be on top or below the motor board yet.

    [​IMG][​IMG]

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

    Texas Tim TrainBoard Member

    53
    52
    9
    could you show me a wiring diagram from the ESP32 to the arduino motor shield? I do not currently have the adapter. Thanks!
     
    Scott Eric Catalano likes this.
  16. Atani

    Atani TrainBoard Member

    1,470
    1,769
    37
    Even with the adapter board, you would still need a diagram of sorts. The only way you avoid a lot of wiring is with one of the ESP32 boards that has the Uno R3 layout.

    For the ESP32 Dev Board and the Arduino Shield you will need the following connections:
    ESP32-----Arduino Shield
    GPIO25---3
    SVP-------A0
    GPIO18---12
    GPIO23---11
    SVN-------A1
    GPIO19---13
    GND-------GND
    5V---------5V

    Those are the minimum connections required.

    If you plan on using an I2C connected LCD or TFT you will want to connect SDA to pin GPIO21 and SCL to GPIO22 for most of the ESP32 boards, the exception being the one with an OLED screen on board which uses different pin assignments for I2C (see notes on wiki).
     
    Scott Eric Catalano likes this.
  17. Cymen

    Cymen TrainBoard Member

    10
    11
    7
    Do you see any problems using the Wemos LOLIN32 LITE board? It has all of those pins except a 5v. Is it as simple as feeding the Arduino Shield 5v from another source? It does have 3.3v and I see the motor shield has a 3.3v -- anyone know if it will function on 3.3v instead of 5v?

    I've loaded the code and it's running well but next I need to hook it up to the Arduino Shield.

    This is the Wemos LOLIN32 LITE:

    https://wiki.wemos.cc/products:lolin32:lolin32_lite

    I also have a BTS7960B (IBT-2) so if that is easier, I could just use that instead of the motor shield.
     
    Last edited: Feb 13, 2018
    Scott Eric Catalano likes this.
  18. Atani

    Atani TrainBoard Member

    1,470
    1,769
    37
    It hasn't been tested but based on the pinout it should work. Make sure you maintain a common GND across all boards, having a power supply for 5V is fine.

    Using the arduino shield vs bts7960 is really up to you, both will work for all purposes. The BTS7960 is a bit less tested though as I haven't been able to get my test setup going with it yet, I do want to get it going soon though.
     
    Scott Eric Catalano likes this.
  19. Texas Tim

    Texas Tim TrainBoard Member

    53
    52
    9
    I tried on the both ESP32 and via the web interface, I could not seem to move any of my loco. anything that I can do to debug where the issue is?

    I have Arduino motor shield and this worked with the original DCC++ UNO BaseStation
     
    Scott Eric Catalano likes this.
  20. Atani

    Atani TrainBoard Member

    1,470
    1,769
    37
    The first thing to do would be connect the serial monitor to the ESP32 from a PC and check what is happening there. It should tell you if it is having any issues.

    The next step is when you turn on track power, do the lights on the motor shield light up?

    We can also try and slow down the DCC signal to observe the lights on the motor shield toggling between left/right as you could do on the Uno base station. In SignalGenerator.cpp at the top is this code:
    Code:
    // this controls the timer tick frequency
    #define DCC_TIMER_PRESCALE 80
    
    Change the value from 80 to 800. The value of 80 results in an approximate resolution of 1uS for the hardware timers. By switching to 800 it should result in approximately ~10uS or 10x slower DCC signal. You won't be able to use this for controlling trains but you will be able to test to confirm the signal is working correctly.

    I will be adding this to the code in the near future as a means to debug since there is a way to change this at runtime without recompilation or restart!
     
    Scott Eric Catalano likes this.

Share This Page