ROVer is online | last fetch at :: | status:

Live Camera Feed

ROVer Robot: The TURBO CHARGER Works! …sort of. We also do a 1st Test of ROVer’s 5x Proximity Sensor Array.

What a relief. DFRobot replied and, while they didn’t quite address my issue, they did provide me with a confirmation that the nob on the DC-DC Step-Up Converter (aka ROVer’s Turbo Charger) should be turned counter-clockwise, so we give it another go… …and, success!

We’re now getting an output voltage higher than the input voltage (12v) so it’s just a matter of tweaking our settings to get the desired 24v at which we want to run ROVer’s primary motors.

Also… 5 Distance Sensors are now mounted on ROVer’s chassis.

5 Distance Sensor Test Sketch (3 Sharp IR + 2 Ultrasonic) Sensors

#include 
#include 
 
//#define SONAR_NUM     2 // Number or sensors.
#define MAX_DISTANCE 200 // Max distance in cm.
uint8_t currentPing = 0;

// For Relay Management
const int latchPin = 4;
const int clockPin = 7;
const int dataPin = 5;

unsigned long currentMillis;
long previousMillis = 0; 
long interval = 1000;

// Trigger, Echo, Max Distance
NewPing sonar[2] = { // Sensor object array.
  NewPing(3, 6, MAX_DISTANCE),
  NewPing(9, 12, MAX_DISTANCE)
};

/** For IR Sensors **/
#define irf A0                // analog pin used to connect the sharp sensor
#define irl A1
#define irr A2               // analog pin used to connect the sharp sensor
int model = 1080;
int sfc, sl, sr, val = 0;                // variable to store the values from sensor(initially zero)
int8_t sfl, sfr;
//int sfc, sfl, sfr;

// Initialize the Sensors
SharpIR sharpf(irf, 25, 93, model);
SharpIR sharpl(irl, 25, 93, model);
SharpIR sharpr(irr, 25, 93, model);
 
void setup() {
  //For Relays
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  
  Serial.begin(9600);
    
}
 
void loop() {

  currentMillis = millis();
  long millisDiff = currentMillis - previousMillis;

  flipRelays(0b00000010);
  delay(1000);
  
  //for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through each sensor and display results.
    //delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  if(millisDiff > 50) {
    Serial.print(currentPing);
    Serial.print("=");
    Serial.print(sonar[currentPing].ping_cm());
    Serial.print("cm ");
    Serial.println();
    if(currentPing == 0) {
      currentPing = 1;
    } else {
      currentPing = 0;
    }
    previousMillis = currentMillis;
  }

  sfc = sharpf.distance();
  sl = sharpl.distance();
  sr = sharpr.distance();
  Serial.print("IR Distance Center: ");
  Serial.println(sfc);
  Serial.print("IR Distance Left: ");
  Serial.println(sl);
  Serial.print("IR Distance Right: ");
  Serial.println(sr);
  //val = analogRead(ir);
  val = map(analogRead(irf), 0, 650, 0, 255);
  Serial.print("IR Distance (raw): ");
  Serial.println(val);

}

void flipRelays(unsigned char relays) {
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, relays);  
  digitalWrite(latchPin, HIGH);
}

Comments (2)

  • Avatar

    Henry

    |

    Hi, could you please share the connection diagram for the Roboclaw with the relays and the turbo charger, it would be great as I would like to know how you did this

    Thanks

    Reply

    • Avatar

      ROVer

      |

      Hi Henry, I’ll try and do a video about this specifically; there are actually a few different ways to implement this and I’ve tried a few of them already. Thanks for the question!

      Reply

Leave a comment