KR2 ROV

What are you working on .... Show off your Rov's Projects here.
Post Reply
Toffe
Posts: 31
Joined: Jan 22nd, 2013, 9:40 pm

Re: KR2 ROV

Post by Toffe »

I have a MPU-9150 but i have no idea to get the data out of it. I'm still going strong with that. :) Hoping to get a heading atleast and maybe the accelerometor data :)
dna1990
Posts: 48
Joined: Mar 14th, 2013, 6:36 pm

Re: KR2 ROV

Post by dna1990 »

Regarding the COMMs between the Arduinos.

I know you are using the MAX488 (I just ordered some to play with).
I know you use a Full Duplex approach using the EasyTransfer lib.

But I got lost on the pinouts and how this is wired. In order to do the full duplex, is a separate fifth wire needed from the Arduino to 'set direction'? Or just the TX/RX and Power/Ground?

Likewise I didn't follow if you use just two wires between each MAX488, seems like that is all that is needed? In the pics and diagrams, looks like four.


Is there 'config' in the EasyTransfer lib or steps needed to do full? Or it just 'does it'? I don't see any code to that regard. And I don't see any reference to a third pin. So how do the two units know when to be talking and when to be quiet and listen?
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: KR2 ROV

Post by KR2_Diving »

dna1990 wrote:Regarding the COMMs between the Arduinos.

I know you are using the MAX488 (I just ordered some to play with).
I know you use a Full Duplex approach using the EasyTransfer lib.

But I got lost on the pinouts and how this is wired. In order to do the full duplex, is a separate fifth wire needed from the Arduino to 'set direction'? Or just the TX/RX and Power/Ground?
Bummer! I just tore my set up apart for packing! From memory... (And this thread.)
Essentially, there are 4 wires in your tether that are needed for the two MAX488 chips to communicate in full duplex.

From your arduino to your MAX488 chip on each side, there are also 4 wires (Tx, Rx, 5vdc, GND).

Likewise I didn't follow if you use just two wires between each MAX488, seems like that is all that is needed? In the pics and diagrams, looks like four.

dna1990 wrote:Is there 'config' in the EasyTransfer lib or steps needed to do full? Or it just 'does it'? I don't see any code to that regard. And I don't see any reference to a third pin. So how do the two units know when to be talking and when to be quiet and listen?
It just works! You will see that each cycle of the Arduino program, there is ONE send cycle but 5 receive cycles which are created by the loop.

Code: Select all

/*#############################################
#####     Send/Receive Values to MEGA     #####
#############################################*/

 // ********** SEND Data **********
 ETout.sendData();     // send the data once!

 // ********** RECEIVE Data **********
 //there's a loop here so that we run the recieve function more often then the 
 //transmit function. This is important due to the slight differences in 
 //the clock speed of different Arduinos. If we didn't do this, messages 
 //would build up in the buffer and appear to cause a delay.
 
  for(int RXi=0; RXi<5; RXi++)  //listen for data 5 times.
  {
    //remember, you could use an if() here to check for new data, this time it's not needed.
    ETin.receiveData();
    /*
    //set our LED on or off based on what we received from the other Arduino
    digitalWrite(13, rxdata.buttonstate);
    
    //set our servo position based on what we received from the other Arduino
    //we will also map the ADC value to a servo value
    myservo.write(map(rxdata.servoval, 0, 1023, 0, 179));
    */
    delay(10);
  } 
 
The long comments are the notes from the original library file. Prior to this chunk of code, all of my data has been "prepared" for transmission, and the command ETout.sendData(); sends it all out!

Preparing the data looks kinda like this:

Code: Select all

    txdata.LeftStickX = HX;    //set variables to be sent using EasyTransfer
    txdata.LeftStickY = HY;
 
Don't forget you also need to define your variables prior to void Setup.

Code: Select all

/****************************************************
*****      EasyTransfer related variables      *****
****************************************************/

struct RECEIVE_DATA_STRUCTURE{
  //put your variable definitions here for the data you want to receive
  //THIS MUST BE EXACTLY THE SAME AS THE SEND_DATA ON THE OTHER ARDUINO
  int CurrentSensor;
};

