DCC++ Serial Port Issues

Marty1962 Mar 27, 2019

  1. Marty1962

    Marty1962 TrainBoard Member

    16
    2
    3
    Hi Guys
    Firstly let me apologise in advance if this is a rookie mistake. ( I am down under in Australia after all!!)

    I have been following Greg from DCC++ and have purchased the Arduino Mega 2650 and the Arduino Motor shield. I have downloaded the required Base Station Software and the Controller Software. I have followed all of Greg's videos on the DCC++ site as well as trolling the web but to no avail.

    I ran the base station software in Arduino IDE version 1.8.9 and it does the compile sketch as it should with no errors and reports back the used up space as it should. When I try to upload the file to the base station it seems to do the upload " the RX and TX " lights flash on the Arduino. What happens after this has me lost!

    An error statement appears at the bottom stating the following:

    Invalid library found in C:\Programs Files (x86) \ Arduino\Libraries\BaseStation-Master: no header files (.h)

    Is this an issue as it seems the program still uploaded?

    Any advice would be greatly appreciated.

    Regards
     
  2. DaveT58

    DaveT58 TrainBoard Member

    18
    2
    2
    Hi Marty

    It looks like the Basestation-Master sketch has been saved in the "C:\Programs Files (x86) \ Arduino\Libraries\" folder. All of your Arduino programs should be saved in a folder in your "User/Document/Arduino" folder.

    Move the folder "C:\Users\<user_name>\Documents\Arduino\libraries\BaseStation-Master" to the "C:\Users\<user_name>\Documents\Arduino\". The libraries folder is only for storing library files, your sketches (Arduino programs) should be saved in the "C:\Users\<user_Name\Documents\Arduino" folder.

    If you do not save your sketches in the ....\Document\Arduino\ folder they can be deleted if/when you update the Arduino IDE to a later revision.

    DaveT
     
  3. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Also; does the screen actually report that it has successfully loaded?

    The LEDs do flash when you first start the process, but I think this is the system checking that there is something connected to the USB port.
     
  4. Marty1962

    Marty1962 TrainBoard Member

    16
    2
    3
    Thanks Dave, this has been fixed thanks to your advice.
     
  5. Marty1962

    Marty1962 TrainBoard Member

    16
    2
    3
    Thanks Jimbo20 It seems there was an error when I added the Motor shield in that the patch lead should have been between pins 13 and pin 2. I only found this when I read the code and it stated pin 2 not 3 or 4. All channels now working and decode has now been programmed. Thanks for your help
    regards Marty62
     
  6. DaveT58

    DaveT58 TrainBoard Member

    18
    2
    2
    HI Marty

    Glad it helped getting DCC++ uploaded and running. Its a wonderful bit of code, makes it very cheap to get a DCC system up and working, JMRI and DCC++ is a great combination.

    Where are you in Oz, I lived there for 20 years - 1982 to 2002, mainly the Sydney and Gosford areas.

    DaveT
     
  7. Marty1962

    Marty1962 TrainBoard Member

    16
    2
    3
    Hi DaveT

    I actually live in a small country town about 30 mins from Wangaratta. Wangaratta is about an hours drive from Albury. I dont know if this helps much with my location. My next project is adding wifi to my DCC++ system, parts are on the way.
     
  8. DaveT58

    DaveT58 TrainBoard Member

    18
    2
    2
    Hi Marty

    I used to know the area from Junee to Albury quite well, I worked on the railway line installing a new signalling system in the eary 1980's (83 - 85 I think), stayed in Harefield and Wagga for a while.

    Back to DCC++, I have updated the DCC++ code to allow an Arduino Mega to connect to JMRI over Serial ports Serial1, Serial2, Serial3, this allows for the use of the ESP8266 wifi boards to provide the Ethernet link between JMRI and DCC++.

    I am just testing a combination of DCC++ on an Arduino Mega with a ESP8266 Wifi board providing the link to the JMRI running on my desktop and also a WEMOS MEGA which has the Arduino Mega and a ESP8266 on the same board. It is running quite well, some tidy up required in the DCC++ code to do. Once I am happy it is running well and stable enough, I will make it available for all to try.

    So if you are getting the parts for DCC++ wifi, I suggest the WEMOS ESP8266 Pro mini (or similar ESP board) or the WEMOS MEGA with ESP8266. I will try to find some links so you can see the parts I bought.

    DaveT
     
  9. Marty1962

    Marty1962 TrainBoard Member

    16
    2
    3
    Hi Dave

    I actually ordered 2 x ESP8266 ESP-01 Wifi Modules, why 2 you may ask, well they were a package and cost me $ 6.00 AUS. It nearly cost more to post them to me than the actual goods. I still have a spare Arduino Uno and a Spare Motor shield so the wifi boards may come in handy later.
     
  10. DaveT58

    DaveT58 TrainBoard Member

    18
    2
    2
    Hi Marty

    When you are next looking to get another Arduino board, treat yourself to the Arduino Mega Clone, not only has it got more I/O on the board, it also has 3 more serial ports the Uno only has one serial port and that is shared on board with Pins 0 and 1 and the USB port for programming and monitoring.

    With the Mega I have the ESP8266 board communicating on "Serial3" to the JMRI and I can load and monitor the Arduino through the "Serial" port, very useful and very flexible.

    You can use an Arduino library called SoftSerial to setup another serial port on the Arduino UNO if required but it will take some detailed modification to the standard DCC++ code to make this work.

    My Mega/ESP8266 setup has been running continuously for 3 days now and I am happy with the Wireless code and operation so I will put up a copy next weekend, I have a couple of small tweaks to the Status Info sent back to the JMRI to give correct structure for the info.

    DaveT
     
  11. Marty1962

    Marty1962 TrainBoard Member

    16
    2
    3
    Hi Dave
    I actually do have the mega 2650 with the version 3 motor shield on top. The Uno was the original with the version 1 motor shield. These are now spare and mega has taken its place

    Regards Marty62
     
  12. DaveT58

    DaveT58 TrainBoard Member

    18
    2
    2
    That's a good combination, add JMRI and its very easy to set the spare I/O on the Mega as inputs for sensors to tell JMRI do carry out actions. The combination of JMRI and DCC++ is very powerful, complicated to start with but it starts to fall into place after a bit of dabbling.

    Have fun

    DaveT
     
  13. Marty1962

    Marty1962 TrainBoard Member

    16
    2
    3
    Hi Dave

    I have been trolling around on the internet trying to find out how to wire the ESP8266 to the Arduino Mega. Some sites show a straight connection while some other show resistor that are required.

    I have designed a small circuit board that allows the ESP board to solder straight onto it. This same board contains a 12 volt to 3.3 volt regulator and filtering caps to ensure the board get sufficient current to operate and it is independent from the mega for any power.

    Do I still need to add the resistors that some sites show in the connections between the TX on the Arduino and the RX on the ESP board. It is very confusing because some sites say you have to and some don't show them at all.

    Could you shine some light on this for me, remembering the power for the ESP board is not connected to the Mega but to the original 12 volt supply that powers the Motor Shield. it is then converted to 3.3 volt by the reg and filters.

    In my mind the only other connections are TX and RX on the ESP board to the opposing RX and TX on the arduino and possibly the reset connection.

    I may of course be way off track on this, hence I need your guidance.

    Regards
    Marty62
     
  14. DaveT58

    DaveT58 TrainBoard Member

    18
    2
    2
    Hi Marty

    Sounds like you have got the two areas of concern for the DCC++ setup

    • Power and RS232
    I have been doing my testing with the ESP8266 board powered by the USB port from the computer and I have connected the Serial TX/RX and GND from the ESP8266 to the Mega Serial3 port. The research I did said that there is no need to do anything special on the RS232 lines between the Mega and the ESP8266 and this combination has been working continuously for over a week with no issues on the RS232 side.

    The power side you will need a 3.3V stable/smoothed power supply for the ESP8266 which sounds like you have in hand. Just don't forget to connect the grounds together to make everything work properly.

    The ultimate configuration I will be using for DCC++ is a WEMOS MEGA that has the ESP8266 built on the board, (available from AliExpress) great for a final arrangement. This is a right pain in the neck during development and testing and loading new sketches as you have to set a range of DIP switches to upload programs to either the Mega or the ESP8266, so I have been using a Mega for the DCC++ and a Wemos ESP8266 Pro Mini board for the Wifi connection each has its own USB connection easy to monitor and upload.

    I would not connect the resets on the Mega and the ESP8266 together, better to be able to individually reset. I have found it is the ESP8266 that stops working and cannot be pinged, reset the ESP8266 and everything comes back to life between the Mega and the JMRI.

    Will upload my revised DCC++ sketch and the ESP8266 sketch on the weekend, you can be the first to get it a go and see have it goes.

    Kind regards


    DAveT
     
  15. Marty1962

    Marty1962 TrainBoard Member

    16
    2
    3
    Thanks Dave

    You are indeed a champion, looking forward to the weekend.

    Regards
    marty62
     
  16. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Just to confirm, according to a post on Facebook by Teo Swee Ann (the founder and CEO of Expressif, the ESP8266 chip manufacturer) The ESP8266 IO pins are 5V tolerant.

    Teo Swee Ann:
    https://www.facebook.com/groups/1499045113679103/permalink/1731855033731442
     
  17. DaveT58

    DaveT58 TrainBoard Member

    18
    2
    2
  18. DaveT58

    DaveT58 TrainBoard Member

    18
    2
    2
  19. DaveT58

    DaveT58 TrainBoard Member

    18
    2
    2
    Hi Marty

    One other thing to remember is that on the commercial DCC units the Programming Track is current limited to try and ensure the on board DCC decoder is not damaged during initial testing of installation and programming. It is very easy to "let the smoke out" of a DCC decoder and then just throw it away and reach for the next decoder.

    The usual way to limit the current is put a current limiting resistor in series with one of the outputs to the Programming track, from my investigations and calculations the resistor size for DCC (OO/HO) with 17v DC input is 27ohms and Im using a 25W resistor. I will only program the DCC decoders on the current limited programming track, I will not use Programming on the Main line as the only current limit is usually the max output of the motor driver board (2-3Amp), more than enough to destroy a incorrectly wired decoder.

    I would be interested to get other opinion and thoughts on the size for the current limiting resistor,

    DaveT
     
  20. Marty1962

    Marty1962 TrainBoard Member

    16
    2
    3
    Hi Dave, long time, no chat.

    I have just followed your advice and purchased the WesMos mega 2560 with the onboard wireles chip.

    There seems to be all sorts of issues on the web with regards to the dip switch position and so forth.

    I would assume that by now you have played enough with the wesmos board to have ironed out a lot of the issues, don't suppose you would like to share your learning's?

    Did you end up creating the code for the wesmos to talk to the DCC++ system

    As per usua,l any advice and direction would be greatly appreciated

    Regards Marty
     

Share This Page