miniThrottle: A model railroad WiFi throttle.
|esp32||Any esp32 module, but consider one with built in battery support if building a hand held unit.||Yes|
|Display||One of displays supported by LCDGFX library. sdd1306, sdd1327, ST7735, st7789 or ili9341 used in testing||Recommended|
|Rotary Encoder||Rotary encoder with push switch function||Recommended|
|Keypad||Any matrix key pad. Membrane key pads recommended at these are compact and can be cut.||Recommended|
|Potentiometer||10K Slide or rotary for throttle. If slide, then consider one with a longer lenth of travel.||No|
|Reversing lever||Single throw two pole switch. Having a center off position is useful for a brake position.||No|
|indicator LEDs||Up to 4 to indicate various states. Note different color LEDs will require different current limiting resistor values.||No|
|Voltmeters||Up to 2 3V voltmeters to use as speedometer or brake indicators.||No|
|Case||A suitable housing to include the options selected||No|
|Prototyping board||For ease of mounting completed project and ease of wiring||No|
|Main on/off switch||A suitable toggle, rocker or key switch||No|
|Wiring||Used to connect components together||Yes|
|Battery||3.7V rechargable battery for untethered operation||No|
|Misc||bridge rectifier, 5V buck converter for non-USB or power >5V||No|
|Misc||PWM controller to control screen brightness on the Blk pin of some displays||No|
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.
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)|
|Type||Resolution||Color||Rotatable||Small 6x8||Std 8x16||Large 10x20||Wide 14x16||Huge 12x24||Giant 16x32|
|SSD1306||128x64||Mono||0, 180 degrees||21x8||16x4||12x3||9x4||10x2||8x2|
|ST7735||128x160||Color||0, 90, 180, 270 degrees||26x16||20x8||16x6||11x8||13x5||10x4|
|ST7789||135x240||Color||0, 90, 180, 270 degrees||40x16||30x8||24x6||17x8||20x5||15x4|
|ILI9341||240x320||Color||0, 90, 180, 270 degrees||53x30||40x15||32x12||22x15||26x10||20x7|
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.
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.
|0||0||Function/Numeric Zero, or ESC in menus|
|2||2||Function/Numeric Two, or up arrow in menus|
|4||4||Function/Numeric Four, or left arrow in menus|
|5||5||Function/Numeric Five, or Select menu option in menus|
|6||6||Function/Numeric Six, or right arrow in menus|
|8||8||Function/Numeric Eight, or down arrow in menus|
|*||*||Toggle Bidirectional Mode|
|#||#||Cab menu - when driving locomotives, or Select menu option in menus|
|X||F1 or A||Select Function 10-19|
|Y||F2 or B||Select Function 20-29|
|E||ESC||Escape, back one menu level|
|S||ENT||Select/Enter, Select menu option|
|L||Left-Arrow||Change direction to reverse, or ESC in menus|
|R||Right-Arrow||Change direction to forwards, or select in menus|
|U||Up-Arrow or C||Increase speed, or previous option in menus|
|D||Down-Arrow or D||Decrease speed, or next option in menus|
|P||*||Potentiometer on/off, bypass potentiometer when driving in potentiomenter enabled systems|
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.
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.
A number of selections can be indicated
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.
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 this website||Home|