Arduino 1-Wire Device Libraries
The Dallas-Maxim DS2438 is a smart battery monitor comprised of a temperature sensor and a pair of voltage monitors. This library supports limited modes of operation. The device is capable of various modes including multiple voltage ranges. See the Dallas-Maxim DS2438 datasheet for more information about this device and its capabilities.
To use this library in a sketch,
- Include the OneWire.h and DS2438.h header files.
- Call the ds2438.begin(mode) method in the setup() method of the sketch. An instance can be configured for any combination of temperature voltage channel A and voltage channel B.
- Call the ds2438.update() method to acquire the configured voltage and/or temperature values.
- Call the ds2438.isError() method to determine if the update succeeded.
- And, if successful, call the ds2438.getTemperature() and ds2438.getVoltage(channel) methods to return the temperature value in degrees Celsius and voltages in volts (0-5v).
Like the other device libraries in this collection, there is also a getTimestamp() method that returns the value of the Arduino millis() function at the time the ds2438.update() method was called. This can be useful to compute elapsed milliseconds between subsequent updates.
The first example demonstrates the use of this library to to read a Honeywell HIH-4021-001 humidity sensor using a DS2438 and prints the relative humidity, temperature and calculated values for dew point and heat index to the serial port. The example code was tested using a Hobby-Boards H3-R1-A humidity sensor
The second example demonstrates the use of this library to to read temperature and raw voltages for both channels, printing the values to the serial port.