Arduino Uno, motor control shield L293D, MPU-9250 sensor mudule, 4 * JGA25-370 motor, jumper wires, 4*dumpers & 3s lipo are used in the actual project.
MPU-9250 sensor setup on Raspberry Pi 3B
MPU-9250 sensor setup on Arduino Uno
Connect SCL
& SDA
pin to pin5 & pin3 of Raspberry Pi, then connect Vcc
& Ground
pin to the 3.3V power pin(pin1) & Ground pin of Raspberry Pi
First we set up a folder for the project in the /home/pi directory and get the i2c tools installed
mkdir jbc
cd jbc
mkdir scripts
sudo apt-get install i2c-tools
Click the Menu in the top Left Corner, go to Prefrences->Raspberry Pi Configuration->Interfaces and enable i2c (this will require a reboot).
sudo i2cdetect -y 1
If the number 68 is in the grid that displays, mpu is detected.
Then install cmake for building the sensor's library
sudo apt-get install cmake
Install python to setup the develop environment
sudo apt-get install python-dev
Install Octave to calibrate the sensor
sudo apt-get install octave
Next, get the RTIMULib Library from Github
git clone https://github.com/richards-tech/RTIMULib2.git
cd RTIMULib2/Linux/RTIMULibCal
make -j4
sudo make install
The last thing is to setup our working directory
cp -r /home/pi/jbc/RTIMULib2/RTEllipsoidFit/ /home/pi/jbc/
Change to the RTEllipsoidFit folder and run RTIMULibCal:
cd /home/pi/jbc/RTEllipsoidFit/
RTIMULibCal
Then follow the instructions to calibrate the sensor.
After finished, copy the sonser data file to our working dictionary
cp RTIMULib.ini /home/pi/jbc/scripts/
Download the imu2.py file and place it under scripts folder
Connect SCL
& SDA
pin to A5 & A4 of Arduino Uno, then connect Vcc
& Ground
pin to the 3.3V power pin(pin1) & Ground pin of Arduino Uno
Download library zip files from the Arduino_Library.
Unpack the folders and paste them to the library
folder under Arduino root directory.
Download the mecanum.ino file and load it onto Arduino Uno.