|
1 | 1 |
|
2 | 2 | [](https://github.com/marketplace/actions/arduino_ci) |
| 3 | +[](https://github.com/RobTillaart/DS28CM00/actions/workflows/arduino-lint.yml) |
| 4 | +[](https://github.com/RobTillaart/DS28CM00/actions/workflows/jsoncheck.yml) |
3 | 5 | [](https://github.com/RobTillaart/DS28CM00/blob/master/LICENSE) |
4 | 6 | [](https://github.com/RobTillaart/DS28CM00/releases) |
5 | 7 |
|
|
8 | 10 |
|
9 | 11 | Arduino library for I2C DS28CM00 unique identification chip. \[48 bit\] |
10 | 12 |
|
| 13 | + |
11 | 14 | ## Description |
12 | 15 |
|
13 | 16 | THe DS28CM00 IC has a 64 bit address consisting of one type byte, 0x50, 6 bytes unique serial and a CRC |
14 | 17 | over the previous 7 bytes. This results in an 48 bits unique ID giving 281.474.976.710.656 combinations. |
15 | 18 | If that number is not unique enough, you could use 2 or more of them with an I2C multiplexer. |
16 | 19 |
|
17 | 20 | The DS28CM00 IC has the same addressing scheme as the better known DS18B20, except for the type byte. |
18 | | -Therefor one could use an DS18B20 as an unique ID chip in a similar way and getting a temperature sensor |
| 21 | +Therefore one could use an DS18B20 as an unique ID chip in a similar way and getting a temperature sensor |
19 | 22 | as bonus. |
20 | 23 |
|
21 | | -The DS28CM00 can work in 2 modes, I2C and SMBus mode. check datasheet for details. |
| 24 | +The DS28CM00 can work in 2 modes, I2C and SMBus mode. Check datasheet for details. |
| 25 | + |
22 | 26 |
|
23 | 27 | ## Interface |
24 | 28 |
|
| 29 | + |
25 | 30 | ### Constructor |
26 | 31 |
|
27 | | -- **DS28CM00(TwoWire \*wire)** |
28 | | -- **DS28CM00(dataPin, clockPin)** ESP32, ESP8266 |
| 32 | +- **DS28CM00(TwoWire \*wire = &Wire)** Constructor, with default Wire as I2C bus. |
| 33 | +- **DS28CM00(uint8_t dataPin, uint8_t clockPin)** Constructor for ESP32, ESP8266 et al. |
| 34 | + |
29 | 35 |
|
30 | 36 | ### public |
31 | | -- **void begin()** initializes I2C bus, default DS28CM00_I2C_MODE |
| 37 | + |
| 38 | +- **void begin()** initializes I2C bus, sets default DS28CM00_I2C_MODE. |
32 | 39 | - **bool getUID(uint8_t \*serial)** get unique 8 bytes serial number or error. |
33 | | -- **bool setI2CMode()** set DS28CM00_I2C_MODE (0x00) |
34 | | -- **bool setSMBusMode()** set DS28CM00_SMBUS_MODE (0x01) |
35 | | -- **bool getMode(uint8_t &mode)** returns mode set above |
| 40 | +Returns false if action failed. |
| 41 | +- **bool setI2CMode()** set DS28CM00_I2C_MODE (0x00). Returns false if action failed. |
| 42 | +- **bool setSMBusMode()** set DS28CM00_SMBUS_MODE (0x01). Returns false if action failed. |
| 43 | +- **bool getMode(uint8_t &mode)** returns mode set above. Returns false if action failed. |
| 44 | + |
36 | 45 |
|
37 | 46 | ## Operation |
38 | 47 |
|
39 | 48 | See examples. |
40 | 49 |
|
41 | 50 | The class is not tested extensively e.g. with ESP32 / ESP8266. |
42 | | -An example sketch for ESP32 exist and compiles. (feedback welcome) |
| 51 | +An example sketch for ESP32 exist and compiles. Feedback welcome. |
| 52 | + |
| 53 | + |
| 54 | +## Future |
| 55 | + |
| 56 | +- **bool getUID4()** to read only 4 bytes to improve performance. Possible? |
| 57 | +- **bool getUID(4)** number of bytes as parameter? |
| 58 | +- **uint8_t getError()** add error handling? - I2C; #bytes; mode; ... |
| 59 | +- measure performance I2C 400 500 600 kHz ... |
| 60 | +- cache the serial? (costs 8 bytes) |
| 61 | +- **bool isConnected()** check in begin. |
| 62 | +- **bool begin()** return type upgrade. |
| 63 | +- **uint8_t getMode()** if not connected error .. |
43 | 64 |
|
0 commit comments