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
How to drive hydraulic
#22
Hi Jamos,

You probably want to read all of this thread:

 https://forum.openmarine.net/showthread.php?tid=1840

And note this code change, because voltage detection isn't done right when pwm_style is 2.

Code:
@@ -115,10 +115,10 @@ PWR+             VIN
 
 
 
-//#define VNH2SP30 // defined if this board is used
+#define VNH2SP30 // defined if this board is used
 //#define DISABLE_TEMP_SENSE    // if no temp sensors avoid errors
 //#define DISABLE_VOLTAGE_SENSE // if no voltage sense
-//#define DISABLE_RUDDER_SENSE  // if no rudder sense
+#define DISABLE_RUDDER_SENSE  // if no rudder sense
 
 
 // run at 4mhz instead of 16mhz to save power,
@@ -405,10 +405,14 @@ void setup()
 #if 1
     // setup adc
     DIDR0 = 0x3f; // disable all digital io on analog pins
+#ifndef VNH2SP30
     if(pwm_style == 2 || ratiometric_mode)
         adcref = _BV(REFS0); // 5v
     else
         adcref = _BV(REFS0)| _BV(REFS1); // 1.1v
+#else
+    adcref = _BV(REFS0)| _BV(REFS1); // 1.1v
+#endif
     ADMUX = adcref | _BV(MUX0);
     ADCSRA = _BV(ADEN) | _BV(ADIE); // enable adc with interrupts
 #if DIV_CLOCK==4

Have a look at the pypilot schematic:

 https://pypilot.org/schematics/hbridge_controller.pdf

The ADC measures relative to a reference voltage.  There's a question of which reference voltage is used.  The two options are to use the AVcc pin (on the Arduino nano this pin is tied to +5V) or to the internal 1.1V fixed voltage source:  

  https://github.com/pypilot/pypilot/blob/...r.ino#L453

Note that if you set pwm_style to 2 (which you need for the VNH5019 ), that code means AVcc will be used.

For my VNH5019 autopilot, the motor controller was reporting an under voltage condition.  The reported voltage was about 4.5x lower than the actual voltage, which is also the ratio 5V:1.1V, which makes me think that if pwm_style is 2, the reference voltage should be the internal 1.1V source, and if I change it, the reported voltage is correct.  So you need this fix.

As another data point, to measure the 12V supply voltage, it's passed through the R3/R4 voltage divider, which scales the input down by a factor of 18.8.  That means the maximum supply voltage that can be read before reaching the 1.1V reference voltage is 20.7V.  So we really do want to use the 1.1V internal reference.

(2020-10-06, 10:47 AM)jamos.tan@gmail.com Wrote: Question, looking at chapter 4.4.4 in http://www.benshandelsonderneming.nl/dri...207960.pdf I understand that the IS pins are for current sense, looking at the datasheet: http://www.benshandelsonderneming.nl/dri...ematic.pdf I can see they are connected to pins 5 and 6

Yes, however although the schematic I shared shows 1k resistors from these pins to ground, if your module is like mine, the resistors aren't connected, and you'll need to provide equivalent resistors off-board.  I also found some soldering problems on my IBT-2's 74244 chip (see the thread I mentioned at the top of this post).  If your module also has that problem, your autopilot could fail as you are sailing, so I suggest you resolder it.

(2020-10-06, 10:47 AM)jamos.tan@gmail.com Wrote: Would this "simply" be the case of hooking it up to one of the Arduino's analog pins?

Almost.  Because the BTS7960 current sense pins work by providing a variable current proportional to the drive current, the two sense pins on the header from the two BTS7960 chips can be wired together to provide a summed sense.  I gather from that thread that across a 1k resistor (as per the IBT-2 schematic), you'll get a voltage of up to 7V, so you'll need to scale it through a voltage divider.  The values of 50k and 10k given in that thread scale down by 6x, so 7V will be scaled down to 1.16V.  You can replace R2 with a 50k resistor, and put a 10k resistor from A1 to ground.

(This depends on what's happening with the resistors in your IBT-2.  If they're not connected, or a different value, you'll need to do some more work).
Reply


Messages In This Thread
How to drive hydraulic - by jamos.tan@gmail.com - 2020-08-21, 11:36 AM
RE: How to drive hydraulic - by seandepagnier - 2020-08-22, 02:34 AM
RE: How to drive hydraulic - by seandepagnier - 2020-08-22, 12:44 PM
RE: How to drive hydraulic - by rastam4n - 2020-08-23, 04:33 PM
RE: How to drive hydraulic - by rastam4n - 2020-08-23, 08:58 PM
RE: How to drive hydraulic - by seandepagnier - 2020-08-24, 02:43 AM
RE: How to drive hydraulic - by CapnKernel - 2020-10-01, 12:59 AM
RE: How to drive hydraulic - by rastam4n - 2020-10-02, 12:50 PM
RE: How to drive hydraulic - by seandepagnier - 2020-10-01, 12:20 AM
RE: How to drive hydraulic - by CapnKernel - 2020-10-01, 10:54 AM
RE: How to drive hydraulic - by CapnKernel - 2020-10-07, 02:20 AM
RE: How to drive hydraulic - by seandepagnier - 2020-10-01, 06:07 PM
RE: How to drive hydraulic - by CapnKernel - 2020-10-02, 02:01 AM
RE: How to drive hydraulic - by seandepagnier - 2020-10-02, 03:31 AM
RE: How to drive hydraulic - by CapnKernel - 2020-10-12, 01:50 AM
RE: How to drive hydraulic - by Siusb - 2020-12-14, 10:50 AM
RE: How to drive hydraulic - by Pop Alexandra - 2024-02-23, 01:33 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)