Model Train System

This was my first project that got me started on electronics again. The initial design did not work at all. It used an STM32 on one side and ESP-03 on the other which created too much interference + I had selected the wrong type H-Drive. The MCU and PSU design did however work well and was re-used on the second design based on ESP32. This one failed on a detail in the datasheet I had overlooked – not all IO pins are output. The main PCB is pictured below.

 


The backside is a bit special since it will only hold a single component ESP32. This is basically just a ESP32 with a PSU and a H-Bridge. I have drafted a New Controller, but it holding back a little investigating the position system that would change this from being a Remote IO toy to be an automated Train system.

This is the intended utility driver to enable control of other things. It was on this I discovered the IO mistake as I only have 8 and not 12 servo ports here. To move on I actually plan to use my new modular control system because it is so much more flexible. But, I will probably still maintain these small all-in one controllers based on ESP32. This worked excellent expect for the surprise on on 4 of the ports.

The main challenge on this project was however that I failed to find a position system that would work. The initial attempt was to triangulate on ultra-sound and yes it works, but it’s no way to get required components into a small model train cockpit. The second attempt was to triangulate on radio strength for Wifi and Bluetooth. And again – yes it kind of works, but it is far to inaccurate.

The third method was suggested by a friend and might just work. He suggested using a camera in the ceiling and recognize model train positions that way. I figured that if I use a IR led to send info I can identify train and position.

Changing the layout of the control system is easy, but I also needed to add a programmer. The intention is that these control systems will be programmed through Wifi, but we need a method to download the bootloader the first time.

I plan using OpenCV on a Raspberry PI with Camera for image processing, but this is an area where I am on thin ice. I know this should work, but I have little experience with image processing so this will be a new.

 

Leave a Reply