Skip to content

Add second analog input for optional sensor sampling #5

@HanClinto

Description

@HanClinto

Summary

Add support for a second input channel that can be sampled like the existing DHT extra-sensor readings, but as a simple analog value. Stephen described this as high importance for expanding WaterPAL beyond the current pump-use input.

Use cases

Potential sensors / applications mentioned:

  • IR sensors for solar pumps
  • Grease detection
  • Handle movement detection
  • Other plug-in analog Arduino-style modules

Example sensor links from the discussion:

Stephen confirmed analog is enough, and thresholding can happen on the database side.

Requested behavior

  • Sample one additional analog input on a regular schedule, similar to how DHT temperature / humidity readings are sampled.
  • Store and report the analog readings alongside existing extra sensor values where practical.
  • Do not apply firmware-side thresholds initially; send raw analog values so database / backend logic can classify them later.

Hardware / pin note

Stephen asked whether a second line on GPIO 0 could be sampled like DHT. The current firmware config comments warn that GPIO 0, 2, 12, and 15 are used for boot mode selection and may not be good wake-up sources, so this issue should confirm the final pin choice before implementation.

Acceptance criteria

  • Firmware has a configurable analog input pin for the new sensor channel.
  • The analog value is sampled on the same cadence as the existing extra sensor reads, unless a better cadence is intentionally chosen.
  • Readings are included in outgoing reporting in a way the backend can store and threshold later.
  • Existing DHT humidity / temperature readings continue to work.
  • GPIO 0 suitability is verified or an alternate safe ADC-capable pin is selected and documented.

Source

From Stephen Peacock's punchlist:

One powerful feature is to add a second input. high importance. IR sensors for solar pumps, grease detection, handle movement etc.

Could you add a second line on GPIO 0 to sample like DHT does? This will work.

We can just take a single analog input. The threshold can be on the database side.

Priority order from Stephen: (2) second input for analog sensing that can be treated like DHT sensor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions