-
Notifications
You must be signed in to change notification settings - Fork 42
Sensors
indi-allsky supports reading external sensors (eg temperature) with SBCs like Raspberry Pi.
If you have an unsupported sensor, please open an Enhancement Issue and I will investigate adding support. It may take a week or two if I have to order the part.
If you receive a PermissionDenied
exception when accessing GPIO pins
https://github.com/aaronwmorris/indi-allsky/wiki/GPIO-Permissions
Data is shared between the indi-allsky processes using a multiprocessing Array. Each sensor module supports a different number of sensors. Some sensors only support a single type, others support multiple eg temperature, humidity, pressure, etc. The code will populate multiple slots of data based on the sensor type.
All slots are floating point values.
There are 30 (0-29) slots for system temperatures.
- 0 is the camera temperature
- 1-9 are reserved for future use
- Slots 10-29 are for all sensor values returned by
psutil.sensors_temperatures()
. Raspberry Pi 1-4 will have a single sensor value (CPU temp), Pi5 has 2 temperatures (CPU Temp, GPU Temp). Generic PCs can have many temperatures returned. The order of the temperature values is not controllable, the first is NOT always the CPU temperature. The order and label for the temperatures can be seen on the System page.
There are 30 (0-29) sensor slots for user data.
- 0 is the camera temperature
- 1 is the dew heater state (duty cycle)
- 2 is the dew point temperature
- 3 is the frost point temperature
- 4 is the fan state (duty cycle)
- 5 is the heat index
- 6 is the wind direction in degrees
- 7 is sqm
- 8-9 are reserved for future use
- Slots 10-29 are available to be assigned for sensors.
There is a test script will will execute the same code that indi-allsky utilizes so you do not have to start the program to validate their behavior.
source virtualenv/indi-allsky/bin/activate
./misc/sensor_test.py
The I2C interface needs to be activated on your SBC. This can be done with raspi-config
on Raspberry Pi systems.
Use i2cdetect -y 1
to inspect the I2C bus to find the correct address for your device.
sudo apt-get install i2c-tools
The SPI interface needs to be activated on your SBC. This can be done with raspi-config
on Raspberry Pi systems.
The 1-Wire interface needs to be activated on your SBC. This can be done with raspi-config
on Raspberry Pi systems.
The default 1-Wire pin on Raspberry Pi devices is GPIO4 (pin 7). This can be overridden in /boot/firmware/config.txt
dtoverlay=w1-gpio,gpiopin=5
Sensor | Type | Status |
---|---|---|
OpenWeather Map API | Temp | Working |
DS18x20 | Temp | Working |
DHT11 | Temp | Working |
DHT21 | Temp | My sample did not work |
DHT22 | Temp | Untested |
SHT4x | Temp | Working |
BMP180 | Temp | Working |
BME280 | Temp | Working - Some modules do not report humidity |
BME680 | Temp | Working |
Si7021 | Temp | Working |
TMP36 via ADS1015 | Temp | Untested |
TMP36 via ADS1115 | Temp | Untested |
MLX90614 | Sky Temp | Working |
TSL2561 | Light | Untested |
TSL2591 | Light | Working |
BH1750 | Light | Working |
The OpenWeather Map API may be used to query local weather conditions for your location. This is not a physical sensor, but data is returned for your local weather conditions based on longitude and latitude.
The API is queried every 5 minutes, therefore there should be no more than 288 (automated) queries per day.
Returns 9 values:
temperature
"Feels Like" temperature
humidity
pressure
clouds percent
wind speed
wind gusts
1h rain
1h snow
This sensor is a 1-Wire interface type device. On Raspberry Pi, the default 1-Wire pin is GPIO4 (pin 7). The Pin in the indi-allsky config is not used.
Returns 1 value:
temperature
This sensor only requires a single pin and in some cases a pull up resistor.
Returns 2 values:
temperature
humidity
The BMP180 has an i2c interface. Common I2C addresses are 0x77
and 0x76
.
Returns 2 values: temperature
and pressure
(hPa)
Pin | I2C | Note |
---|---|---|
VCC | 5v on 5 pin sensors, 3.3v on 4 pin modules | |
GND | ||
SLC | SLC | Raspi pin 2 |
SDA | SDA | Raspi pin 3 |
3.3 | Not available on 4 pin modules |
The BME280 can be used in either i2c or SPI modes. Common I2C addresses are 0x77
and 0x76
.
Returns 3 values:
temperature
humidity
pressure
Pin | I2C | SPI | Note |
---|---|---|---|
VCC | Usually 3.3v | ||
GND | |||
SLC | SLC | SCLK | I2C - Raspi pin 2 SPI - Raspi pin 23 (SCLK) |
SDA | SDA | MISO | I2C - Raspi pin 3 SPI - Raspi pin 19 (MOSI) |
CSB | CS | SPI - Any GPIO pin | |
SDO | MOSI | SPI - Raspi pin 21 (MISO) |
Some versions of the BME280 do not support humidity measurements. There are references online that say this affects chip ID 0x58
. Without the humidity measurement, dew point calculations will not be available.
RuntimeError: Failed to find BME280! Chip ID 0x58
If you receive this Exception, you need to edit virtualenv/indi-allsky/lib/python3.##/site-packages/adafruit_bme280/basic.py
and set _BME280_CHIPID
to 0x58
The BME680 can be used in either i2c or SPI modes. Common I2C addresses are 0x77
and 0x76
.
Returns 4 values:
temperature
humidity
pressure
-
gas
(ohm)
Pin | I2C | SPI | Note |
---|---|---|---|
VCC | Usually 3.3v | ||
GND | |||
SLC | SLC | SCLK | I2C - Raspi pin 2 SPI - Raspi pin 23 (SCLK) |
SDA | SDA | MISO | I2C - Raspi pin 3 SPI - Raspi pin 19 (MOSI) |
SDO | MOSI | SPI - Raspi pin 21 (MISO) | |
CSB | CS | SPI - Any GPIO pin |
- The initial humidity measurement may always be 100%. Subsequent measurements should be correct.
The Si7021 has an i2c interface. Default I2C address is 0x40
.
Returns 2 values
temperature
humidity
The SHT4x has an i2c interface. Common I2C addresses are 0x44
and 0x45
.
Returns 2 values
temperature
humidity
The ADS1x15 ADC has an i2c interface. Common I2C addresses are 0x48
, 0x49
, 0x4a
, and 0x4b
The ADC reads the analog voltage from the TMP36 sensor which is converted to the temperature value.
Returns 1 value
temperature
Returns 2 values
temperature
This MLX90614 has an i2c interface. Default i2c address is 0x5a
Returns 2 values:
temperature
sky_temperature
The TSL2561 has an i2c interface. Default i2c address is 0x39
Returns 3 values:
lux
broadband
infrared
The TSL2561 has an i2c interface. Default i2c address is 0x29
Returns 4 values:
lux
visible
infrared
full_spectrum
The BH1750 has an i2c interface. Default i2c address is 0x23
Returns 1 value:
lux