// Dallas TM1990-F5 iButton Reader
// Arduino Nano
// Reads the unique 64-bit ROM ID from a TM1990-F5 iButton
// Requires: OneWire library (no DallasTemperature needed)
// Install via: Sketch > Include Library > Manage Libraries > OneWire
#include
#define ONE_WIRE_PIN 2 // iButton probe/reader connected to D2
OneWire iButton(ONE_WIRE_PIN);
void setup() {
Serial.begin(9600);
Serial.println("Dallas TM1990-F5 iButton Reader");
Serial.println("================================");
Serial.println("Touch iButton to reader probe...");
Serial.println();
}
void loop() {
byte addr[8]; // 8-byte (64-bit) ROM code buffer
// Wait until a device is detected on the bus
if (!iButton.search(addr)) {
iButton.reset_search();
delay(300);
return;
}
// Verify CRC - detects wiring errors or corrupt reads
if (OneWire::crc8(addr, 7) != addr[7]) {
Serial.println("ERROR: CRC mismatch - bad read, try again.");
iButton.reset_search();
delay(500);
return;
}
// Check family code - TM1990A/DS1990A = 0x01
if (addr[0] != 0x01) {
Serial.print("WARNING: Unexpected family code: 0x");
Serial.println(addr[0], HEX);
Serial.println("Expected 0x01 for TM1990-F5");
}
// Print full 64-bit ROM code
Serial.println("iButton detected!");
Serial.print(" Family Code : 0x");
Serial.println(addr[0], HEX);
Serial.print(" ROM ID : ");
for (int i = 1; i <= 6; i++) {
if (addr[i] < 0x10) Serial.print("0"); // Leading zero padding
Serial.print(addr[i], HEX);
if (i < 6) Serial.print(":");
}
Serial.println();
Serial.print(" CRC : 0x");
Serial.println(addr[7], HEX);
// Full 64-bit code as one string (useful for logging/comparison)
Serial.print(" Full 64-bit : ");
for (int i = 0; i < 8; i++) {
if (addr[i] < 0x10) Serial.print("0");
Serial.print(addr[i], HEX);
}
Serial.println();
Serial.println();
iButton.reset_search();
delay(1000); // Wait 1 second before next read
}
```
/* **Wiring:**
| iButton Probe | Arduino Nano |
|---|---|
| Signal (centre contact) | D2 |
| Ground (outer shell) | GND |
Add a **4.7kΩ pull-up resistor** between D2 and 5V — same as any 1-Wire device.
**Typical Serial Monitor output when an iButton is touched:**
```
iButton detected!
Family Code : 0x01
ROM ID : A3:F2:11:4C:00:08
CRC : 0xB7
Full 64-bit : 01A3F2114C0008B7 */