drivers.Flood.Flood¶
Driver for the MaxBotix I2C ultrasonic flood level sensor.
This module provides the Flood driver which reads distance
measurements from a MaxBotix ultrasonic rangefinder over I2C to determine
water / flood levels on Oizom environmental monitoring stations. The sensor
returns distance in millimeters which is used as an inverse proxy for the
water level inside a containment area: the lower the measured distance, the
higher the water level.
- Hardware:
Interface: I2C (SMBus) Default address:
0x70Bus: Configured via constructor (default bus0) Protocol:Write range command
0x51to the sensor address.Sleep
1second to allow the ultrasonic ping to complete.Read 2 bytes
[high, low]representing distance in mm (big-endian).
Example
Read a single distance sample from a MaxBotix sensor on I2C bus 1:
>>> from drivers.Flood.Flood import Flood
>>> flood = Flood(i2c_bus=1)
>>> distance_mm = flood.getFloodData()
>>> isinstance(distance_mm, int)
True
Note
Requires smbus2 for I2C communication. Despite the file living under
drivers/Flood/, this is an I2C driver, not a UART driver. The class
is intentionally lightweight and does not subclass
SensorBase.SensorBase.GenericSensor; see that base class for
the wider sensor lifecycle conventions used elsewhere in the codebase.
Attributes¶
Classes¶
Driver for the MaxBotix I2C ultrasonic rangefinder used for flood sensing. |
Module Contents¶
- drivers.Flood.Flood.__author__ = 'Kishan Joshi'¶
- drivers.Flood.Flood.__status__ = 'Production'¶
- drivers.Flood.Flood.__version__ = '1.0.0'¶
- drivers.Flood.Flood.basic_logger¶
- drivers.Flood.Flood.context_logger¶
- drivers.Flood.Flood.flood¶