ESP32 Command Station

Atani Dec 10, 2017

  1. AndyH

    AndyH TrainBoard Member

    77
    9
    6
    So I tried a different 'track' today. Overnight I realised that the Prog track might not be sorting because the l298 that I have might not like 3.3v logic govern that it need 5v to drive, and 3.3v is right on the limit for what would trigger the 5v logic. I've got a logic level shifter coming to try.

    I tried the ops track, and that is working on 3.3v all round. Well, I say working. It's a little bit hit and miss. It works, and then it stops controlling but still powers the rails, so you get periods of time where you can't control a train that carries on doing what it last did - not ideal. This is pairing with jmri - I haven't tried it with an hc12 based controller yet, and can't get to the software controller properly (how do I do that if I'm connecting to an existing wifi network?).

    The only consistent option I have found to clear things is to turn track power off. I have once been able to reload jmri and get control back, but that's not a great solution.

    I'm currently using a wroom-32 (clone?) board with 38 pounds and without an on-board tf reader. I've got some new t8s on order from aliexpress, but they will be a while.



    Sent from my SM-N976B using Tapatalk
     
  2. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    This sounds a lot like https://github.com/atanisoft/ESP32CommandStation/issues/80 which I haven't been able to track down the cause of yet. It is not clear where the slowdown is actually occurring.

    I don't actively use HC12 myself, a few others have tested it with some success though. It is a serial based protocol so WiFi shouldn't be involved.

    I agree that is less than ideal. It is not clear where the failure might be though, I'd suggest capture some logs from the JMRI side (including console logs) and from the CS if you can to cross check where the connection is being lost as that is about the only reason I can think of and JMRI is not always responsive in re-establishing the connection via the DCC++ protocol. I'd highly recommend moving to the OpenLCB (LCC) connection type instead.

    That shouldn't be a problem as long as it matches up with the DevKit-C pinout etc.
     
  3. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    I haven't commented on the CS PB in a while but progress has been being made on it. I've had a few issues with the last batch of PCBs and as a result I've reworked the PCB considerably.

    The latest version of the PCB has been improved in a number of ways:
    • Increased OPS track to 5A from 3A by switching to a different h-bridge IC.
    • Integrated thermal monitoring to warn and shutdown the track power when the CS PCB is getting too warm.
    • Integrated MicroSD slot.
    • Improved current monitoring via shunt resistors and an INA2180 IC.
    • Integrated support for OpenLCB (LCC) CAN
    • OLED / LCD connection with OLED Reset pin available (needed for some OLED displays).
    I'll be ordering a test batch of this PCB in a couple days and starting the assembly process once I receive them.
    esp32cspcb.png

    More on this once the PCBs are in-hand...
     
    murarduino, bocabob and Sumner like this.
  4. AndyH

    AndyH TrainBoard Member

    77
    9
    6
    What's this and how do I do it? Sorry, not overly knowledgeable on the variety of rail technologies available.

    I'll come back on other points later (like asking how to capture logs). I'll try and test with an hc12 based controller later.


    Sent from my SM-N976B using Tapatalk
     
  5. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    LCC is an NMRA standard (https://www.nmra.org/lcc) and OpenLCB is the underlying technology for this. There are two connection types which are currently supported: CAN Physical (requires CAN transceiver) or GridConnect over TCP/IP. ESP32 Command Station supports both of these today, the CAN physical connection can be more reliable than TCP/IP connections on the ESP32 though in most cases.

    To configure this I'd suggest setup a new profile in JMRI and use OpenLCB (or LCC) as the connection type. You can then have JMRI start it's built in OpenLCB Hub and provided that JMRI and the CS are on the same network the CS should find and connect automatically if mDNS works correctly. Once you have the connection between the CS and JMRI via OpenLCB you can then configure JMRI to use OpenLCB to talk to the CS, this will include control of locos and DCC accessories (turnouts). The only area I haven't explored fully is the programming track interactions within JMRI when using OpenLCB as the connection, I'll do some digging into this and add it to the documentation once I figure out the right approach and what is needed on the CS side.

    I also have https://github.com/atanisoft/ESP32CommandStation/issues/67 which tracks adding a user guide to the website, if anyone wants to take a stab at writing up some notes for this I'll gladly add them to the website. I'll be trying to work on this as well after v1.5.0 is out since there are a few major changes in v1.5.0 that will cause some people some confusion.
     
  6. AndyH

    AndyH TrainBoard Member

    77
    9
    6
    How do I sort out a physical connection? I've got the basics for the CS side, but I'm not clear on what I need to do on the computer side. I've found some commercial usb lcc adapters out there, but is there anything cheap/homebrew?

    Thanks

    Sent from my SM-N976B using Tapatalk
     
  7. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    There are a lot of adapters but most are not OpenLCB/LCC certified. The only commercial ones I'm aware of are from RR-CirKits. You can build one yourself by having a CAN adapter on the system where JMRI runs and a CAN Transceiver connected to the ESP32.
     
  8. AndyH

    AndyH TrainBoard Member

    77
    9
    6
    Merg canusb4 work?

    Sent from my SM-N976B using Tapatalk
     
  9. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    I don't know for certain as I haven't used it. I use the RR-CirKits LCC-Buffer.
     
  10. AndyH

    AndyH TrainBoard Member

    77
    9
    6
    The bottom connectors, just to confirm, that's two rj45 for lcc and a micro sd reader?

    I presume that the two lcc connectors are run off the same chip, and just have connections between corresponding pins so that you have continuous data flow between them for signal throughput?

    Or have I missed something? Thanks



    Sent from my SM-N976B using Tapatalk
     
  11. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    Yup, the MicroSD is for configuration data storage (loco roster, turnouts, wifi config, etc). The RJ45 sockets are for connecting to the other OpenLCB (LCC) nodes via standard Cat5 network cables.

    Pretty much yes. There are two chips immediately above the DCC/RC marking, the left one is a CAN transceiver (TJA1057/3) and the right is LM358 which is used to blink the RX/TX LEDs below as data flows in/out of the network. To the right of the right side RJ45 are a pair of 350mA PTC fuses and a DRV8801 which provide a DCC signal on pins 4 and 5 of the RJ45 connectors for the Power Station Interface. Immediately above the right side RJ45 is a dual MosFET which shorts pins 4 and 5 together during a RailCom cut-out to allow boosters to send RailCom data back to the CS.
     
  12. AndyH

    AndyH TrainBoard Member

    77
    9
    6
    Do you have a circuit diagram for that please? Cheeky request I know...

    Sent from my SM-N976B using Tapatalk
     
  13. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    The full schematic can be seen here. The OpenLCB (LCC) portion is on page 5/6 with a few references to other pages (2/6 for vref, 3/6 for RailCom short).

    I've received tracking details for the PCBs this morning and expect them to picked up today by FedEx and hopefully will have them in-hand sometime next week.
     
  14. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    New CS PCB arrived today and as far as I can tell looks pretty good. I'm waiting on parts to arrive later this week so I can assemble one and do some testing. But if this works out well I'll be looking at the next steps for the PCB.

    IMG_20210209_113900.jpg

    Around 170 components to put on the PCB, most of which are 0603 SMT parts with a small number of 1206 and 0805 parts.
     
    Quax and AndyH like this.
  15. AndyH

    AndyH TrainBoard Member

    77
    9
    6
    Hi Atani, I've been looking at the schematic, and seems all of the parts are SMT only, so I've been looking at substitutions for TTH/DIP components, and have come up with following shopping list:

    CAN Transceiver: Instead of TJA1057/3 buy MCP2562-E/PIC

    CAN TVS Device: Instead of NUP2105L buy ?

    AND gate: Instead of 74AHC1G08 buy SN74 series

    Shottky diodes: Instead of B5819W 1 buy N5819

    OpenLCB DCC Signal Generator Instead of DRV8801PWP buy ?

    LM358 LED drivers are available in TTH style, so no need to change there.

    As you can see, I'm struggling with the CAN TVS device and the DCC signal generator. Any suggestions for that, or corrections to my shopping list? Thanks.
     
    Last edited: Feb 20, 2021
  16. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    The drv88xx chips are SMT only, likely the TVS is as well. I don't know for certain on the other parts.


    Sent from my ONEPLUS A5010 using Tapatalk
     
  17. AndyH

    AndyH TrainBoard Member

    77
    9
    6
    Thanks

    Any suggestions as to an alternative for them?

    Sent from my SM-N976B using Tapatalk
     
  18. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    Depend on the usecase. You can safely omit the DRV8801 chip and not have the OPS DCC signal sent out on the LCC bus. For OPS and PROG there are a few options available in through hole with the L298 being the most tested.
     
  19. AndyH

    AndyH TrainBoard Member

    77
    9
    6
    That gives me a thought. Could I use the spare second channel on my l298 to generate a second ops signal for the lcc bus?

    Sent from my SM-N976B using Tapatalk
     
  20. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    Yes that would work but you will need to use an IC to create the inverted signal for the second input to the L298.
     

Share This Page