My "MINIRAY" Rov.

What are you working on .... Show off your Rov's Projects here.
fryslan76
Posts: 290
Joined: Dec 18th, 2012, 4:52 pm
Location: Netherlands

Re: My "MINIRAY" Rov.

Post by fryslan76 »

Nice pictures, salt water has a lot more lift compared to fresh water. For the timing in your loop, just save the time and compare it in the next loop if x (micro)seconds have passed evaluate if you need to adjust. That way you will not have an actual delay in the code but an option to skip some loops if it start bobbing. Although your 17cm should help also a lot.
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: My "MINIRAY" Rov.

Post by bigbadbob »

Cheers for the tip about microseconds, I might well need to do that.
I'm going to sneak out to the pier today and collect some seawater so I can ballast the ROV at home.
I have managed to squeeze a little more throttle out of the ESC by tweaking the pulse widths so a combination of that and ballast will hopefully get it diving again, then I can work on tweaking the Auto Depth.
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: My "MINIRAY" Rov.

Post by bigbadbob »

ballasting now done for seawater so i'll test it off the pier again when I get the chance.

doing the Auto Depth routine got me thinking I could have an Auto Heading function too.

this should work I think-

Code: Select all

void Autohead()
 {
  if (AheadCount < 1) //first time only
{
  AheadRef = heading;
  AheadCount ++;
}
if (HeadL)//left button pressed
{
  AheadRef=(AheadRef-5);// decrease desired heading by 5 degrees
}
if (HeadR)// right button pressed
{
  AheadRef=(AheadRef+5);// increase desired heading by 5 degrees
}
   error = AheadRef - heading;

      if (error >= 180){error -= 360;}//subtract 360
      if (error <= -180){error += 360;}//add 360
      if (error > 90){error = 90;}//limit it to a value the ESC will handle
      if (error < -90){error = -90;}
      ESCHL.write(90+error);
      ESCHR.write(90-error);

//neutral is 90, error can be up to +/-90, so left and right ESC commands range between 0 and 180.

}
it's a better way to do it than my Auto Depth routine as the thruster speed is proportionate to the heading error
so it shouldn't overshoot.
So far this only works while stationary, it doesn't hold a heading while you are moving forward.

I could use-

ESCHL.write(HLraw+error);
ESCHR.write(HRraw-error);

to add the joystick ESC commands to the error, but I need to think about what happens if the ESC command is less than 0 or greater than 180 and what happens if I constrain it.
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: My "MINIRAY" Rov.

Post by bigbadbob »

This should allow me to drive forward or back as long as the heading error is within +/- 10 degrees.

Code: Select all

void Autohead()
 {
  if (AheadCount < 1) //first time only
{
  AheadRef = heading;
  AheadCount ++;
}
if (HeadL)//left button pressed
{
  AheadRef=(AheadRef-5);// decrease desired heading by 5 degrees
}
if (HeadR)// right button pressed
{
  AheadRef=(AheadRef+5);// increase desired heading by 5 degrees
}
   error = AheadRef - heading;

      if (error >= 180){error -= 360;}//subtract 360
      if (error <= -180){error += 360;}//add 360
      constrain (error, -90, 90); //limit the error to a value the ESC can handle.
      if ((error >= -20)&& (error <= -2)){error = -20;} //increase throttle at low error values....
      if ((error <= 20)&& (error >= 2)){error = 20;}//to achieve accuracy of +/- 2degrees.
      
      if ((error >= -10) && (error <= 10))//within+/- 10 degrees...
      {
       ESCHL.write(rxdata.HLraw-error); //allow forward drive with error correction
       ESCHR.write(rxdata.HRraw+error); 
      }
      else
      {
      ESCHL.write(90-error);// correct the heading without forward drive.
      ESCHR.write(90+error);
      }

}
Edit. yep, that works on the bench, I'm desperate to try it in the sea now. :-)
Last edited by bigbadbob on Apr 13th, 2020, 3:01 pm, edited 1 time in total.
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: My "MINIRAY" Rov.

Post by bigbadbob »

Hmmm..... interesting test dive today.

