DCC++ Hardware - Motor Shields

KE4NYV Jan 25, 2016

  1. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Correct.....I bought a 25W resistor on EBAY for $1.50......the data sheets for L298 and some othe chips warn about NOT using wire wound resistors because of the inductive affect on the load, but I ignored this because we're only running at a frequency less than 10K, and nowhere near the maximum rating for the parts in question.

    Anyway, the wire wound resistor I found on EBAY works fine, especially since the L298 is only on the program track.

    http://www.ebay.com/itm/172040060996?_trksid=p2060353.m2749.l2649&ssPageName=STRK:MEBIDX:IT
     
    Scott Eric Catalano likes this.
  2. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    Thanks, I ordered 2 (in case one goes bad).

    ~Travis
     
    Scott Eric Catalano and sboyer2 like this.
  3. Diego Pamio

    Diego Pamio TrainBoard Member

    10
    11
    2
    First and foremost, thanks a lot to build the DCC++ and share it with the world!!! Is very inexpensive but the most interes
    I've just received the only one board I was able to get here in Argentina: http://www.geekonfire.com/wiki/index.php?title=Dual_H-Bridge_Motor_Driver (L298N based)


    My observations and a question:
    1) CON: Is not a shield, but a module.
    2) CON: it has 2 inputs (n1/n2, n3/n4) to determine direction of each motor, so I'll need to use the "inversor" used by Dave Bodnar in the 5AMP bridge experiment (http://trainelectronics.com/DCC_Arduino/DCC++/)
    3) PRO: It has 2 bridges.
    4) PRO: It has a 5v regulated output (using a 78M05 CI) which can be used to power the Arduino.

    And the question:

    1) I've read some care should be taken on the current sensing, and I'm not sure if I should modify something in this board to make current-sensing possible?
    2) Yes... I actually have two questions: in the documentation says "Pull up resistor jumpers Only if you connect IN1(IN2 IN3 IN4) to MCU which have ports of strong driving ability such as AVR,you can take off the jumpers." As I'm connecting it to an Arduino Mega, can/should I remove the jumpers?

    [​IMG]
     
    Scott Eric Catalano likes this.
  4. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    The board you show can easily be setup for current sense.....

    The L298 requires a current path to ground, and on this board, the current path goes through the 2 current jumpers to ground. To measure current, an external resistor is needed as a voltage divider to create a voltage for the current path.

    The right side of the jumper(s) is ground, and the left side is the output from the L298. When the jumper(s) are removed, there is no current path for the chip to supply any output, so you need to add external resistor(s) to each channel to complete the current path. I use 15 ohm resistors.

    So, the resistor(s) are electrically in place of the jumper(s). To measure current, the ungrounded side of the resistor would be connected to the Arduino analog input pin that's used to measure current. Since the standard MD board uses the same value 15 ohm resistors, nothing in the code needs to change.

    Yes, inverters are required for the control signals like Dave did, but I used a 74ls04 chip instead of wiring discrete transistor inverters......it works fine.
     
    Scott Eric Catalano likes this.
  5. Jirka

    Jirka TrainBoard Member

    32
    39
    3
    @crusader: I am afraid you are mistaken. Arduino MD shield uses resistors 0.15 Ohm and amplifier with gain 10. Check the circuit diagram.
     
    Scott Eric Catalano likes this.
  6. Diego Pamio

    Diego Pamio TrainBoard Member

    10
    11
    2
    Weird, but it looks like you're right @Jirka. The diagram indeed says 0R15, and the picture of the board shows a R150, both denominations for a 0.15 ohm resistor.
     
    Scott Eric Catalano likes this.
  7. Diego Pamio

    Diego Pamio TrainBoard Member

    10
    11
    2
    Ouch! That means I should also pass it thru an amplifier? @crusader27529 have you made it work with just a 15 ohm resistor connected at the end of the L298 pin?
    And another question... 25W!? isn't that too much? how much current is passing over that path?
     
    Last edited: Sep 6, 2016
    Scott Eric Catalano likes this.
  8. Jirka

    Jirka TrainBoard Member

    32
    39
    3
    Please look into the catalogue data. Maximum allowed voltage of sensing pins is 2V. When we consider the max current 2A, the sensing resistor must not be bigger than 1Ohm.
    That is the problem of the module- besides the invertor you need the amplifier. Resistors below 1Ohm are not easily available...
     
    Scott Eric Catalano likes this.
  9. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    I just now received my IBT_2 MD boards. :)
    I am excited to try them out.

    ~Travis
     
    Scott Eric Catalano likes this.
  10. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Yes, it works with a 15 ohm resistor functioning for the program track, which requires a somewhat precise current sense to read the CVs.

    With 16 volts to the rails at 1.5 amps (practical limit for the L298 as configured and tested) that works out to 24 watts......granted, the power calculated is for maximum specs, AND since the actual average current on the program track will be quite low, 25 watt resistor is definitely overkill.
     
    Scott Eric Catalano likes this.
  11. Diego Pamio

    Diego Pamio TrainBoard Member

    10
    11
    2
    I ended up doing a "shield" for the L298N module, with all the things of the original shield (a 74LS04 for the inverters, and a 0.15ohm resistor with a LMV358 used as amplifier for the current sensing). Hopefully it will work jsut like the original shield.

    Do you know how it would be the best way to test it (given I don't have an osciloscope)?

    Here it is my "shield". Is not pretty, I've made it on a prototyping board:
     
    Scott Eric Catalano likes this.
  12. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    what I did to test mine is run some jumpers with clips to a DCC equipped locomotive. just make sure to not connect them to the wheels. I popped the shell off and clipped the leads to the pickup connections. for voltage, I used a 12V source to test. though I will use 15 - 18V when I build the layout.
    to test the current readings, I simply dragged my finger on the motor flywheel a bit.
    for a controller, I used JMRI. just make sure to enable track power in JMRI.

    ~Travis
     
    Scott Eric Catalano likes this.
  13. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    I stand corrected......BUT it still works on the program track with the 15 ohm resistor......the origional MD board uses an OPAMP between the current sense and the Arduino, which may be used as a buffer or amplifier......I don't know which.

    So, without the OPAMP in the circuit, the 15 ohm resistor works fine.......my analog skills and test equipment are lacking, so I'm not exactly sure why.
     
    Scott Eric Catalano likes this.
  14. Jirka

    Jirka TrainBoard Member

    32
    39
    3
    @Diego: Providing you did all wiring correctly, I trust it will work.
    @crusader: I believe 15Ohm resistor can work for programming track (which needs just the voltage pulses). I would not expect it can work on the main track since the current will be unacceptably limited (around 133 mA ?). Besides, I would be afraid that voltage peak in case of track short circuit can fry the Arduino input.
     
    Scott Eric Catalano likes this.
  15. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    On the main, I use a MD based on the BTS7960 chips, and that doesn't need an external resistor, since the chip returns a direct voltage that corresponds to the current draw.

    In any case, I'll change the resistor to see if it works without the OPAMP from the original design.
     
    Scott Eric Catalano likes this.
  16. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    I was just playing with my new BTS7960 modules (IBT_2), and I was very pleased that they worked perfectly. :)
    Furthermore, I switched the wires from the main to the program pins, and with one alteration in code, I got it to read and write CV values. I calculated a new value for ACK_SAMPLE_THRESHOLD in file PacketRegister,h, and set it down to 3. it calculated to about 3.4 ADC value, but as it is always an integer, I rounded it down to just 3.

    I am very pleased that the MD module works for both the main and programming, even if it is overkill for the programming track.
    Now I can start finalizing the circuits into an enclosure, and work on the benchwork, track, and so forth.

    and if you couldn't guess it from above, I am VERY pleased. :)

    ~Travis
     
  17. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    I forgot to mention, as this was my first time programming CVs, I didn't realize the motor pulses were all one direction. I would guess that my programming track needs to be a circle of sorts. that was something I didn't figure into my layout plans. I guess I assumed the pulses would alternate between forward and reverse to save space.
    I am still pleased that it works though. :)

    ~Travis
     
    HVT and Scott Eric Catalano like this.
  18. Diego Pamio

    Diego Pamio TrainBoard Member

    10
    11
    2
    I still don't understand how I didn't blow up everything like 10 times with all the mistakes in the wiring (and even on the color-code of the resistors for the current sensing paths) I've made! Well, I did break the 5v regulator on the L298N board, so I need now to use the Arduino's power to power the logic on my "shield".

    Nevertheless, I'VE MADE IT WORK!!!!! I couldn't believe when I saw the decoder responding to the identification read. I'm also VERY pleased! Thanks Dave and all the people who contributed to this cheap and (from Argentina) available solution.

    Now it comes this hard time to setup the controllerConfig file on the Controller to design my layout. I understand that's a manual process, right?

    I'm a software developer, but right now I'm more biased to Web Development and JavaScript, so perhaps I get the courage to do a webapp that talks to the BaseStation.

    Regards,
    Diego.
     
    Scott Eric Catalano likes this.
  19. esfeld

    esfeld TrainBoard Member

    443
    382
    17
    What are you guys using for re-settable short circuit protection with a base station stack? ...if anything.
     
    Scott Eric Catalano likes this.
  20. Qunametin

    Qunametin New Member

    4
    6
    2
    Hi all!
    I just got my Mega working with Pololu shield. The only problem I have is the current sensor showing 0 all the time. Even if there is a loco on the track. I've checked and A0,A1 is connected to M1FB and M2FB. Did anyone had a similar issue?
     
    Scott Eric Catalano likes this.

Share This Page