Has anyone considered adding a 1-wire support to firmware?
I'm interested in adding an external thermometer, and also a way to measure relative light levels. I thought a 1-wires bus might be the way forward.
223 Views
I'm interested in adding an external thermometer, and also a way to measure relative light levels. I thought a 1-wires bus might be the way forward.
Hi Matt,
There is a hardware supported UART on the GPIO pins but no hardware support for other protocols.
However, it is possible to generate 1-wire signals using the UART.
https://www.analog.com/en/resources/technical-articles/using-a-uart-to-implement-a-1wire-bus-master.html
Alternatively, you could implement other protocols such 1-wire or I2C through bit-banging. Bit-banging an I2C interface would also be possible but a bit more complex.
Another simpler option would be a hardware UART to I2C bridge would give you a lot of flexibility in attaching external sensors.
https://www.nxp.com/docs/en/data-sheet/SC18IM704.pdf.
For light level measurements we have previously used reverse-biased LED as sensors. You connect the LED to two different GPIO pins, and apply a reverse-bias voltage to charge it. The voltage decays away at a rate proportional to the light level and you can measure the time period over which this occurs (typically around 1/8 of a second).
Alex