Auto heading works... sort of.... as I am using an integer value to read my heading and only allowing forward drive when the actual heading is <= +/- 5 degrees referenced to the desired heading, there is a dead spot between 5 degrees and 6 degrees where neither auto heading or forward drive work.
of course the tide is trying to spin the rov and the auto heading is correcting it but it sits at between 5 and 6 degrees so I can't drive forward. this needs a re-think.
EDIT- I've corrected the code above, it works better now.

Ballasting has helped my vertical problem, the vehicle now dives but very slowly and auto depth doesn't have enough power to work properly.
With my old single direction ESC it gushed up a fountain of water with full throttle applied before it dived, now it just whirls the prop and dives slowly. Current draw for that motor is also very low with the new ESC.
I'm trying to work out if this is a function of all bi-directional ESC's that they give half throttle compared to a single direction one. or if I just have a crap ESC that doesn't map the input pulse width to the output frequency properly.
Anyway, I've ordered a Mystery Cloud 30A boat ESC that is programmable and calibrateable. hopefully that will sort it out.

Just out of interest I found this link on how to measure the Kv of a brushless motor-
https://fishpepper.de/2017/10/17/tutori ... ess-motor/
Using my scope to measure it's output my motor is approximately 433Kv. that should give me 5200RPM max at 12v.
And I've checked with no load and the scope on the motor drive which is showing just under 2ms between peaks which works out at just over 5000 rpm. so far so good.

EDIT- Bingo!!! found the problem.... that esc IS giving me full throttle with no load but it's not liking the load the water puts on the prop at startup and it's throttling back. some setting in the esc that I can't access. not under-voltage cos that's regulated to 12.4v with a 300W dc-dc converter in the ROV, not overcurrent cos it should handle 30A. hmmmm..... lots of beard stroking going on. I'm confused.com.
It also ramps up the throttle slightly after a few seconds with no load. some weird car orientated algorithm methinks.
Although the product description states- " Can be used for vehicles, boats, underwater thrusters.
Bidirectional 1: 1 power output, without brake, direct reverse, fast speed and good linearity."
Last edited by bigbadbob on Apr 13th, 2020, 3:02 pm, edited 2 times in total.
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: My "MINIRAY" Rov.

Post by bigbadbob »

fryslan76 wrote:Just wondering, how are you going to sort out the issue that when you start up your system. First you send 90 degrees wait a bit and then you have to turn on the ESC. Are you planning on doing that on land and then closing up the ROV or are you adding a relay or an external switch to the ESC which can be fliped on the outside of the ROV?
I have a similar setup and did not make up my mind about this issue.
The real answer to your question just dawned on me. :idea:
My umbilical has two pairs of power cores, two for 12v to the electronics and two for ESC/motor power.
the electronics power is direct from the main switch but the ESC power passes through two DC-DC converters (12v-48v and 48v to 12v)
these converters will have a rise time while the internal capacitors charge up. so electronics power comes on first and the code starts then the ESC power comes on some milliseconds later. ;)
fryslan76
Posts: 290
Joined: Dec 18th, 2012, 4:52 pm
Location: Netherlands

Re: My "MINIRAY" Rov.

Post by fryslan76 »

Check, I have onboard battery packs one for the electronics and one for the motors, which provides me with this nice issue to solve.
How is the auto heading working in fresh water, probaly less currents to handle.
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: My "MINIRAY" Rov.

Post by bigbadbob »

It works great now in my test tank (850L of fresh water) so yes, I think you're right, it will be fine in the reservoir. :-)
Auto depth works ok in the tank too, I can get it to hover mid water but it doesn't need much power in the tank.

Ah, yes, I see your problem with onboard batteries. In that case I'd be looking at a solid state relay to switch your Motor power on.
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: My "MINIRAY" Rov.

Post by bigbadbob »

new skids today. with ballast bars screwed on. I can fine tune the ballast by adding/removing screws.

Image

They're made from two "clansman antenna wire spools" and are very tough, strong, plastic.

Image
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: My "MINIRAY" Rov.

Post by bigbadbob »

today the post man came bearing gifts-
60ft of videoray tether from the USA.
It cost me more in shipping and taxes than it cost to buy but I'll splice it into the end of my DIY tether to give the ROV some freedom of movement.

Image
Post Reply