Arduino 1-Wire Device Libraries

DS2438 Library

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,

  1. Include the OneWire.h and DS2438.h header files.
  2. 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.
  3. Call the ds2438.update() method to acquire the configured voltage and/or temperature values.
  4. Call the ds2438.isError() method to determine if the update succeeded.
  5. 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.


<<Previous Page | Index | Next Page>>