Geoff Bunza geoffb
Model railroaders running JMRI have the capability of connecting  their cell phone or wireless tablets as a remote throttle for DCC control. I have often heard modelers who would like newcomers to operate their layouts with a simplified throttle, with a speed control knob.  Also reducing the possibility of inadvertently changing things visitors know nothing about. This article describes the construction of a simple WiFi throttle that connects directly to the JMRI WiFi server. It is not dependent on your DCC base station connected to JMRI. It will support loco address selection, six (or more) function switches, speed and direction control, running on a standard nine volt battery. While providing basic throttle functions, it can be customized and expanded by the inventive modeler to perform multiple functions at the touch of a button. You can also limit its functionality as you wish. It uses simple readily available parts for a one or two evening project. Throttle sketch updated 7 May 2019 to V5.2 minor bug fix.
_Opening.jpg 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 6
Michael Tondee

Just to be sure

This throttle and JMRI on my laptop are all I would need to rum trains on my railroad? Assuming I had something to program locos with, no other DCC base station is needed?

Michael, A.R.S. W4HIJ

Model Rail and "mad scientist" for over 50 years.

Member of "The Amigos", Co-Inventor of the A.O.S.T.

I call what I do "An artistic impression of reality" and the Island is "lost" somewhere in the Pacific Northwest, see it here...

The Blackwater Island Logging & Mining Co.

Reply 0
Geoff Bunza geoffb

@Michael

Hi Michael,

Quote:
This throttle and JMRI on my laptop are all I would need to rum trains on my railroad? Assuming I had something to program locos with, no other DCC base station is needed?
No, This is a throttle that connects to JMRI via a JMRI WiThrottle Server connected to a WiFi network. It says nothing about how JMRI connects to a DCC layout. Simplest, lowest cost solution would be JMRI running on a Raspbeerry Pi 3B+ (about $30) which has its own built in WiFi access point hardware, and a DCC++ Arduino/Motor Shield combo connected to the RPi via USB. Separate 14-15V power is needed for the motor shield for track/DCC power. But, you likely know JMRI can connect to a wide variety of DCC base stations to provide the DCC power to the track. Once JMRI is controlling a DCC loco on the track, it has to be provided with the ability to connect its WiThrottle to a WiFi network near your layout. The simple WiFi throttle acts as another JMRI throttle interface for JMRI.
'Hope I made this clear. Have fun! 
73 \  AD7JP 
Geoff

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Michael Tondee

OK, it was getting late last

OK, it was getting late last night. I now realize how I misread what I did. Just trying to determine my shopping list for Arduino stuff. I still have my Digitrax DCS-51 and PR-3 but the ultimate goal for me is an all DIY solution although I may have to have my PR-3 for loco programming. Looks to me like the ESP32 is the best overall bang for the buck. 73 Geoff, my call is W4HIJ, it was my Father's and I got it through the vanity program when he passed. Wonder how many other ham ops we have here?

Michael, A.R.S. W4HIJ

Model Rail and "mad scientist" for over 50 years.

Member of "The Amigos", Co-Inventor of the A.O.S.T.

I call what I do "An artistic impression of reality" and the Island is "lost" somewhere in the Pacific Northwest, see it here...

The Blackwater Island Logging & Mining Co.

Reply 0
HVT Dave

@Michael

I agree that the ESP32 will give you the best bang for your buck, and I highly recommend the Pololu motor shield.  Here is how Geoff's throttle and several others can interface with Digitrax and with DCC++

%20DCCpp.jpg 

My suggestion:  Geoff's Throttle - Raspberry Pi/JMRI - ESP32 - Pololu

Dave

Member of the Four Amigos

 

Reply 0
Michael Tondee

Thanks Dave

I think I'm about to pull the trigger on two of the ESP32 from Geoff's supplier listed at the beginning of the thread. On my other Arduino thread someone recommended I  go ahead and use one for DCC++ rather than an Uno or Mega.

Michael, A.R.S. W4HIJ

Model Rail and "mad scientist" for over 50 years.

Member of "The Amigos", Co-Inventor of the A.O.S.T.

I call what I do "An artistic impression of reality" and the Island is "lost" somewhere in the Pacific Northwest, see it here...

The Blackwater Island Logging & Mining Co.

Reply 0
Paelgin

