Adding Sensor Support

I decided to get more hardware support for different Sensors going.  In the process, I’m cleaning up and enhancing the sensor and database code.  This will allow recording of ONLY what sensors are present, so there’s no big list of “N/A” for things not there, just null columns.  

I think I have added / modified all the compatible sensors that I have, which include the Raspberry Pi Sense hat, and the following, that are all Pimoroni brand Sensors;  bh1745 (Light), BME680 (Temp, Pressure, Humidity and gas resistance), Enviro hat (temp, pressure, light, magnetometer, accelerometer), LSM303D (magnetometer, accelerometer), VL53L1X (Distance sensor /w lasers). 

Now to modify the SQL writer to work with them.  Although, I’m going to take a little time to rethink how it determines which sensors are available, as I would like to cut down on the amount of code needed to identify said available sensors… Not to mention make it simpler to understand and modify. 

30 min later …. 

I think I got it!  create a new line per sensor in the “Sensors installed” file, have a number as the first char, such as 0 = not installed, 1 = installed.  Then after that, put the name of the sensor, as it would only look at the line’s first char to check.

Example.
# The first char is 0 for disabled and 1 for enabled
0 = Pimoroni BME680
1 = Pimoroni Enviro
0 = Pimoroni bh1745
0 = etc.

This way, it’s easy to modify if you open the config up, as the names right there with simple instructions.  hmm… yeah I think that will do nicely. Time to work that into the installer script.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>