Not that many days since I ordered this, so was happy to see it. Caused me to work to 04:00 this morning and voila – Arduino IDE is running smooth. I am not sure I want to continue using Arduino IDE, but was nice to see that it works with ESP32 even if they still have things left.
To code a few lines and suddenly be on Wifi – cool! I also know that my 2 designs are in mail – exiting.
The power of Arduino is that you plug in the chip, start Arduino IDE, write a few lines and woops – it works. I will give many arguments for not using Arduino on more complex systems, but it is great for prototyping.
As for the Model Train Controller and Model Train Utility Driver I will support Arduino on them. My own model train plans are limited to a track around next years x-mas tree, but I think it’s a huge number of hobbyists out there that would benefit from these designs and enjoy a bit of coding themselves.
Early mornig fun. Just changed the driver to use USB (CH340G) and added a separate 12V supply and some jumpers to select power Source. It can now be driven from 12V or 5V and you can use 12V for PWM’s while using USB 5V for ESP32 etc to have some isolation. Also added pull-up for Boot/Reset and jumper to use them.
A bit more labels and TVS diodes on the left 12 x IO and we’re done. I must admit that this little fellow will see some usage.
My 12 legged robot comes to mine as this is a very small, compact alternative for this one. But, I need some experience with using ESP32 before I continue.
We have a lot of space on the Utility Driver, so I can afford to add some TVS diodes on the ports that go directly out. These are 3.3V and can only handle 6-12mA out – basically they can just about drive a Led with some care.
I also need to change UART0 pins + I would like to replace the RS485 port with an USB powered by CH340G – in which case the LM1117 can have a jumper selecting if it is powering 3.3V from USB or 12V. The advantage of this is that I get the Boot pin free.
I also need to add a pull-up on Reset and a way to Reset the ESP32.
And obviously – a power Led.
I found this schematics on esp32.com forum. I will add pull-up resistors on GPIO0 and EN as well as route them to the extension bus on the TCS. I also need to change pins so I use pin 34/35 as UART0.
UARTS can be assigned to any GPIO pins, but in this case I need to know where it is after Reset and how we boot firmware on a clean system.
As for the FTDI chip above – I apologize for this – You will NEVER see a FTDI chip on any of my designs!
This is a draft of the Utility Driver. Basically this is a ESP32 based driver board with 7 PWM lines, 2 H-Bridges, 12 IO lines and a RS-X connection. The board can be used as a wired/wireless utility board.
- ESP32 Wroom
- 7×2 PWM connectors
- 2 x H-Bridge Motor ports
- RS-X port w 12V Power inn.
- Jumper to select 3.3V or 12V on signal channels.
- 12 x Signal channels. Can be analogie in, Digital In/Out, Servo, I2S, I2C, UART, SPI, PWM or others.
With a small controller in each train I need a standard wireless router, a train central and Train Utility Drivers to have a complete system. I also need a HMI, but I will use the HMI Browser for this.
The Utility Driver based on ESP32 (actually ESP WROOM 32) already contains Wifi/Bluetooth. But it is sometimes nice to have wired alternatives to reduce radio density (collisions) so we add RS-X. On the driver side we add an ULN2003 providing 7 PWM channels for lights etc. We ad a few H-Bridges and min 8 input channels for analogue/digital.
This shows the new Train Model Control System based on ESP-WROOM-32. The full size is 19.5 x 26.6 mm. The old one was 20 x 30 and I needed to cut it down from 30 to fit in my smallest cockpit.
Pin 1,2 & 9 are GPIO. Pin 7 & 8 can also be used as GPIO.
Pin 3 & 4 are 12V AC or DC Power. I am using a small rectifier bridge even if I only plan 12V DC. The 3.3V Regulator is a classic LM1117.
Pin 5 & 6 is the H-Bridge using a L9110.
Pin 7 & 8 is the UART for programming the ESP32. This is basically only needed for first time factory config, so 5&6 can be used as GPIO pins.
Pin 10 is Ground.
Notice that it is 3mm pads on the connector so wires can be connected on the surface, but it is also possible to attach a pin header with some work. It can’t go though so soldering the pins will require some care.
The design require an isolater tape between ESP32 and the PCB.
I have never programmed one of these, but I believe we just set the Wifi correct and work through this. The UART ahould only be needed as backup – but, we will learn as we go.
I will wrap up full schematics and gerbers later, but I prefer to do that after initial testing.
This is the block diagram for the ESP32 alternative. The parts in yellow is the new board mad in the same size as the ESP-WROOM-32 breakout and mounted back to back.
The total cost of this should be < 10.- USD, but it is very board. The PCB is a bit of a challenge with soldering pads on the side.
ESP32 and it’s breakout board ESP-WROOM32 actually impresses me. Expressif surpriced everyone with ESP8288 a few years back, but ESP32 is a serious upgrade. Just look at this list:
- Supported in Arduino IDE. Straight forward to develope custom solutions.
- 38 pin IO
- Dual core 32-bit 240Mhz MCU – 600 DMIPS performance.
- Floating Point Unit & DSP Instructions
- 4-16MB Flash
- 448KB ROM
- 520KB SRAM
- 4 x 64 bit timers
- 3 Watchdog timers
- Temperature sensor
- ADC 16 channels 12 bit resolution
- DAC 2 channel 8 bit resolution
- 10 channel touch sensor
- Analogue Pre-Amplifier
- SD/SDIO/MMC Interface
- Motor PWM
- Hall Sensors
- Led segment output
- Programmable GPIO. Many IO devices can be freely allocated to pins.
- Infrared Remote controller
- SPI, Dual, Quad
- Wifi with security
- Temperature -40 to 85 degrees
- And much more…
That’s rather good for a breakout measuring 18 x 25.5 mm and costing ca 4.- USD. No wonder why the internet community have embrased it. And yes – I have ordered some. You should too!
An interesting option is the ESP32 WROOM breakout board. This comes with wifi and bluetooth and a very powerfully MCU. More important is that it support wifi security, cost ca 3.5 USD and measure 18 x 25.5 mm in size.
If I use this as MCU I only need to worry about the H-Bridge, PSU and extension port. I probably could attach that as a piggy pack soldiered under the ESP32. The total package would be something like 6-7mm thick, but this could actually work.
ESP32 have an awesome dual core MCU running at 240Mhz with loads of IO. I have GPIO, ADC’s, DAC’s, SPI, UART, + more.
The best part is that this is supported through Arduino IDE allowing people to add their own code easy. An even more exiting idea is Bluetooth and if I could set up a ESP32 as a “sender” allowing the train to detect their own position – I also have 2 DAC’s that easily become 2 sound channels. Some interesting options/ideas here.