Building a WiTcontroller Throttle....

Sumner May 16, 2023

  1. Sumner

    Sumner TrainBoard Member

    2,829
    5,949
    63
    This page will cover mainly the wiring diagrams for the WiTcontroller throttle. One needs to follow the basic wiring diagram as shown at first below but then there are options. I had two batteries so used them but wiring for one is simpler. I added a charging port but one can charge using the ESP32's USB port. I wanted the ESP32 off during charging but it doesn't have to be. With two batteries I added a battery selector switch and a main on off switch. I also put two screws through the case side and connected one to ground and the other to the battery selector switch. I can put my VOM on the two screws and measure the battery voltage easily so see if I want to recharge.

    The main addition was I wanted additional pushbutton switches on the case for seven of the functions. These functions can also be selected at any time via the keyboard also. I find it easier and quicker and more intuitive over time to use the buttons but you do not need to add them and I'll put the print files up for 'Buttons' and 'No Buttons' and a option for 'Very Small Button Holes' that could later be drilled out maybe.

    The two side buttons make it easy to operate the Bell or Horn with the hand holding the case. Also you can reach most of the rest of the buttons with that hand leaving the other hand free for the throttle knob or doing something else. I mounted the throttle on the side and really like it there. Hold your left hand out palm up like you would holding a throttle. Now pretend the throttle is in that hand. Is it easier and more natural to operate a throttle knob clockwise and counter-clockwise with your right hand on the side or top of the throttle you are holding? The case kick-out where the throttle is also makes the case more natural to hold I find.

    The case seems to be a good size. I was going to make it thinner but glad I didn't. For me I wouldn't want if any smaller yet it is smaller than my phone throttle that has a physical throttle knob. After using it some the phone throttle isn't going to be used much except for maybe sound locos as it is easier to see all the sound function options on the screen with Peter's EngineDriver. A couple big pluses for this throttle is it runs forever without having to recharge the battery vs. the phone throttle. It is quicker to pickup, turn on, connect to the WiThrottle and run a loco than the phone throttle. Finished.....turn it off....set it down.... it is ready to go without having to plug it into be charged. Great job on the software by Peter Akers that makes the throttle possible to build. A link to his GitHub account where you can find the software and more ( HERE ).

    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    As you can see above you can build a WiTcontroller throttle to suit your needs. It can be as simple as one battery and no additional button switches for functions as you have up to 10 functions that can be assigned to the keypad or add as many function buttons as you want. Peter will be working on the software so that one could have maybe seven buttons and the 10 keypad functions for a total of 15 or more functions that could be used via the keypad and other buttons on the throttle.

    You don't need to use my 3D printed case. Make a case from other materials, such as styrene that can be cut, drilled and glued together. Also PeteGSX has a 3D printed case you can download from ( HERE ) and I'll bet more will be coming.

    The throttle is evolving and updates can be download fairly easily with a USB cable between the throttle and your computer. There is a lot of flexibility with the throttle as you decide what functions (from those available – Peter's GitHub account ) you want assigned to the keys on the keypad and/or any additional function buttons you add.

    To be continued.........and if you came into this build here click ( HERE ) to go to the start of the build.

    Sumner
     
    Last edited: May 16, 2023
  2. sidney

    sidney TrainBoard Member

    1,243
    2,110
    38
    Thank You for the detailed build. Very nice of you to share your hard work/Time and I also thank others hard work as well as there/time/ willingness to share that work.
    I think it great and also helps other Modelers that are stuck with few $$$$$ to obtain equipment / know how needed to full fill there layout needs.
    Im sure this hurts the big boys retails, but not every body has a money tree or knowledge tree for that matter..
    so im sure this is a very good contribution to a great hobby and teaching of the younger generation wanting to learn more .
    Im getting my grand daughter involved in the electronics builds that i do . she has an interest in this field at 11 years old so ill encourage her as much as i can . i would hope that others are doing same with the grand kids ect. ( grandson just wants to go FAST.)(y)
     
    Sumner likes this.
  3. BigJake

    BigJake TrainBoard Member

    3,282
    6,269
    70
    Arduino is a great ecosystem to further kids' interests in electronics and software, and model railroading has plenty of applications for both!
     
    Sumner likes this.
  4. Sumner

    Sumner TrainBoard Member

    2,829
    5,949
    63
    Building Peter's WiTcontroller Throttle Part 2:

    Parts List:

    The parts used for building the throttle can be obtained from a number of sources. The keypad and display need to be source so that you end up with parts that will fit PeteGSX's case, my case, your case or someone else's. There are a number of ESP32's out there and I'm not familiar with them and unless you are I'd stick with the one that Peter used or I used (the same one) as it works for sure. Peter is in Australia and I'm in the States so we source parts from different sources.

    The following are the parts that Peter used along with PeteGSX's 3D printed Case (From Peter's GitHub account ( HERE ).


    • WeMos Lite LOLIN32 (ESP32 Arduino with LiPo charger) (Example)
    • 3x4 Keypad (Example)
    • Polymer Lithium Ion Battery LiPo 400mAh 3.7V 502535 JST Connector (or larger capacity) (500mAh Example)
    • KY-040 Rotary Encoder Module
    • OLED Display 0.96" 128x64 Blue I2C IIC SSD1306 (Example)
    • PeteGSX's Case you can print - ( HERE )
    • Knob (Example)
    The following are the parts I used for 'my build' You might want to use them or not. If you are going to print my throttle case I'd get the same keypad and OLED display to make sure they fit. If you go with a 0.96” display it will be smaller than the window in the case. You can find these items numerous places:



      • 3x4 Keypad (If you are going to print my case I'd get the one in the link to make sure it fits) – $5 each – ( HERE ) (I ordered two so I can make 2 throttles)
      • Lipo battery (the links are the two I'm using but lots of options here although for my case I'd get a flat one like in the links) – $10 & $16 – ( HERE ) & ( HERE )
      • Rotary Encoder Module – $10 for 5Pcs -- ( HERE )
      • WeMos Lite LOLIN 32 (ESP Arduino with Lipo Charger port – $16 3Pcs -- ( HERE )
      • OLED 1.3” Display (I went with a 1.3” vs. the 0.96” that Peter used and I'm happy with it) – $9 -- ( HERE )
      • DPDT On/Off/On Toggle Switch -- $7 5 Pcs -- ( HERE )
      • SPST Momentary Pushbutton Switches – $8 10Pcs -- ( HERE )
      • SPST On/Off Pushbutton Switch -- $10 5Pcs -- ( HERE )
      • USB-C Port -- $8 for 5Pcs -- ( HERE )

      • My 3D printed case print files ( HERE soon)
    A number of the items like the switches I already had as the result of ordering parts for other projects. Since I ordered 2 keypads I'll probably build a second throttle as I also have all the other parts needed as shown above.

    =========================================

    Let's put a throttle together. If you solder pretty good you can do this in an easy day but take your time and so that it works the first time. Also it is your choice if you want the extra (besides the keypad) function buttons and how many. You can print a case with or without them. If you decide to go without I'd suggest thinking about still printing the case with the holes for the function buttons in it. Then get some decorative plugs to plug them. In the future if you wanted some function buttons pop the plugs and put them in.

    [​IMG]

    In total there are six parts that need to be printed. The case top, middle, bottom and the three other small components shown above.

    [​IMG]

    .

    [​IMG]

    .

    [​IMG]

    I kept the tolerance on the print tight and printed on 'Standard' quality using Cura as the slicer and an Ender 3 Pro filament printer for the printer. I spent a few minutes on the the fit of the keypad and the holes for the button switches using some small files.

    [​IMG]

    .

    [​IMG]

    .

    [​IMG]

    The first bracket I designed to push against the OLED display and hold it in place was pushing on some of the components on the back of the display. I then designed a second one (bottom left above) that still pushes on the display but not the components. Orientate so that it is not pushing on the components when it is screwed into place.

    [​IMG]

    When your are at the step above or before it I'd suggest soldering some wires to the pins on the OLED display. Above the pins are still straight. I bent the tips slightly backwards before soldering the wires on. Support the bottom of the pin so you don't exert pressure on the display itself. I wait until later but it would be easier to do the soldering now or before this. Make the wires 5-6 inches long and cut them to length later in the build.

    [​IMG]

    The flat bracket shown above has a cutout in it that matches the shape of the cross-member. When you lay it in place as shown in the next photo make sure it is indexed onto the cross-member properly. It sits in place and isn't screwed into place.

    [​IMG]

    Similar to the bracket that pushes on the OLED display this one pressed against the back of the keypad and holds it in place on the backside of the case top once the top is screwed to the mid-case section.

    To be continued.........and if you came into this build here click ( HERE ) to go to the start of the build and a link to this info on my site ( HERE ).

    Sumner
     
    Last edited: May 20, 2023
  5. sidney

    sidney TrainBoard Member

    1,243
    2,110
    38
    simply awesome. im soaking it up like a sponge in water haha:D ....hopefully one day ill have your skills and more.....
    I never thought(n) about using the bread board wires for any thing but the bread board .....something else to use (y)
     
  6. Sumner

    Sumner TrainBoard Member

    2,829
    5,949
    63
    Building Peter's WiTcontroller Throttle -- Part 3:


    [​IMG]

    .
    [​IMG]

    Above the DT, CLK and SW wires from the Encoder have been soldered to the ESP32 at pins 12, 14 and 13. I brought the wires up from the bottom with the board out of the case and soldered on the top side. I did the same for the OLED displays SCL and SDA wires to pins 22 and 23. At this point leave the positive and negative 3.3v wires for the encoder and display loose. They will be addressed with the next step.

    An option is to solder a header to the ESP32 (you will see I did this later) and solder breadboard wires to the encoder and display terminals and put the female end of the breadboard wire onto the ESP32 header. In the long run soldering is probably more reliable.

    [​IMG]

    Next (above and following images) a number of solder pads will be made to solder keypad, ESP32, battery/charging and 3.3v positive/negative wires to.

    [​IMG]

    .

    [​IMG]

    .

    [​IMG]

    .

    [​IMG]

    .

    [​IMG]

    .

    [​IMG]

    .

    [​IMG]

    With the solder pads in place the encoder and display's 3.3v wires and battery/charging wires were soldered in place. Also the ESP32's 3.3v positive and GND outputs were connect to the solder pads at the bottom in the picture above. Also a GND wire was run between the GND (-) pads at the top and bottom of the solder pads to create a 'common ground'.

    To be continued.........and if you came into this build here click ( HERE ) to go to the start of the build and to go to my site for above click ( HERE ).

    Sumner
     
  7. Sumner

    Sumner TrainBoard Member

    2,829
    5,949
    63
    Building Peter's WiTcontroller Throttle -- Part 4:

    On this page we will finish the WiTcontroller throttle build.

    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    .


    [​IMG]

    To see the throttle in use click on the image above or ( HERE ). Love the throttle. Peter did a great job on the software. Next I'll build the version of the throttle that uses direct input from the function buttons to the ESP32.

    NOTE: You can find the print files on my thingiverse.com account ( HERE )

    To be continued.........and if you came into this build here click ( HERE ) to go to the start of the build and a link to the info above ( HERE ).

    Sumner
     
  8. Sumner

    Sumner TrainBoard Member

    2,829
    5,949
    63
    Forgot to cover how the ESP32 gets its power from the battery so here is that info:

    [​IMG]

    To get the power from the battery to the ESP32 we need to connect the battery to the jack on the end of the ESP32 that a battery would/can plug into to power it. The ESP32 can also be powered with 5v USB cable going to the USB port on the end of the ESP32 and that is the port one connects their computer to to download the software to run the ESP32.

    The battery positive power runs to the master On/Off switch (On/Off Pushbutton switch in my case. From the switch the positive power goes to the back of the batter jack at the end of the ESP32 as shown above. Solder the wire as shown above to the back of the jack on the side marked with a small white '+'. You don't need to solder to the negative lead coming off the jack. There is a common negative ground solder pad that the battery, the ESP32 and all the other grounds connect to.

    [​IMG]

    Above we can see a red wire that carries the 3.7v positive battery power to the back of the battery input jack on the ESP32 that was discussed with the previous image. The wire runs from the master on/off pushbutton switch on the front of the case to the battery input jack. The other side of the switch is connected to the positive solder pad for the battery or in my case to the battery selector switch that switches power and charging between the two batteries I have.

    Sumner
     
  9. Sumner

    Sumner TrainBoard Member

    2,829
    5,949
    63
    Software Config Files:

    Using Peter's software you need to edit 3 config.h files. He gives you example files and you can edit them easily using something like 'Note Pad'. Next are images of how I edited mine. You might set your function keys up differently and/or your keypad so these are examples only.

    [​IMG]

    Above is the config file that allows you to setup the the keypad for the assignments/functions that Peter's software has as I write this (May '23) and shows how I edited it for what I wanted.



    • FUNCTION_0 - FUNCTION_28

    • SPEED_STOP

    • SPEED_UP

    • SPEED_DOWN

    • SPEED_UP_FAST

    • SPEED_DOWN_FAST

    • SPEED_MULTIPLIER

    • E_STOP

    • POWER_TOGGLE

    • POWER_ON

    • POWER_OFF

    • DIRECTION_TOGGLE

    • DIRECTION_FORWARD

    • DIRECTION_REVERSE

    At this time you can assign any of the above to the 10 keypad keys. Since in this throttle build we are paralleling the button function keys on the case to the keypad that will mimic pushing one of the keys on the keypad. You can decide with of the above assignments you want to use and then edit the config_buttons.h file like I did above.

    NOTE: The next throttle build will allow you to configure the case buttons to any of the above assignments independently of what assignments the keypad keys have been assigned to since the buttons are connected to other ESP32 inputs. I'll have it up soon so maybe consider that build instead of the one you have been following here. Peter's current software does offer that option now.

    [​IMG]

    The image above is the last part of the config_keypad_etc.h file. You need to edit his example again and then save it. The only thing I edited with this file was about the OLED display. The file as it is presented is for a number of .96 inch displays. This case is designed for a 1.3” display so I commented out line 80 with the “//” at the beginning of the line and removed those from line 82 to make that the line that will be executed.

    You might be able to use a .96 display in the case in some manner but it isn't designed for one (let me know if you were able to go that route). Here in the states I could find the 1.3” display for $2 more, $9 vs. $7 (with shipping on Amazon) so went with it and have been happy with it. If you live somewhere where the price differential is more I'd still consider it as it is a one time buy and I believe worth it as far as viewing quality is concerned.

    [​IMG]

    I run JRMI on a Raspberry Pi and set the config_network.h file to log onto it for the WiThrottle and it works like a charm. The software can be intimidated to setup if you aren't familiar with GitHub and Arduino's but stick with it and ask for help.

    A good source for that is with DCC-EX's Discord Group ( HERE ).

    To be continued with the throttle build that uses direct input to the ESP32 from the function buttons on the case

    If you came into this build here click ( HERE ) to go to the start of the build.

    Sumner
     
    sidney likes this.
  10. sidney

    sidney TrainBoard Member

    1,243
    2,110
    38
    Awesome. im still waiting on parts to arrive but i have started printing. so far printing it going well. was gone for a few days visting the grand kids.
    will get them here with me pretty soon for the summer. now im back logged on chores haha.
    Thanks for the update on the sketch. Im saving all the info for when all the parts get here if they ever do.. that boat sure is slow moving :D
     
  11. Sumner

    Sumner TrainBoard Member

    2,829
    5,949
    63
    Uploaded new files for the top and middle of the case yesterday (05-28-23) with some small changes to make assembly easier. So if you haven't printed those parts get the new files. If you have I wouldn't worry about it. I found the OLED display to be a tight fit on both the cases I printed but opened the opening up with an x-acto knife a bit in a few minutes. That worked. The other couple changes also were small and also minor fitment issues that were quickly overcome with a knife or file. I took a round file to most of the holes for the switches but again that only takes a few minutes if they end up tight.

    I didn't know Amazon was sending things by boat now ;). We are pretty remote, nearest Walmart is 80 miles, so most things come to us UPS or USPS and not by boat here in the high desert. With that said we have the largest ACE hardware I've been to any place in the U.S.. A great lumber yard a couple hundred yards from the house. A metal shop a mile down the road that sells me metal for less than I can find anywhere in the 4-Corners. The grocery store is 100 yards away and the Dollar store on the other side of one fence. Sometimes we don't drive anywhere for a week or more. The electric bikes take care of getting to the bank and hardware store a mile away. Best place I ever lived,

    Sumner
     
  12. sidney

    sidney TrainBoard Member

    1,243
    2,110
    38
    most all my electric parts order are from aliexpress so it takes weeks to get them . they travel by boat/ship sometimes plane rides.
    parts are much cheaper but take time to arrive here. i use amazon when i need stuff a little faster, but try not to use them if i dont need to.................. case is printed. I also printed that other smaller case to build as well (why i need so many throttles i dunno ) but there printed. they both printed very well . i can use joint compound to smooth them all up. but probably wont do that. well until i get some more parts in this is as far as i can go. maybe ill tear apart an old printer that's lying here on my floor for some wires. i thought i had some flat batteries in a box someplace . they seem to elude me right now. Thank You for your time to share/build files ect.
    I still dont know what im gunna do with three throttles..... I do love the phone throttle very much.. HUMMM maybe the phone has a flat battery . i have a few laying around.(y) i dunno what voltage they would be .....YET.....:D
     

    Attached Files:

  13. Sumner

    Sumner TrainBoard Member

    2,829
    5,949
    63
    Color coded....very nice. I guess you picked up on the fact that mine is using a 1.3" display and Pete's is .96". Also I believe his keypad is a touch narrower than the one I got. He has a link to his keypad that is available in Australia and I think I was having a hard time finding the same one in the States.

    Once you use these the phone throttle might sit there. I like mine better than the phone throttle for non-sound locos but the extra labeled sound function buttons are nice on the phone throttle. I've got the second one built but I'm having problems with it that I can't figure out yet.

    Sumner
     
  14. sidney

    sidney TrainBoard Member

    1,243
    2,110
    38
    yes i did pick up on the different sizes of parts. as far as finding parts that's why u se aliexpress i can find weird stuff very cheap.
    i like the phone throttle a lot. I just wish my phone was a bit wider. i use the turnout controls with it as well as the throttles. some times i have 4 trains running at the same time , but most times just three...ive had real good luck with aliepress for good parts. so far all have been good no duds yet.....it just takes weeks to arrive 4 is the longest so far but most times under 3 weeks...
     
  15. Sumner

    Sumner TrainBoard Member

    2,829
    5,949
    63
    This might make the throttle 'not so nice' for you. I only ran two engines once and as far as I can tell you can add them but at this point I think the controls are then only working on the second one or maybe it was the first one selected?? The other one is running at whatever speed it was set to. I didn't play with it so don't know how to switch back and forth.

    I think Peter, who is also responsible for EngineDriver, is working on this and consisting. You can't split screens like with ED. Since I have two of these and the phone throttle I think, if I ever get the layout to that point, I'll be running one or two maybe doing laps around the layout with one of the other throttles. Set that throttle down and use this one for the train I'm working with. That would work for me.

    I like it in my hand a lot better than the phone throttle and like the throttle knob on the side much better also. This throttle or the software for it, is in its infancy at this point so I'm sure it is going a lot further down the road. I think you will find that you can throw turnouts with it as it has that option (I haven't tried to use it as I'm not setup that way).

    I think the biggest negative about it at this point is that it is not easy, unless you are familiar with GitHub and Arduino's to setup the software on the throttle. Peter is working on that and I'll help the best I can but I struggle with that part of it myself.

    Sumner
     
  16. sidney

    sidney TrainBoard Member

    1,243
    2,110
    38
    im thinking build green throttle for my grand son when he comes to visit, then maybe your throttle build for running a train and then use the phone throttle for one train and the turnouts or just the turn outs. when and if i find a bigger house ill build bigger layout. until then it is what it is. im not familiar with git hub for sure and i need to relearn the arduinos stuff. but i think i can get it all figgered out , if not ill be a posting back......
    i like the feel of the (Peters) smaller throttle . It will be good fit for the grandson though. but i don't think it will handle all i do by its self. your throttle feels pretty good as well in the hand. cant hardly wait till all the goodies arrive so i can build it .
     
    Sumner likes this.

Share This Page