0% found this document useful (0 votes)
50 views8 pages

Digital Signal Filtering

This document discusses building a robot car that operates in a straight line on a revolving platform. The robot car uses an MPU6050 sensor and L298 motor driver to control its DC motors. An exponential filter is implemented to stabilize the robot's motion and compensate for gyroscope drift. The robot is constructed using an Arduino board, sensors, motor drivers and a 4WD chassis. It is powered by batteries and moves using stepper motors on the revolving platform and DC motors to drive the robot car itself.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views8 pages

Digital Signal Filtering

This document discusses building a robot car that operates in a straight line on a revolving platform. The robot car uses an MPU6050 sensor and L298 motor driver to control its DC motors. An exponential filter is implemented to stabilize the robot's motion and compensate for gyroscope drift. The robot is constructed using an Arduino board, sensors, motor drivers and a 4WD chassis. It is powered by batteries and moves using stepper motors on the revolving platform and DC motors to drive the robot car itself.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Digital Signal Filtering

Rodriguez, John Michael

Batangas State University, Alangilan Batangas City, Philippines


College of Engineering, Architecture and Fine Arts
ECE/ICE/MEXE Department
[email protected]

Abstract – The aim of this paper is to build a robot car that operates through a straight path on a
revolving platform. The robot car is equipped with MPU6050 sensor an Inertia Measurement Unit
or IMU used for motion processing. The robot DC motors is controlled using L298 motor driver. To
compensate for the gyro drifts and stabilize the motion of the robot an exponential filter is used.

I. INTRODUCTION Digital filter samples the analogue


signal and convert it into a set of binary
A robot is a machine programmed and numbers. These numbers are stored as digital
designed to carry through one or more tasks data in a hard disk drive, processed, and
automatically with fast action and preciseness. manipulated digitally. One example is
There are as many different types of robots as exponential filter. The exponential filter is a
there are tasks for them to perform. Robots that weighted combination of the previous estimate
appear like humans are known as androids; (output) with the newest input data, with the
however, many robots aren't built to resemble sum of the weights equal to 1 so that the output
human model. Industrial robots, for example, matches the input at steady state.
are often created to perform monotonous tasks
that aren't facilitated by a human-like The Exponential Filter class implements
a simple linear recursive exponential filter for
construction. Some robots are remotely
controlled by a human , even from a great the Arduino. It provides a simple way to smooth
noisy measurements from analogue sensors
distance. An autonomous robot acts as a stand-
without using as much memory.
alone system, complete with its own computer
(called the controller).Today many robots are
containing sensors and programmable
II. OBJECTIVES
controllers.

An inertial measurement unit (IMU) is a  To build a robot that operates through a


device that directly measures the three linear straight path on a revolving platform.
acceleration components and the three rotational  Implement a filter to raw data for the
rate components (6-DOF) of a vehicle. An IMU robot to run smoother.
is unique among the sensors typically found in
an autonomous vehicle because an IMU requires III. LITERATURE REVIEW
no connection or knowledge of the external
world.
A two-wheeled self-balancing robot with effective having straightforward design to
dynamics model perform line following task.[2]

A two-wheeled self-balancing robot


based on the inverted pendulum model which is
IV. MATERIALS
built as a platform to look into the use of a
Kalman filter for sensor fusion. As the robot is Arduino
inherently unstable, it is necessary to implement
a control system to keep the system in balanced.
This paper examines the stability and evaluates
the performance of a PID controller in the self-
balancing robot. The main challenging issues
are when an external force is applied and
reducing vibration in order to improve the Figure 1.
stability of the robot. It mainly focuses on the
dynamic modelling and PID controller design to Arduino Uno is an open-source
reduce the problem. Besides the simulation of microcontroller board based on the
the transfer function, poles and zeros, Kalman Microchip ATmega328P microcontroll
filter are the cause which determines the er and developed by Arduino.cc.
performance of the self-balancing robot.[1]
MPU-6050
Implementation of Autonomous Line
Follower Robot

The line follower is an autonomous


