DCC++ Ethernet & Wifi Shield

Jean-Eric Jan 25, 2016

  1. sierrasmith71

    sierrasmith71 New Member

    7
    13
    6

    Thanks for the info.. I have some on order!


    David G.
     
    Scott Eric Catalano likes this.
  2. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi David and All,

    Setting up the ESP8266 in access point mode.

    This is for Windows users only, although Mac would be something similar.

    First let me say that I'm no expert on this device, although I have spent some considerable time just recently reading about it and running a few experiments.

    The following is by no means the best way of doing this although because it uses a simple Web UI, I found it is great for beginners (like me) to get the device configured easily.

    The ESP8266 is a Microcontroller with on chip WiFi capabiliity. It can serve our needs very well as in it's simplest form it is a Transparent TCP wifi/serial device that only requires Vcc (3v3), Gnd, Rx, Tx. It can be Flashed with various standalone tools or IDE's such as Arduino or the official Expressif SDK.

    In this example we will be using a standalone tool called XTCOM UTIL.exe which you can download in the esp_flasher.zip link from This page.

    While your viewing that page, have a look a the info on connecting the 8pin header type modules to a serial interface. Please note we will not be using the firmware described there and included in the ZIP package. The link is to provide a safe source for the XTCOM UTIL only.

    Next grab the the open source firmware ESP8266_F1_1.7.zip from This page. Credit to Jim Spence of ByVac for making the firmware available. Again there is another connection diagram, but more importantly instructions on how to load the .bin files to your module. Please follow those instructions very carefully after reading the following points in this and the next paragraph. Please note the esp8266 is a 3.3V chip, do not power it up from a 5V supply unless your module has the serial interface intergrated onboard with a usb connection port. The Witty Cloud combo shown in my last post can be powered from 5V usb. Most boards will require GPIO0 to be grounded througout the proceedure or on others the Flash button be held which does the same thing.

    On my 64bit Windows 8.1 machine, I could not get Xtcom Util to run. You might be lucky ! No problems on 32bit Windows 7.
    Although I found the app to be unstable and had to try several times to get the .bins to flash correctly. Do take note of the memory offset requirement before you flash the second file. And don't panic if it all goes wrong it's a hard chip to brick so just persevere. I tried other tools to flash these files but without success. i.e. they seemed to work but the module didn't boot as expected. Maybe you can try your own experiments, NODEMCU's flash tool is very 'flash' but wouldn't work for me.

    So, if you made it this far it's time to reboot (reset or cycle power) your module and check if it's doing it's thing. It should be broadcasting in AP (Acces Point) mode. Click on your PC's wifi connection to get the list of available networks. Something similar to ESP_98765B should be visible. If so thats great, you will shortly be connecting to your device but not before hitting This page, while you still got internet access.

    Then just follow the instructions. Which is for AP mode. Open browser, Go 192.168.4.1
    Basically in the Station Setup tab set mode to 2 and pick a port number if you don't want 80 default. Click Save.
    Go back to home page, Click AP Setup. Change the device SSID, Enter a password if you want one. and set Security if you want it. Save
    Home,> Save Changes,> Exit.> Log back on to your home network.

    That's it for this part. We'll discuss connecting to Base Station in Part 2.

    Let me know if you want help with any issues.

    Steve.
     
    Last edited: Feb 19, 2016
    VaBEast, HVT and Scott Eric Catalano like this.
  3. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Flash Tool Update

    Hi All,

    I've had another go with another esp8266 flash tool and can confirm the Electrodragon 2.4 tool runs and flashes the above firmware successfully on Windows 8.1

    You can download it Here

    Note the zip password 'electrodragon' when extracting. And again apply the offset to the second bin.

    This tool seems very stable and worked for me first time. (y)

    Of note also is that these firmware changes are not permanent. You can overwrite with something else at anytime. Of interest to me is the AT command set firmware. Which should unleash more potential from the chip with things like multi client (at least 4) connections.

    Steve.

     
    Last edited: Feb 19, 2016
    Scott Eric Catalano likes this.
  4. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    ESP8266 - Now DCC++ Meets the IoT

    In further experiments with this wonderful device, I have now been able to send commands to the Base Station in a proof of concept from an interactive Web Page.

    This development opens up some amazing possibilities. It will work on any device that can run an HTML5/Javascript browser, so that covers cross platforms at a stroke.
    Hardware costs are minimal, most people already own phones or tablets.
    The Throttle webpage can be any custom design that you like, sounds too easy because it is.
    It will work standalone, no additional network, so great for exhibitions etc.
    Kids/Grand-kids can log on with their phones minimal set-up required.
    Multiple clients so you can hit the ALL STOP any time.
    The Server runs on the ESP8266 so no alterations to Base Station code. Its Plug and Play !

    The code is from a project by Rahul27 Here It needs some modification for the basic tests that I've done.

    With Credit to the original developer
    Markus Sattler [https://github.com/Links2004/arduinoWebSockets]

    Steve.
     
    Last edited: Feb 25, 2016
    sboyer2, HVT, lnxlnx and 1 other person like this.
  5. sierrasmith71

    sierrasmith71 New Member

    7
    13
    6
    Steve

    I bought a WeMos D1 Arduino compatible ESP8266 Wi-Fi Board to play with on the Arduino IDE. It really is a neat processor and Wifi engine/tool. I am looking forward to seeing what you come up with next.!!


    D.Garrison
     
    Scott Eric Catalano likes this.
  6. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi David,

    Great! You should try a few simple experiments to get yourself acquainted with flashing the board and seeing it's capabilities, there is a huge community out there.
    If you want to work in the Arduino IDE you will need to install ESP8266 support. You should do this using the Git method as otherwise some stuff won't work.
    This is especially true of the WebSocket library. Caused me some headaches 'till I got that sorted !
    Go https://github.com/esp8266/Arduino halfway down the page follow Using Git Version. Install Git first then follow the method to the letter including the bit about Python.

    Edit: Just found a page for your board http://www.wemos.cc/wiki/doku.php?id=en:arduino_get_started. Same thing


    This is a very new and exciting space, much of the work in the community was only completed last year.

    Since my programming skills are still at beginner level, progress is a little slow. However I should be able to release draft versions of my Client Webpage (already working) and Server code shortly.
    Just need to crack an EEPROM problem on the 8266. I'll post here first so you guys can tinker with it, then up to GitHub once its a bit more polished.

    Have fun

    Steve.
     
    Last edited: Mar 1, 2016
    Scott Eric Catalano likes this.
  7. Scott Eric Catalano

    Scott Eric Catalano TrainBoard Member

    205
    57
    6
  8. Jean-Eric

    Jean-Eric TrainBoard Member

    25
    24
    8
    Hello to all! I am back ans settled down in my new house with some time to dedicate to my Z scale network. I have move to a Mega 2560 with a new Arduino motor shield. I am looking forward using the ethernet shield.
    But before I still have to solve my acknowledgment issue: <r10|20|8 -1> when I program CVs. So I move to the other thread where I was explaining my issue and will redo all test.

    Nice to be back

    JEZ
     
    Scott Eric Catalano likes this.
  9. Steve L

    Steve L New Member

    2
    3
    1
    Hello everyone,

    I was able to get the Arduino WiFi101 shield to work with DCC++ and JMRI. I had to make some code changes to DCC++ to get the WiFi101 to work, but the changes mirrored the Ethernet interface code.

    20160625_211014.jpg 20160625_211020.jpg
     
    HVT and Scott Eric Catalano like this.
  10. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Steve L
    Details?
    Steve F
     
    Scott Eric Catalano likes this.
  11. Steve L

    Steve L New Member

    2
    3
    1
    The hardware portion was actually fairly straightforward. I used a Arduino Mega 2560 with an Arduino Motor Shield and an Arduino WiFi101 Shield. https://www.arduino.cc/en/Main/ArduinoWiFiShield101

    The Mega 2560 is on the bottom, WiFi101 in the middle and the Motor Shield on top. Everything powered right up via external power.

    Software-wise I modified the DCC++ source code to add another COMM_TYPE, this one for WiFi. The WiFi101 library mirrors the Ethernet library, so the calls are , for the most part, similar: https://www.arduino.cc/en/Reference/WiFi101

    I did run across a few oddities though. When the WiFi101 board first fires up, it drives power out that is picked up by the Motor Shield. If you have any trains on the track when it powers up they will sometimes run full throttle for a few seconds uncontrollably. I got around that by making a kill switch between the Arduino and the track. I don't complete the circuit for the track power to the Arduino until after the WiFi board does its little startup routine.

    I've also noticed that sometimes the connection will drop out between the Arduino and JMRI and it won't accept any more connections. I think it's a software bug vs. hardware incompatibility. WiFi can be notoriously flakey at times and I'm suspecting that either DCC++ or JMRI or both aren't handling the disconnects/reconnects properly in software. I've seen this behaviour before in other things and my experience has shown it's almost always a software and not a hardware issue. It might be in JMRI or it might be in DCC++ or it might be both.

    I hope this helps. Feel free to ask more questions.
     
    Scott Eric Catalano likes this.
  12. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Steve
    Thanks I will put it on my todo list and play around with it.
    Steve F
     
    Scott Eric Catalano likes this.
  13. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12

    Steve,

    FYI there really is no need to be adding more things to your todo list.
    As I posted a few weeks ago, the ESP8266 can now serve your standard TCP connection needs alongside WebSocket connections all in the current version of my server code.
    Effectively what this means, is that Applications that run on a PC or Tablet or Cellphone and that can connect using an IP address can do so via our standard ESP Wifi Shields (THE cost effective solution).
    The end connection is SERIAL so no mods to Base Station code required.
    When I have contacted the developer it is hoped Async (Multiple TCP) will soon be available. But for now you can connect say Greggs DCC++ Controller app simultaneously with the Websocket Mobile Controller (My phone app).
    How many throttle options would one need at the same time ???
    All apps will stay in Sync with each other because I use the active feedback provided by Base Station.
    And just to finish off my line of throttles I intend to build a premium throttle (cost around $50) using some new up and coming technology I have just taken delivery of.
    This yet to be new throttle will also connect to our server simultaneously and be fully in sync with others on the system.
    Interested ?
    I might start a how to thread detailing the full development process over the coming weeks.

    Steve.


    P.S
    I made the announcement at #1335 here http://www.trainboard.com/highball/...ource-dcc-station-and-interface.84800/page-67 .
    Astonishingly and somewhat disappointingly no one on this board made any comment on this breakthrough.

    In other news. Over the w/e I got some code working, that enables a standalone ESP8266 to talk to my ESP server in full duplex using websockets. Great, this will be the basis of the new throttle as we can communicate both to the WiFi and the onchip Serial however we like, be that full duplex passthrough or one or the other. Stage enter my new secret device.
     
    Last edited: Jun 28, 2016
  14. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Steve
    I saw your announcement and put a like on it but didn't respond because it was a teaser :) ( I thought that I had to wait for new code)....... now I am actually excited and can't wait to see the plans for your new throttle ........ if new ESP code is necessary for the new capabilities please post it ........ I have torn up my todo list.
    Steve F
     
    Scott Eric Catalano likes this.
  15. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi Steve,

    My todo list is growing somewhat, but I'm excited too.
    Today the final major component for the new throttle arrived from China.

    As rotary encoders are flavour of the month, I decided to push the boat out on this one as the little 12 or 24 ppr hobbyist encoders are not up to the job for the premium
    throttle I have in mind. I work on machine tools. The encoders you find on an average CNC control are more what I was after.
    Turns out (excuse the pun) they can be had for not a lot of money if you order from China.
    The device that arrived today is of very good quality, 60mm dia aluminum body 100ppr. What little testing I have been able to do has produced flawless results with some test code on an ESP.
    This build will last you for years. At 100 ppr you can also go from 0 to 126 in about 450 degrees rotation, just what I need.

    I got mine on ebay for somewhat less than $20US delivered

    PC083325.jpg

    The other main part of my new throttle is a relatively new concept in display technology.
    In fact the version I got was only released a few weeks ago.
    Introducing the Nextion HMI Touch Display. https://www.itead.cc/nextion-nx4832k035.html
    This device incorporates an onboard processor and connects to your project with just plain vanilla Serial.
    The downside at the moment is that the instruction set and their IDE are still very immature, I do hope the hobbyist community runs with this one.
    On the positive you can share some of the workload between it and the ESP.
    So three main components plus a battery and case

    Thoughts...

    Steve.
     
    sboyer2 and Scott Eric Catalano like this.
  16. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Steve
    I know that rotary encoders are hot right know but I have always preferred a vertical scroll wheel (ala NCE Power Cab) which I find more convenient for one handed operation. Did you mean 450 degrees of rotation? or 45 degrees ....... 450 seems a like a bit much to me, but I've never even tried a 360 degree wheel so I'll wait and see.
    The new touch display looks great ..... can't wait to see some enhanced software on it. Keep up the good work.
    Steve F
     
    Scott Eric Catalano likes this.
  17. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Yes I did mean 450 degrees. or 1 1/4 turns. That's a considerable improvement over something like a cheap KY-40 with only 12 ppr or 10.5 revolutions from 0 - 126.
    Of course there are software methods to multiply fast rotation and fall back to fine when slow.
    On my encoder the output is Quadrature so 400 ppr can be used instead, downside is 4 steps per detent.

    Cheap vertical wheels can of course be found in your average computer mouse, might be worth playing around with.

    I'll be experimenting with the screen sometime soon then connecting all together for proof of concept.

    Steve.
     
    sboyer2 and Scott Eric Catalano like this.
  18. Dago

    Dago New Member

    5
    6
    4
    Hi all

    I m considering trying ESP8266 on an arduino, i saw warning to use 3.3 volt so some are using a separate power supply.
    But on arduino uno ther is a 3.3 volt output, any reason not to use this output?
    Also starting to figure out to update firmware on ESP8266, an saw some that do it with the arduino, is it really possible ?

    Thanks
     
    Scott Eric Catalano likes this.
  19. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi Dago,

    Yes you can use an Arduino to upload firmware. Here http://www.princetronics.com/arduino-uno-as-usb-to-serial-ttl-converter/
     
    Scott Eric Catalano and Dago like this.
  20. Dago

    Dago New Member

    5
    6
    4
    Scott Eric Catalano likes this.

Share This Page