miniThrottle, Hardware Selection

miniThrottle: A model railroad WiFi throttle.

Bill of Materials

esp32Any esp32 module, but consider one with built in battery support if building a hand held unit.Yes
DisplayOne of displays supported by LCDGFX library. sdd1306, sdd1327, ST7735, st7789 or ili9341 used in testingRecommended
Rotary EncoderRotary encoder with push switch functionRecommended
KeypadAny matrix key pad. Membrane key pads recommended at these are compact and can be cut.Recommended
Potentiometer10K Slide or rotary for throttle. If slide, then consider one with a longer lenth of travel.No
Reversing leverSingle throw two pole switch. Having a center off position is useful for a brake position.No
indicator LEDsUp to 4 to indicate various states. Note different color LEDs will require different current limiting resistor values.No
VoltmetersUp to 2 3V voltmeters to use as speedometer or brake indicators.No
CaseA suitable housing to include the options selectedNo
Prototyping boardFor ease of mounting completed project and ease of wiringNo
Main on/off switchA suitable toggle, rocker or key switchNo
WiringUsed to connect components togetherYes
Battery3.7V rechargable battery for untethered operationNo
Miscbridge rectifier, 5V buck converter for non-USB or power >5VNo
MiscPWM controller to control screen brightness on the Blk pin of some displaysNo


Using a module based on the esp32 processor is recommended. Designing your own circuit board is probably more detail than most hobbists would care to do. Some modules support rechargable batteries or built in displays. Having a battery in your controller makes it ideal for handheld units.

The primary target for this project is the ESP-32 processor, but it may run successfully on other variants such as the ESP32-S3. It is not expected that the additional memory offered by these would give any advantage. However, they do offer additional I/O pins and even different WiFi bands. Very limited testing has been done against these CPU variants.

A sample of esp32 based processors modules suitable for use with miniThrottle DCC throttle


Aside from the esp32 processor, this is the only mandatory hardware. However, one of a number of displays can be selected, as long as it is supported by the lcdgfx library. Any display supported by the lcdgfx library should work, but not all have been tested in prototypes. A minimum resolution of 128x64 pixels is recommended. For example:

Display Cols & Rows per font size (landscape)
TypeResolutionColorRotatableSmall 6x8Std 8x16Large 10x20Wide 14x16X Large 12x24XX Large 16x32
SSD1306128x64Mono0, 180 degrees21x816x412x39x410x28x2
ST7735128x160Color0, 90, 180, 270 degrees26x1620x816x611x813x510x4
ST7789135x240Color0, 90, 180, 270 degrees40x1630x824x617x820x515x4
ILI9341240x320Color0, 90, 180, 270 degrees53x3040x1532x1222x1526x1020x7

When considering a display, think of the font height and the distance at which it is going to be read at. Bigger fonts make for more comfortable reading. It is recommended that your font height should be no less than 1/200th of the reading distance, and 1/150th of the distance may be more readable.

Depending on renaming of alternative files between 4 and 6 font sizes can be selected at runtime. miniThrottle will attempt to adjust to display data meaningfully. But lines may be truncated or not displayed. While miniThrottle may be usable with less than 16 characters by 4 rows, that is the recommended minimum.

Until more testing has been done, the largest fonts are only available on the 0.7 development stream.

A sample of displays showing a range of sizes suitable for use with miniThrottle DCC throttles

Rotary Encoder

This can be used to navigate menus and adjust locomotive speed. Use a 20k pull up resistor for encoder and encoder switch pins connected to the ESP32 pins. Other encoder pins are connected to ground. Effectively to MiniThrottle the encoder becomes a simple "keypad" with up, down and select buttons. Thus the input from another keypad can override or duplicate the effect of the rotary encoder.


Any one of a number of key pads can be selected. Membrane keypads are highly recommended, both because of the variety of them, and the ability to trim them using scissors or craft knife. These keypads tend to come with a ribbon cable connector which can connect directly to the esp32. They have a row and column matrix, such that every key can be mapped by its row and column reference. Typically the keys are mapped to something related to their legend, but can be mapped to any single character function.

On a newly built system, check the keypad mappings produce the characters you expect by giving the "showkeypad" command at the serial console. By pressing keys or buttons, encoder etc, you can ensure each key press gives the expected value shown in the "Function" column of the table below. Then either correct the wiring or update the keypad mapping in "miniThrottle.h", recompile and reflash the micro controller.

