Here's what I used for my test:
- Adafruit DS2413 Breakout board.
- RPI3 I2C to 1-Wire Host Adapter with 8 1-wire bus lines. (Sheepwalkelectronics has other RPi addon boards that put the 1-Wire it to a RJ-45 jack and provided power through the data line.)
- OWFS Python Library. Instructions on compiling it here
- owpython
With these I created a demo to see the read and write speeds through the 1-wire data line.
Source code for benchmark:
I then ran the loop to see how fast it would go at turning on and off the relay and saw an average of 20.833 requests per second. (Don't worry, the relay wasn't able to click on and off that fast)
Adding a DS18B20 Temperature sensor and requesting it every second I found that when the temperature was requested the requests per second dropped down to 1.950 requests per second and then jumped back up to the 42.27 range until the next second came along.
Requesting the temperature every loop cycle was unworkable. I had to hold my finger on the button far longer than desired to get the relay to turn on. I tuned it up by requesting the lesser accurate temperature value "fasttemp". I also requested it less often (every other second).
t=ow.Sensor('/28.B0A534050000')
t.useCache(False)
print t.fasttemp
t.useCache(False)
print t.fasttemp
The DS2413 datasheet mentions the ability for Overdrive (~10x the communication speed) but I was unsuccessful on getting it to work. The communication would seize when I tried enabling it on the bus.
Conclusion:
Controlling your lights with the DS2413 is possible, but you are limited on the quantity of chips on the same bus line. If you are able to get the chip's Overdrive feature working then I would suggest getting the 8-port i2c to 1-wire add-on board if you have plans for your whole house.
I'm going to test the DS2408 (8 port 1-Wire I/O chip) soon and am a little more hopeful since you can control multiple rooms and/or lights with one chip.
(Pictures coming soon.)
The following was 21 times faster in my case:
ReplyDeletetry:
v62=''.join(file('/mnt/1wire/uncached/12.DXXXXXXXX/sensed.B'))
print v62
except IOError:
print 'Fehler 12.DXXXXXXXX'