Parts List

I got my stuff from that list, but found that the horn button, and the knob for speed control, are not on that list.  So plan on adding whatever you need for the horn and for the speed control.  In our design. we also decided to keep our throttle simple, so we cut back some, and I only bought parts for the horn, lights and bell (along with on/Off, direction and speed).

I built my first throttle with a momentary pushbutton (modified the code to use Active LOW instead of HIGH), but the 2nd throttle, I built different.  I put a spring-loaded momentary SPDT lever switch, and modified the sketch to activate the horn by pulling down, and triggering the short horn by pushing up.  I also changed the switch for the lights to a SPDT center off, and modified the code for Off/Dim/On for the headlights.  I am going to the Club layout this afternoon to meet with my cohort in this project to show him the new throttle and see if those features are worth including in our planned-to-be simple throttle. Geoff has provided an excellent project here, and we're thrilled to actually have one (so much so that 3 other guys in the club have asked me to build one for them).

Incidentally, the speed control knob, as Geoff pointed out, is the main "feel" of the throttle (and most used).  I bought 25mm (about 1") solid aluminum knob with knurling, specified to fit a 6mm shaft.  The potentiometer in the parts list has a 1/4" flatted shaft (an excellent Bourns pot by the way) so I had to slightly enlarge (drill out) the knob shaft hole, but it almost fit as it was. I looked at larger and smaller diameter knobs, and settled on the 25mm and with the pot that is in the parts list, we're very happy with that size.  It is tall enough to reach over the horn button, and extends close to the side (like a Digitrax UT4, but mine's on the opposite side) for thumb movement without having to look at it. 

Regarding how it works for us: we have Digitrax (at the Club where the guys are planning to use it) with a PR3 connected to a computer with a dedicated, non-Internet wifi. We run JMRI with WiThrottle so we can use our phones (with Engine Driver on Android, and WiThrottle on ios). This throttle connects right up because I added the WiFi SSID, password and WiThrottle IP address (from JMRI) into the sketch.  As Dave points out, many other options are available.

The case I used is from the United Kingdom, and while a bit tight fitting everything in, does actually fit very well (the board fits sideways across, so the USB port is at the edge) and is easily held in one hand.  We're thrilled with the fit and feel.  The ebay item number is 131978994077.

Phil in gorgeous Young Harris, Georgia, USA.  http://www.tsmri.org

Reply 0
sdcruz

Hi Dave Thanks alot for the

Hi Dave

Thanks alot for the diagram showing what goes with what - I see you have the Digitrax system, could one replace this with a NCE Procab system?  What is required with a NCE Procab System to go wireless with DCC++

Regards
Shelton

Reply 0
HVT Dave

@ Sheldon

The DCC++ system would completely replace all you NCE components just as it replaces all the Digitrax compontnts in the drawing, if that is your objective.

However, if your objective is to run Geoff's wireless throttle along with your existing system you can just add the NCE USB interface board and a RaspberryPi 3B running Steve Todds JMRI image.  That way could also use smartphones and tablets.  The ProtoThrottle will already connect to your NCE system cab bus.

So, what is your objective?

Dave

Member of the Four Amigos

 

Reply 0
Michael Tondee

I'm happy to report that I

I'm happy to report that I now have an ESP32 on the way from the supplier Geoff listed. I've yet to order any of the other parts because I still don't know exactly what form the throttle is going to take and I have several other projects going, not the least of which is putting together a DCC++ system to hopefully completely replace the Digitrax system I use now. Trying to get back to my DIY/electronics experimenter roots.

I just had to get the ESP32 board while I had the chance. It was my Valentines day present from my lovely wife.

Michael, A.R.S. W4HIJ

Model Rail and "mad scientist" for over 50 years.

Member of "The Amigos", Co-Inventor of the A.O.S.T.

I call what I do "An artistic impression of reality" and the Island is "lost" somewhere in the Pacific Northwest, see it here...

The Blackwater Island Logging & Mining Co.

Reply 0
cstalsworth

Here's mine!

 

Geoff,

I have been working on a similar project for about a year now. Basics are:

ESP8266 , supports 4 locos or consists, reads and stores JMRI roster information for loco selection, 28 Function keys, rotary encoder speed control, two programmable function keys that are not paged (normal keys are are on 3 pages 0-9, 10-19, 20-28). Rechargeable battery with built in charger module. Works with JMRI or LNWI.

 

