2019-08-28, 04:44 PM
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:
http://forum.openmarine.net/showthread.php?tid=1840
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;
#else
if(v > 16)
v = v * 275 / 64 / 16; // 820mA offset
else
v = 0;
#endif
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.
Help from any direction would be deeply appreciated. Thanks in advance!
http://forum.openmarine.net/showthread.php?tid=1840
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;
#else
if(v > 16)
v = v * 275 / 64 / 16; // 820mA offset
else
v = 0;
#endif
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.
Help from any direction would be deeply appreciated. Thanks in advance!