The purpose of this lab is to integrate an IMU into the robot, transition to battery-powered operation, and record a stunt with the RC robot.
Parts Required
1 x SparkFun RedBoard Artemis Nano
1 x USB cable
1 x 9DOF IMU sensor
1 x Force1 RC car
1 x Li-Ion 3.7V 850mAh battery
Instructions
Setup the IMU
Installed the “SparkFun 9DOF IMU Breakout_ICM 20948_Arduino Library” from the Arduino Library Manager.
Connected the IMU to the Artemis board using the QWIIC connectors.
Ran the example program and analyze sensor output.
Accelerometer
I gathered the accelerometer data with pitch and roll using these equations.
This allowed me to get outputs from -90 to 0 and 0 to 90 degrees for both the pitch and roll.
Roll:
Pitch:
As you can see in these pictures the accelerometer is very noisy. This lead me to taking a FFT of the data to gather a good cutoff
frequency would be for the data. The FFT taken is shown below:
I also took an FFT of what the output would look like if I banged on the table continously:
After taking the FFT I was able to see that a cutoff between 5-10hz should be sufficent in filtering out the higher frequncy noise. This lead to a low pass filter that'
produced that was produced by these equations and produced this image even with noise induced into the data:
Gyroscope
To comwback the noisiness of the accelermeter I used a gryoscope which is less noisy and finds absolute angles since it measures angular change. The equations
used for the gyroscope were:
These equations produced this gyroscope plot
As you can see the gyroscope is far less noisy than the accelerometer but also as you can see it became sensivity to drift.
Due to the advantages balancing out the disadvangtes of the accelerometer and gyroscope I created a complementary filter that took full advantage of the strengths
of both devices.
The equations used to create the filter is shown here:
Finally the plot produced by the filter is here:
Sample Data
Within the interest of making the deadline I will be writing out this section and adding the proper images after the deadline
I took out all of the serial prints I was using for debugging and only used the dataready() flag to know when and when not to send data.
I did place the pitch and roll for each device and the complementary filter in one string and sent it back over bluetooth to be process
in python and it seemed to be noticably faster.
Record a Stunt
To conclude this lab I was able to drive the small RC car before modifcations would be made internally with new hardware.
When using the toy I noticed that at a certain speed the car would drift in one direction and that more complex
movement was hard to pull off. It did take some adjusting before it felt that I had control the toy.
Note: Since this video is a first person FOV I am using one hand to steer the toy so sorry for the bad control of the toy.