Additional IMUs : server

Description of the file server.py from Raspberry Py

The two additional IMUs are connected to Rasberry Pi in I2C. If you have flashed the SD card with the image : aColor-BlueRov2-raspberry-with-server-for-imu-4Gb.img the only thing to do is to connect the two IMUs to the Raspberry.

Connect IMUs on the Raspberry :

Raspberry Pin

Sensor Pin

3V3

VIN

GND

GND

SCL

SCL

SDA

SDA

GND

SDOM (only for the second IMU)

GND

SDOAG (only for the second IMU)

circle-info

To connect the two adafruit LSM9D1 IMUs on the same I2C bus, one of them must have its SDOM and SDOAG pin connected to the ground

Libraries

circle-info

This is already setup in the aColor-BlueRov2-raspberry-with-server-for-imu-4Gb.img

This require Python3 and pip.

sudo apt-get update
sudo apt-get upgrade
        
sudo apt-get python-smbus
sudo apt-get i2c-tools
        
pip3 install RPi.GPIO #a sudo may be necessary
pip3 install --upgrade setuptools #a sudo may be necessary
pip3 install adafruit-circuitpython-lsm9ds1 #a sudo may be necessary

In order to deal with the two IMUs on the same I2C bus we must replace the adafruit_lsm9ds1.py file in /usr/local/lib/python3.4/dist-packages/ by the file adafruit_lsm9ds1.py from the folder tools/lib2imus/ in the folder imu_i2c. You can use this command in Raspberry Pi terminal :

Server

To send data to topside computer, a server is launched when the Raspberry start. This server read data from IMUs. To collect data on topside computer, you should launch the client which is the file Imu_brigde.py. It is a client to the server running on Raspberry Pi.

Server configuration

IP

192.168.2.2

Port

14600

Last updated

Was this helpful?