miniThrottle Troubleshooting

miniThrottle: A model railroad WiFi throttle.


Preamble

The miniThrottle is a complex piece of software, which it is hoped will give you flawless operation. But given the variety of hardware and software options it permits, there is a good chance you may encounter issues. So where do you start?!!

Note the command line commands use lowercase commands, but some parameters may use capitals. If you find using the command line clumsy or counterintuitive, then please use the web interface instead!

Command line

Serial connection from either the Arduino IDE or a terminal emulator (Putty, Teraterm etc), 115200, 8 bits, no parity, one stop bit. Commands are sensitive to CAPS-lock or additional characters being added. Use help command to list all commands, or look up specific commands, eg using green for users commands, and yellow for miniThrottle's responses:
help protocol
Running permanent settings without parameters prints current settings:
protocol {withrot|dccex}
    Select default protocol to use
PROTOCOL DCCEX
	Command not recognised.
protocol dcc-ex
protocol should be one of: withrot, dccex
protocol
Default protocol is WiThrottle
protocol dccex
protocol
Default protocol is DCC-Ex

Web interface

an example of the web interface

For many users using the web interface is a good configuration option. Not only is it easier to use, but you do not have to be tied to the miniThrottle by a USB cable. Simply use your web browser to access your throttle, eg: http://192.168.4.1 There are two networks that are of interest when connecting to the web interface:

Since by default miniThrottle will run mdns, for some systems such as Android or Apple, you can connect using the throttle's name - dot - local address. With the example in the screenshot, http://woodthrottle.local would work. Since the web interface uses an unencrypted link, there maybe a warning that your connection is insecure. Given you aren't (and should not) be putting your banking details in via this link, this warning can be ignored.

When you select options to configure using the web interface, you will be prompted from a user name and password. Unless you have changed them, the defaults will be:



Troubleshooting

SymptomSuggestion
How do I connect to the USB console?The USB console provides the primary diagnotic interface for miniThrottle. It may be reached using the Arduino development environment or terminal emulation software like Putty, Minicom or TeratermPro. Use settings of Speed: 115200, 8 bits data, no parity, 1 stop bit. Using CR/LF line endings is also recommened if your emulation offers that option. Once connected use the help command or help followed by a command name to find your way around. The miniThrottle's serial interface is unique and differs from diagnostics on other projects.
Can I backup or clone my settings?Using the USB console, run the export command. You should be able to cut and paste these to somewhere else. These commands can be run on the same or another miniThrttle to clone it. Before doing a major upgrade, say from version 0.4 to 0.6, use export to back up your settings.
The project doesn't run
  • Connect to the miniThrottle using the USB serial connections, either using Arduino IDE, or a terminal emulation like Putty or TeraTerm-Pro. Reboot the the miniThrottle module and look for errors.
  • run the command "pins" on the console and check you have wired up your display correctly, and your encoder, keyboard, switches and potentiometer are connected to the right pins.
  • Check your throttle and control station are on the same WiFi network.
  • If needed specify the IP address and port number of your control station.
I've got WiFi Connection problems.If your ESP32 module has a built in WiFi antenna etched in the circuit board, try a module with an external antenna. Or try to move closer to your access point, the strength of you access point signal and your distance to it is more important than your distance to the WiThrottle controller. If you want to experiment with your own antenna start by looking at some thoughts on WiFi Antenna for ESP32.
My keypad buttons does strange things
  • Use the USB serial port then type "pins" and enter. check you haven't connected the key pad connector back to front.
  • Use the USB serial port then type "showkeypad" and enter, then press the keypay bottons. See if a pattern of mapping is shown. Then either rewire you keypad rows and columns to match, or change your keypad mapping in miniThrottle.h and recompile.
  • Replace the keypad if it is faulty.
When I compile I see ugly errors like:
C:\Users\enfield\projects\ESP32_miniThrottle\webserver.ino: In function 'void mkWebDeviceDescript(WiFiClient*)':
C:\Users\enfield\projects\ESP32_miniThrottle\webserver.ino:1748:6: error: 'spi_flash_get_chip_size' was not declared in this scope
 1748 |      spi_flash_get_chip_size() / (1024 * 1024));
      |      ^~~~~~~~~~~~~~~~~~~~~~~

