GeoluxHydroCam class

The Sensor sub-class for the Geolux HydroCam cameras.

Base classes

class Sensor
The "Sensor" class is used for all sensor-level operations - waking, sleeping, and taking measurements.

Constructors, destructors, conversion operators

GeoluxHydroCam(Stream* stream, int8_t powerPin, Logger& baseLogger, int8_t powerPin2, const char* imageResolution = "1600x1200", const char* filePrefix = nullptr, bool alwaysAutoFocus = false)
Construct a new Geolux HydroCam object.
GeoluxHydroCam(Stream& stream, int8_t powerPin, Logger& baseLogger, int8_t powerPin2, const char* imageResolution = "1600x1200", const char* filePrefix = nullptr, bool alwaysAutoFocus = false)
Construct a new Geolux HydroCam object.
~GeoluxHydroCam()
Destroy the Geolux HydroCam object.

Public functions

String getLastSavedImageName() -> String
Extra unique function to retrieve the name of the last saved image.
String getSensorLocation(void) -> String override
Get the pin or connection location between the mcu and the sensor.
bool setup(void) -> bool override
Do any one-time preparations needed before the sensor will be able to take readings.
bool wake(void) -> bool override
Wake the sensor up, if necessary. Do whatever it takes to get a sensor in the proper state to begin a measurement.
bool sleep(void) -> bool override
Puts the sensor to sleep, if necessary.
bool startSingleMeasurement(void) -> bool override
Tell the sensor to start a single measurement, if needed.
bool addSingleMeasurementResult(void) -> bool override
Get the results from a single measurement.
void powerUp(void) override
Turn on the sensor power, if applicable.
void powerDown(void) override
Turn off the sensor power, if applicable.
bool isWarmedUp(bool debug = false) -> bool override
Check whether or not enough time has passed between the sensor receiving power and being ready to respond to logger commands.
bool isStable(bool debug = false) -> bool override
Check whether or not enough time has passed between the camera wake and being ready to image.
bool isMeasurementComplete(bool debug = false) -> bool override
Check whether or not the camera has completed imaging.

Function documentation

GeoluxHydroCam::GeoluxHydroCam(Stream* stream, int8_t powerPin, Logger& baseLogger, int8_t powerPin2, const char* imageResolution = "1600x1200", const char* filePrefix = nullptr, bool alwaysAutoFocus = false)

Construct a new Geolux HydroCam object.

Parameters
stream An Arduino data stream for RS232 communication. See notes for more information on what streams can be used.
powerPin

The pin on the mcu controlling power to the Geolux HydroCam. Use -1 if it is continuously powered.

  • The Geolux HydroCam requires a 9V - 27V DC power supply.
baseLogger The logger instance with an attached SD card.
powerPin2 The pin on the mcu controlling power to the RS232 adapter, if it is different from that used to power the sensor. Use -1 or omit if not applicable.
imageResolution The image resolution to use. Optional with a default value of "1600x1200".
filePrefix The start of the file name for saved files. An underscore and then the date and time will be appended to the prefix to create the filename. The extension will always be #HYDROCAM_FILE_EXTENSION (.jpg). Optional with a default value of nullptr. If you want only the date/time as the file name specify "" as the filename prefix. If you do not specify any file prefix, the logger ID will be used
alwaysAutoFocus True to autofocus before every image. This may be necessary if the camera is power cycled between images. If you are not power cycling or moving the camera, I recommend not autofocusing often because the autofocus takes about 30s. Default false.

The RESOLUTION parameter must be one of the following:

  • "160x120" (4:3, 0.019 megapixel, Quarter-QVGA, QQVGA)
  • "320x240" (4:3, 0.077 megapixel, Quarter VGA , QVGA)
  • "640x480" (4:3, 0.307 megapixel, VGA)
  • "800x600" (4:3, 0.48 megapixel, Super VGA, SVGA)
  • "1024x768" (4:3, 0.79 megapixel, XGA)
  • "1280x960" (4:3, 1.23 megapixel, QuadVGA)
  • "1600x1200" (4:3, 1.92 megapixel, Ultra-XGA, UXGA)
  • "1920x1080" (16:9, 2.07 megapixel, 1080p, Full HD, FHD)
  • "2048x1536" (4:3, 3.15 megapixel, Quad-XGA, QXGA)
  • "2592x1944" (4:3, 5.04 megapixel, 1944p)

GeoluxHydroCam::GeoluxHydroCam(Stream& stream, int8_t powerPin, Logger& baseLogger, int8_t powerPin2, const char* imageResolution = "1600x1200", const char* filePrefix = nullptr, bool alwaysAutoFocus = false)

Construct a new Geolux HydroCam object.

Parameters
stream An Arduino data stream for RS232 communication. See notes for more information on what streams can be used.
powerPin