MG_x0331.jpg 

I had the prototype at the NTS in Kansas City and based on the input from potential users made a bit smaller.

Chad Stalsworth

Arroyo Grande, CA

 

Reply 0
Michael Tondee

I like that display and

I like that display and keypad. How much of that besides the front panel is custom?

Michael, A.R.S. W4HIJ

Model Rail and "mad scientist" for over 50 years.

Member of "The Amigos", Co-Inventor of the A.O.S.T.

I call what I do "An artistic impression of reality" and the Island is "lost" somewhere in the Pacific Northwest, see it here...

The Blackwater Island Logging & Mining Co.

Reply 0
dapenguin

Nice Project

Were did ya get that keypad???

TC Carr
Malheur, Kopperton & Tejas * Sn3½ in 1923
(the I don't know yet) * Sn2 "Gilpin in Idaho"
​Anaconda, Oregon & Pacific * S Scale Heavy Electric
My Blog Index

Reply 0
cstalsworth

This is what it looks like inside

The whole thing is custom from scratch. I designed the boards and built them myself. Mostly surface mount except the buttons and switches.The throttle is configurable over Wi-Fi from a phone or laptop and can take software updates over the air (OTA) from a properly configured JMRI web server. The majority of the  electronics is on the mainboard  (2nd board from the left). Only thing on the others is the keypad. Keypad board plugs into the mainboard and the screen plugs into the mainboard through the hole in the keypad board. The direction switch is to left on the mainboard. MG_0319S.jpg 

Chad Stalsworth

Arroyo Grande CA

Free-Mo SLO

Reply 0
Logger01

Nice Design and Layout

Chad,

A very nice design and layout.

Some of the questions lurking in the minds of MRH Forum readers: What are your plans for your throttle? Is this just an "I need a less expensive WiFi throttle" or - on the other end - are you planning for a commercial product? If this is just a DIY project will you be making the design files available?

Ken K

gSkidder.GIF 

Reply 0
Michael Tondee

I second Ken's questions

Specifically, I'm very interested in the details of the keypad and display. I understand the boards are custom but how about the source of the buttons and display?

Michael, A.R.S. W4HIJ

Model Rail and "mad scientist" for over 50 years.

Member of "The Amigos", Co-Inventor of the A.O.S.T.

I call what I do "An artistic impression of reality" and the Island is "lost" somewhere in the Pacific Northwest, see it here...

The Blackwater Island Logging & Mining Co.

Reply 0
cstalsworth
Reply 0
Michael Tondee

Thank you Chad, very much

Thank you Chad, very much appreciated. I really like the look of your throttle but right now I'm pursuing something DIY that will have a "steam look". It will need function keys though so that's why I was curious about the pad.

Michael, A.R.S. W4HIJ

Model Rail and "mad scientist" for over 50 years.

Member of "The Amigos", Co-Inventor of the A.O.S.T.

I call what I do "An artistic impression of reality" and the Island is "lost" somewhere in the Pacific Northwest, see it here...

The Blackwater Island Logging & Mining Co.

Reply 0
Mark Stafford

Remote config for ESP32 throttle

Hi Geoff,

I know and respect your opinion and therefore, I wanted to bounce a idea around and I figure your the right man to tear the concept to bits if is dumb or not.

But the thought revolves the idea of separation of the act of configuration of a device like your ESP32 throttle and the function of the throttle itself.

To explain what I am banging on about....

If I focus on a throttle that is somewhat prototypical in its design and operation it needs control that more or less give the impression that it’s operator is in charge of a train and that train is more or less working like the real thing.

The second bit we need is the behind the scenes “configuration” function that lets our operator connect our ESP32 throttle to an assigned decoder or decocders.  It covers setting CV as required. In short all those house keeping duties that are required to set up our throttle to do what we want to the target train in the way we want it too.

It occurred to me that I wouldn’t mind at all if my train throttle was relived of the “DCC Configuration” duties and was solely targeted at simulation of an engine control stand.

What if say my mobile phone had the app on it that talked to my throttle (via a Bluetooth pairing) and was the device that all those “DCC Configuration” activities.  Seperatly from and indipendantly of my ESP32 throttle.

The phone /iPad/whatever could have multiple setups for multiple throttles and multiple train/s engines.

Is it a dumb idea Geoff?

Mark

Reply 0
Eugene Griffin EGRX

Customized Design Completed

 

The throttle emulates an ALCO RS-3 braking and throttle. The horn and bell are activated by push buttons on the side. All setup of the throttle will be completed using a web page generated by the ESP32 similar to the web page used to control and setup the ESP32 controlled engine.

https://forum.mrhmag.com/post/diy-wifi-engine-control-project-12211875

IMG_0628.jpg 

I have a "low end" 3D printer and it's been doing an OK  job. 

Hope to have a working throttle soon.

Eugene

Reply 1
Geoff Bunza geoffb

@Mark re: Several points

Hi Mark,
Quote:
If I focus on a throttle that is somewhat prototypical in its design and operation it needs control that more or less give the impression that it’s operator is in charge of a train and that train is more or less working like the real thing.
OK... accepted as stated.
Quote:
The second bit we need is the behind the scenes “configuration” function that lets our operator connect our ESP32 throttle to an assigned decoder or decocders.  It covers setting CV as required. In short all those house keeping duties that are required to set up our throttle to do what we want to the target train in the way we want it too.
Either setting CV's as required is static (as you set them up with decoder pro and you are done, and this is another "given and accepted") or you are implying but not stating somehow you are wishing to set up CV's dynamically, as in on the fly as you operate your train, and currently that is really not do-able for mere mortals.
Quote:
It occurred to me that I wouldn’t mind at all if my train throttle was relived of the “DCC Configuration” duties and was solely targeted at simulation of an engine control stand.
Your throttle, while in operation, has no "DCC configuration duties," by definition, since setting CV's requires a different DCC protocol, and is done in a decoder programming environment, generally incompatible with running trains. Is it possible you mean setting certain DCC Functions instead of CV's?
Quote:
What if say my mobile phone had the app on it that talked to my throttle (via a Bluetooth pairing) and was the device that all those “DCC Configuration” activities.  Seperatly from and indipendantly of my ESP32 throttle.
Perhaps yo can clarify the "DCC Configuration activities" that you want done separately from your throttle? If you take a look at the JMRI WiFi throttle commands found here: http://jmri.org/help/en/package/jmri/jmrit/withrottle/Protocol.shtml  you will find the entire set oc commands the throttle may use, and you may be disappointed to not see any dealing specifically with setting CV's. The closest command is to send raw data packets to the command station.
 
I would ask you to clarify a bit more what you envision as the end result of your thinking. Maybe then I could comment a bit more intelligently.
Have fun! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
cstalsworth

Remote configuration

The throttle I designed and discussed previously has remote configuration capabilities. Why you might ask? The primary reason is that as a Free-Mo person I need to be able to connect my throttle to deferent servers either JMRI or LNWI without recompiling and reloading the code. To accomplish this task the Throttle becomes an access point with a web server that takes configuration information from the user via the browser in his phone or tablet. It provides a list of available SSID's and lets the user select the JMRI/LNWI SSID and provide a password and port. It grabs a couple of other configuration bits from the user and re-boots the throttle and logs into the JMRI server. When I go to to a new location, if I hold a specific down while it powers up, that forces the throttle into AP mode. I also collect stuff like do you want to be able to control the DCC power from the throttle, what function keys do you want the user keys to send, throttle name to pass to JMRI, and addressing information for the software update server.

 Chad Stalsworth

Arroyo Grande, CA

Free-Mo SLO

 

Reply 0
Mark Stafford

@Chad

Hi Chad,

Remote configuration for me is for a different reason than yourself I think.

The reason I would like remote configuration is so my throttle controls do not have to include buttons, screens, keypads etc that I would not expect to see on a real throttle stand be it diesel or steam.

It seems to me that quite a bit of “controller real estate “ is routinely given over to push buttons etc that do setup tasks primarily and almost as an after though are used to control bits and pieces.  To my eye it makes most controllers look like tv remotes.  I personally find that look most unattractive (everyone to their own however)

How the config stuff is on a phone/iPad is layed out is to me  personally of no consequence Whatever!  But on my throttle I’d like my controls to at least try to look authentic. (While still being practical of course)

Though in your place I think your reason is more useful when compared to mine.  

‘Good work Chad  

Mark

Reply 0
Prof_Klyzlr

Divide and conquer

Dear Mark, Something to consider. I was (still am, slowly) working on converting a prototype (genuine RR) bellypack OCU to a DCC Throttle. The problem was that the prototype OCU does not have the kind of numpad + "select loco" and associated buttons of a "one throttle may need to jump between selecting locos at any given moment" Model train throttle. The solution I was playing with for a while was a GPIO extension board (lots of hardware input and output pins) which connected via USB or BT to a Droid phone (running Enginedriver/JMRI throttle app). The idea was: - Put on the bellypack OCU - connect OCU --> phone (USB plugin) - Select the required loco using the phone and the ED app GUI (assumes the backend WiFi + JMRI + DCC rig is solid and known) - Then slip the phone into a (already existing) pouch in the OCU vest (designed for the prototype OCU operator to hold a 2-way walkie-talkie) - And "Drive" the train from the prototype OCU tactile hardware controls. This separation of "initially selecting-the-loco-to-drive" and subsequent "doing your shift in the cab driving" actions mirrors the prototypes procedural separation of "setting up and mating a given OCU to a given Remote Locomotive", and subsequent "doing the 8hour shift switching with the remote loco/consist". Of course, the coding of the "bridging app" between the GPIO board and the existing Enginedriver app was the sticking-point, (I code easier in solder than I do onscreen), And with Dr Geoff's excellent "simple throttle" core, it appears that electrically I could well "replace the phone/smart-device/HUI-->WiFi-link Circuitry+app I first thought of", But with a lack of hardware IO pins, and the need to do have a "loco selection" numpad which can be "discretely hidden once a loco is assigned to the OCU", There's still a lot more drawing-board time and effort required... Happy modelling, Aim to Improve, Prof Klyzlr
Reply 0
Paelgin

Cannot control anything on LNWI, even though connected...

Howdy again Geoff. I have made so many changes to the sketch to make it do other stuff.  However, while it is working well on JMRI, I tried with a Digitrax LNWI (during the public viewing at the Grand Strand Model Railroaders "http://www.gsmrrc.org/" with the help of a couple of their members).  It did connect, but would not control a loco,although my Engine Driver Android app did.  With no way to look up what it was doing (the LNWI is a stand-alone LocoNet-connected device with no computer), I have tried to see what the difference is between JMRI and LNWI but have not solved that mystery yet.  Any thoughts or direction would be helpful. 

On a different note,I did get the Roster to load into memory for selecting when starting a new DCC address.  I think that will be easier to use.

Another problem I still have is how to save a foreign SSID/Password/ServerIP when I am off-site and connecting to a new SSID.  I have a means to connect, but not to save, so I was wondering how the eeprom could be used.  I see that integers are saved and can be read from eeprom to build the DCC address (two bytes if over 127). How can a string be saved to eeprom, and read back at a later boot? 

Thanks again for the great ideas and excellent support!

Phil, from gorgeous Young Harris,Georgia, USA

ps, my old laptop (2006 Dell Inspiron 1525, the only one I brought on vacation) would not connect with the USB on the board ("Timeout Waiting for Packet Header" error). I figured it was probably due to USB 1.0 ports on the laptop.  On a hunch, I went to Best Buy and bought a powered USB 3.0 hub, and it works great!

Reply 0
Geoff Bunza geoffb

@Phil re:

Hi Phil,
 
I do use Digitrax but not the Digitrax LNWI so I don't have much to offer your debugging.
 
'Glad to hear you are eagerly extending the WiFi cab too!
Quote:
How can a string be saved to eeprom, and read back at a later boot? 
EEProm is dealt with a byte at a time.... Something like this:

// EEProm Strings
//
#include < EEPROM.h>
int  i, prom_address_start, mystringlen;
String mystring = "Loco_24";           // string example

void setup() {
  prom_address_start = 0;
  mystringlen = mystring.length();
 
  for (i=prom_address_start; i < prom_address_start+mystringlen+1; i++)  {
    EEPROM.write(i, mystring.charAt(i));
  }

  for (i=prom_address_start; i < prom_address_start+mystringlen+1; i++)  {
    mystring = mystring + char(EEPROM.read(i));
  }
 
}
void loop() {
}

Have fun!
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Reply