2019-11-25, 01:47 AM
(This post was last modified: 2019-11-25, 02:32 AM by CapnKernel.)
(2019-11-25, 12:20 AM)seandepagnier Wrote: It might be interesting to try to merge the changes if possible.
Can the IBT_2 be supported with an ifdef without affecting the other supported circuits?
I'll give merging a go.
Is it worth having a preprocessor var that's the name of the driver, eg "VNH2SP30", "IBT_2". And could the pin 6 functionality (RC vs H-bridge, which is currently done at run-time) be done with this var too?
(2019-11-25, 01:47 AM)CapnKernel Wrote: I'll give merging a go.
FWIW here are the diffs between @beholder77's code, and the motor.ino it was apparently derived from (152f648):
https://gist.github.com/CapnKernel/8b7d5...b7abff8fb0
The version @jim321 posted on August 30 also had these lines:
Code:
@@ -75,6 +75,14 @@
If incoming data has the correct crc for a few frames
the command can be recognized.
+IBT_2 ARDUINO
+
++5V 5v
+GND GND
+R_EN+L_EN D2
+R_IS+L_IS A1 (with voltage divider)
+L_PWM D9
+R_PWM D10
*/
/* vnh2sp30 is supported, but warning, I received 3 boards:
Regarding current sense, my understanding of the BTS7960 is that Is (pin 6) measures the current through the high side switch, so when the low side switch is off, the pin doesn't measure current. Internally, these are done with current sources.
The IBT_2 board has two BTS7960s, and we can assume/ensure that both high sides are not on at the same time. Question: If I just connect the Is signals together, does Kirchoff's node law mean that the current flowing out of that connection (into the voltage divider) is equal to the sum of the two Is signals? And since one Is signal will always be very small, that this summed signal will faithfully represent the motor current, regardless of direction? (If so, motor.ino will only need to monitor the one analog pin).
Some of this may answer @skyeyedoc's questions about current sensing...