Arduino library for DS1804 Nonvolatile Trimmer Potentiometer.
Experimental
The library implements a class for the DS1804 potentiometer. These devices come in 10K, 50K and 100K and allows control in 100 steps.
The DS1804 has a simple pulse interface and cannot be read back so the library cannot provide the current position of the wiper.
The DS1804 has an EEPROM to save the current position (writeable for 50000 times) and uses that as start position at power up.
(from datasheet)
On power-up, wiper position will be loaded within a maximum time
period of 500µs once the power-supply is stable.
Additionally, the three-terminal interface port will be active after 50 ms.
On power-down, the wiper position register data will be lost. On the next device power-up, the value of EEPROM memory will be loaded into the wiper position register.
There is no defined factory default, expect the value to be random.
Other digipots
- https://github.com/RobTillaart/AD520x
- https://github.com/RobTillaart/AD524X
- https://github.com/RobTillaart/AD5245
- https://github.com/RobTillaart/AD5248 (also AD5243)
- https://github.com/RobTillaart/AD5144A
- https://github.com/RobTillaart/AD5263
- https://github.com/RobTillaart/X9C10X
- https://github.com/RobTillaart/DS1804
#include "DS1804.h"
- DS1804(uint8_t csPin, uint8_t incPin, uint8_t udPin) constructor.
- void begin(bool b = false) initializes pins, default the device is not selected.
- void select(bool b) enable / disable device.
- void moveUp(uint8_t n = 1) if enabled move position n steps up (n is clipped to 0..100)
- void moveDown(uint8_t n = 1) if enabled move position n steps down (n is clipped to 0..100)
Duration of moveUp/Down depends linearly on n, expect less than half a millisecond.
- void saveEEPROM() saves the current position to internal EEPROM. Note the library cannot read this EEPROM value.
To set a value for sure, you might go 100x down and P times up to get at the requested position.
See DS1804_save_EEPROM.ino
- improve documentation
- test with hardware
- array example (sharing UD, INC pins, unique CS)
- stereo example, (sharing all pins).
- default true for select() / begin()?
If you appreciate my libraries, you can support the development and maintenance. Improve the quality of the libraries by providing issues and Pull Requests, or donate through PayPal or GitHub sponsors.
Thank you,