How many 1wire (one wire) networks can be connected to Arduino?
I will guess that this is relatively simple – since Arduino has multiple ‘pins’ you could have one MicroLan per pin (with appropriate power levels, connecting circuits, etc.) The good news – you only need one device per ‘network node’ to do a basic test with a multi-node MicroLan, unless you test with ‘empty node’ networks – which is also possible…
Using the Dallas 1wire code as a starting point duplicate each related variable/’network call’, i.e. partial code snippet (which needs re-factoring…):
// Data wire is plugged into ports 10, 12 on the Arduino
#define ONE_WIRE_BUS_A 10
#define ONE_WIRE_BUS_B 12
#define NET_A 0
#define NET_B 1
// Setup a oneWire instance to communicate with OneWire devices
OneWire oneWireA(ONE_WIRE_BUS_A);
OneWire oneWireB(ONE_WIRE_BUS_B);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensorsA(&oneWireA);
DallasTemperature sensorsB(&oneWireB);
int numberOfDevicesA; // Number of temperature devices found
int numberOfDevicesB; // Number of temperature devices found
int currentNetwork=0; // default to NET_A
// snip ###################### other code/variables //
void setup()
{
// Start up the library
sensorsA.begin();
sensorsB.begin();
// Grab a count of devices on the wire
numberOfDevicesA = sensorsA.getDeviceCount();
numberOfDevicesB = sensorsB.getDeviceCount();
// locate devices on the bus
Serial.print("Locating devices...");
Serial.print("Net_A: ");
Serial.println(numberOfDevicesA, DEC);
Serial.print("Net_B: ");
Serial.println(numberOfDevicesB, DEC);
// your code continues below...
} // end of 'setup'
On the hardware side you duplicate the setup, i.e.
- share power & ground lines (on a bread board bus)
- add one ~5k ohm resistor per MicroLan
- add one ‘pin line’ per MicroLan
- test, test, test…
Sample output from a 1 wire, dual node, MicroLan test:
################################################################ # >>###### ECLIPSE Ver:V_0.7 << # # Net_A Device Count: 16 # # Parasite power is: ON # # Net_B Device Count: 3 # # Parasite power is: ON # # # # | # # # # # # # # # # # # # # # | # # Net_A Parasite power is: ON # # Net_B Parasite power is: ON # # # # >> 07/11/2011-01:17:01 | Started: 07/10/2011-23:21:21 << # # # # Net_A Reading Sensors: 16 # # 07 11 01:17:01 | TSensor: 1 | C: 26.06 F: 78.91 | 13103470 # # ... # # 07 11 01:17:04 | TSensor: 16 | C: 26.06 F: 78.91 | 13103470 # # # # Net_B Reading Sensors: 3 # # 07 11 01:17:04 | TSensor: 1 | C: 26.25 F: 79.25 | 13103470 # # ... # # 07 11 01:17:05 | TSensor: 3 | C: 26.19 F: 79.14 | 13103470 # ################################################################
The number of sensors per network would be limited by the power requirements and network ‘weights’ involved. At this point it looks like Arduino might be a simple solution for a 1Wire network hub (there are challenges in getting all of your sensors working using parasite power – still working on this myself…) My bread-board experiments are encouraging – in this instance (Network ‘A’) there are 8 DS18B20 temperature sensors on the large bread board and 9 additional DS18B20 sensors (using ~70 feet of cable) on a CAT5e ‘chain’ connected via keystone jacks and RJ45 connectors.
Hmm, a custom Arduino shield with CAT5e connectors? connected to:
- power (with jumper choice for 3.3/5 volts)
- ground
- one unique pin for each ‘network’? (the Arduino Uno board has 13 ‘digital pins’.)
You should be able to use Arduino for multiple 1wire networks using this approach (although I have only tested with two ‘pins’…) In the photo below, network ‘B’ in on the right with three (3) temperature sensors and network ‘A’ is on the left with 16+ temperature sensors (on a bread board…) The +/- power bus nearest to the Arduino Uno is ‘shared’ by the two networks. Note – the temperature sensors are wired for ‘parasite power’ (pins 1 & 3 are connected – see the ‘blue bus’ on network ‘B’ below.)
