A Nextion Based Controller for DCC++ and DCC-EX

NormHal Sep 6, 2022

  1. Sumner

    Sumner TrainBoard Member

    2,798
    5,837
    63
    I read it through twice so probably missed something but my thoughts and my perspective is someone who has managed, after YouTubes, to use an Arduino in basic terms and program one a bit. If you are trying to reach someone like myself or someone with less experience links to some basics might be helpful. As it is written right now I don't feel it is basic enough maybe for myself or someone with less experience. I still haven't tried to take something and proceed with it using only a GitHub source. Maybe it should stay that way as I know there are a number of people out there that have the ability to use what you have as it is.

    Another question would be and considering the cost of a 5 inch Nextion is what does it have to offer over what I have now which is an Android phone running EngineDriver with a physical throttle (volume control) attached? Also where do you see it going? EngineDriver has been improved over the years with more and more features. I'm interested in your throttle thinking if it catches on and you, your team and maybe with more help from the Discord guys it could also evolved past where it is now.

    So on to some suggestions:

    1. Links to how to load the sketch onto an ESP32. You reference the Uno and I think it is the same but maybe clarify that?

    2. If the ESP8266 and Uno aren't really as good as the ESP32 maybe remove them and go with the ESP32 only. It is not like the others are a lot cheaper.

    3. I know you started with this being a tethered throttle to a command station and I think that with a cabinet design that would house a power supply, buck converter, mega with WiFi and one of the three options that has appeal for smaller layouts. I would look like a commercial command station. With that said I think what most want, probably even if they have a smaller layout, is a wireless handheld throttle. With that in mind I'd expand the option for it and the associated battery and charging circuit. Wonder if Dave's charging circuit and battery options might be a start or I'm sure there are easier options like the battery shield we discussed further up the thread.

    4. Also on the Encoder would his application of the 'caps' be what you mentioned as a possible add-on to the encoder?

    5. To replicate some of the other handheld controllers instead of using the encoder push button could a 2 way switch replace if for more of a throttle feel and sight reference to the current direction?

    6. The wiring is very basic and the description handles it but I still feel that a simple schematic with the parts shown would be nice and would also show how little wiring is needed vs. some other do-it-yourself throttles.

    7. As far as the Basic vs. Enhanced Nextion would we see a difference on the screen between one or the other? Is the Enhanced something that would be better to have down the road if the throttle evolves. If so I think I'd just reference the Enhanced, not much difference between them.

    8. I feel that images always help on selling the idea of something and feel that a build step-by-step with pictures/images or a YouTube video would also help broaden the group of people that might be interested in building the throttle.

    I do realize that you are in basically in the beginning steps of the project, even though you have put in the time over the past years, so take it step by step and don't burn yourself out and the others. Easy for me to say do this or that and I do realize the time needed to accomplish it.

    The best to you and the rest of the guys working on this. I think it has a lot of potential,

    Sumner
     
    Erik84750 and NormHal like this.
  2. Erik84750

    Erik84750 TrainBoard Member

    334
    134
    12
    An extensive manual is in the writing. At the moment the project is ready for install for all those familiar with the basics of Arduino programming.

    Where did you read the ESP8266 or the Uno/Nano/Pro Mini are not as good as the ESP32? The project runs well on all three families of processors; but what I wrote before is that the ESP8266 has some limitations, which has no bearing on the workability on a ESP8266.

    We have advanced a lot since David's Nextion throttle. And basically, this project is all about being wireless. But I understand some accompanying "how-to" is necessary. And in the works.

    The "caps" (capacitors) for the rotary encoder are optional, to make sure there are no parasitic signals; will be covered in the "how to" doc.

    The encoder already has the built-in available physical switch for direction reverse. Far more handier than a separate button.

    In the works.

    The enhanced has the advantage of built-in EEPROM, meaning a lot of data is stored without the program having to rehash at every start; and for the difference in price absolutely worth it.

    Time will tell and marketeering is not an electronics developer strongest asset :ROFLMAO:. But we will look into that.

    The project is "oven ready", as our beloved Boris would say :D.
    We are far from burned out. and basically we started somewhere around Jan 1st, 2022. Let the champagne roll ;).

    If Norm or esfeld or... has to add/rectify on my musings we will read it here ;)

    Thank you very much!
     
    Last edited: Oct 6, 2022
  3. Sumner

    Sumner TrainBoard Member

    2,798
    5,837
    63
    Reading this...

    • An ESP32 as the Host processor (Recommended Configuration)
      • The amount of integrated Memory, additional Hardware Serial Port and WiFi make this the processor of choice
      • In addition to facilitating WiFi, its range of features and relativly affordable cost, contribute to its strengths
    It looked to me that they all work but maybe why have all the options if the ESP32 is the 'recommended configuration' and it is easy to get and cheap. Would cut down on documentatio. I had a trading post for a number of years and sold a lot of jewelry. When there were too many options for a buyer to chose from I found that at times they just wouldn't buy anything. I'd found that only keeping so much out that I sold more that way. I guess it all depends on who you are targeting with this.

    On not using the button on the encoder I was thinking that if I remember right one of the goals was to move towards something like the Proto throttle...

    [​IMG]

    ... as an option. So instead of using the encoder as the reverser use a physical switch as an option. Possibly adding other features that could be physically controlled as options down the road. I didn't go back and look but maybe I'm mixing up what your guys are doing with another thread here or somewhere else.

    Sounds like a lot of what I brought up will be covered in the manual so look forward to it.

    Sumner
     
  4. mtncityman

    mtncityman New Member

    2
    0
    2
    Downloaded V1.1 and installed per the instructions available. Using ESP32 with Nextion Nx4024TO32-011R. Program compiles, and 1st Flash Screen looks great. Touch the screen and Main Menu with configuration loads. Power and Stop/Go buttons work but none of the other buttons do anything. Just wondering if the TFT file only contains 2 pages???
     
  5. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Sumner, Here is a simple DIY case for our throttle. The small window is a voltmeter to read the battery voltage .. the batteries I use for the ESP 32/Nextion are two 3.7V cell phone batteries in parallel... with a JST connecter on the side for charging. I have made these for 3.2", 3.5" and 5" Nextions .... Just an idea if your looking to do 3d printed versions. BTW this is an old pic showing a much earlier version of the code .. the latest code is very much improved as you can see in Norms pics.
     

    Attached Files:

    Last edited: Nov 13, 2022
    Sumner likes this.
  6. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Hi! The tfts actually have 15 pages - but they are accessed via communication with the host (in your case an ESP32?)
    The symptoms you describe indicate that there is no communication between the ESP32 and Nextion... If you're using the sketch as uploaded, you should connect the Yellow (RX) wire to pin GPIO17 of the ESP32 and the Blue (TX) wire to GPIO16. The baud rate speeds between the two have been pre-configured for 38400 bps so there is no need to change them:)
    As a small BTW, version 1.2 of all the Nextion Images and the Arduino Sketch is very imminent - I'm busy with some final bugs fixes and testing, and should be available before the end of this week:).

    EDIT: PS. More "Beta" testers are always welcome:) - if you're interested, you could join our development group?
     
    Last edited: Nov 13, 2022
    Erik84750 likes this.
  7. mtncityman

    mtncityman New Member

    2
    0
    2
    always interested in Beta testing.. I've been working on this project for a month - starting with Dave Bodner's original version..just couldn't get the radio versions to work with DCC_EX CS wifi. That's why I like the mods you are making - all Wifi.
     
  8. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    I'll send you an invite... I've just uploaded version 1.2 for the guys so you will also be able to see and download the "raw" HMIs.
     
  9. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    New Version uploaded!

    Version 1.2 had just been posted on Github - " https://github.com/normhal/DCCppEX-Nextion-Controller " Apart from some rather significant changes to both the Nextion images and the Arduino Sketch, the major new feature is support for a "Guest" loco. Due to operational experiences, the need for "instant" access to a non-permanent loco address was needed. This is facility is accessed by touching the currently active Loco Address which causes the Nextion to prompt for a "guest" address which can instantly been controlled, without interference to the existing active Locos. Touching any "other" location on the display instantly discards the Guest and restores the interrupted state.
     
    Erik84750 likes this.
  10. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    279
    195
    12
    Way late and just getting back into this. 3d Priniting was consuming my hobbytime recently. Anyway I downloaded and bench tested this and all seems well. I am waiting on a wifi shield to connect to base station over wifi but everything else seems fine.

    A couple suggestions.

    1) Preload a loco with address 3 and the functions (just generic F1-F12 or whatever) so that it's super easy just to test on a trck without having to load.

    2) And this may exist and I just haven't looked. Is there a way to download the roster from JMRI and then upload or "prepopulate" the 10 locos rather than having to type them in? Simplistically thinking a CSV file or the likes.

    Thanks for the work on this! As soon as I work kinks out I'll make a 3D case for it and post
     
    sidney and NormHal like this.
  11. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Hi Keith! Good to hear from you again:)

    The behaviour of the UNO vs ESP versions is slightly different - mainly because of the UNO memory contraints. The readme file on Github has some fairly detailed guidelines for the first startup - the UNO requires a two step process to get the best results. I gather you've done your first tests with an UNO?

    In short, for the UNO, the first step is to conpile the sketch with line 33 of the "config.h" file un-commented (the default). Once compiled, flashed, and restarted, navigate to the "Configuration" page on the Nextion and press the "Load pre-defined details" button. This loads the Nextion Controller UNO with 10 loco detains, 12 sample accessories, and 2 Routeswhich can be accessed after the next step...

    The second step is to compile and flash the sketch with line 33 commented out. This will allow the Nextion Controller to have sufficient memory to access the 10 Locos, 12 Accessories, and Routes. Yes there is a Loco with Address 3, but with no functions enabled - an easy editing task to resolve:)

    In terms of downloading from JMRI, it is not possible on version 1.x simply because the Controller code only recognizes the Power On and Off data from the DCC++/EX Command Station. Please note that it is however possible to edit the Pre-defined Loco and Accessory details in the "config.h" file, which will allow for the reloading without having to re-enter. The UNO version is somewhat compromised, but the ESP versions work a treat:)

    Hope that helps:)

    EDIT: I just looked at your photo and noticed you're using an ESP32 Dev Board:) All you need to do is go to the "Configuration" page and press the "Load pre-defined details" button, and you'll have all the sample details loaded. (No functions for the Locos (yet) but I'll see if I can add a few (F0/FL as a minimum):)

    EDIT 2: A version 1.2.9 is in the works (which adds the ability to enter "_" and "$" characters. I'll see if I can add a Loco function or two before releasing the update:)
     
    Last edited: Jan 28, 2023
  12. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    279
    195
    12
    Thanks for that. Ya its a ESP32 dev board I had laying around. The rotary encoder is flaky in that the speed on works some of the time but I chalk that up most likely to flaky connectors. I will look at config.h a little closer. I should have my Wifi shields in this weekend as well to get some real testing in next week. BTW how does the sketch know if you have UNO or ESS32 or ??
     
    Last edited: Jan 28, 2023
  13. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    It picks it up from the Arduino IDE (automatically):)
     
  14. cyber7

    cyber7 TrainBoard Member

    20
    8
    7
    Awesome. This is going to be my next project. I have all the parts in drawers, so it is going to be a pretty cool addon!

    Thank you for an excellent project!
     
  15. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Hi Aubrey - Welcome! I'm in Cape Town as well:)
     
    cyber7 likes this.
  16. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    I've just completed the code to pre-load two functions for each of the 10 locos configured with the "Load" button:)
    Tomorrow, as soon as I get the chance, I'll test and hopefully be ready to upload a version for you guys to try out... Works for both ESP and UNO implementations:)
     
    Sumner likes this.
  17. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    279
    195
    12
    One other request :) Could you add in (commented out if you want) something like 5 buttons for functions (initially set to F0-F5 but editable) connected to other IO pins(with internal pullup resistor and debounce enabled)?

    What I'm thinking is that I will add at least 3-4 buttons on the throttle for lights (F0), horn, bell, probably F8 for silent rather than having to hit the nextion screen to do that. My 7 year old will be able to handle the buttons a lot better than a small piece of a 3.2" screen :)
     
    Last edited: Jan 30, 2023
  18. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Here is a "trial" version V1.2.9 to try out. Press the "Load" button on the "Config" page and it will populate the first 10 loco slots with loco addresses 3 to 12. I have configured a few sample functions more as an example than for practical use.
    I'll have to give your new request some careful thought:) For example, do you want the physical buttons to invoke the same functions for every loco in the inventory/roster? As it stands, the current version supports individual configurations for each loco, from those with only 1 function (eg Headlights) to locos with sounds which can be called up with any function between 0 and 28?
     

    Attached Files:

    Sumner likes this.
  19. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Keith, I've invited you to join the "development" conversation - I think it would be better to discuss your ideas in a more "closed" environment?
     
  20. Erik84750

    Erik84750 TrainBoard Member

    334
    134
    12
    Hi Norm, does this version use the same HMI files as for the 1.2.8 version?

    Somehow I find on my computer a downloaded zip file DCCEX_Controller_V1.2.9.1 (from Jan 1 2023): is that the same as 1.2.9?
     

Share This Page