raspberrypi / scratch

Scratch releases
79 stars 21 forks source link

GPIO server should read attached 1-wire DS18B20 sensors #201

Closed timrowledge closed 8 years ago

timrowledge commented 8 years ago

The DS18B20 1-wire sensor is a very common device and we should be able to read it.

timrowledge commented 8 years ago

Added a new category of device for 1-wire things; only current user is the ds18b20 stuff. Users need to set the device tree overlay correctly before it can work; "To enable the 1-wire bus add the following line to /boot/config.txt and reboot. dtoverlay=w1-gpio

By default you should connect the DS18B20 data line to GPIO 4 (pin 7). Connect 3V3 for power, ground to ground, 4k7 pull-up on data line to 3V3, and data line to GPIO 4." Unfortunately reading a 1-wire device is extremely slow, taking some .6sce for the temperature sensor. This is time completely lost to Scratch and the only plausible solution would be to make an asynchronous call. This would almost certainly annoy users even more because there would be no value until the call returned and the any script would have to cope with it. all in all I think leaving as something rated "this is slow, tough" is less problematic. See OneWireDevice in the HardwarePeriperals-Core package.

timrowledge commented 8 years ago

Fixed in HardwarePeripherals-Core-tpr.28 for sept '16 release