ESP32 Command Station

Atani Dec 10, 2017

  1. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Try 4 and 5 for the scl/sca.. also it likely uses the other type of controller for the oled. Most of the esp32 boards with onboard oled screens are clones of one board type.

    Swapping the signal pins to other pins is fine. It will work fine.

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

    jrob3rts TrainBoard Member

    15
    20
    7
    Just jumping in here.

    Loving the work you have done. What I was attempting to create with an arduino for my 8 year old son is possible with your solution.

    I have an issue with the current sensing of the Arduino Motor Shield (Deek robot in my case). Trips almost immediately. Do I need to add a resistor to the A pins?

    On the OLED. I've got the non Lora version of this board. The Oled doesn't seem to be working. Will try the other numbers myself but I have seen it working on the original with some other code. You use a different library but my other code so have been hacking a little to see if I can find a solution.

    James

    Sent from my SM-G955F using Tapatalk
     
    Scott Eric Catalano likes this.
  3. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    That is great! I have updated the wiki a couple weeks ago to give some defaults for different types of board you may want to check them out.. https://github.com/atanisoft/DCCppESP32/wiki/DCCppESP32-Hardware

    As for tripping immediately, that sounds like a missing connection. Make sure you have the gnd pin wired to the shield as well as other pins as documented above in the thread.

    If all pins are connected correctly, connect a USB cable to the esp32 and capture the serial output using v1.1.1 from GitHub as this will dump more diagnostic data than older versions.

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano likes this.
  4. Shdwdrgn

    Shdwdrgn TrainBoard Member

    251
    182
    13
    I finished up my schematic today, including the L298N board modified with a 3W 1.5 ohm resistor. Figured I would get it posted here, however if I find any errors I will update the original image so this post is correct.

    [​IMG]

    This design will allow control of up to 43A on the main track and about 1.5A on the programming track. The transistors are pretty generic, you can use 1n3904, 1n2222, or any number of other NPN transistors. I am using 1/8W resistors beside the transistors and the values aren't too critical as long as they are all the same. There isn't really an identifier for the 5V output board, however it will take an input of up to 35VDC and put out a steady 5V @ 5A supply (I plan to use this to run arduino decoder boards).

    You can operate the ESP32 board from a USB power supply, or by connecting the 5V supply on the left to the Vin pin. Use one method or the other, NOT BOTH.

    This design will allow control of up to 43A on the main track and about 1.5A on the programming track. The power supply should be adjusted based on what scale you model in. HO should work with 15-16 volts, I believe N uses around 13-14 volts. The H-bridge driver boards shown here will accept a power supply of up 27VDC, so this should work with pretty much all model train requirements.
     
  5. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    This looks great! If you can also provide a zoomed in schematic for the motor boards I will include them in the wiki (more specifically the L298N, mainly showing how you modified it)
     
    Scott Eric Catalano likes this.
  6. Shdwdrgn

    Shdwdrgn TrainBoard Member

    251
    182
    13
    Well, how Jimbo modified it anyway. :) I haven't received my resistors yet. All of the images there are just pics from the web that I put together, and what I posted is the full image at 100%. Sorry. But once I get the resistors I'll try to remember to take pics as I do the mod. I'll just be copying what Jimbo showed above since it still keeps the board nice and compact.
     
  7. Texas Tim

    Texas Tim TrainBoard Member

    53
    52
    9
    after some googling and learned that I needed to do these for the OLED to work:
    Code:
    // Config.h
    #define SDA 4
    #define SCL 15
    #define RST 16
    
    #define INFO_SCREEN_SDA_PIN SDA
    #define INFO_SCREEN_SCL_PIN SCL
    
    
    // InfoScreen.cpp
    // ::init()
    
    pinMode(RST, OUTPUT);
    digitalWrite(RST, LOW);
    delay(50);
    digitalWrite(RST, HIGH);
    
    
    and now the OLED is displaying info.

    I toasted my motor shield and now I am waiting for my motor shield to arrive to further test the track/programming

    thanks!
     
    Scott Eric Catalano likes this.
  8. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Instead of overriding SDA and SCL as #defines just use pass the values in Config.h via the INOF_SCREEN defines. It is odd that it is 4 and 15 though. That doesn't match up with any other info I have found anywhere.

    Also make sure the correct board is selected in platformio.ini as this will impact the default values for SDA and SCL.

    Sorry to hear about the motor board, what happened?

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano likes this.
  9. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Oh and I haven't seen a need for the reset pin but will check into that further and add support via Config.h to have that supported.

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano likes this.
  10. RCMan

    RCMan TrainBoard Member

    271
    132
    12
    I little error in your drawing is the transistor numbers.

    1Nxxx or 1Nxxxx is a diode number.

    2N or PN xxx or xxxx is for a transistor.


     
    Scott Eric Catalano and Atani like this.
  11. MegaBlackJoe

    MegaBlackJoe TrainBoard Member

    43
    58
    10
    Hi Guys. ESP 32 looks like an interesting option. Did you encounter any videos showing how it works and which information can be displayed on the screen? Also, are there any hardware throttles that you can use with it ? Thanks for the info.
     
    Scott Eric Catalano likes this.
  12. jrob3rts

    jrob3rts TrainBoard Member

    15
    20
    7
    Thanks for your replies. My board was incorrect in platformio. Good spot, so I changed that. I do not know what's going on to be honest, the log indicates this:

    [W][esp32-hal-i2c.c:235] i2cWrite(): Ack Error! Addr: 3c
    OLED screen not found at 0x3C
    Unable to initialize InfoScreen, switching to Serial

    Examples of this board utilise SSD1306.h and U8x8lib.h. I have had it working with U8x8lib.h but not within your code as the library is quite different and would prefer to get it working under SSD1306Wire if possible.

    Grounding appears to be all good, so I'll crank it up again shortly and see if anything else looks dodgy.
     
    Scott Eric Catalano likes this.
  13. jrob3rts

    jrob3rts TrainBoard Member

    15
    20
    7
    Ok, read the above, and made the changes as indicated by Texas Tim and it's working :)
     
    Scott Eric Catalano and Atani like this.
  14. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    I will post some pictures soon of the oled screen in action.

    As for hardware throttles, any that are able to connect to the base station via WiFi (like jmri) and that talk the standard DCC++ protocol should work. Additionally you can use a mobile device with a browser pointed to the base station with the web based throttle.

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

    Atani TrainBoard Member

    1,466
    1,736
    37
    Make sure that the screen is using address 0x3C as well. I probably should add an i2c scan at that point in the code to dump out device addresses, maybe even have an auto mode.

    And yes many of the esp32 boards with an oled screen do use the SSD1306 library and different pins for the i2c bus (mostly pins 4,5).

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

    Texas Tim TrainBoard Member

    53
    52
    9
    if I just passed the values, it wont work. It seemed like the SDA and SCL must be defined. I found that from my sample sketch.
     
    Scott Eric Catalano likes this.
  17. jrob3rts

    jrob3rts TrainBoard Member

    15
    20
    7
    In Config, my lines are:
    #define INFO_SCREEN_SDA_PIN 4
    #define INFO_SCREEN_SCL_PIN 15
    #define INFO_SCREEN_RST_PIN 16

    In InfoScreen.cpp (after Wire.begin at line 64, I used:
    pinMode(INFO_SCREEN_RST_PIN, OUTPUT);
    digitalWrite(INFO_SCREEN_RST_PIN, LOW);
    delay(50);
    digitalWrite(INFO_SCREEN_RST_PIN, HIGH);

    This is working for me. The reset, as you highlight is used elsewhere is required.
     
    Scott Eric Catalano likes this.
  18. Shdwdrgn

    Shdwdrgn TrainBoard Member

    251
    182
    13
    Ack yes! I had diodes on my mind from working with the optoisolator chip. Schematic has been fixed.
     
  19. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    Are you sure this is an i2c screen and not an SPI screen? There is no reset for i2c connected devices.

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano likes this.
  20. jrob3rts

    jrob3rts TrainBoard Member

    15
    20
    7
    Apparently it is an i2c screen.

    It's referenced elsewhere as like this:
    U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 15, /* data=*/ 4, /* reset=*/ 16);

    and

    U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, 16, 15, 4);
     
    Scott Eric Catalano likes this.

Share This Page