The example code ran for us on an Adafruit Grand Central without any problems. Unfortunately, the example code is a bit of a mess. Maybe it’s just us, but we like to be able to copy and paste from the example code wholesale when building our own software, but in this case, the process of reading the sensors is too closely tied to the actual flow of the example for this to work.
You can certainly gut the code and adapt it to your needs, but for this to work, you’ll need to be comfortable working with sending binary commands over I2C. For example:
Wire.beginTransmission(0x2A); // transmit to device // Device address is specified in datasheet Wire.write(byte(0xC0)); // sends instruction to read sensors in next byte if (opt_sensors & 0x01) // If gas sensor is installed, include it in the data request Wire.write(byte(0x7F)); // 0x7F indicates to read all connected sensors else Wire.write(byte(0x3F)); // exclude gas sensor from data request // 0xFF indicates to read all connected sensors Wire.endTransmission(); // stop transmitting // Delay to make sure all sensors are scanned by the AmbiMate delay(100);
To anyone used to working with embedded hardware, this shouldn’t pose any problems, but if you’re more used to working with maker-level hardware that typically comes with a wrapper library to get the data you need, it’ll take a bit more work.
Putting it to use
TE Connectivity advertises this sensor as being suitable for indoor lighting, thermostats, and motion sensor ceiling-mounted devices. This is certainly the sort of area we’d expect the MS4 to find use – anything that needs a microcontroller to respond to the environment in some way.
The sensors aren’t accurate enough for scientific measurement, but can be useful for general automation. For example, temperature is read to plus or minus 0.3 degrees Celsius, humidity to plus or minus 2%, but bear in mind that the sensors are mounted on the board, so can’t be positioned to take readings in other orientations unless the whole board can be repositioned.
It is a sad reflection of the world today that the eCO2 sensor is only accurate above 400 ppm. This means that it would have been unable to accurately read CO2 levels as recently as 2010, but unfortunately, it’s unlikely that this is going to be a problem for this sensor in the foreseeable future. The ‘e’ at the start of eCO2 stands for estimated. It’s a calculated value, based on the volatile organic compounds (VOC) reading that attempts to work out how much CO2 is present, based on people breathing it out – and for that, it can be a useful measure – but it’s not suitable for measuring the CO2 output from things other than people.
Given the range of sensors on the module, the size has been kept impressively small, which means that it should fit well into most smart devices. The downside of the form factor is that you have to design your enclosure so that all the sensors will be able to get the light and environmental readings they need – and there’s no flexibility to reposition anything that gets in the way.
Perhaps the best feature of this product is that the different sensor options all come with the same footprint. This means that if you’re looking to build a device with multiple different options, you can design it so the only difference is the particular module that slots in. For small-run manufacturing, this could be a useful feature.
The MS4 is probably most suited to small- to medium-run smart home/office devices. For these, the form factor and range of sensors make it something that could come in useful in many different applications.
TE Connectivity From $15 te.com
A standard format for environmental measuring in your smart home.