Good Day everyone!
I'm currently working on a Oil Spill cleaning boat using loofa fibers
I'm able to make the code for the movement of the boat (moving forward, backward, left, and right) using an app with my smartphone connected to a bluetooth module connected to my arduino uno
We made 2 conductivity sensors using 2n222 transistors, and now I'm wondering, where should I connect the pins of the sensor
Also, I would like to ask if I should use another motor driver for the working mechanism of the cleaner
Basically, the working principle is that, I'll use 2 dc motors that is connected to a sheet of loofa fibers (oil absorbent material) that will spin like a belt. It will work only if the conductivity sensor is not conducting, due to the prescence of oil on the water
should I connect the another 2 dc motors to the existing motor driver for the movement of the prototype?
the diagram for the boat
the conductivity sensor (we're planning to use 2 of these)
this code if for the movement of the boat
#define IN1 2
#define IN2 3
#define IN3 4
#define IN4 5
void setup() {
Serial.begin(9600);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
char value = Serial.read();
Serial.print(value);
if (value == 'F') {
forward();
} else if (value == 'B') {
backward();
} else if (value == 'L') {
left();
} else if (value == 'R') {
right();
} else {
Stop();
}
}
}
void forward() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void backward() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void left() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void right() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void Stop() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
Thanks in advance!

