Introduction: Android Things as an Advanced IoT Gateway
The Internet of Things (IoT) is increasingly pervasive, with smart homes and industrial automation leading the charge. While off-the-shelf hubs offer convenience, they often lack the flexibility, privacy, and customization potential required for truly advanced scenarios. This is where Android Things shines. By leveraging the power of Android on embedded devices, developers can create highly custom IoT gateways. This article delves into integrating two dominant low-power wireless protocols, Zigbee and Z-Wave, directly into an Android Things gateway, enabling granular control and bespoke automation scripts.
Zigbee and Z-Wave are mesh networking protocols designed for reliable, low-power communication between smart devices. Typically, a dedicated hub translates their signals into IP commands. Our goal is to replace this proprietary hub with a custom Android Things device, giving us full control over device interactions and automation logic.
Prerequisites for Your Custom Gateway
Hardware Requirements:
- Android Things Compatible Board: A Raspberry Pi 3B/B+ or newer, NXP i.MX7D, or similar board running Android Things OS.
- Zigbee/Z-Wave USB Dongle: A compatible USB stick that acts as the network controller. Popular choices include the Aeotec Z-Stick Gen5+ (Z-Wave) or ConBee II (Zigbee). Ensure your dongle is supported by standard serial drivers or has open-source drivers.
- Test Devices: At least one Zigbee or Z-Wave device (e.g., smart bulb, switch, sensor) to test communication.
Software Requirements:
- Android Things OS Image: Flashed onto your development board.
- Android Studio: Latest version for development.
- Android Things SDK: Integrated into your Android Studio project.
- Java/Kotlin Proficiency: Understanding of Android app development.
- Serial Communication Library: A robust library to handle USB serial port communication, such as
usb-serial-for-android.
Understanding Zigbee and Z-Wave Protocols
Both Zigbee and Z-Wave operate on a mesh network topology, allowing devices to relay messages to extend range. They are designed for low-power operation, making them ideal for battery-powered sensors.
- Z-Wave: Operates in sub-1 GHz frequencies (e.g., 908.42 MHz in the US), which typically offers better wall penetration. It has a simpler addressing scheme and is highly interoperable due to strict certification requirements.
- Zigbee: Operates on 2.4 GHz (like Wi-Fi), which can lead to interference but allows for higher data rates. It’s an open standard with more device types and manufacturers.
Each network requires a single ‘controller’ or ‘coordinator’ (our USB dongle) to manage device pairing, routing, and communication. All commands and responses flow through this controller.
Hardware Setup and Verification
Physical setup is straightforward:
- Insert the Zigbee/Z-Wave USB dongle into a USB port on your Android Things board.
- Power on the Android Things device.
To verify that Android Things recognizes the USB dongle as a serial device, connect via ADB and run the following commands:
adb shell lsusb
adb shell ls /dev/ttyACM*
adb shell ls /dev/ttyUSB*
You should see your USB dongle listed by `lsusb` (e.g.,
Android Mobile Specs & Compare Directory
Are you researching mobile hardware properties, processor SoCs, GPU chipsets, or RAM configurations? Access our complete specs catalog to compare up to 5 devices side-by-side!
Compare Devices Specs →