Functions and their meanings are as follows. Since some keys support different function when in menu or driving mode, quite a lot of functionality can be had even from very simple keypads.

FunctionTypical KeyEffect
00Function/Numeric Zero, or ESC in menus
11Function/Numeric One
22Function/Numeric Two, or up arrow in menus
33Function/Numeric Three
44Function/Numeric Four, or left arrow in menus
55Function/Numeric Five, or Select menu option in menus
66Function/Numeric Six, or right arrow in menus
77Function/Numeric Seven
88Function/Numeric Eight, or down arrow in menus
99Function/Numeric Nine
**Toggle Bidirectional Mode
##Cab menu - when driving locomotives, or Select menu option in menus
XF1 or ASelect Function 10-19
YF2 or BSelect Function 20-29
EESCEscape, back one menu level
SENTSelect/Enter, Select menu option
LLeft-ArrowChange direction to reverse, or ESC in menus
RRight-ArrowChange direction to forwards, or select in menus
UUp-Arrow or CIncrease speed, or previous option in menus
DDown-Arrow or DDecrease speed, or next option in menus
P*Potentiometer on/off, bypass potentiometer when driving in potentiomenter enabled systems

A sample of membrane keypads, miniThrottle DCC throttle can be flexible enough to accommodate any one of these

Throttle potentiometer

A 10K or 20K potentiometer wired as a voltage divider can be used with the wiper (Generally labelled 2) connected to the esp32 and the remaining pins (1 and 3) connected between 3.3v and ground. If using a slide potentiometer, one with a longer length of travel will work better than a shorter one, as the a shorter length will be more sensitive to any movement. The esp32 analogue to digital conversion tends to flatten out at about 3v, so you may like to consider placing an additional resistor that is about 10% of the potentiometer value between it and the 3.3v supply. If the ESP32 is powered from a 5V supply and you wish to connect the potentiometer to the 5V supply, then use a 5K1 resistor between the 5V and pin 1 of a 10k potentiometer. The pins 32, 33, 34, 35, 36 and 39 are candidates for potentiometer use.

When selecting a potentiometer be aware of the difference between the initial letter in the designation. A A10K one will have a log taper, ie small initial change, bigger later change and usually used in audio systems. A B10K one will have a linear taper, ie even changes over the distance/rotation. For most users the linear taper will be more desirable in a throttle.

In standard operation the side of the potentiometer nearest 0V is stop, and the extreme nearest 3V is full speed. in bidirectional mode the centre position is stop, while positions nearest 0V or 3V are full speed in reverse or forward respectively. A sample of potentiometers, shorter slide or rotary potentiometers can be expected to be more sensitive to small adjustments to position. Longer ones may therefore give a nicer/smoother throttle control.

Forward/Reverse switch/lever

This uses 2 pins only one of which should be brought to ground potential at any time. By using a double pole single throw switch with 3 positions this permits a reverse lever with forward, brake and reverse positions.

Note the reversing lever is effectively a keypad with "L" (Left), "B" (Brake) and "R" (Right) functions. Thus direction can be overriden with keypad entries from a membrane keypad, or by using the rotary encoder "keypad" in bidirectional mode.

Indicator LEDs

A number of selections can be indicated

Speedometer (3V voltmeter)

This is implemented as a 3V voltmeter between the esp32 I/O pin and ground. One of pins 25 or 26 may be used. Replace the voltmeter scale with a more appropriately labeled one of your own. Full scale deflection is at 100% throttle.

Brake Pressure Indicator (3V voltmeter)

This is implemented as a 3V voltmeter between the esp32 I/O pin and ground. To operate it in reverse, wire the meter between the esp32 I/O pin and the 3.3V pin. One of pins 25 or 26 may be used. Replace the voltmeter scale with a more appropriately labeled one of your own.

It is a very rough brake pressure simulator, pressure builds to a maximum over a few seconds, and drops quickly when slowing down. On a real train the pressure may take several minutes to build up and generally won't get used as quickly. This simulation doesn't simulate using brake while travessing an incline. However, it may help awareness in slower steady braking and just be a "fun" addition to a throttle system.

Thank you for visiting camelthorn.cloudHome