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
#21
(2020-10-01, 10:54 AM)CapnKernel Wrote:
(2020-10-01, 09:29 AM)jamos.tan@gmail.com Wrote: Advantage of VNH5019 is that it seems to have current sense, which would be great.

Your module is an IBT-2 (you can see it on the circuit board).  There's no support for this in Sean's code.  

The BTS7960 does support current sense (section 4.4.4).

I found a schematic for the IBT-2:

  https://elecrow.com/download/IBT-2%20Schematic.pdf

I bought this one:

  https://www.aliexpress.com/item/4001351651925.html

The schematic shows 8 1k pulldown resistors.  However the IBT-2 I bought (see above) has 8 **10k** resistors, but none of them are connected.  So you might want to check this on your module.

(2020-10-01, 09:29 AM)jamos.tan@gmail.com Wrote: determine if my board, or the VNH5019 is better suited for driving it.

If you'd like to try the VNH5019, I have bought several from here:

  https://www.aliexpress.com/item/4000046778315.html

Pictures of my autopilot, using the VNH5019:

  https://photos.app.goo.gl/kWuzHooS4Fmwunc19

I found a bug in the VNH5019 support in motor.ino, where voltage detection wasn't done right:

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

If you'd like to keep using the IBT-2, I suggest you read this, then contact @McNugget for help:

  https://hackaday.io/project/168592-openc...-waypoints

There's a link on that page to his (now old) motor.ino which works with the IBT-2.

Me, I'd measure the current of your hydraulic system under different situations, especially at the end of travel, and with lots of weather helm.  You could measure high current with something like this:

  https://www.aliexpress.com/item/4000776170917.html

Then you can work out whether you need the IBT-2, or whether the VNH5019 will be ok.

(2020-10-01, 09:29 AM)jamos.tan@gmail.com Wrote: I'll dive into what I need extra so I complete the setup
I've found some schematics on Sean's website that are helpful.

If it helps, here's a schematic for an absolute bare-bones autopilot using the VNH5019:

  

It works, but there's no fault detection or circuit protection.  It's useful just as a starting point / proof of concept.

(2020-10-01, 09:29 AM)jamos.tan@gmail.com Wrote: also rises more questions for me
Hope you don't mind.

Not at all, happy to help and answer questions!

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

Would this "simply" be the case of hooking it up to one of the Arduino's analog pins?
Reply
#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
#23
That thread is probably exactly what I need, I'll test the suggestion that he tried just before that hurricane that he was facing. After that he didn't report it worked, hope he survived the hurricane. At least I have a good overview of how to go ahead with this now, thank you so much!
Reply
#24
Just out of curiosity, where is the ibt-2 produced? It is labeled with "arduino" but I cannot find anything about the ibt-2 on their website.
Reply
#25
(2020-10-10, 08:11 AM)jamos.tan@gmail.com Wrote: Just out of curiosity, where is the ibt-2 produced? It is labeled with "arduino" but I cannot find anything about the ibt-2 on their website.

It has no connection to Arduino.  The word is just there to encourage people with Arduinos to use an IBT-2.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)