DCC++ Using SparkFun Redboard

bklynman01 Jun 23, 2020

  1. bklynman01

    bklynman01 TrainBoard Member

    14
    6
    3
    If this should be a reply somewhere else instead of it's own thread, please forgive me and let me know so I can fix it. I've spent the last hour searching and reading through extensive threads trying to find what my issue may be, but to no avail. Hopefully someone can help.

    I'm using a SparkFun RedBoard and a SparkFun Wireless Motor Driver Shield (links at the bottom of this post). The DCC++ code uploads to the Redboard without a problem, even can see the communication in the serial monitor: "<iDCC++ BASE STATION FOR ARDUINO UNO / ARDUINO MOTOR SHIELD: V-1.2.1+ / Jun 23 2020 12:26:45><N0: SERIAL>" after upload completes. JMRI software says that it is connected to the command station, but it does not allow me to turn on the Track Power.

    When I send the command "<1>" the LED at the motor output blinks, but does not stay on (same with JMRI). The serial monitor adds the string "<p1><p2>". A meter on the output shows action, but quickly returns to 0V. I don't have a scope at my disposal, so I can't see exactly what's happening.

    The power source for my motor shield is a wall plug power pack, output 17V at 1A (enough for my small HO layout). At first I thought the motor driver couldn't handle the load, so I put an adjustable power supply in there and tested at 12V, 10V, and 8V, but the same behavior continued. SparkFun robot examples use a 9V battery, so my tests at 10V and 8V should have been just fine. The website says normal operation of 13V at 1.2A is acceptable, 15V maximum.

    I'm simply trying to get it working with a a single section of track and alligator clips on a bench top. Is it possible that there isn't enough load to keep it running? Do I need to hookup the current monitor pins so it doesn't default to OFF by not seeing a load? Is the motor shield the issue?

    Any ideas of what's going on here? I don't normally consider myself a complete dummy with electronics, but for some reason I can't think of what to try next. Any advice is appreciated!


    Redboard: https://www.sparkfun.com/products/13975
    Wireless Motor Shield: https://www.sparkfun.com/products/14285
     
  2. Atani

    Atani TrainBoard Member

    1,466
    1,736
    37
    It sounds like the analog current sense may not be working correctly. The motor shield you are using uses a TB6612FNG which has two sets of current sense pins (I think A0,A1 for MAIN and A2,A3 for PROG) so you may need to add some jumpers and adjust the Config.h to reflect the analog input pins.
     
  3. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    I agree with Atani. It is either current sense or wiring. If you find it is wired correctly, then check the overcurrent trigger value. It could be shutting off immediately because it think you have a short. You are using DCC++ Classic. We have Classic and EX. Our web page is here:

    https://dcc-ex.github.io
     
  4. bklynman01

    bklynman01 TrainBoard Member

    14
    6
    3
    Thanks guys! And sorry for delay - I get a couple hours a day to mess around with this between work and kids and everything else.

    The first thing I tried was to use the DCC++-EX. Everything is the same except the serial monitor only returns "<p1>" when I send the "<1>" command.

    I tried looking around to find a wiring diagram for the current monitoring, but couldn't find one (probably overlooked?). It seems the Arduino version of all this does not require additional wiring for current monitoring, and SparkFun claims that the pinout is the same.

    I did look at the schematic for the motor shield, here's what I found:
    upload_2020-6-24_12-38-34.png
    The question this raises for me: PWM is called out as pins 3 and 6. Does it mean that the jumpers defined for the Arduino and Pololu shield are different?
    (again, my comment above - SparkFun claims that the pinout is the same)
    To double check my wiring, I have 2 jumpers on the motor shield - pins 5 & 13, and pins 10 & 12.

    I will try to play around with the pinout/jumpers and report back. Worst case I fry the shield which would only lead to my purchasing the Arduino or Pololu shield...
     
  5. Massey

    Massey TrainBoard Member

    2,016
    6,508
    58
    If this is similar to other motor shields I have used in the past the jumpers on the PWM pins simply set it to "255" so its full power all the time. I'm not sure about the pin 10/12 jumper as I would expect another jumper on pin 6 and something else. If you were to apply a 5V DC reference to the pins 3 and 6 it would put those 2 channels on at full power. It could be that the jumper on pins 10/12 are actually causing a short and could be the cause of the drop out. I have never seen a shield fry because jumpers were removed... now I have seen the magic smoke from jumpers not installed correctly...
     
  6. CSX Robert

    CSX Robert TrainBoard Member

    1,503
    640
    41
    Well according to the Sparkfun schematic, it does use different pins. If that was the only issue, you could most likely simply change a few constants in code and it would work, but in this case there's even more to it. The way these H-bridge driver chips work is they have two input pins on each channel for direction - set one high and the other low for clockwise and swap them for counter-clockwise. The Arduino shield has circuitry to to handle this so you can change directions using only one pin per channel, which the Sparkfun board does not appear to have.
     
  7. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    I'll take a look in a bit. But even if it does need the 2 signals combined into one, we can do that with one or two transistors and a couple of resistors.

    Fred
    DCC++ EX
     
  8. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    That is just a schematic of the H-Bridge Driver chip. Here is the entire schematic: https://cdn.sparkfun.com/assets/parts/1/2/2/4/3/Wireless_Motor_Driver_Shield.pdf

    I think Sparkfun is commenting on the fact that the Pololu and this board use the same Toshiba motor driver. That is probably what they mean by "compatible". But the implementation of the boards is very different.

    After spending some time on this, I think it is more trouble than it is worth to try and get it to work.

    1. You would need a jumper between pin 11 and pin 6
    2. Now we have a problem. This was mentioned by @CSX Robert. This board has a DIRA AND a DIRB. They are pins 4 and 5. So that eliminates a network shield. Assuming that's not a problem. Pin 5 is. We would have to switch the software because we are using 5 for DIRB on the Programming track. So we would need to change the DCC_SIGNAL_PIN_PROG to perhaps 2. But I'm not sure that wouldn't effect something else. More problems brewing, but let's continue. Pin 10 would then jumper to a homebrew circuit, more below.
    3. Our newly switched pin 2 would now have to connect somewhere, but since that is pins 7 AND 8, we need another circuit.

    You would need 2 circuits made from 1 transistor and 2 resistors. One for each track. I won't go into the circuit and wiring here, but it would obviously require something like a small breadboard to solder things to and making connections to the components (Voltage, Ground and each of the DIR_A0, DIR_A1 and DIR_B0 and DIR_B1 pins).

    And now the current sense problem. There is no current sense circuit on the board and the pins we need are wired to the XBee header. You could actually use that, by closing the switch and wiring a dual comparator circuit from the header, or use a resistor shunt to feed a voltage to the sense pins on the Redboard. But at that point you would be better off to just get something like a MAX471 board for each track and use it to reliably report the current.

    So I am writing all this A. In case you actually want to tackle this project or B. People searching for this will be able to find the info and make the same decision.

    I would recommend just getting either an Arduino Motor Board R3 (if you want it fast) or a Deek-Robot Motor Controller (the slow boat from China).
     
  9. bklynman01

    bklynman01 TrainBoard Member

    14
    6
    3
    Guys, this information is amazing!

    As I said in my last post, I played around with the jumpers to try and get some functionality, but to no avail. After reading @FlightRisk posts, it makes a lot of sense why I can't get function out of this thing. It's great to know that there's an amazing amount of support and knowledge in this forum, especially for a new member like myself.

    I've purchased an Arduino motor shield and an Uno R3 just to get straight with all of the resources that are available. And, now that I have an extra redboard and motor shield, I can play around with different types of controls on the layout without the potential of messing up my DCC++ system :)

    Again, I appreciate the help everyone. I'll try to remember to update here with what happens when I get my new equipment.
     
  10. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    Good luck! And if you wanted to try something different, you could always swap out parts later. Many people can get by with a home setup with the 2 Amps you get on the track with that motor board. And you can always connect accessories and stationary decoders from another DC bus so you don
    't have to power accessories and lights from the track. It's much the same as powering your Arduino from a 9v wal-wart, cutting the trace on the motor shield and powering it separately from a 14V, higher amperage power supply so you can have more juice.
     
  11. bklynman01

    bklynman01 TrainBoard Member

    14
    6
    3
    Quick update...

    The new Uno and Motor Shield came in on Thursday and I finally had some time today to get them plugged in and sketches uploaded. To test and make sure, I sent the <1> through the serial monitor and the lights turned on. Immediate excitement! Then I started up JMRI and was able to move engines forward and back on both main and programming tracks. Even more excitement!! Then I realized I have some more learning to do with JMRI, so now that's my next task. Building a roster shouldn't take too long as I don't have a large collection, seems like a good place to start.

    Thanks again for the advice, and the expert level technical support! You guys (both of you) saved me a lot of time banging my head against the desk.
     
    FlightRisk likes this.

Share This Page