robot that detects and follows a line. The path
may be visible like a black line on a white
surface or may be reverse of that or it can be
invisible like a magnetic field. A close loop Figure 2.
control system is used in the robot. The robot
The MPU 6050 is a 6 DOF (degrees of
must sense a line and maneuvers accordingly to
freedom) or a six-axis IMU sensor,
stay on course while correcting the wrong
which means that it gives six values as
moves using feedback mechanism thus forming
output: three values from the
a simple but yet effective closed loop System
accelerometer and three from the
[I]. The robot is designed to follow very tight
gyroscope.
curves as the data from the sensors are
continuous in nature. This robot is simple but L298n motor driver
Figure 3. Figure 6.

The L298N is a dual H-Bridge The robot chassis kit is a good


motor driver which allows speed and platform for electronic enthusiasts or
direction control of two DC motors at beginners to add micro-controller(such
the same time. The module can drive as Arduino/Raspberry pi) and some
DC motors that have voltages between 5 module to build their own robot car.
and 35V, with a peak current up to 2A.
Connecting wires
Stepper Motor

Figure 7.
Figure 4.
Connecting wires allows an
It is a DC motor used to drive electrical current to travel from one
the revolving platform. point on a circuit to another because
electricity needs a medium through
Power bank
which it can move.

4 AA alkaline batteries

Figure 5.

A portable power supply used


to power up the Arduino uno. Figure 8.

4WD motor chassis A disposable power source used


to drive the dc motors.

Round platform
5. Mount the Arduino board and apply the
proper connections of the wires.
6. Mount the sensor and the driver and
assemble its proper connections to the
Arduino board and motor.

Figure 9.

Testing platform of the robot


car.

V. METHODOLOGY

A. Construction of the revolving platform


1. Cut the plywood to a circular form Figure 10.Completed robot car
approx. 48 in in diameter.
2. Create a motor base at the center under
C. Choose the desired filter for the robot.
the platform.
D. Write the program of the robot and
3. Attach a motor to the base of the
revolving platform in Arduino IDE.
platform.
B. Construction of the robot
Code for the Platform
1. Prepare the chassis parts contained in
the 4WD chassis package.
2. Assemble the motor of the wheels. Use #include <Stepper.h>
four long bolts to attach two motors to const int stepsPerRevolution = 72 ; //to achieve
each of the side plates. Ensure the motor 5 degree per step 360/72 equal to 5 degree
is flat against the plate and tighten the
nuts firmly but take care not to use too // initialize the stepper library on pins 8 through
11:
much force. Stepper myStepper(stepsPerRevolution, 8, 9, 10,
3. Assemble the chassis, use Phillips 11);
screwdriver to tighten the screws. The int stepCount = 0; // number of steps the
battery pack is knotted to the top chassis motor has taken
plate together with the l298n driver
4. Solder the power and motor void setup() {
// initialize the serial port:
connections.
Serial.begin(9600);
}
void loop() {
// step one step:
myStepper.step(1);
Serial.print("steps:");
Serial.println(stepCount);
stepCount++;
delay(1500);
}

Code of the filter

Figure.14

Figure.11 This section show the control of


This section indicates the the motor speed based on the filtered
library used and the Filter setting used
for the robot. raw values.

Code for the MPU6050

Figure.12
This section shows the value to
be filtered and the function use to filter
the raw data.

Figure 15.
Code for the Car’s motor
For the code of MPU6050 we
just modified the example sketch from
MPU6050 library and combined all the previous
codes for the robot car to work.

E. Test the functionality of the robot.


1. Calibrate the sensors using
calibration sketch.

Figure.13 Figure 19.


