Add second sensor instructions and ToDo list
This commit is contained in:
parent
211267a3ad
commit
eb92bfe192
14
README.md
14
README.md
@ -78,6 +78,11 @@ At this point, everytime the relay closes the circuit, apart from the "click" so
|
||||
|
||||
Notice that we're using GPIO5 in the board when creating the `cs` object and channel #5 on the MCP chip when creating the `analog_ic` object, respectively:
|
||||
|
||||
**Note**: The MCP3008 allows up to 8 different sensors in its 8 different channels. One only has to create:
|
||||
- another `digitalio.DigitalInOut` object using the same pin on the raspberry pi (GPIO5 in our case)
|
||||
- another `MCP.MCP3008` object using the new `DigitalInOut`
|
||||
- another `AnalogIn` object with the correspondig MCP channel.
|
||||
|
||||
```python linenums="1"
|
||||
|
||||
import adafruit_mcp3xxx.mcp3008 as MCP
|
||||
@ -92,10 +97,13 @@ def test_sensor_in_out_water():
|
||||
spi = busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
|
||||
# create the chip select
|
||||
cs = digitalio.DigitalInOut(board.D5)
|
||||
#cs_2 = digitalio.DigitalInOut(board.D5)
|
||||
# create the mcp object
|
||||
mcp = MCP.MCP3008(spi, cs)
|
||||
# mcp_2 = MCP.MCP3008(spi, cs_2)
|
||||
# create an analog input channel on pin 5
|
||||
analog_ic = AnalogIn(mcp, MCP.P5)
|
||||
# analog_ic_2 = AnalogIn(mcp_2, MCP.P6)
|
||||
try:
|
||||
while True:
|
||||
print(f"ADC Voltage value: {analog_ic.voltage:.3f}")
|
||||
@ -132,3 +140,9 @@ def test_relay_on_off(rly=None):
|
||||
except KeyboardInterrupt:
|
||||
gp.cleanup()
|
||||
```
|
||||
|
||||
## To-Do
|
||||
|
||||
[] Integrate Telegram bot to allow `water-on-demand`
|
||||
|
||||
[] Monitor moisture levels in Grafana
|
Loading…
x
Reference in New Issue
Block a user