Hi Angelo,
Really love your project! Appreciate all the work you put into it.
I would like to add in a second MCP3008 ADC in a configuration such as outlined here. I can't seem to see a setting for multiple devices on SPI in the hardware table. Having a look at the code around line 961 in HWcontrol.py, I guess its not implemented yet?
From some quick googling, I believe all that this is something that can easily be added by doing something like:
spi2 = spidev.SpiDev()
spi2.open(0, 1) # chip enabling using spi0_ce1
spi2.max_speed_hz=spi_speed
... etc.
for the second SPI device (but don't quote me on that as I don't really have any experience interfacing with SPI)
Is this something that is on the plan to be implemented? Would be really great to be able to add more soil moisture sensors into my system.
Thanks again for making this project 🌱
Ivan
You should be very clever to find such simple solution in my messy code.
One question, did you use this connection schema and GPIO ports?
Thanks
Hello Ivan,
well, the SW is not meant to support Multiple SPI. Main reason is that I thought 8 analog inputs would be more that enough , at least for the majority of the cases ;).
Anyway having a look at the schema, what it is needed is just to have one GPIO pin activating one MCP3008 and another GPIO pin to activate the other. The SW has this possibility to activate a GPIO pin using the PowerPIN field. Now I'm not sure if it will fit with the logic of the CE (if active high or low) but if you have more that one MCP3008 in your lab, you can give it a try.
Currently I have no plan to make further implementation in this area.
Regards,
Angelo