This section shows the
declaration of pins and data type for 2. Change the offset using the result
each values. on step one.
• yn is the output of the filter at a
moment in time n
• xn is the new input value at a
Figure 16.
moment in time n
• yn – 1 is the previous output
3. Don’t move the robot for 30 second
value of the filter
to find the offset of the yaw value.
w is the weighting factor in the range
[0, 100]. High values of w (90, for
example) favour new data over old data.
Figure 17.
The output responds quickly to changes
in the input but is not smoothed much.
4. Change the offset of the yaw value
Low values of w (10, for example)
using the result of the previous step.
favour old data over new data. The filter
Then set the settings of the filter in
output is heavily smoothed and
the code. (50 is the smoothening
responds slowly to changes (noisy or
constant and 0 is the initial value).
not) in the input. [3]

We have our first RawValue = -1.9


Figure 18.
,w=50 or (0.5), new input xn=-2.15 and
our first smoothened value 0.
5. Upload the sketch again. This time
Substituting these to the equation we
the values will be less sensitive.
get:
6. Power-up the robot using power
bank.
yn= (0.50)(-2.15)+(1-0.50)(0)
7. Start the revolving platform.
yn= -1.075 ≈ -1
8. Place the robot car on the top of
revolving platform and observe its
yn=(0.50)(-2.42)+(1-0.50)(-1.075)
behaviour.
yn=-1.21+0.5375
yn=-0.6725 ≈ -1
VI. DATA AND RESULTS

yn=(0.50)(-2.7)+(1-0.50)(-0.6725)
1. Exponential Filter Formula.
yn=-2.2+0.33625
yn=-1.86375≈ -2
yn = w × xn + (1 – w) × yn – 1 (Eq. 1)

Computing and substituting all given


Here:
raw values in the equation will have
these following results.
Figure 20. Filtered data when Figure 23.
smoothing constant is 50. The figure shows the Filtered
(red) and Unfiltered (blue) yaw values
2. Position of the robot car on the read from arduino. Due to the constant
platform. rotation, unevenness of some parts of
the platform and the natural yaw drift of
MPU6050, noises were observed during
testing. But the exponential filter
manages to smoothen the signal and
minimize the noises mentioned.
Upon testing and setting the
initial yaw orientation for the robot, we

Figure 21. actually observed how the robot


managed to keep track of its original

3. Filtered and unfiltered data when yaw orientation even the platform is

robot car is not moving. rotating. The robot was able to run on a
straight path. Though upon trials, we
observed that the robot needed to have
better design because the wheels can’t
get a good grip on the platform in some
occasions which lead the car to stop in
Figure 22. the middle of testing.

The blue line represent the unfiltered


VII. CONCLUSION
data ,while the red line represents the
filtered data. The two data values are
To build the robot, all parts must
almost same in magnitude.
properly connected so that no lose parts will
4. Filtered and unfiltered data when hinder its performance. The MPU 6050
robot car is moving. sensor did a great job of making the robot
run on a straight path using its DMP or [7] MPU6050
Digital Motion Processing. https://www.invensense.com/products/motion-
Even though DMP compensates MPU tracking/6-axis/mpu-6050/
6050 lack of magnetometer, natural gyro
drift still occur in the system. Using a filter
like exponential filter minimized the effect
of this said phenomenon on the system. The
noisy raw data was smoothened, minimizing
the effect of the noise in the operation of the
robot. Though its effect is not noticeable on
actual action, because the differences of the
data were in decimal at most, its effect can
be observe through the use of the serial
plotter of arduino ide.

VIII. REFERENCES

[1] A two-wheeled Self-Balancing Robot with


Dynamic model.
https://ieeexplore.ieee.org/document/4109027/
[2] Implementation Of Autonomous Line Follower
Robot .
http://ieeexplore.ieee.org/document/6317486
[3] Exponential Filter
https://www.megunolink.com/documentation/ar
duino-libraries/exponential-filter/
[4]L298N Datasheet
http://www.handsontec.com/dataspecs/L298N%
20Motor%20Driver.pdf

[5] MPU6050 Datasheet


https://www.invensense.com/wp-
content/uploads/2015/02/MPU-6000-
Datasheet1.pdf

[6] Exponential Filter


https://gregstanleyandassociates.com/whitepape
rs/FaultDiagnosis/Filtering/Exponential-
Filter/exponential-filter.htm

You might also like