Category Archives: STM32 Development

PSU Ripple

The LMR14206 ripple was a bit much for my taste. It worked, I had 12V out, 3V3 out and the MCU ticked. But, it’s not a design I can live with. For now I continue on a different board and avoid mounting the DC/DC because I also realized that I could not really bypass it they way I had set up the jumpers. I decided for a 78M05 in TO252 format that gives 0,5A. But, for now I will use 12V directly.

This will work for now. I will return to DC/DC later, but looking at other peoples postings and the lack of LMR14206 popularity I get the picture.

The supercap in the schematics works well, but I probably need to add a bit of circuitry like I did on on PLC Com module. I use a 0.33F due to the size.

12V/0.6A DC/DC Regulator

This is my LMR14206 DC/DC regulator with R1=15K and R2=1K which gives 12.2V out. The white wire is the PCB error I wrote about earlier.

This is basically only the reference diagram – just be aware that the datasheet and demo schemtics mess up R1/R2 a little. Myself I use E values, so by setting R2=1K I can adjust voltage out by changing R2.

You need ca 2V drop, so the input for 12V out is 14-42V. I will get back with updated schematics and values for 3V3 matching E24 series later. I also want to have a look at the ripple that need some improvements.

3V3 DC/DC PCB Failure

I finally got around to assemble my 3V3 DC/DC converter and it did not work. Somehow I have switched off all checks in the EDA and managed to send it out like this – notice pin 6 is not connected … 

Luckily this is the first time I stepped into a bug in the PCB. The project check usually pick everything up – if it is switched on…


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
  • RTC
  • 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
  • 2xUART
  • CAN
  • 2xI2C
  • I2S
  • Programmable GPIO. Many IO devices can be freely allocated to pins.
  • Infrared Remote controller
  • SPI, Dual, Quad
  • Ethernet
  • Wifi with security
  • Bluetooth
  • 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!

Model Train Control System

It is now ca 2 year since I started this blog writing about a Model Train Control System. The system had several newbie issues, but what stalled me was the 40Khz sender I needed for the position system. I never found components with correct size and cost that could do the job. The design itself also had issues. It was to wide, H-Bridge was wrong and mounting the MCU on one side and ESP-03 on the other side created a lot of unexpected interference heat.

Moving on I would like to simpify the design and complete it. I need to return to the position system because I have no working solution for this. It is not only about solving it, but doing it with size and cost in mind.

The first issue is the form factor. It need to be even smaller to fit into the smallest H0 trains, and it need a better connector solution. I used 1.27 pitch holes as connectors, but this decoder is generic and need to be soldered on. I can just about do 1.27 pitch, but most people will struggle with this.

Limiting the design to 12V, no sound, no positioning and no utility functions on main board. I will rather use an extension bus to allow for utilities and sound to be added.

As for MCU I have 3 options. I could go with NRF24L01 and replace ESP-03 using a STM32F030, or I could use ESP12E and control things directly from this. I could also use an 8 bit AVR, but the reason I don’t is because the AVR chips cost 1.50 USD while STM32F030 cost 0.50.- USD. 3.3V also goes better with NRF24L01.

Having Wifi directly requires a router + it is not so great with maybe hundreds of trains running, so I go for the smaller NRF24L01+ breakout bords. Shockburst (NRF24L01) is open, but it is rather easy to create a system that reject non-intended messages.

And one last modification – lets replace those 1206 components with 0603 ones. This was my first SMD design and the small size scared me, but these days a 1206 looks like a large dinosourus.

Universal Motor Controller – Actuator Control System

I have a few electronic designs that annoy me simply because I lack time to work on them. The reason is simply to much happening in RL with projects (have to pay the bills) + focus on Software. This one is the worst. It is actually one of my most advanced designs and a very capable Actuator Control System.

I started this partly because I wanted to make my own 3-phase motor controller. But, as I did the design I also added a 4th Half-Bridge, Hall Sensors, Temperature Sensors, End point Sensors, Resolver input as well as the RS-X port. It is much better 3-phase motor controllers than this around, but that’s the point – this is not a motor controller it is a scalable Actuator Control System.


I blogged a lot about MicroPLC/Home Automation lately, and this design fit’s right into this scheme. We can’t use long wires with actuators involved as they need to be close to the objects they control (high currents). A centralized PLC design is not optional in a home that actually need distributed unit’s like this.

I will get down to it, but for now I want to focus on getting the HMI running. One of the first projects will be test applications for these devices.

The concept I will use is that the HMI Browser contact this device and upload the HMI. So all you install on the desktop, phone or tablet is a HMI Browser. This is similar to things you know from classic Web Browsers and HTML5, but the main difference is that we operate on a closed, industrial network consisting of a combination of technologies.

One aspect of easyIPC that I have not mentioned is that you have a set of HMI & devices that actually are a closed, industrial loop. It is not connected or available to internet or the outside world unless you want it to. Neither will you be able to connect any phone or tablet if it is on Wifi – the devices will need to be enabled from inside (white listed).

PLC/Home Automation HMI

I have been thinking a bit about creating a stand-alone HMI component. Basically a terminal with a touch display and optional keyboard, mouse and customized input equipment. The key principle would be that we use a Ethernet/RSX as bacbone for data traffic, while the HMI takes care of graphics, input etc.

This is just some random GIF I found on the net, but an HMI app could consist of a set of standard components where layout is controlled by XML files that are uploaded from the device. Communication could be Ethernet/RSX. Equiped with a Plain VM this could be an interesting concept where HMI logic is executed on the HMI unit and only events/data transferred to/from the rest of the system.

Making the app above might seem complicated, but it’s nothing I have not done before from scratch in C/C++. I am thinking more and more about creating a standard HMI app in Qt since that can run on Windows, Linux, Android, OsX etc. I need to check around for options.


Since we are talking about a network of stand-alone units we could create a full control center as well.


This picture is from CubeMX, just a few clicks and I have assigned 6 x UART’s, 3xSPI ports, crystal, SWD + added USB – the IO capabilities on the F405 never stop to amaze me + you gotta love CubeMX. Be a bit on your watch because not every possibility is available through CubeMX. Another tool I like is the 3D Paint version in Windows.

This is for the RS-X Switch.

Active RS485 Switch

I still got a few components to make\upgrade before I have a full Home Automation network. The CCM and RSX module allows me to create a central, but I need sensors and I need to feed the sensors power. One solution to this is to create an active RSX Switch with power output on each network.

The RS-X Switch as drawn here will take 2 x Ethernet or 2 x RS-X (M1 & M2) input and provide 4 x RS-X output with power. Each of RS-X E1,E2,E3 & E4 can be switched on/off separately and be used for networks or 1:1 with sensors/actuators.

The functionality in the switch is simple message switching. The idea of having 2 x Ethernet and 2 x RS-X Input is redundancy, but I realise this might be a bit tight to achieve so will see what pins & space I have available.

This module will also be a great RS485 Hub used stand-alone.