exit status 1

Compilation error: 'spi_flash_get_chip_size' was not declared in this scope
Compilation error: 'spi_flash_get_chip_size'Check that you are not using verson 3 of the ESP32 board manager. If you are, downgrade to version 2. In your IDE go to the "Tools" drop down and find "boards manager". Now search for "ESP32", and in the "esp32 by Espressif" you will see a dropdown selection. This may have a number like "3.0.3", select the most recent version 2, eg "2.0.17" and install that. Don't upgrade your boards for esp32 while you want to compile miniThrottle.
When I compile I see ugly errors like:
expected unqualified-id before '(' token
#define max(a, b) ((a) > (b) ? (a) : (b))
Define the following in miniThrottle.h:
#define NOHTTPCLIENT 1
The compile error is caused by an incompatibility between lcdgfx and the httpclient library on version 2 of the Arduino ESP32 compiler. By disabling this feature you disable the ability to download configuration files or OTA updates to your throttle. It is not expected that will pose much inconvienence to the average user, you will need to use version 1.8 of the compiler if you wish to enable it.
This is the slowest thing on the planet!!There is a known problem when using version 2 of the Arduino IDE and a SDD1306 display. Screen refreshes will take 2 or 3 minutes or more! Avoid using version 2 of the Arduino ESP32 compiler and the SDD1306 display. Either select a different display type or use version 1.8 of the IDE.
How can I see if commands are going between my throttle and command station?Two options:
  • Use the USB serial port and type "showpackets" and enter. Use the throttle, the commands and responses should be displayed. The USB option requires you are teathered to your throttle.
  • Enable the temporary diagnostic port via the web page and then use a "telnet" program like Putty or TeraTermPro to connect to your throttle, then entering the command "P" (packets) will show your network traffic.
Can I monitor communication with the control station if miniThrottle is bolted away in a box or under my benchwork?Yes, perhaps. V 0.6a and later has a "diag" port that can be enabled from settings on the web interface. Once enabled, you can telnet to the diag port to monitor control station commands. This diagnostic port won't restart when miniThrottle is restarted, it is a temporary facility.
miniThrottle crashes and rebootsThat is not intended! Did it work previously? Did you change a setting? Does it always crash when you do the same thing? Now to figure out what went wrong by increasing the debug level prior to the next crash. To do that run "debug 3", the debug levels persist reboots and are:
  • debug 0 - Minimal
  • debug 1 - Default / recommended
  • debug 2 - Extra info, eg shows WiFi networks, if and when checked
  • debug 3 - Noisy, shows what major program routines are invoked
Including the last 5 to 10 lines of debug is useful in your bug report.
How can I check what data is loaded?If you an to see the raw data about your rosters etc, try "locos", "turnouts" or "routes" at the USB console. If you want delve deeper check "help dump" and "help nvs" for descriptions of deeper diagnostics.
When I select a route there is a time when it is inconsistent. Is that a bug?It is intentional. The route is being set up. Parts of it is set up and part is not. Trying to make use of it in this state can result in an accident if a turnout position changes while a train is passing over it.
Can I test the throttle without connecting to a control station?No not really! miniThrottle relies on getting control station responses to confirm settings. miniThrottle works on a design principle of getting feedback from the control station. You are not going forward at 60% speed until the control station has confirmed it. A side effect of that is sometimes miniThrottle may appear to lag in response compared to throttles that simply assume their requests will be obeyed and set a speed without having any confirmation.
I am using miniThrottle as a WiThrottle relay, my speed settings are diplayed briefly in EngineDriver then drop to zero.Check you have the track power on, without track power, your speed will be zero. Also check your serial connections between miniThrottle and DCC-Ex are correct. Without proper communications you'll not be able to move.
I get no joy from code or soldering.
I just want run trains.
Avoid projects like this one. Buy a commercial product. On the other hand, you may get a kick at looking at your own customised throttle and thinking "I did that!" - in that case it will be worth the effort.
The throttle menu is missing optionsBy default the menu only shows options which are usable. You may need to check you have track power applied, or refresh the menu by going back one menu level. CV Programming is not possible using WiThrottle, you need to use the DCC-Ex protocol for that.
This looks more complicated than other throttle projects!There are several other throttle projects that create throttles with less code or less soldering. But check if any of these are important to you:
  • Support of more than one protocol: WiThrottle and DCC-Ex.
  • Support for either WiFi or Serial (teathered) connectivity to the control station
  • WiFi information for up to 6 networks can be defined in advance allowing you to move seamlessly between different networks when operating on different layouts.
  • Support of bidirectional communications with the control station. Many other projects just issue commands to the control station and assume their command will be obeyed. MiniThrottle waits for a response from the command stantion to confirm what was asked of it was done. Sometimes a command station can't fulfil a request that was sent to it. This also gives you feed back your request was received.
  • Support for a variety of different hardware and layouts. By allowing a selection of keyboards, displays and switches, additional complexty is added.
  • Text based console interface. This allows a level of configuration and diagnostics that some other projects do not support.
  • Optional web configuration interface: Not uncommon in micro-controller projects, but this does allow another level of customisation.
  • Optional relay facility. Not too many throttle projects offer a similar feature.
