I2C Interfacing Acceleration Sensing PCF8591

18,141

Circuit Image

This section of the I2C interfacing project focuses on constructing an acceleration sensor while also addressing two additional aspects: the advanced application of the PCF8591 chip (previously discussed in the context of the pressure sensor) and operating the bus at 3.3V. This project effectively demonstrates the capabilities of the I2C bus in the NXT. Sensors that provide a single analog value, such as temperature or pressure, can be designed as analog sensors similar to the NXT's sound and light sensors. However, for an acceleration sensor that needs to report multiple values, specifically the acceleration along two or three axes, an I2C sensor is the most viable solution. Acceleration sensors are highly beneficial; they can detect when a robot collides with an obstacle, recognize free fall (prompting parachute deployment), estimate position, count steps, and much more. Their utility raises questions as to why Lego did not incorporate one into the NXT. There are two commercial acceleration sensors available for the NXT: one from HiTechnic and several from Mindsensors. The sensor described here offers advantages over these options, such as programmability for two sensitivity settings, unlike the fixed sensitivity of commercial sensors, and the capability to measure acceleration across three axes, whereas some commercial sensors are limited to two axes. However, commercial sensors typically offer higher resolution and do not require assembly. The sensor utilizes the LIS3L02AS4 accelerometer, produced by STMicroelectronics. This component is a single silicon chip equipped with sensing elements capable of measuring acceleration in three directions, along with integrated analog electronics that simplify usage (including amplifiers and multiplexers). The chip requires a supply voltage of 2.4 to 3.6V and has three analog outputs. The voltage at each output corresponds to the acceleration in a specific direction (X, Y, or Z). Sensitivity can be configured to measure acceleration in either the ±2g range (where g represents acceleration, approximately 9.8m/s²) or the ±6g range. In the absence of acceleration along a given axis, the output voltage is half the supply voltage (Vdd). When subjected to acceleration or deceleration, the voltage varies by Vdd/5 volts per g in the ±2g scale or Vdd/15 volts per g in the ±6g scale. Therefore, if the supply voltage is 3.3V, the outputs will range from 0.33V to 2.97V. These values are nominal, with actual sensitivity potentially varying by approximately 10%. The sensor is interfaced with analog-to-digital converters to obtain digital readings. The scale is determined by connecting a specific pin to either ground or Vdd. In applications that consistently utilize one scale, this pin can be permanently connected to ground or the supply line. For dynamic sensitivity configuration, the pin can be connected to a controllable voltage. The operational principle of this sensor, and similar devices, is relatively straightforward. It can be visualized as a mass suspended between two springs that are initially at rest and capable of lateral movement. If the entire assembly moves to the left at a constant speed, the springs remain stationary, and the mass stays centered. However, if the assembly accelerates to the left, the mass's inertia causes it to maintain its speed, leading to compression of the left spring and extension of the right spring. This compression and extension exert elastic forces on the mass. When the assembly resumes constant speed, these elastic forces will eventually restore the mass to its central position.

The LIS3L02AS4 accelerometer is a highly integrated device designed for low power consumption and high performance, making it suitable for various applications, including robotics and mobile devices. The accelerometer's three-axis measurement capability allows for comprehensive motion detection, essential for applications requiring precise orientation and movement tracking. The choice of operating voltage (2.4V to 3.6V) enables compatibility with various microcontrollers and systems, ensuring flexibility in design.

In practical applications, the outputs from the accelerometer can be processed by a microcontroller equipped with an analog-to-digital converter (ADC). The ADC converts the analog voltage levels from the accelerometer into digital values, which can then be utilized in software algorithms to interpret motion data. Depending on the configuration, the microcontroller can switch between the ±2g and ±6g sensitivity settings, allowing for adaptability based on the specific requirements of the application.

The integration of the accelerometer into an I2C bus system facilitates communication with multiple sensors and devices, enhancing the overall functionality of the robotic system. The I2C protocol supports multiple devices on a single bus, enabling efficient data exchange and reducing the complexity of wiring. This capability is particularly advantageous in applications where space and weight are critical factors.

Overall, the LIS3L02AS4 accelerometer serves as a versatile and powerful component in motion-sensing applications, providing valuable data that can enhance the performance and capabilities of robotic systems and other electronic devices.This part of the I2C interfacing project focuses on building an acceleration sensor, but in the process it also explores two other issues: advanced use of the PCF8591 chip (that we have already seen in the pressure sensor) and running the bus at 3. 3v. For the rest of myI2C series, see the table of contents. This project really shows the power of t he I2C bus in the NXT. Sensors that report a single analog value, such as temperature or pressure, can be built as analog sensors, just like the NXT`s sound and light sensors. But for an acceleration sensor that must report two or three values, the acceleration along two or three axes, anI 2C sensor is the only reasonable solution.

Acceleration sensors are wonderfully useful. They can detect that a robot bumped into a wall, they can detect that it is in a free fall (open that parachute!), they can be used to estimate position and to count steps, and much more. They are so useful that it makes you wonder why Lego did not include one inside the NXT. There are two commercial acceleration sensors for the NXT, one from HiTechnic and several from Mindsensors.

The sensor that I am describing here is better than all of these in some ways (it can be configured by your program to two sensitivities unlike all the commercial sensors that have a fixed sensitivity, and it measures acceleration along 3 axes, whereas some of the commercial ones are 2-axis sensors). But the commercial ones have higher resolution, and of course, you don`t have to build them yourself.

The sensor uses an accelerometer called LIS3L02AS4, manufactured by STMicroelectronics. This device is a single silicon chip that contains sensing elements that can measure accelerateion in three directions and some analog electronics that make it easy to use the chip (amplfiers, multiplexers, and so on). The chip needs a supply of 2. 4 to 3. 6v. It has three analog outputs. The voltage in each output is proportional to the acceleration in one particular direction (X, Y, or Z).

The sensitivity of the outputs can be set so that the chip measures acceleration either in the range ±2g (g is the unit of acceleration, about 9. 8m ·s ’2) or in the range ±6g. When there is no acceleration in a given axis, the output voltage is half the supply voltage (Vdd). When the sensor is subject to acceleration or deceleration, the voltage changes by Vdd/5 volts/gin the ±2g scale or byVdd/15 volts/gin the ±6g scale.

This means that if the supply voltage is 3. 3v, the outputs range from 0. 33v to 2. 97v. These are nominal values; the actual sensitivity can differ by up to 10% or so. You use such a sensor by connecting its outputs to analog-to-digital converters, to obtain digital measurements. The scale is set to ±2g or ±6g by connecting one of the pins to either ground or Vdd. In a device that always use one of the scales, you can connect this pin permanently to the ground or to the supply line.

If you want to configure the sensitivity at run time, you can connect this pin to a voltage that you can control from the program. How does this sensor (and similar like it) work The principle is fairly simple. Think of a mass that is suspended between two springs that are both at rest, and which can only move left and right, as shown in the diagram on the right.

If the whole structure is moving, say to the left, at a constant speed, the two springs will remain at rest and the mass will remain exactly in the middle between the two walls. If the structure is now accelerating (to the left), the inertia of the mass will cause it to continue to travel at a constant speed, which will cause the left spring to compress and the right one to extend a bit.

The compression/extension of the springs excerts elastic force to be applied to the mass. If the structure starts moving at a constant speed again, this elastic force will eventually return the mass to the center of the structure. Silicon accelerometers (often c 🔗 External reference