ESP32 Breakout

  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.

ESP32 Robot Arm Controller

I bought this robot arm a few years back for educational purposes. It’s great fun, but a bit limited in what it can do. The robot consist of 5 DC motors, but no sensors indicating position, so it is basically remote operated with no option for automation. I did create a RPI Hat dedicated for this one, but even that require a RPI that add to it’s size. ESP32 is so much neater as it replaces both RPI and the IO MCU.

This block diagram is based on the Train Utility Driver as I just remove the PWM signals and increase the number of H-Bridges to 5+ 1/2.

If you compare with the Train Utility Controller you will see that this have 6 H-Bridges on right side. It actually is 5 H-Bridges and 1 PWM signal. The illustration show right angle connectors, but this will mostly use straight connectors.

That said I want to wait a bit with this one until I get the others back and get a bit more experience with ESP32.

HMI Concept

This picture show a single Gauge on a form to illustrate how HMI Designer & Browser works. In this case we have a rotating needle that needs to be associated with an input value. What we do is to save this form as an XML and include it in a device.

But, we also need to associate this needle with a variable on that device. This is no coding, only a few clicks -job done.

The next that happens is that we start HMI Browser on Windows, Linux, OSX, iOS, Android or whatever. It contact our device, upload the HMI XML and we have a working HMI with a gauge showing the value of the variable we selected.

No coding involved, just a few click & plays on the screen and job done. No more need for hours by hours from expensive C#, Java, C++, HTML5 developers- no more need for specialised HMI/GUI skills – just a few clicks & play.

And I have not even got to the best part yet…

Train Control System – Utility driver

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.

Model Train Utility Driver – Part 2

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.

ESP32 – Downloading Firmware

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!

Model Train Utility Driver

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.

  1. ESP32 Wroom
  2. 7×2 PWM connectors
  3. 2 x H-Bridge Motor ports
  4. RS-X port w 12V Power inn.
  5. Jumper to select 3.3V or 12V on signal channels.
  6. 12 x Signal channels. Can be analogie in, Digital In/Out, Servo, I2S, I2C, UART, SPI, PWM or others.

Model Train Control System – Part 5

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.

Model Train Control System – Part 4

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.