mix bb_nsk.add_environment_sensor (bb_nsk v0.1.2)

Copy Markdown View Source

Adds the base board's HTS221 temperature and humidity sensor

Adds BB.NSK.Sensor.Environment to the robot's sensors section, reading the HTS221 at 0x5F on i2c-0 and publishing BB.NSK.Message.EnvironmentState on [:sensor, :environment].

A robot-level sensor rather than one hung off a link, because it reads the air and not a frame. That also decides where the readings go: on a link it would publish under that link's whole path, and the panel — which subscribes to [:sensor, :environment] — would never see one.

This is the air, not the robot. The sensor is deliberately placed away from the rest of the board so that it reads the room rather than the SoC, so it is no measure of how hard the robot is working. Nor is there an alternative: the T113 has no thermal zone at all, so /sys/class/thermal/thermal_zone0/temp does not exist and the SoC's own temperature cannot be read.

Nothing here changes quickly, so it is read every thirty seconds.

It adds a git dependency

The hts221 package on Hex is a different library with a different API. The one this driver speaks to is only on harton.dev, so this task puts a git dep in your mix.exs. That is deliberate and temporary — a prototype driver pinned to a branch — and it can become a Hex version later without anything else in your project changing.

Example

mix bb_nsk.add_environment_sensor

Options

  • --robot - The robot module (defaults to {AppPrefix}.Robot).