The Adafruit DS2413 1-Wire Two GPIO Controller Breakout is a versatile module that enables control over two digital General Purpose Input/Output (GPIO) pins via the 1-Wire protocol. This protocol allows multiple DS2413 devices to be connected to a single data line for communication with a microcontroller, such as an Arduino UNO, which simplifies wiring in complex projects. Common applications include home automation, industrial control systems, and DIY projects where remote or numerous digital signals need to be managed.
Pin Number | Name | Description |
---|---|---|
1 | GND | Ground connection |
2 | VDD | Supply voltage (2.8V to 5.25V) |
3 | DQ | 1-Wire data line |
4 | PIOA | GPIO channel A |
5 | PIOB | GPIO channel B |
Power Connections:
Data Line Connection:
External Components:
To communicate with the DS2413 using an Arduino, you will need to use a 1-Wire library, such as the OneWire
library, and possibly a DS2413-specific library for easier interaction.
Here is a simple example code to control an LED connected to PIOA:
#include <OneWire.h>
// OneWire DS2413 address (replace with your own)
uint8_t ds2413_address[] = { 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
// Instantiate a OneWire object
OneWire oneWire(2); // Pin 2 connected to DS2413 DQ
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH); // Turn on built-in LED to indicate setup is complete
}
void loop() {
// Code to toggle PIOA would go here
// This is a placeholder for actual DS2413 library code
}
Q: Can I connect multiple DS2413 modules to the same data line? A: Yes, the 1-Wire protocol is designed to handle multiple devices on the same bus. Each device has a unique address.
Q: How do I find the address of my DS2413 module? A: You can use a 1-Wire address finder sketch that searches the bus and prints out the addresses of all connected 1-Wire devices.
Q: What is the maximum distance for the 1-Wire bus? A: The maximum bus length depends on the environment and pull-up resistor value, but it is typically around 100 meters. For longer distances, consider using a 1-Wire extender.
For further assistance, consult the Adafruit DS2413 datasheet and the OneWire library documentation.