The time has come to test what the DS2482 modules are capable of. I have purchased a large pack of sensors and got to work. I had already had mounting of sensors in the switcher frames behind me so all went quite smoothly. Here are some photos of details…
As all the Ethernet cables leading to the wall-mounted switches end up at one point – the central cabinet – my 1-wire network has the shape of the unrecompensed star. With every additional sensor the ability of such a network to properly read the data falls. I was able to connect up to 11 sensors to one ‘hole’ of the DS2482-800. That is by no means a scientific measure of anything – I cannot measure the length of which wire or analyse the interference with the 230V wires. That shows, however, that with the DS2482-800, which offers a total of 8 1-wire hubs, one can control a huge amount of sensors even in a falsely laid network.
Currently my RPi reads data from 16 DS18B20 and 1 light-sensor. I connected the sensors on the outside of my house to a separate ‘hole’/hub, so 3 hubs are used. Still… the reserve for future extension is big.
A few words about scripts. I have placed 2 files in the directory /var/www:
1. sensors.csv, which stores the numbers/names and descriptions of the sensors. I fill it gradually after connecting each additional sensor:
28.F471B0040000;Salon - przy oknie; 28.B2B3A1040000;Sypialnia - drzwi; 28.87E9A0040000;Salon - kominek; 28.914CA1040000;Pokój Dzieci - drzwi; ...
2. sensors.php, which is opened in an internet browser
<?php echo "<p>Update of: ".date('Y-m-d H:i:s')."</p>"; if ($MainDir = opendir('/mnt/1wire')) { $SensorFile = file("sensors.csv"); if (!$SensorFile) { echo "Opening file with sensor names failed"; } else { foreach ($SensorFile as $line){ $SensorData = explode (";", $line); $SensorNumbers[]=$SensorData[0]; $SensorNames[]=$SensorData[1]; } } echo "<ol>"; while (false !==($MainDirItem = readdir($MainDir))){ if (preg_match('/[0-9]{2}./', $MainDirItem)) { $key = array_search($MainDirItem, $SensorNumbers); echo "<li>"; if (false !==$key){ echo $SensorNames[$key]." : "; } else{ echo $MainDirItem." - no name assigned : "; } $TempFile = fopen("/mnt/1wire/$MainDirItem/temperature", "r"); if (!$TempFile) { echo "...some problems with temp. file opening..."; } else { $Temperature = fgets($TempFile); echo $Temperature."°C<br>"; } echo "</li>"; } } echo "</ol>"; }