TigerShark ROV for exploring Puget Sound

What are you working on .... Show off your Rov's Projects here.
User avatar
TigerShark
Posts: 108
Joined: Jan 7th, 2014, 2:43 pm
Location: Washington State

Re: TigerShark ROV for exploring Puget Sound

Post by TigerShark »

Here are some pictures from the test and as I work to get all the electronics cleaned up.
DSCF6460.jpg
DSCF6460.jpg (77.3 KiB) Viewed 3226 times
DSCF6459.jpg
DSCF6459.jpg (103.45 KiB) Viewed 3226 times
DSCF6467.jpg
DSCF6467.jpg (74.99 KiB) Viewed 3226 times
DSCF6547.jpg
DSCF6547.jpg (136.43 KiB) Viewed 3226 times
I am adding a solid state relay to turn the batteries on and off. When the tether is shut down the relay is off.
User avatar
salona
Posts: 6
Joined: Sep 15th, 2015, 2:21 am

Re: TigerShark ROV for exploring Puget Sound

Post by salona »

TigerShark wrote:Here are some pictures from the test and as I work to get all the electronics cleaned up.
DSCF6460.jpg
DSCF6459.jpg
DSCF6467.jpg
DSCF6547.jpg
I am adding a solid state relay to turn the batteries on and off. When the tether is shut down the relay is off.
Hello, I am using exactly the same Hobbyking ESC's as you have but I'm struggling to get the Arduino code correct for arming the ESC's. All I get is a continuous cycle of 4 beeps and the Hobbyking documentation for that particular ESC's is not much help at all. Would it be possible for you to share your code so that I can see where I might be going wrong?
User avatar
TigerShark
Posts: 108
Joined: Jan 7th, 2014, 2:43 pm
Location: Washington State

Re: TigerShark ROV for exploring Puget Sound

Post by TigerShark »

Did you program the ESCs with a programming card or manually? That could be an issue. Also you might test it with a servo instead to make sure it is working up to that point.

Here is my bottomside code:

//Bottomside ROV Software
//Created 06/30/13 by Nick S.
//Last Modified 11/30/13 1503hrs
//Released into the Public Domain
//Thanks to Bill Porter for his Easy Transfer Serial Library

//-----libraries------------------------
#include <Servo.h>
#include <EasyTransfer.h>
EasyTransfer ETOut;
EasyTransfer ETIn;
//-----rs-422/485 com receiver setup-----
#define SSerialTxControl 8 //RS485 Direction control
#define RS485Transmit HIGH
#define RS485Receive LOW
struct rovData
{
int motor1;
int motor2;
int motor3;
int motor4;
int relay1;
int relay2;
int servo1;
int servo2;
boolean homeCamera;
int motorSpeed;

}data;
struct SensorData
{
int Temperature;
int Pressure;
}Sensor;


//----------define pin variables----------
int motorPin1 = 2; //Left
int motorPin2 = 3; //Right
int motorPin3 = 4; //Verticals
int motorPin4 = 5; //Verticals
int EnableSensor =6; //TEST ONLY!
//int motorPin5 = 6;
//int motorPin6 = 7;
int relayPin1 =12;// A2; //Accessory 1
int relayPin2 =13; //Accessory 2
boolean relay_1 = false;
boolean relay_2 = false;
int servoPin1 = 11;//A0; //Tilt
int servoPin2 = 10;//A1; //Pan
int ledPin = 9; //Com status pin
int pinSensor=7;// blinks while reading sensors **TEST purposes
//*************Sensors******************
boolean bEnableSensor=true;;
int pinPressureSensor=0;
int pinTemperature=1;
//int PressureSensor;
//int Temperature;
//---------------define value variables-------
int servo1value = 1500;
int servo2value = 1500;
boolean lostCom = false;
int neutral = 1500;
int motorMin = 1000;
int motorMax = 2000;
int ServoNeutral = 90;
Servo Motor1;
Servo Motor2;
Servo Motor3;
Servo Motor4;
//Servo Motor5;
//Servo Motor6;
Servo Servo1;
Servo Servo2;
int gear = 0;

//--------Com led blink variables-----------
int ledState = LOW;
unsigned long previousMillis = 0;
unsigned long interval = 500;
unsigned long lastComCheck = 0;
unsigned long lastComInterval = 1500;
unsigned long last2 = 0;
unsigned long interval2 = 100;
unsigned long current2;

//-----------------------------------------
void setup()
{
//start serial communication
pinMode(SSerialTxControl, OUTPUT);
pinMode(EnableSensor,INPUT);
bEnableSensor=digitalRead(EnableSensor);
digitalWrite(SSerialTxControl, RS485Receive); // Init Transceiver
Serial.begin(57600);
ETOut.begin(details(Sensor), &Serial);
ETIn.begin(details(data),&Serial);
//set I/O state
// pinMode(TxEnable,OUTPUT);
pinMode(relayPin1, OUTPUT);
pinMode(relayPin2, OUTPUT);
digitalWrite(relayPin1, LOW);
digitalWrite(relayPin2, LOW);
pinMode(ledPin, OUTPUT);
//attach servos
Servo1.attach(servoPin1);
Servo2.attach(servoPin2);
Servo1.writeMicroseconds(neutral);
Servo2.writeMicroseconds(neutral);
//attach ESC's
Motor1.attach(motorPin1);
Motor2.attach(motorPin2);
Motor3.attach(motorPin3);
Motor4.attach(motorPin4);
//Motor5.attach(motorPin5);
//Motor6.attach(motorPin6);
Motor1.writeMicroseconds(neutral);
Motor2.writeMicroseconds(neutral);
Motor3.writeMicroseconds(neutral);
Motor4.writeMicroseconds(neutral);
//Motor5.writeMicroseconds(neutral);
//Motor6.writeMicroseconds(neutral);
//*************Sensors*********************
pinMode(pinSensor,OUTPUT);
digitalWrite(pinSensor,LOW);
data.homeCamera = false;
}

