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.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
servo.current units
#1
Hi gang, I'm trying to get an arduino nano reading current from an iBT_2/BTN7960.  Before starting to fiddle.... 

With 1v applied to pin A1 the servo.current returns 2.569 - should this be calibrated as Amps? 

Am I right assuming to change this line in the arduino motor.ini to do the calibration? 
    if(pwm_style == 2) // VNH2SP30

        return v * 9 / 34 / 16;

This is the circuit between the IBT_2 & A1
[Image: jf3QjP3.png]
Think the voltage at Con 1 was around 1.2v with about 1.8A on the load (just a lightbulb for testing). Will do some more testing later, just checking I'm along the right track, Ta.
Reply
#2
yeah you can change that line to try to get it closer... I thought it was correct for VNH2SP30 although sometimes these parts are defective so it is hard to say. Once you get the amps right it would be good to know what value you used and if nothing else at least I can put a comment in the code.
Reply
#3
Hi,

you can take a look here: https://github.com/McNugget6750/pypilot-.../Motor.pdf
You can find the code there too. In the code you´ll find the lines for the current detection.

It´s also possible to look here: https://github.com/AndreasW29 I use the code from Timo with some modifications and with the IBT_2

Best regards

Andreas
Reply
#4
(2021-08-05, 04:50 AM)seandepagnier Wrote: yeah you can change that line to try to get it closer...   I thought it was correct for VNH2SP30 although sometimes these parts are defective so it is hard to say.   Once you get the amps right it would be good to know what value you used and if nothing else at least I can put a comment in the code.

Thnax, OK so ignoring the driver for a moment, if I put a voltage on to pin A1 there wil be a current value displayed but it seems very low?


0.1v > 0.24
0.2v>0.51
0.3v>0.74
0.4v>1.02
0.5v>1.29
0.6v>1.53
0.7v>1.8
0.8v>2.04
0.9v>2.31
1.0v>2.58
1.1v>2.7
1.2v>2.7
IIRC the analog pin is referenved to 1.1v so will only read up to 1.1v. 
 [Image: r3fMc3q.png]

Then with the code changed to 'return v * 90 / 34 / 16;',  1.1v>27.07 so that calibration seems low to me, but it works! Next I'll put a simple pwm output sketch on the arduino with a dummy load and see what comes out of the R_IS & L_IS pins with a 1K resister to ground as per their datasheet. But all looks OK though, just a little tweaking needed ?? 

(2021-08-05, 07:47 AM)Andreas29 Wrote: Hi,

you can take a look here: https://github.com/McNugget6750/pypilot-.../Motor.pdf
You can find the code there too. In the code you´ll find the lines for the current detection.

It´s also possible to look here: https://github.com/AndreasW29 I use the code from Timo with some modifications and with the IBT_2

Best regards

Andreas

Thanks, I did spend a while looking in those & reading your guide PDF - great notes, well done! 
Though think I'll stick with the pypilot sketch for now, worked straight way and any new versions should be easy to load. 

Ta ?
Reply
#5
Hi,

I just want to say, that there is a circuit with the IBT_2 and a voltage divider to read current and a code which works with the resistance values used in this circuit.
Maybe it´s possible to use this for your project.

Best regards

Andreas
Reply
#6
(2021-08-05, 11:09 AM)Andreas29 Wrote: Hi,

I just want to say, that there is a circuit with the IBT_2 and a voltage divider to read current and a code which works with the resistance values used in this circuit.
Maybe it´s possible to use this for your project.

Best regards

Andreas

Thanks, saw that, I copied the concept and have a very similar circuit but with a pot for voltage divider adjustment. Just about to do some tests.
Reply
#7
So with a 1.2k Ohm between R_IS/L_IS & ground..
2.9A on load = 0.534v on IS pin.
470 Ohm ,
3.34A = 0.258v

So might just stick with 470 Ohm for now & calibrate to that, doubt if I'll pull over 10A.
Reply
#8
If you are using pwm_style == 2, for ibt 2, then the reference is from 0 to 5 volts which may explain some of the low readings. The other thing to consider is exactly how many volts per amp the ibt 2 puts out which as you mention is adjustable?
Reply
#9
(2021-08-05, 03:45 PM)seandepagnier Wrote: If you are using pwm_style == 2, for ibt 2, then the reference is from 0 to 5 volts which may explain some of the low readings.   The other thing to consider is exactly how many volts per amp the ibt 2 puts out which as you mention is adjustable?

I assume pwm_style == 2, as VNH2SP30 is defined >
#define VNH2SP30 // defined if this board is used

Though just putting an adjustable voltage onto A1 the servo,current values stop rising once the voltage reaches 1.1v which suggests the reference is 1.1v? 

Not that it seems to matter much, either with a voltage divider or changing the resister between IS & ground the voltage coming out of the IBT_2 can be changed to whatever suits.
Reply
#10
This may be the case. Are you able to determine if the current output is linear or does it need a non-linearity correction?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)