miniThrottle: A model railroad WiFi throttle.
These are defined in miniThrottle.h which can be copied from miniThrottle.h.example. When you update your project for source that should preserve any customisations you have made to miniThrottle.h. However, if you then encounter compiliation errors you may have to compare the two files and update your customised copy with any new or changed definitions.
The Esp32 is very flexible in how pins are assigned. But there are some limitations that need to be followed. The list in miniThrottle.h is a summary of these, please be aware of these before simply assigning a function to an I/O pin. Each I/O pin can only perform one function.
********** PIN ASSIGNMENTS ****************************************************************** * * NB: pins 34 and above are read only, do not use them for outputs, assign to switches and rotary encoders * pins 34 and above do not have internal pull up resistors, if using for switches add your own 20K pull up * * NB: pins 06 to 11 are connected to the internal flash memory, do not use these even if available on your board * * ADC is used for Potentiometer throttle (Pot-Throt / POTTHROTPIN) * ADC1_CH0 - GPIO 36 * ADC1_CH1 - GPIO 37 * ADC1_CH2 - GPIO 38 * ADC1_CH3 - GPIO 39 * ADC1_CH4 - GPIO 32 * ADC1_CH5 - GPIO 33 * ADC1_CH6 - GPIO 34 * ADC1_CH7 - GPIO 35 * ADC2 not usable with WIFI enabled. * * DAC is used to drive 3v voltmeter speedo and brake pressure * DAC pins are limited to 25 and 26 * * SPI bus can be mapped to other pins, but the "native" pins are * SPI | MOSI | MISO | CLK | CS * VSPI | GPIO 23 | GPIO 19 | GPIO 18 | GPIO 05 * HSPI | GPIO 13 | GPIO 12 | GPIO 14 | GPIO 15 * * I2C bus can be mapped to other pins, but the "native" pins are * SDA - GPIO 21 * SCL - GPIO 22 * * The following are "strapping pins" which should in the state shown on reboot * GPIO 05 (must be HIGH during boot) * GPIO 12 (must be LOW during boot) * GPIO 15 (must be HIGH during boot) * * Bringing the EN pin to GND temporarily will hard reset the ESP32 module *
One of the design objectives of miniThrottle was to minimise parts count to keep the build simple. The examples below show relatively simple builds using 2 main parts the Esp32 module, and either a keypad or rotary encoder. Some wiring is still required.
The examples below show the minimum builds which allow for a viable unit. The module used includes a built in SSD1306 display. This module uses pins 4 and 5 for I2C communications, which includes the display. I/O pins other than those shown in the "Configuration" sections below are commented out using a "//". This configuration section refers to the file "miniThrottle.h".
From version 0.5 onward miniThrottle gains the ability to relay WiThrottle to DCC-Ex. This required neith input (keypad/encoder) or display to work allowing it to replace a standard DCC-Ex WiFi module. However, with a display to will show additional information, and in some cases the DCC-Ex LCD display becomes redundant/optional! From version 0.5d, see miniThrottle.h.004 for a template file that will work as a "relay-only" on a module with built in SDD1306 display.
Thank you for visiting this website | Home |