DCC++ Throttle Design - Ideas to finished product.

UK Steve Nov 9, 2017

  1. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Scott Eric Catalano likes this.
  2. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Mike
    Just saw your post (#54 @ Base Station with WiFI) is the WeMos esp32 the same one you are using for this throttle development? I have been playing with this one ...... but have others on order.
    [​IMG]
     
    Scott Eric Catalano likes this.
  3. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    I just posted a pic of the three boards I am using so far. Your board should work but will require a few wires to connect the pins to the motor shield (more than likely you would need that anyway). You will need a pinout diagram on that board to connect things correctly, if the numbers are correct on the silk screen D4=A0, D2=A1, D25=MAIN ENABLE, D23=PROG ENABLE, D19=MAIN DIRECTION, D18=PROG DIRECTION, D21=SDA, D22=SCL..
     
    Scott Eric Catalano likes this.
  4. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi All

    Well it's just over a week since I started this thread. Prior to that date, I had neither my first ESP32 or an SPI driven Touch Screen Display.
    Today I'm playing with the first 13 function keys all displaying nicely on the display, with all the driver code running on the "32" and the touch interface is working too:)
    I guess I need to slow down a little and take a few steps back. So I'll be getting a few lessons together along with the Uno versions of the code, then we can work through this together.

    Here's my Wifi & Bluetooth Battery ESP32 dev board driving the display. Note, there is no USB powering this setup, that's because as you can see in the second picture, there's an 18650 LiIon battery 'on board'. I have loads of these salvaged from old laptop battery packs. It doesn't take much imagination to see where I'm heading here, with a custom interface PCB, connecting the '32', display and joystick the throttle just needs a nice compact case to put it in.
    The battery charge circuit is also on the dev board :)

    20171117_135712.jpg


    20171117_135827.jpg
     
    Last edited: Nov 17, 2017
  5. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    I can see where a second board would be useful for those who opt for an ESP32 without the battery/charger setup. Any suggestions on a standalone setup for charger? Perhaps one of the RC Car charger setups for the batteries? (those are 3.7VDC usually)
     
    Scott Eric Catalano likes this.
  6. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    The guts of a 'Dollar Shop' power bank might be one option, you also get 5 volts back out :)

    20171117_151542.jpg
     
    Scott Eric Catalano likes this.
  7. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi All

    When you guys have acquired a display of the type I suggested, here are the connection details to set it up with an UNO.
    If you grab this library... https://github.com/Bodmer/TFT_ILI9341 there are plenty of examples included to test your setup.
    As the displays are 3.3v logic we have to shift Uno's output levels unfortunately, hence the resistor arrays.

    You can use combinations of values in the 1k to 10k range (not critical) with the upper array (as pictured) being roughly half the value of the lower.
    I used 1k upper, 1.8k lower giving a voltage at display pins of about 3.2 volts.

    The file User_Setup.h that comes with the library, needs editing at line 48

    #define TFT_DC 8 // Data Command control pin

    Needs changing to 9.

    Uno_TFT.PNG
     
    Last edited: Nov 19, 2017
  8. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    279
    195
    12
    I finally over the weekend got to hook this up and play around. I have to say way easier then I thought!

    just as an FYI I used 10k and 4.7k resistors they work fine.
     
    Scott Eric Catalano and esfeld like this.
  9. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Way to go Keith, nice to see someone reporting back :)

    After you and other folks are done testing the library examples, it will be time to do some work with the touch interface. This will involve a little understanding of how the touch surface works and how we integrate the two 'devices' into a seemingly single package that all works together with some clever code. Out of the box the TFT_ILI9341 library does not support touch, or adaptations of Adafruits TFT Button class. To that end I'm currently trying to integrate the additional code into that library. This is only to keep work done on the forthcoming Arduino Uno type examples in line with the brilliant stuff one can do with Bodmers TFT_eSPI library that specifically targets ESP8266 and ESP32.

    I've still a little work to do on that, but I'm getting there.

    What I would like to achieve with all this, is a menu based throttle display. Where users can have a choice of either picking say a Loco # from a list with the joystick scroll/select control or just touching the appropriate area of the screen with the little plastic stylus that should have been included with your purchase :)

    Regards

    Steve.
     
    Scott Eric Catalano, Atani and esfeld like this.
  10. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Keith
    Glad to hear you are operational. I have my breadboard set up and am patiently awaiting the proper LCD.
    Steve F
     
    Scott Eric Catalano likes this.
  11. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Hi Guys,
    I've been watching this thread for a while and am dying to get started... Have a bunch of ESP32s and a TFT display or two on order, as well as some joysticks but they're taking forever to arrive - seems like I'll only get them next year.
    I do however, have a different 3.5in TFT display with SPI interface, and also a few ESP8266-12S modules, also two WeMos D1 Arduino-like boards.
    I would like to start playing with the code you've been working on - is there a link somewhere?
    TIA
    Norm
     
    Scott Eric Catalano likes this.
  12. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Hi Steve, I'm interested to see how you have wired your level shifter? IMHO I would have connected the 1.8K resistor to ground, the centre tap between the two resistors to the TFT panel, and the Arduino output to the 'free' end of the 1K? Am I missing something?
     
    Scott Eric Catalano likes this.
  13. Simon Mitchell

    Simon Mitchell TrainBoard Member

    113
    105
    7
    RC Car charger is probably overkill. They are designed for multicell batteries that need balance charging and fast charging. I’ve got one, but not been able to use it for my 1s batteries. Instead I have used the much cheaper WeMos charger, or a cheap stand alone charge board. I’ve also bought some cheap 4s charger boards, but haven’t used them yet.
     
    Scott Eric Catalano likes this.
  14. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Keith/Steve
    Frustrating! wired up according to the diagram .. checked wiring numerous times ... I get nothing but a white screen with the Bodmer examples. I have now tried with two different 2.4" TFT screens and both get white screen. I wish there was a simpler set up to test the TFT so I could figure out if they are functional and proceed from there.
    Steve F
     
    Scott Eric Catalano likes this.
  15. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    279
    195
    12
    Simon, I have found using cell phone batteries works great for stuff like this. Most have the charging circuits built in and you can have just a small sub or even 2 wire jst type plug on the receiver. Put the on/off switch after the battery and then you are good to go. For low power applications like this they last for a very long time between charges.

    Steve F, believe me I know how frustrating this stuff can be ! Is there a chance you can link the exact ones you have here? I know there are a couple different chipsets out there and have read of issues with a certain type so maybe that could be it? Knowing you a bit from here I doubt it’s anything your doing.
     
  16. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Keith
    This is the TFT I am using: https://www.ebay.com/itm/2-4-240x32...e=STRK:MEBIDX:IT&_trksid=p2057872.m2749.l2649

    I was just about to update my post as when I plugged the setup into USB earlier I saw a graphic arch (TFT_ArcFill) which then disappeared ...... unless my mind was playing tricks :) ..and then back to white screen. So I'm back to square one
     
    Scott Eric Catalano likes this.
  17. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    I had the same problem when using platformio. I submitted a pull request to Bodmer that added the ability to define the pins as build flats and avoid the user setup header file. The problem I ran into was the wrong user setup was picked up, it was always picking the default pins which wouldn't work no matter what.

    With the pull request I sent I define all pins from the platformio.ini file now and avoid modifications to the library bits.

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano likes this.
  18. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Interesting info. Can you give me your list of pin connections as you listed them in the sketch ...... I'll give it a try.
     
    Scott Eric Catalano likes this.
  19. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Here are the defines I used:

    Code:
    -DUSER_SETUP_LOADED -DILI9341_DRIVER -DTFT_CS=17 -DTFT_DC=16 -DTFT_RST=5
    Here is the full set of pins used, with the above defines for the ESP32:
    Code:
    MISO 19
    MOSI 23
    SCK 18
    DC 16
    RESET 5
    CS 17
    
    T_CS 21
    T_DIN 19
    T_DO 23
    T_CLK 18
    
     
    Scott Eric Catalano likes this.
  20. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Mike/Keith/Steve
    Thank you ......I now know that the TFTs are funcional .... if I let them rest for a period, upon re-powering I get a functional display (in this case TFT-Pie-Chart) and then it reverts to a white screen ....... OH fun, a new wrinkle to look into. Thanks guys.
     
    Scott Eric Catalano likes this.

Share This Page