//-------------------------------------
void loop()
{
//ReadSensors();

//start com led timing variables
current2 = millis();
unsigned long currentMillis = millis();
//check for incoming serial data
digitalWrite(SSerialTxControl, RS485Receive); // Disable RS485 Transmit
if(ETIn.receiveData())
{
lastComCheck = millis();
interval = 1000;
lostCom = false;

processData();
// if(bEnableSensor==true){ReadSensors();}
ReadSensors();
}
//check for a break in communication
if(millis() - lastComCheck > 1000)
{
interval = 100;
rovSafe(); //set everything to safe values
}
//set com led blink rate
if(currentMillis - previousMillis > interval)
{
previousMillis = currentMillis;
if(ledState == LOW)
{
ledState = HIGH;
}
else
{
ledState = LOW;
}
digitalWrite(ledPin, ledState);
}
}

//--------------------------------------
inline void rovSafe() //if com is lost or ROV is disabled then set everything to "safe" state
{
Motor1.writeMicroseconds(neutral);
Motor2.writeMicroseconds(neutral);
Motor3.writeMicroseconds(neutral);
Motor4.writeMicroseconds(neutral);
//Motor5.writeMicroseconds(neutral);
//Motor6.writeMicroseconds(neutral);

Servo1.writeMicroseconds(neutral);
Servo2.writeMicroseconds(neutral);

digitalWrite(relayPin1, LOW);
digitalWrite(relayPin2, LOW);

}

//------------------------------------------
inline void processData()
{
//motor1 - left
if(data.motor1 > 150 || data.motor1 < 110) //if values are not in neutral range
data.motor1 = map(data.motor1, 0, 255, 1000, 2000); //map values from PS2 range to servo range for good speed control
else
data.motor1 = neutral; //if values are in neutral range set output to neutral

//motor2 - right
if(data.motor2 > 150 || data.motor2 < 110)
data.motor2 = map(data.motor2, 0, 255, 1000, 2000);
else
data.motor2 = neutral;

//motor3 - verticals
if(data.motor3 == 1)
data.motor3 = 2000;
else if(data.motor3 == 2)
data.motor3 = 1000;
else67
data.motor4 = 2000;
else if(data.motor4 == 2)
data.motor4 = 1000;
else
data.motor4 = neutral;

//Servo1 - tilt
if(data.servo1 == 1)
servo1value = (servo1value + 3);
if(data.servo1 == 2)
servo1value = (servo1value - 3);
if(data.homeCamera == true)
servo1value = ServoNeutral;
Servo1.write(servo1value);

//Servo2 - pan
if(data.servo2 == 1)
servo2value = servo2value + 3;
if(data.servo2 == 2)
servo2value = servo2value - 3;
if(data.homeCamera == true)
servo2value = ServoNeutral;
Servo2.write(servo2value);

if(data.relay1 == 1 && relay_1 == false) //relay 1
{
digitalWrite(relayPin1, HIGH); //-watchdog loop so that the pin does no flicker
relay_1 = true;
}
else if(data.relay1 == 0)
{
digitalWrite(relayPin1, LOW);
relay_1 = false;
}

if(data.relay2 == 1 && relay_2 == false) //relay 2
{
digitalWrite(relayPin2, HIGH);
relay_2 = true;
}
else if(data.relay2 == 0)
{
digitalWrite(relayPin2, LOW);
relay_2 = false;
}

//Gear Speed Select
if(data.motorSpeed == 1)
{
motorMin = 1300;
motorMax = 1700;
}
if(data.motorSpeed == 2)
{
motorMin = 1150;
motorMax = 1850;
}
if(data.motorSpeed == 3)
{
motorMin = 1000;
motorMax = 2000;
}

//Write motor values to ESC's
data.motor1 = constrain(data.motor1, motorMin, motorMax);
data.motor2 = constrain(data.motor2, motorMin, motorMax);
data.motor3 = constrain(data.motor3, motorMin, motorMax);
data.motor4 = constrain(data.motor4, motorMin, motorMax);
//data.motor1 = constrain(data.motor1, motorMin, motorMax);
//data.motor1 = constrain(data.motor1, motorMin, motorMax);
Motor1.writeMicroseconds(data.motor1);
Motor2.writeMicroseconds(data.motor2);
Motor3.writeMicroseconds(data.motor3);
Motor4.writeMicroseconds(data.motor4);
//Motor5.writeMicroseconds(data.motor5);
//Motor6.writeMicroseconds(data.motor6);
digitalWrite(pinSensor,LOW);
}
//---------------------------------------------
void ReadSensors()
{ digitalWrite(pinSensor,HIGH);
Sensor.Pressure=analogRead(pinPressureSensor);
digitalWrite(pinSensor,LOW);
delay(2);
digitalWrite(pinSensor,HIGH);
Sensor.Temperature=analogRead(pinTemperature);
delay(2);
digitalWrite(pinSensor,LOW);
/* Serial.print("ROVPress:");
Serial.print(analogRead(pinPressureSensor));
Serial.print(" ROVTemp:");
Serial.println(Sensor.Temperature);
*/
digitalWrite(SSerialTxControl, RS485Transmit); // Enable RS485 Transmit
ETOut.sendData();
// delay(30);
}
User avatar
TigerShark
Posts: 108
Joined: Jan 7th, 2014, 2:43 pm
Location: Washington State

Re: TigerShark ROV for exploring Puget Sound

Post by TigerShark »



The latest video. This was a test in a livestock water tank at our last Kitsap CREATE meeting.
Post Reply