This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with current sense/over-current detection
So I've been working at making a motor controller based on an arduino IBT_2 , with BTS79608 mosfets. I'm not an engineer, just a lowly "sous-chef" working from this "cookbook" recipe posted by beholder77 in this thread:

Using beholder77's modified motor.ino, I had good early success running my motor through an arduino uno and this MCU,  but I haven't yet figured out how to enable current sense,  or over-current protection.

I've gone through the modifications in beholder77's motor.ino compared to Sean's motor.ino, and found these changes. Sadly, I don't know enough to translate them into how I should wire a shunt resistor in the right place. Here's that code:

//#define HIGH_CURRENT_OLD   // high current uses 500uohm resistor and 50x amplifier
// otherwise using shunt without amplification

#define shunt_sense_pin 4 // use pin 4 to specify shunt resistance
uint8_t shunt_resistance = 1;

#define low_current_pin 5 // use pin 5 to specify low current (no amplifier)
uint8_t low_current = 1;

Also, there was this modified code in beholder77's motor.ino:

        // high curront controller has .0005 ohm with 50x gain
        // 275/64 = 100.0/1024/.0005/50*1.1
#if defined(HIGH_CURRENT_OLD)
        // high curront controller has .001 ohm with 50x gain
        // 275/128 = 100.0/1024/.001/50*1.1
        v = v * 275 / 128 / 16;
        if(v > 16)
            v = v * 275 / 64 / 16; // 820mA offset
            v = 0;

I did try to PM Beholder77, but haven't reached him.

Beholder77 did report that he had current sense working, so I'm hopeful that this will be fairly easy to implement by adding the right kind of shunt in the right place. I've studied Sean's MCU schematic diagrams, but I just don't know exactly where to place the shunt resistor, or how to select the right values for the component.  The motor I'm driving is a pretty light Autohelm 3000 , which draws maybe 3 amps dc. I really need a simple diagram to understand what to put, where. I mean, really simple. Undecided  Big Grin

Help from any direction would be deeply appreciated. Thanks in advance!
check the schematics to the pypilot controller:
(08-28-2019, 02:41 PM)seandepagnier Wrote: check the schematics to the pypilot controller:
Thanks for replying!

Ok, in that schematic I'm seeing A1 on the Nano going to R2 (560 ohms), and thence to "shunt".

With the IBT_2,  I have it connected to R_IS+L_IS through a voltage divider.  The values in that divider are approximately 47kohms (R1) and 15kohms (R2) (they were just lying around, perhaps better to be 50k and 10kohm, per beholder77's post?) That is wired thus:

(IBT_2)R_IS + L_IS --> 50kohm --> (Uno)A1 --> 10kohm --> GRND

Does that voltage divider serve the same function as the R2 resistor, as it is above without adding a shunt?  I'm hoping the answer is yes!

Thanks for your help!
No, it does not serve the same function.
(08-28-2019, 05:45 PM)seandepagnier Wrote: No, it does not serve the same function.
Ok.  Then should I be using a 560 ohm (R2) resistor from A1, and what does it tie to at "shunt", exactly? This is ignorance on my part, I know, but it's not obvious from the schematic, and this board is different in many respects. Maybe this IBT2 is incompatible with what I'm looking at? Thanks again for trying to help.
The 560 ohm resistor could be any value. It is to ensure the input to the analog pin is high impedance from the high current shunt and in this way protects the arduino.

Forum Jump:

Users browsing this thread: 1 Guest(s)