The pin on the mcu controlling power to the Geolux HydroCam. Use -1 if it is continuously powered.

  • The Geolux HydroCam requires a 9V - 27V DC power supply.
baseLogger The logger instance with an attached SD card.
powerPin2 The pin on the mcu controlling power to the RS232 adapter, if it is different from that used to power the sensor. Use -1 or omit if not applicable.
imageResolution The image resolution to use. Optional with a default value of "1600x1200".
filePrefix The start of the file name for saved files. An underscore and then the date and time will be appended to the prefix to create the filename. The extension will always be #HYDROCAM_FILE_EXTENSION (.jpg). Optional with a default value of nullptr. If you want only the date/time as the file name specify "" as the filename prefix. If you do not specify any file prefix, the logger ID will be used
alwaysAutoFocus True to autofocus before every image. This may be necessary if the camera is power cycled between images. If you are not power cycling or moving the camera, I recommend not autofocusing often because the autofocus takes about 30s. Default false.

The RESOLUTION parameter must be one of the following:

  • "160x120" (4:3, 0.019 megapixel, Quarter-QVGA, QQVGA)
  • "320x240" (4:3, 0.077 megapixel, Quarter VGA , QVGA)
  • "640x480" (4:3, 0.307 megapixel, VGA)
  • "800x600" (4:3, 0.48 megapixel, Super VGA, SVGA)
  • "1024x768" (4:3, 0.79 megapixel, XGA)
  • "1280x960" (4:3, 1.23 megapixel, QuadVGA)
  • "1600x1200" (4:3, 1.92 megapixel, Ultra-XGA, UXGA)
  • "1920x1080" (16:9, 2.07 megapixel, 1080p, Full HD, FHD)
  • "2048x1536" (4:3, 3.15 megapixel, Quad-XGA, QXGA)
  • "2592x1944" (4:3, 5.04 megapixel, 1944p)

String GeoluxHydroCam::getLastSavedImageName()

Extra unique function to retrieve the name of the last saved image.

Returns String The name of the last saved image

String GeoluxHydroCam::getSensorLocation(void) override

Get the pin or connection location between the mcu and the sensor.

Returns String Text describing how the sensor is attached to the mcu.

bool GeoluxHydroCam::setup(void) override

Do any one-time preparations needed before the sensor will be able to take readings.

Returns bool True if the setup was successful.

This sets the image resolution and runs an autofocus.


bool GeoluxHydroCam::wake(void) override

Wake the sensor up, if necessary. Do whatever it takes to get a sensor in the proper state to begin a measurement.

Returns bool True if the wake function completed successfully.

Verifies that the power is on and updates the _sensorStatus. This also sets the _millisSensorActivated timestamp.

For the Geolux HydroCam, this also sets the image resolution.


bool GeoluxHydroCam::sleep(void) override

Puts the sensor to sleep, if necessary.

Returns bool True if the sleep function completed successfully.

Does not take any action if not necessary.


bool GeoluxHydroCam::startSingleMeasurement(void) override

Tell the sensor to start a single measurement, if needed.

Returns bool True if the start measurement function completed successfully.

This also sets the _millisMeasurementRequested timestamp and updates the _sensorStatus.


bool GeoluxHydroCam::addSingleMeasurementResult(void) override

Get the results from a single measurement.

Returns bool True if the function completed successfully.

This asks the sensor for a new result, verifies that it passes sanity range checks, and then adds the value to the result array.

This also un-sets the _millisMeasurementRequested timestamp (sets _millisMeasurementRequested to 0) and updates the _sensorStatus.


void GeoluxHydroCam::powerUp(void) override

Turn on the sensor power, if applicable.

Generally this is done by setting the _powerPin HIGH. Also sets the _millisPowerOn timestamp and updates the _sensorStatus.


void GeoluxHydroCam::powerDown(void) override

Turn off the sensor power, if applicable.

Generally this is done by setting the _powerPin LOW. Also un-sets the _millisPowerOn timestamp (sets _millisPowerOn to 0) and updates the _sensorStatus.


bool GeoluxHydroCam::isWarmedUp(bool debug = false) override

Check whether or not enough time has passed between the sensor receiving power and being ready to respond to logger commands.

Parameters
debug True to output the result to the debugging Serial
Returns bool True indicates that enough time has passed that the sensor should be ready to respond to commands.

For the Geolux camera, this waits for both the power-on warm up and for an affirmative from the camera that it is ready to accept commands.


bool GeoluxHydroCam::isStable(bool debug = false) override

Check whether or not enough time has passed between the camera wake and being ready to image.

Parameters
debug True to output the result to the debugging Serial
Returns bool True indicates that enough time has passed that the camera is ready to take an image.

bool GeoluxHydroCam::isMeasurementComplete(bool debug = false) override

Check whether or not the camera has completed imaging.

Parameters
debug True to output the result to the debugging Serial
Returns bool True indicates that the camera is now reporting ready after an image was started.