Expand Arduino IO with 1wire DS2408

In this post I will explain how you can expend the number of IO of your Arduino via Maxim 1wire DS24O8.

The DS2408 is an 8-channel, programmable I/O 1-Wire® chip. PIO outputs are configured as open-drain and provide an on resistance of 100Ω max. A robust PIO channel-access communication protocol ensures that PIO output-setting changes occur error-free. A data-valid strobe output can be used to latch PIO logic states into external circuitry such as a D/A converter (DAC) or microcontroller data bus.

Needed hardware

ArduinoUno_r2_front450pxArduino Uno
Price: less than $30 (Amazon)

 

41k5eyqj3VLDS2408
Price: around $10 (Amazon)

Datasheet: PDF

1Wire bus on Arduino

Protocol

1-wire is a Dallas Semiconductor proprietary adressed serial protocol. This protocol based on a master (in our case the Arduino) communicating with several slave connected to the bus. The same wire is used to power and to communicate with all slaves. Communication operating in parasitic power signal.

Wiring the bus on arduino

1wirebus_schema

1wirebus_bbNB: A 4,7kΩ acting as a pull up resistor is needed by the 1wire bus.

 

Add DS2408 to the 1wire bus

DS2408 pinout

DS2408 pinout is the following:

Capture d’écran 2015-01-21 à 19.22.13

 

Wiring DS2408 to 1wire bus

 

  • 5V from 1wire bus goes to Vcc(Pin3)
  • GND from 1wire bus goes to GND(Pin5)
  • Data from 1wire bus goes to I/O(Pin4)
  • RSTZ also goes to 5V – no reset on this configuration.

1wireDS2408Connected_schéma

1wireDS2408Connected_bb

 

Code – Detected DS2408

This sample counts and list DS2408 devices on the bus. This code uses the DS2408 library available here: https://github.com/queezythegreat/arduino-ds2408

And the output is:

Count!!
Found 1 devices.
1. [29 AC 82 E 0 0 0 5F] 

Use the DS2408 PIO

DS2408 has 8 PIO (from P0 to P7). Each PIO is opendrain and can be use as output or as input. No configuration is needed to use PIO as output or as input.

  • to use pin as output, write value in PIO register
  • to use pin as input, simply read value.


1wireDS2408ConnectedIO_schéma

1wireDS2408ConnectedIO_bbCode

For this example, I choose to make a really simple program: When you push the switch the led turn on:

 

Add more IO

You can connect as many DS2408 as you want to the 1wire bus to expand IO to the infinite.

1wireDS2408Multiple_schéma

1wireDS2408Multiple_bb

Remarks

DS2408 package is 16-Pin SO, 150 mil. To use it on a breadboard you have to adapt it to DIP. you can buy an adapter or make your own.

SODIP

 

 

2 Comments

Leave a Comment.