DCC++ Hardware - Motor Shields

KE4NYV Jan 25, 2016

  1. hexadec

    hexadec TrainBoard Member

    18
    18
    4
    Hi Steve,
    The first thing I would check is that you have more than 4.5V on pin 8 of the 6N317 (VCC) as the datasheet states that this is the absolute minimum it requires. I had 4.3V to start with, also if you are using a 7805 check with the 'scope that you are getting a stable output.
    Roy
     
    Scott Eric Catalano likes this.
  2. hexadec

    hexadec TrainBoard Member

    18
    18
    4
    PS you should be getting a nice DCC 5V square wave and it's inverse as inputs to the IBT-2.
     
    Scott Eric Catalano likes this.
  3. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Roy
    I swapped out the 4.7k resist for a 330 ........ I am only getting 4.17 out of pin 8 .... I am getting a stable 7805 output of 4.96 .....
    Any ideas?
    esfeld@cyberdude.com
     
    Scott Eric Catalano likes this.
  4. hexadec

    hexadec TrainBoard Member

    18
    18
    4
    Here's an extract from the 6N137 datasheet.
    You'll note that the MAX pull-up resistor is 4K and the MIN Voltage is 4.5V neither of which you fulfilled. Having said that Dave's circuit seems to work for others!

    Try taking the diode (my D2) out of circuit and connecting the 4.96V straight to pin 8 of the optocoupler. See if that helps. :)
     

    Attached Files:

    Scott Eric Catalano likes this.
  5. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Tried that ... no change .. then burned up the 7805 :( ... put in a new one .. now get 4.24V on pin 8 ... obviously still not enough, not sure were to go from here to get the needed 4.5 Vs ... I'll sleep on it (too much else going on) and have at it in the AM
     
    Scott Eric Catalano likes this.
  6. RCMan

    RCMan TrainBoard Member

    271
    132
    12
    Measure the input voltage to the 5 volts. Should be a minimum of 7-12 volts. If that is OK then you have a defective device on the output of the 5 volts.
    Is the 5 volt regulator getting hot to the touch?

    You might have to add a filter cap to the output also. sometimes the regulator can start oscillating and give you a low reading.


    Dennis
     
    Scott Eric Catalano likes this.
  7. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Hi Dennis
    Thanks for jumping in. I am getting 9.37V into the 7805 and 4.96V out .. but only 4.21V on pin 8 of the opto. In addition I am only getting 4.23V from the 5V pin of the pro mini.
    7805 is not getting hot. On Daves circuit board the output already goes thru a 470mf cap ......
    Steve F
     
    Last edited: Sep 19, 2017
    Scott Eric Catalano likes this.
  8. hexadec

    hexadec TrainBoard Member

    18
    18
    4
    The diode drops 0.7V so you'll only ever get around 4.3V on the 6N137 and the Arduino VCC.
     
    Scott Eric Catalano likes this.
  9. SP_fan_1951

    SP_fan_1951 TrainBoard Member

    93
    86
    6
    You can easily boost the output of the voltage regulator by putting a diode between the ground pin of the regulator and ground (the cathode to ground), ideally a diode identical to the series protection diode. This will exactly balance the forward voltage drop of the protection diode, and return the measured voltage to 4.96V
     
    Scott Eric Catalano and hexadec like this.
  10. peakecentral

    peakecentral New Member

    3
    3
    2
    Hello everyone,

    I'm a programmer who has agreed to help a close friend sort his DCC system out. It's complicated and will take a while. I decided to build a DCC++ base station to be able to run stuff at home, but I have hit a hurdle. I've looked through this entire thread, but can't quite see what I'm looking for.

    I started by building a few Arduino-based accessory decoders, such as the ones by Rudy Boer (clickety). I can easily turn these on and off using the Dynamis controller I have on my bench. I also built Rudy's DCC sniffer, and using this I can see the DCC messages sent from the Dynamis box. So far, so good.

    I then built a DCC++ controller using a genuine Arduino Uno and a genuine Arduino motor shield, jumpered 10-12 and 5-13. The DCC circuit is powered by a smooth 15VDC from a laptop PSU. I could not get a single message to be received by any of my accessory decoders, nor was anything seen on the sniffer. Swapping to an Arduino Mega made no difference, so I ordered another motor shield, this time the stock eBay Deek-Robot version. This didn't appear to put anything on the lines either. If I remember correctly, I also tried a stock 12V wall wart PSU, but no dice.

    I then found the debug mode instructions on the GitHub page. I went through these, and it appears that the Arduino and the motor shield are working as expected, right through to LEDs pulsing at the output stage.

    At this point, I'm out of ideas. It's driving me mad, and even if the genuine Arduino Motor Shield was duff (which is unlikely), it's unlikely that both cards were DOA. Finally, I did connect a regular motor to the genuine Arduino Motor Shield, and this worked fine.

    Can someone point me in the right direction please?

    Thanks in advance.

    Martin
     
    Scott Eric Catalano likes this.
  11. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Hi,
    A few questions;
    How are you sending commands to the DCC++ BS? If you are using the arduino IDE serial monitor, does switching on and off the track power work ok? (the motor sheild LEDs should turn on and off). Does the serial monitor give confirmation messages of any commands you do send? You are connected to the Main track (and not the programming track)?
     
    Scott Eric Catalano likes this.
  12. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    After much analysis I decided to replace the transistor and now everything is working as it should. Whoopee, I am a happy puppy! Thank you all for your patience and assistance. Now, on to making sure that the current sense is reporting accurately.
    Steve F
     
    Scott Eric Catalano and hexadec like this.
  13. peakecentral

    peakecentral New Member

    3
    3
    2
    Jimbo,

    I am controlling the Arduino directly via the IDE serial monitor. The power turns on and off without a problem, and the serial monitor shows the acknowledgement messages returned by the Arduino. I am connected to the A output for the main track, although I also tested the programming track just in case.

    As far as I can see the DCC data should be leaving the base station. There may be some sort of disconnect between the base station's implementation of DCC and that of the mynabay library. I have an Ecos decoder somewhere which I will try out tonight if I have time.

    Martin
     
    Scott Eric Catalano likes this.
  14. hexadec

    hexadec TrainBoard Member

    18
    18
    4
    Glad you've sorted it Steve!
     
    Scott Eric Catalano likes this.
  15. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Roy
    Quick question. I am trying to verify the current reading on the booster. It seems to be reading a correct proportion of the Max Amp setting …. With a single loco (sound decoder installed) I get 80% with a Max setting of 1 Amp (.8Amp) and 40% with a max setting of 2Amp etc etc ……. The odd thing is that I am getting a current reading on a bare track (no loco) leading me to believe that something is amiss. Any ideas?
    Steve F
     
    Scott Eric Catalano likes this.
  16. RCMan

    RCMan TrainBoard Member

    271
    132
    12
    Start removing one item from the setup. Start with the piece of track only, leave the wire. If no change then remove the wire used to connect to the track. If their is nothing else except the motor shield then look carefully verify that the wiring modifications done to the shield correctly.

    Report back your findings.

    One step at a time when troubleshooting a problem:

    Dennis
     
    Scott Eric Catalano likes this.
  17. hexadec

    hexadec TrainBoard Member

    18
    18
    4
    That for me was where all this started. I have 3 IBT-2s, one of which immediately shuts down as soon as power is applied showing "PWR OFF-2 sec" on the LCD, one shows 80% current draw and one seems to work properly after I changed :
    percentage = (CurrentPinReading * 0.0105) / PotReading;
    to
    percentage = (CurrentPinReading * 0.001) / PotReading;

    The only difference in Hardware or software is in swapping the 3 IBT-2s which all points to some anomaly in the current sense circuit (or software).
    All this is with no current draw at all (the output is not connected to anything).

    Roy
     
    Scott Eric Catalano likes this.
  18. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Roy
    Re-reading the thread, I see that this is where it all started for you. I kind of wish that we could coerce Dave into a brief re-visit to the project since he is satisfied with his results. I will try your code changes when I get a chance and see if that helps.
    Steve F

    Dennis ... looks like Roy and I both have the same problem/result, so I think it goes beyond wiring.
     
    Scott Eric Catalano likes this.
  19. RCMan

    RCMan TrainBoard Member

    271
    132
    12
    Understand:
    One question? Why the drastic change in the CurrentPinReading formula?
     
    Scott Eric Catalano likes this.
  20. hexadec

    hexadec TrainBoard Member

    18
    18
    4
    Nothing other than trial and error to make the screen say something like the reality. Having said that, I have no clue where Dave got his figures from in the first place and not having anything to go on....

    I am currently (pun alert!) building a DCC current/voltage meter so that I can do some accurate (ish) measuring and try and work it from there. Not having an IBT-2 module that I can trust it's difficult to narrow down the problem.
     
    Scott Eric Catalano likes this.

Share This Page