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
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
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
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. 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.
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)
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.
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!
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
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
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.
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.
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.
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
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
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.
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.
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
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);