So does that mean this is better than other Arduino DCC throttles?No! Depending on what and how you are trying to do things others maybe better. Look at build complexity, and features. Then compare and decide what you want to do. Many of these have been around for years and have wide support bases. miniThrottle has only been around since early 2022.

Here are some examples, although not an exhaustive list and not in any order of preference:

Connectivity Issues

This is potentially a big topic of its own, so will be dealt separately to general troubleshooting.

Checking data flow

One of the primary tools for this is using the "showpackets" command at the serial console. This allows you to verify miniThrottle is attempting to send data and the format it is in. You will also be able to see what data is being returned and the format it is in. If data is not flowing in both directions using the same protocol, then there is no controlling of trains!

There will be arrows indicating the direction of data flow:

You can verify what protocol is used. miniThrottle needs to use the protocol the remote side is expecting. If the remote side is expecting and sending WiThrottle data, then sending it DCC-Ex data won't work. To verify the packet types look at the fort of the packets in either direction: If you are connecting to an esp8266 WiFi module on DCC-Ex, you should try using WiThrottle protocol to connect rather than DCC-Ex. A serial to WiFi adapter connected to an enabled serial port of a DCC-Ex controller on the other hand is more likely to respond to DCC-Ex protocol.

Checking data flow wirelessly

Configuring the diagnostic port

Note: Version 08 had a bug with the way the diag port works which would cause the miniThrottle to reboot. This is corrected in version 0.8a - available via git only. Please check your miniThrottle version before using!

Normally the diag (diagnostic) port is not running, to start it you can use the "diag" command at the command prompt, or use the "Main Config" in the web interface. It is a useful diagnostic toll if your miniThrottle is built into a closed box or under some benchwork. Connecting to the diagnostic port To access it use a terminal emulation (eg putty or TeraTermPro) to connect to your miniThrottle specifying either a raw or telnet protocol. Pressing "p" and "enter" will start and stop the display of packets to your teminal emulation. You can also get a dump of important memory structures to see what data is loaded.

When scanning networks (wifi scan option), this takes a few seconds and may lead to a temporary loss of network connectivity. The higher the number the stronger the signal. -20 is much stronger than -80.


Serial connections

This may apply to both directly attached serial to the miniThrottle, or when using a serial to TCP/IP (or WiFi) adapter on your control station. Both sender and receiver must use the same speed and flow control settings - Typically 115200 bits per second / baud, 8 bits of data, no parity, 1 stop bit. If random bits of junk get passed back and are shown in showpackets, then you probably have mismatched speed settings. If no data is flowing check you have transmit in either side connected to the receive pin of the opposite side.

WiFi

Initially a freshly built miniThrottle will create a Wifi access point named after itself, and no password. You can connect a tablet of laptop to this WiFi network and access http://192.168.4.1 on this network to configure other wireless settings. It is recommended that unless you are using this miniThrottle as a relay, that to turn off this access point. The default user and password for web admin are "admin" and "mysecret" - it is suggested you change these.

There are some diagnostics to run at the serial prompt, note most of these can be run with a parameter to change the setting. Note all commands are run lower-case, do not use capital letters:

Note if you want more on these commands, you can use the help command at the serial prompt, eg:
help
help wifi
help wifimode




Thank you for visiting camelthorn.cloudHome