The Analysis
The Analysis
The components used in construction of the charging circuit are listed below
1. Op-Amp
2. Resistor
3. Zener diode
4. Variable resistor
5. Rectifier diode
6. Relay
R3 and VR1 is used to form a voltage divider circuit that was feed in to the non-
inverting terminal of the op-amp (lm358) and R4 and D1 was also used to form
another voltage divider for the inverting terminal of the lm358. The op amp
compares the voltage at the pin3 and pin4, if the voltage is a negative voltage; the
output (pin1) will be 0 and if positive voltage, the output is will be 1. Because the
non-inverting terminal has been fix to 3.7 using Zener diode. Once pin 2 voltage is
3.92 pin1 will turn 0 and Q1 will de-energize and at the same time disconnecting
the charging battery from the charging source through the help RL1. R2 is a
feedback resistor to help increase the output gain. When the charging the battery
D4 receive current through R6 to reduce amount of current flowing into it and
when the battery is full D4 will off and D3 will receive current through R5.
D6 and D7 respectively were used to separate the robot battery from the sweeping
battery as show in the circuit diagram.
Then, to charge a 14.8V, 5.2Ah, we need 12V, 1A charger and with this charger, it
will take 5.2 hours to charge the battery to 100%.
1. Charging unit
2. Motor driver unit
3. Arduino unit
4. Bluetooth unit
5. Sweeping mechanism unit
Charging unit:
This unit handles the charging cycle of the system battery, it protects the battery
from been over-charged. It has some active and passive components that help to
the work so that when the battery is full, it will separate the battery from the
charger automatically.
This unit drives the system around. It is used to control the movement of the
motors whether to go forward. Backward, Left or Right. With the help of the L298
motor driver IC, you can increase the speed or reduce the speed. It receives
information from the Arduino direct and act in line with information received.
Arduino unit:
This unit is the brain of the whole system; it takes decision for the whole system. It
is a digital module that can accept set instructions as software code and act
according the code or firmware. It has digital and analog pins for receiving analog
or digital information, process it and act according to the information.
Bluetooth unit:
This is another digital module that helps to receive information from the mobile
app and send it to Arduino for further processing and decision making. In the
system we used H0C6 Bluetooth module for control. It has a blue and red light on
its body and this light will blinking until the module is connect to a device and
once is connect, the light will on steady until is disconnected again from the
device.
This unit handles the sweeping process, once the Arduino send information it
through the base of the mosfet transistor, it will start sweeping. The speed of the
brush motor is adjustable, either fast or slow and you do this from mobile app.
In this section I include the library I will use for serial communication with
Bluetooth module.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 4); // RX, TX
In this section I declare all the pins and variables that I will use for the code.
#define in1 9
#define in2 10
#define in3 11
#define in4 12
float temp=0.0;
float r1=47000.0;
float r2=11700.0;
float input_voltage = 0.0;
In this section I set he pins / ports in their respective function either as input or
output
void setup()
{
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(7, OUTPUT);
analogWrite(7,0);
Serial.begin(9600);
mySerial.begin(9600);
}
This is the main loop of the code, the program revolves here permanently until
reset button is pressed or you off and on it back.
void loop()
{
Val = analogRead(analogPin1);
temp = (Val * 5.0)/1024.0;
input_voltage = temp / (r2/(r1+r2));
input_voltage =(input_voltage - 1.3);
if (mySerial.available())
{
rcd = mySerial.read();
Serial.write(rcd);
}
if (rcd == '1')
{
spd = 150;
}
if (rcd == '2')
{
spd = 180;
}
if (rcd == '3')
{
spd = 200;
}
if (rcd == '4')
{
spd = 255;
}
if (rcd == 'F')
{
Forward();
time_now = millis();
while (millis() < time_now + 100) {}
}
if (rcd == 'B')
{
Backward();
time_now = millis();
while (millis() < time_now + 100) {}
}
if (rcd == 'R')
{
SharpRight();
time_now = millis();
while (millis() < time_now + 100) {}
}
if (rcd == 'L')
{
SharpLeft();
time_now = millis();
while (millis() < time_now + 100) {}
}
if (rcd == 'd')
{
analogWrite(7,255);
}
if (rcd == 'c')
{
analogWrite(7,130);
}
if (rcd == 'W')
{
analogWrite(7,0);
}
if (rcd == 'f')
{
analogWrite(7,200);
}
if (rcd == 'S')
{
Stop();
}
}
void buzzer()
{
digitalWrite(sound,HIGH);
delay(500);
digitalWrite(sound,LOW);
delay(500);
rec = 0;
}
void Forward()
{
digitalWrite(in3, 0);
analogWrite(in4, spd);
analogWrite(in2, spd);
digitalWrite(in1, 0);
}
void Backward()
{
analogWrite(in3, spd);
digitalWrite(in4, 0);
digitalWrite(in2, 0);
analogWrite(in1, spd);
}
void SharpRight()
{
analogWrite(in3, spd);
digitalWrite(in4, 0);
analogWrite(in2, spd);
digitalWrite(in1, 0);
}
void SharpLeft()
{
digitalWrite(in3, 0);
analogWrite(in4, spd);
digitalWrite(in2, 0);
analogWrite(in1, spd);
}
void Stop()
{
analogWrite(in1, 0);
analogWrite(in2, 0);
analogWrite(in3, 0);
analogWrite(in4, 0);
}