Acme::FishFarm::WaterConditionMonitor - Water Condition Monitor for Acme::FishFarm

- NAME
- VERSION
- SYNOPSIS
- EXPORT
- CREATION RELATED SUBROUTINES/METHODS
  - install ( %sensors )
  - add_oxygen_maintainer ( $oxygen_maintainer )
- WATER CONDITIONS RELATED SUBROUTINES/METHODS
  - current_ph ( $new_ph )
  - ph_threshold
  - set_ph_threshold ( $ph_value )
  - ph_is_normal
  - current_temperature ( $new_temperature )
  - temperature_threshold
  - set_temperature_threshold ( $celcius )
  - temperature_is_normal
  - lacking_oxygen
  - current_turbidity ( $new_turbidity )
  - turbidity_threshold
  - set_turbidity_threshold ( $new_turbidity_threshold )
  - water_dirty
- BUZZER RELATED SUBROUTINES/METHODS
  - is_on_buzzer_short
  - is_on_buzzer_long
- Private Methods for Buzzers
- LED LIGHTS RELATED SUBROUTINES/METHODS
  - on_LED_pH
  - is_on_LED_pH
  - on_LED_temperature
  - is_on_LED_temperature
  - on_LED_DO
  - is_on_LED_DO
  - on_LED_turbidity
  - is_on_LED_turbidity
  - lighted_LED_count
- AUTHOR
- BUGS
- SUPPORT
- ACKNOWLEDGEMENTS
- LICENSE AND COPYRIGHT

# NAME

Acme::FishFarm::WaterConditionMonitor - Water Condition Monitor for Acme::FishFarm

# VERSION

Version 1.00

# SYNOPSIS

        use Acme::FishFarm::WaterConditionMonitor;
        # missing stuff will be added in the next release

# EXPORT

None

# CREATION RELATED SUBROUTINES/METHODS

Only 3 sensors are built-in. However, there is a 4th socket for the oxygen maintainer. For this socket, you'll need to manuall connect an Acme::FishFarm::OxygenMaintainer object by calling the `add_oxygen_maintainer` method.

More sockets might be available in the future.

## install ( %sensors )

Installs a water condition monitoring system.

The `%sensors` included are:

pH

  Optional. The default threshold range is `[6.5, 7.5]` and the default pH is `7.0`.

  This will set the threshold value of the water pH. Please pass in an array reference to this key in the form of `[min_pH, max_pH]`

  The values are in the range of `1-14`.

temperature

  Optional. The default threshold range is `[20, 25]` degree celcius and the default temprature is `25`.

  This will set the threshold value of the water temperature. Please pass in an array reference to this key in the form of `[min_temperature, max_temperature]`

  The ranges of values are between 0 and 50 degree celciuls

turbidity

  Optional. The default threshold is `180 ntu` and the default turbidity is set to `10 ntu`.

  This will set the threshold of the turbidity of the water.

  The range of values are between 0 and 300 ntu.

## add_oxygen_maintainer ( $oxygen_maintainer )

Connects the oxygen maintainer to this monitoring system.

For now, this module can only check if the oxygen is lacking or not. This module contains a user friendly method compared to the standard terminology used in the `Acme::FishFarm::OxygenMaintainer` module. Other user friendly methods will be added in the future.

# WATER CONDITIONS RELATED SUBROUTINES/METHODS

## current_ph ( $new_ph )

Sets / returns the current pH of the water.

`$new_pH` is optional. If present, the current pH will be set to `$new_ph`. Otherwise, returns the current pH reading.

## ph_threshold

Returns the pH threshold as an array ref.

## set_ph_threshold ( $ph_value )

Sets the pH threshold.

## ph_is_normal

Returns true if the current pH is within the set range of threshold.

The pH LED will light up and a short buzzer will be turned on if the pH is not normal.

The long buzzer will not be affected, you'll need to turn it on yourself.

## current_temperature ( $new_temperature )

Sets / returns the current temperature of the water.

`$new_temperature` is optional. If present, the current temperature will be set to `$new_temperature`. Otherwise, returns the current temperature reading.

## temperature_threshold

Returns the acceptable temperature range as an array ref.

## set_temperature_threshold ( $celcius )

Sets the water temperature threshold.

## temperature_is_normal

Returns true if the current temperature is within the set range of threshold.

## lacking_oxygen

Returns true if the current DO content is lower then the threshold.

## current_turbidity ( $new_turbidity )

Sets / returns the current turbidity of the water.

`$new_turbidity` is optional. If present, the current turbidity will be set to `$new_turbidity`. Otherwise, returns the current turbidity reading.

## turbidity_threshold

Returns the turbidity threshold.

## set_turbidity_threshold ( $new_turbidity_threshold )

Sets the turbidity threshold to `$new_turbidity_threshold`.

## water_dirty

Returns true if the current turbidity is highter then the threshold.

# BUZZER RELATED SUBROUTINES/METHODS

## is_on_buzzer_short

Returns true if the short buzzer is turned on.

A short buzzer will buzz if there is 1 abnormal condition. If more than 1 abnormal conditions are present, the long buzzer will be turned on and this short buzzer will be turned off so that it's not too noisy :)

## is_on_buzzer_long

Returns true if the long buzzer is turned on and also turns off the short buzzer to reduce noise.

# Private Methods for Buzzers

&_tweak_buzzers ( $self )

  Tweak the buzzers. It's either the short buzzer or the long buzzer switched on only.

# LED LIGHTS RELATED SUBROUTINES/METHODS

An LED is lighted up if the corresponding parameter are in an abnormal state. This action is to be done in through the main script.

## on_LED_pH

Lights up the LED for pH sensor, indicating abnormal pH.

## is_on_LED_pH

Returns true if the LED of pH is lighted up.

## on_LED_temperature

Lights up the LED for temperature sensor, indicating abnormal water temperature.

## is_on_LED_temperature

Returns true if the LED of temperature is lighted up.

## on_LED_DO

Lights up the LED for dissolved oxygen sensor, indicating low DO content. You fish might die :)

## is_on_LED_DO

Returns true if the LED of DO is lighted up.

## on_LED_turbidity

Light up the LED for turbidity sensor, indicating high level of waste etc. Fish might die :)

## is_on_LED_turbidity

Returns true if the LED of DO is lighted up.

## lighted_LED_count

Returns the number of LEDs lighted up currently

# AUTHOR

Raphael Jong Jun Jie, `<ellednera at cpan.org>`

# BUGS

Please report any bugs or feature requests to `bug-. at rt.cpan.org`, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=.. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

# SUPPORT

You can find documentation for this module with the perldoc command.

        perldoc Acme::FishFarm::WaterConditionMonitor

You can also look for information at:

- RT: CPAN's request tracker (report bugs here)

  https://rt.cpan.org/NoAuth/Bugs.html?Dist=.

- CPAN Ratings

  https://cpanratings.perl.org/d/.

- Search CPAN

  https://metacpan.org/release/.

# ACKNOWLEDGEMENTS

Besiyata d'shmaya

# LICENSE AND COPYRIGHT

This software is Copyright (c) 2021 by Raphael Jong Jun Jie.

This is free software, licensed under:

      The Artistic License 2.0 (GPL Compatible)