The laboratory experiment aims to explore the possibilities of creating extensions for RPi platforms using the I2C communication protocol. Its main specifications are introduced as well as integration into MEMS sensors (acceleration, compass). The example is centered on the ADXL345 acceleration sensor connected to the Rpi zero 2 W equipped with a library module that can be accessed in an application program. At the end of the lab, detailed information will be available about the interconnection of systems that communicate via the I2C protocol to the Raspberry Pi platforms.
![]()
Sensor tilt event generator
![]() The data is preceded by the device address, a generic transfer cycle for read operations specific to I2C sensors is represented as follows:
The ADXL345 acceleration sensor module has the following diagram:
> sudo apt-get update > sudo apt-get install -y python-smbus i2c-tools After connecting the ADXL345 sensor to the SDA and SCL lines, its address can be viewed as follows: > i2cdetect -y 1 In the correct situation, the previous command will provide the following information:
> pip3 install adafruit-circuitpython-adxl34x At this stage, the 2 prototype programs can be analyzed and run that allow to visualize the data delivered by the sensor as well as use them to generate some events by the sensor's movement. Solve the problems proposed;
1. Create a program that allows you to view the signals SDA and SCL with an oscilloscope. . 2. Complete example 2 with LEDs for movement on the Y and Z axes. 3. Create a Python script that will activate the LED when the Y tilt is 90 degrees 4. Create a Python script that will allow you to detect hand "shaking"; 5. Create a Python script that will activate an LED when the Z tilt is 45 degrees.
- Development of Cyber Physical System ; - Creation of actuators for Internet of Things ; - Development of active modules for APACHE servers ; - Control of digital actuators from very long distances;
|