struct SEND_DATA_STRUCTURE{
  //put your variable definitions here for the data you want to receive
  //THIS MUST BE EXACTLY THE SAME AS THE RECEIVE_DATA ON THE OTHER ARDUINO
  int LeftStickX;
  int LeftStickY;
};


//give a name to the group of data
RECEIVE_DATA_STRUCTURE rxdata;
SEND_DATA_STRUCTURE txdata;

Hope this helps!
dna1990
Posts: 48
Joined: Mar 14th, 2013, 6:36 pm

Re: KR2 ROV

Post by dna1990 »

Thanks. Yes, I have your code printed and copied several times, I study it often.

I will experiment on this as soon as the 488s arrive. I think you answered my question, in that it 'just works' from a code stand point. Although the 4-wire interconnect still has me puzzled. But only so much you can theorize before you have to dive in and play with the actual components.



And good progress news yesterday. With your code and also from NJS552, the team had two motors working yesterday. Just a single Arduino for now, but the PS2 controller has been worked out and using the Y motion of the two joysticks to control ESC/Motors in variable forward and reverse.

They plan to smooth the numbers abit for the first 15% or so of travel and to increase the center dead zone a little more. They also want to put in a delay when changing from forward to reverse. The motors seem to handle this, but they sorta jerk and squeak. That may wait until after we see their performance in water with prop...I suspect the flywheel effect will disappear once under load. But I was proud they thought of the concept and recognized the power of having 'code' to intercept and alter behavior of something physical.


Using the same ESC as you I think (Turnigy TrackStar 18amp). Once 'calibrated' by going full speed, full reverse, neutral, etc - do they ever loose this and need that again? Just wondering if we need to have a code option for that once we move from workbench to actual ROV, and out in the field one day the ESCs no longer responds. Or is it something you plan to do every startup?
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: KR2 ROV

Post by KR2_Diving »

Hey Dna,
Great to hear that things are progressing! It is always good to see them really take of and start think of solving "problems" with code!


dna1990 wrote:Using the same ESC as you I think (Turnigy TrackStar 18amp). Once 'calibrated' by going full speed, full reverse, neutral, etc - do they ever loose this and need that again? Just wondering if we need to have a code option for that once we move from workbench to actual ROV, and out in the field one day the ESCs no longer responds. Or is it something you plan to do every startup?
I have never experienced my ESC's losing their settings... wont say it is not possible, but I think it is not very likely.

On my set up, I have actually written a separate program and build a different rig for calibrating the ESC. Once I have configured the ESC, I am able to cycle the power and it "just works" each time I plug it in!

I just ripped about my ROV for my international move, so it will be interesting to see how the ESC works on the other side once i get around to rebuilding it!

Keep me posted on how things are going! Really great to hear you have had some success with my code!

Ryan
"KR2_Diving"
User avatar
bikerbones1968
Posts: 374
Joined: May 10th, 2012, 5:21 pm
Location: Annapolis Valley Nova Scotia
Contact:

Re: KR2 ROV

Post by bikerbones1968 »

Where ya moving to now Ryan?
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: KR2 ROV

Post by KR2_Diving »

hey bikerbones!
I'm moving from London (uk) back to the US (Chicago area).

just a little bit of stress! but I have some new deadlines for my ROV to help keep me motivated!
User avatar
zotta
Posts: 14
Joined: Jul 22nd, 2013, 12:41 pm
Location: Palermo Italy

Re: KR2 ROV

Post by zotta »

Hello,
which pins of arduino uses to connect ps2.
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: KR2 ROV

Post by KR2_Diving »

zotta wrote:Hello,
which pins of arduino uses to connect ps2.
Hello zotta,
the ps2 controller can connect to any pin in theory.


in my case, I use the analog pins as I am not using any analog sensors on my top side rov.
User avatar
bikerbones1968
Posts: 374
Joined: May 10th, 2012, 5:21 pm
Location: Annapolis Valley Nova Scotia
Contact:

Re: KR2 ROV

Post by bikerbones1968 »

KR2_Diving wrote:hey bikerbones!
I'm moving from London (uk) back to the US (Chicago area).

just a little bit of stress! but I have some new deadlines for my ROV to help keep me motivated!
Cool, maybe we can connect for a beer one day seeing as we will be on the same continent.
:D
Post Reply