1-Wire + ASI Biont: Connect DS18B20 Temperature Sensors and iButton Access Control to Your AI Agent

1-Wire + ASI Biont: Connect DS18B20 Temperature Sensors and iButton Access Control to Your AI Agent

1-Wire devices are the hidden workhorse of reliable automation. They are cheap, precise, and require only a single data line. But pairing them with an AI agent unlocks a much bigger opportunity: instead of programming rigid thresholds, your ASI Biont agent can reason about temperature history, cross-check access logs, and decide what matters — all in real time.

In this guide, you’ll learn how to connect DS18B20 temperature sensors and iButton keys to ASI Biont using a USB adapter or a Raspberry Pi. We’ll cover wiring, Python code, data exchange, and realistic automation scenarios — from server-room monitoring to greenhouse heating control.

Why 1-Wire Still Matters

The 1-Wire protocol was created by Dallas Semiconductor (now Maxim Integrated). It uses a single data line plus ground, and every device on the bus has a unique 64-bit ROM ID. One GPIO pin can host dozens of sensors — temperature loggers, iButtons, humidity and voltage monitors. No complex wiring, no IP addresses, no network stack. For smart home and industrial contexts, this simplicity is a feature, not a limitation.

DS18B20 is the most popular 1-Wire temperature sensor. It measures from -55°C to +125°C with ±0.5°C accuracy in the -10°C..+85°C range. iButton (DS1990A) is a stainless-steel key with a unique serial number — a tiny, durable token perfect for access control.

Two Ways to Connect 1-Wire to ASI Biont

The two most common host setups are a USB adapter and a Raspberry Pi.

Option Hardware needed Pros Cons Best for
USB 1-Wire adapter DS9490R or similar Plug-and-play, no soldering Extra cost (~$20) Prototyping, desktop
Raspberry Pi GPIO Pi + 4.7k resistor Built-in kernel driver, cheap Requires wiring and a Pi Permanent smart-home hub

For a permanent installation, the Raspberry Pi path is almost always better: the Linux kernel has built-in 1-Wire support via the w1-gpio and w1-therm modules, and ASI Biont can run right alongside your automation stack.

Wiring DS18B20 and iButton on Raspberry Pi

Standard wiring for DS18B20 in normal power mode:

  • VDD — 3.3V (pin 1)
  • GND — GND (pin 6)
  • DQ (data) — GPIO4 (pin 7), with a 4.7kΩ pull-up resistor to 3.3V

iButton is connected the same way: its contact surface goes to GPIO4. Since iButton draws power from the bus, a strict parasitic power connection is acceptable, but a pull-up resistor is still required.

After boot, enable the 1-Wire interface:

# add to /boot/config.txt
dtoverlay=w1-gpio,gpiopin=4

Then reboot and scan for devices:

ls /sys/bus/w1/devices/
# output example:
# 28-012345abcde1  (DS18B20)
# 01-4d3f2a000000  (iButton DS1990A)

The presence of a 28- family folder means your temperature sensor is alive; 01- is your iButton.

Reading DS18B20 Without Libraries (Pure Python)

No proprietary library is needed — the kernel exposes raw data through a virtual file. A minimal reader looks like this:

import glob, time

dev = glob.glob('/sys/bus/w1/devices/28-*')[0]
slave = dev + '/w1_slave'

def read_temp():
    lines = open(slave).readlines()
    if 'YES' not in lines[0]:  # wait and retry
        time.sleep(0.2)
        return read_temp()
    return float(lines[1].split('t=')[1]) / 1000.0

print(f'Temperature: {read_temp():.2f} °C')

For multiple sensors, iterate over all 28-* folders. The sensor performs a 12-bit conversion in about 750 ms, so sample no faster than once per second.

Reading iButton ID for Access Control

To use iButton as a key, read its ROM ID:

import glob

ibtn = glob.glob('/sys/bus/w1/devices/01-*')[0]
key_id = ibtn.split('/')[-1].replace('-', '')
print(f'iButton ID: {key_id}')

A 64-bit ID is unique for each key. ASI Biont can treat this ID as an access credential: compare it with a database, record the event, and trigger a door-opening relay.

Sending Sensor Data to ASI Biont

ASI Biont receives device events through REST API, MQTT, or WebSockets. The simplest integration is a POST request each time a sensor is sampled:

import requests

payload = {
    'device': 'ds18b20-server-room',
    'metric': 'temperature_c',
    'value': read_temp(),
    'timestamp': '2026-07-31T10:00:00Z'
}
requests.post('https://api.asibiont.com/v1/events', json=payload)

The platform then attaches the event to your digital twin, checks active automations, and feeds the data into the AI agent’s context.

AI Agent Decision-Making: From Event to Action

The true advantage of ASI Biont is the reasoning layer. Instead of a simple if temp > 30 rule, the agent works with context: it can compare current temperature with historical trends, check weather, review access logs, and even ask you for clarification in natural language.

Scenario Event AI agent action
Server room cooling temp > 30°C Notify admin, enable relay to increase fan speed
Greenhouse heating temp < 15°C at night Turn on heating, adjust watering schedule
Office access iButton ID matched Unlock door, write entry to HR log

These actions are configured on the asibiont.com dashboard in a few clicks: select a device event, define a condition, and connect an action to your relay, notification channel, or external script.

Real-World Example: Greenhouse on a Raspberry Pi

A greenhouse has three DS18B20 sensors (air, soil, water) and one iButton at the staff door. All sensors sit on the same 1-Wire bus as a Raspberry Pi running the Python sampler. Every 30 seconds the Pi sends payloads to ASI Biont. The agent:

  1. Maintains a temperature baseline for each zone.
  2. Starts a heating relay if air temperature drops below 15°C before sunrise.
  3. Detects a frozen water line when the water sensor diverges from other sensors by more than 5°C.
  4. Logs staff entry via iButton and sends a notification to the owner when the door is opened outside work hours.

Conclusion: Start With One Sensor

1-Wire integration is an ideal starting point for physical automation: cheap sensors, solid protocol, and instant value. Combined with ASI Biont, your DS18B20 stops being a thermometer and becomes a source of insight, while iButton transforms from a metal puck into a full access-control credential.

Start small: connect one DS18B20, send its data to asibiont.com, and create your first automation rule. It will take less than an hour — and then you can scale to hundreds of sensors.

← All posts

Comments