FloatShield Class

class automationshield.FloatShield(port: str | None = None)[source]

Bases: BaseShield

Class for Floatshield device. Inherits from BaseShield.

The Floatshield features a ball in a vertical tube. A fan (the actuator) is installed at the bottom, which can blow the ball up in the tube. The position of the ball in the tube is measured by a distance sensor at the top of the tube, using infrared laser.

Interface:
  • Actuator input should be provided in percent by default.

  • Potentiometer is provided in percent by default.

  • Sensor values are provided in millimetres from the bottom of the tube.

Parameters:

port (str | None) – Port on which the Arduino is connected, defaults to None.

script: str = 'floatshield'

Name of the script directory in which the .ino file for the specific shield is located.

shield_id: str = 'FL'

ID assigned to shield. This is used to check whether the correct firmware is installed on the Arduino.

actuator_bits: int = 12

Number of bits used for actuator.

potentiometer_bits: int = 10

Number of bits used for potentiometer.

sensor_bits: int = 12

Number of bits used for sensor.

class PlotInfo[source]

Bases: PlotInfo

sensor_unit: str = 'mm'

Sets the unit on the axis label of the output plot.

sensor_type: str = 'Height'

Sets the name of the axis of the output plot.

sensor_min: float = 0

Sets to lower bound of the sensor value. This is used to set up the LivePlotter.

sensor_max: float = 320

Sets the upper bound of the sensor value. This is used to set up the LivePlotter.

calibrate_sensor_reading(sensor: int) int[source]

Calibrate sensor reading. 0 is taken as the ball being at the bottom of the tube.

Parameters:

sensor (int) – Raw sensor value.

Returns:

Calibrate sensor value.

Return type:

int