-
First 3D Printed Enclosure
05/19/2018 at 11:28 • 0 commentsExciting moment! EAZYFAB, an on-demand 3D printing service provider from Kozhikode, Kerala, India came forward to sponsor a single print for the EXPLOG project and they did. Thanks to Sijah AK and Nabeel BA from EAZYFAB. I sent them the STL files exported from Fusion 360. It was printed with PLA and the print is very sturdy.
Bottom section Bottom GPS window That's how GPS will be installed Middle section Top section Two 18650s fit perfectly Roughly the size of a 5" smartphone. Shown is Moto G2 This is just a sample print to see if the sizes and placements are satisfying. I'll have to modify this further as I develop the PCB and add more modules. I still don't know how to make the buttons and haven't decide the placements of antennas. I'm thinking of 3D printing the buttons with either flexible rubber or PLA itself. If you have any suggestions on making good buttons, please let me know in the comments :)
-
The Grand Plan
04/23/2018 at 16:29 • 0 commentsSo far we've been discussing about the system design, which sensors to use etc. I think now I'm able to see the big picture. So here's the grand plan for the development of EXPLOG.
Hardware
First I need to buy all the sensors and modules from different stores and test them for their performance and possible constraints. Most of the sensors are available as breakout modules from many Chinese online stores. The rest can be bought from DigiKey or Mouser. If you own any sensors I have listed on one of the previous logs, and is willing to test them and share the results, that would really save me some time. Doing so will make you a contributor to this project and will be added to the team.
Once we finish testing the sensors and the prototyping, we then will have to design a custom SMT PCB as per our form factors.
Firmware
The main interfaces will be the 1.8" TFT LCD and 7 button keypad though which the user can interact with the device. Programming can be done on the ESP-IDF framework as it better implements the plethora of hardware features available on ESP32. FreeRTOS tasks will be used for simultaneous operations. The task distribution will look like this,
- Task 1 (core 0) - will repeatedly read values from all sensors on the I2C bus and update the global sensor readings variables. The keypad controller will be read when there there's an interrupt occurs at the event of user interaction. A dedicated input will be used for interrupt.
- Task 2 (core 0) - will update the display with information from the sensors depending on the current user interaction.
- Task 3 (core 0) - will save the data read from sensors to a CSV file on the micro SD card.
- Task 4 (core 0) - will read the NMEA data from the GPS module and update the variables.
- Task 5 (core 0) - will handle the LoRa protocol.
- Task 6 (core 1) - will handle WiFi and Bluetooth.
Utility Software
I plan to design a utility software for EXPLOG that can fetch data from the device, visualize them in real-time and save it if required. I'm considering Processing platform for this.
Smartphone Application
A smartphone application can be used to connect to the EXPLOG via WiFi or Bluetooth and visualize data. Applications written in Processing can be exported to run on Android phones easily. Will have to see how far we can go with it.
Cloud Platform
A cloud platform dedicated for sharing data from EXPLOG devices all around the world sounds a pretty bold idea. Users will be able to save the data from their device to the cloud by connecting to the internet and share the data to the Open Data Pool. Others can use these data for climate studies and a whole lot of other applications. Cool!
Enclosure
The enclosure can be 3D printed on PLA material. The 3D models are designed in Fusion 360 and the source files will be made available to the public.
Marketing
If this project gains enough attention from the open source community and other interested enthusiasts, I would be able to sell EXPLOG as product at marketplaces such as Tindie for a reasonable price.
-
Thoughts On Using A Coprocessor
04/21/2018 at 16:01 • 0 commentsESP32 is a feature packed power house when it come to price-performance ratio which makes it ideal for all IoT applications. But there's one tiny drawback - limited number of GPIO pins. On the ESP-WROOM32 module, some pins are used by the flash chip and can't be used for other purposes. Some other set of pins can only be used as inputs, not outputs. As per the datasheet, ESP32 has 34 GPIOs of which I/O GPIO pads are 0-19, 21-23, 25-27, 32-39, while the output GPIOs are 0-19, 21-23, 25-27, 32-33. GPIO pads 34-39 are input-only. So in total we get 22 I/O pins and 4 input only pins.
Even though it is not apparent in this initial phase of the project, sooner or later we're going to run out of pins if we're going to add more sensors and stuff in future. That's why I'm considering adding a less powerful but GPIO rich coprocessor to the design. The second processor or microcontroller could offload some tasks from the ESP32 chip giving us more room for some possible number crunching tasks. For that I'm considering the AVR Xmega series ATxmega128A3U which has 50 IO pins (64 pin package) which is plenty. It runs at 32MHz, has 128KB flash, 8KB SRAM, 7 UART, 10 SPI, 2 I2C and one USB modules.
Let's estimate the pin requirements for each interfaces.
- SD card - 4 (hardware SPI)
- Display - 4 (3 wire SPI with MOSI only and CD)
- I2C for sensors - 2
- GPS - 2 (hardware or software UART interface)
- USB to Serial - 2 (software of hardware UART)
- LoRa module - 4 (hardware SPI)
- Keypad controller interrupt - 1
So that's 19 of available 26 pins and we still have 7 pins left. If we ever use up all the pins left, we'll have to add a coprocessor.
-
Choosing the Right Sensors
03/19/2018 at 11:21 • 5 commentsEXPLOG needs a lot of sensors obviously and there's a large list to choose from. Some of the criteria for selection of sensors are,
- Size - must be small with less than 5 mm height, and be surface mountable and reflow solderable or through-hole solderable.
- Interface - I2C compatible.
- Operating voltage - 3.3V
- Calibration - should be either factory calibrated or user calibratable.
- Global availability
- Cost
We need to make the right choices by considering the global availability and cost of each sensor to make sure that others will be able to get them to replicate/modify the device. These are what I've been able to come up with. Datasheets of all these sensors will be available at the file section of this project.
Barometric Pressure Sensor
- DPS310 from Infineon
- BMP280 from Bosch
- BMP380 from Bosch
- BMP388 from Bosch
- BME680 from Bosch
- MPL3115A2 from Maxim
We need a sensor to accurately measure barometric air pressure becasue we need accurate pressure measurements for calculating the altitude accurately. DPS310 was my first choice becasue I had received an evaluation module from Infineon as part of a give away. But not everybody is going to get these as they are not available in the usual maker markets. BMP280 on the other hand is widely available and most are familiar with. But they're not the best ones out there. Let's have a comparison of features of sensors from leading manufacturers.
DPS310 BMP280 BMP380 BMP388 BME680 MPL3115A2 Operation range 300 - 1200 hPa 300 - 1100 hPa 300 - 1250 hPa 300 - 1250 hPa 300 - 1100 hPa 200 - 1100 hPa Abs. Max. Pressure 10000 hPa 20000 hPa 20000 hPa 20000 hPa 20000 hPa 5000 hPa Max. Resolution (Pressure) 24-bit 20-bit 24-bit 24-bit 20-bit 20-bit Precision 0.005 hPa 0.0016 hPa 0.003 hPa 0.0016 hPa 0.0018 hPa 0.0025 hPa Absolute Accuracy ± 1 hPa ± 1 hPa ± 0.5 hPa ± 0.5 hPa ± 0.6 hPa ± 4 hPa Relative Accuracy ± 0.06 hPa ± 0.12 hPa ± 0.06 hPa ± 0.08 hPa ± 0.12 hPa ± 0.5 hPa Temperature Coefficient Offset 0.5 Pa/K 1.5 Pa/K 1.2 Pa/K ± 0.75 Pa/K ± 1.3 Pa/K NA Sampling Rate 128 Hz 157 Hz 200 Hz 200 Hz 182 Hz 100 Hz FIFO Size 32 samples NA 512 Bytes 512 Bytes NA 32 samples Current Consumption @ 1Hz 1.7 uA 2.7 uA 2.7 uA 3.4 uA 4.2 uA 8.5 uA -
From evaluating the specifications, BMP380 and BMP388 seem to be the best choices becasue they provide better absolute and relative accuracies, higher sampling rate, highest bit depth and higher absolute maximum pressure. The BME680 is special becasue it crams a pressure, temperature, humidity and air quality sensors in a single package. It might save some PCB real estate but can't compete with specs of other single purpose sensors, and it's going to cost higher than others. So we won't be using that. The DPS310 has its problems such as lower sampling rate, lower FIFO size etc, and it is priced similar to others. So these reasons also favor BMP380 and BMP388.
Absolute accuracy is how close the output reading to the actual reading of absolute pressure (absolute pressure is the pressure reading taken with a zero pressure as reference). The more accurate the absolute pressure, more will be the accuracy of our calculated true altitude relative to seal level. So if we need more accurate altitude measurements we need more absolute accuracy. On the other hand, relative accuracy, as you guessed, is the degree of error between two relative pressure readings (absolute error on two relative readings will be same). This reading is crucial because it is what helps us to determine the relative elevation, for example how high a drone from the ground is etc.
Temperature Sensor
Most pressure and humidity sensors come with internal temperature sensors to compensate for variation in temperature affecting pressure and humidity measurements. So we could simply read the temperature from any of those sensors. But there's a small problem; as suggested by many datasheets, the temperature indicated by the internal sensor of the pressure sensor can be inaccurate due to the heat produced by the sensor itself. The heat produced will depend on the voltage and frequency of measurement. Bosch's datasheet says the measured temperature will be slightly greater than the actual ambient temperature. The other possibility is to measure the temperature from a humidity sensor. The HDC1080 humidity sensor we'll be using has a temperature accuracy of ± 0.2 °C which is pretty good.
Relative Humidity Sensor
Humidity is the measure of amount of water vapor in air. Some of the best available are,
- HDC1080 from TI - ±2% humidity accuracy, ±0.2°C temperature accuracy, 14-bit humidity and 14-bit temperature.
- Si7021 from Silicon Labs- ±3 humidity accuracy, ±0.4°C temperature accuracy, 12-bit humidity and 14-bit temperature.
- SHT3x-ARP from Sensirion - ±2% humidity accuracy, ±0.3°C temperature accuracy, 0.01 %RH humidity resolution and 0.015 °C temperature resolution.
- SHT15 from Sensirion - ±2% humidity accuracy, ±0.3°C temperature accuracy, 12-bit humidity and 14-bit temperature resolutions.
We'll use the HDC1080 for its better accuracy and resolution figures. It comes factory calibrated and has I2C interface.
Air Quality Sensor
An air quality sensor, unlike a gas sensor, measures the amount of Volatile Organic Compounds (VOCs) and equivalent CO2 (eCO2) in the surrounding air. VOCs are what give the air its odor and are originated from natural and human made substances such as paints and fuels. Abnormal levels of VOCs can lead to long-term health effects. Equivalent CO2 represents the potential of mixture of all greenhouse gases in the air to produce global warming. It is a relative measure based on a standard reference and is known as Global Warming Potential (GWP). Most of the times, the measure of total mixture of compounds in air will better indicate the quality of the air, than measuring individual gases or compounds. That's where a typical gas detectors that can detect one or tow specific gases differ from an air quality sensor. CCS811 from AMS is an air quality sensor that measures the VOCs and eCO2 in air and outputs the measurements in a range of values which are 400 ppm to 64000 ppm for eCO2 and 0 ppb to 64000 ppb for TVOC. The sensor is available in an LGA package and is interfaced via I2C.
Light Intensity Sensor
For this we need one or more light sensors to detect the intensity levels of visible, infrared (IR) and ultraviolet (UV) light. Some sensors are designed to measure multiple regions of light wavelengths and some are dedicated to a single spectrum and thus blocks other ranges of light. Also a proximity sensor emits IR light in order to detect the distance to an object in the proximity field. The reflected light from the object could affect other light intensity sensors and therefore needs to be compensated (some for example Si1145 has dedicated registers for compensation values). Some sensors have filters to block the unwanted spectrum of light and some don't. So these are the considerations to be given while choosing a light intensity sensor. Our candidates are,
- Si1145 from Silicon Labs - This can measure ambient visible light, IR and UV levels as per the datasheet. The internal IR photodiode has good IR wavelength response and thus can be used for proximity sensing too for up to 50 cm. The Si1145 model has one IR LED driver pin with programmable current sink of up to 300 mA which makes it ideal for a proximity sensor. Moreover, the IR light reflected back from an object can be internally compensated for accurate ambient IR level measurement. The visible light photodiode has a nominal response range from 330 - 950 nm and therefore can also serve as a UVA (330 - 400 nm) sensor. By adjusting the integration time via registers, it is possible to measure ambient light as low as 100 mLux. The UV levels are reported as UV index range rather than raw values.
- VEML6070 from Vishay - This is a dedicated UV sensor with sensitivity range 320 - 410 nm (UVA) with all the required signal conditioning and compensation components and outputs the measurements as 16-bit values.
- MAX44009 from Maxim - This is a dedicated and low power Ambient Light Sensor (ALS) with IR and UV blocking capabilities. It has 12-bit resolution and high dynamic range of 0.045 Lux to 188,000 Lux. The on-chip photodiode’s spectral response is optimized to mimic the human eye’s perception of ambient light.
- TSL2561 from TAOS - This is also an ALS that has a spectral response of similar to human eye and outputs two 16-bit values; one for Visible+IR channel and one for a separate IR channel. The problem with using silicon detectors to measure ambient light intensity is that our eyes don't respond to IR but the photodiodes do. This is circumvented by using a separate IR sensor that only responds to IR light.
The Si1145 seems to be good for our application but tests need to be conducted before we can make the final choice becasue all of them have some pros and cons. We'll test all four sensors soon.
IR Proximity Sensor
We've seen that an IR sensor can be used as a proximity sensor if coupled with an IR emitter diode. But there are some dedicated IR proximity sensors available as single packages in the market, which reduces the overhead of adding IR emitters to a standalone IR sensor. There are multiple methods of range sensing including but not limited to Time of Flight (ToF), Phase difference, laser based etc. For compact spaces ToF or Phase Detectors are best suitable. Phase detectors work by measuring the phase (or angle) and intensity of a reflected light from an object to determine the distance where a ToF measures the time taken by a pulse of light to reflect and return from an object to calculate the distance. Our choices here are,
- APDS-9930 from Avago - is an IR proximity sensor with fully calibrated 100 mm range, 16-bit ALS and 0.01 Lux sensitivity.
- APDS-9960 from Avago - is an IR proximity, 16-bit ALS with UV and IR blocking, RGB and gesture sensor with programmable integration time, and LED current.
- TMG3993 from Avago - is an IR proximity, 16-bit ALS with UV and IR blocking, RGB and gesture sensor with programmable gain and integration time.
- VL6180X from ST Microelectronics - is an IR proximity sensor with 100 mm absolute range and ALS with 16-bit output, < 1 Lux up to 100 kLux range, and 8 level gain setting.
- VL53L0X from ST - Time of Flight (ToF) ranging sensor with absolute range up to 2 metres and gesture recognition.
- VL53L1X from ST - Long range ToF sensor with accurate measuring range of 4 metres.
- VCNL4020X01 from Vishay - IR proximity sensor and ALS with 16-bit resolution, 0.25 Lux to 16 kLux range, flicker rejection and 200 mm detection range.
- VCNL4040 from Vishay - IR proximity sensor and ALS with 16-bit resolution, 0.0125 Lux/step sensitivity, flicker rejection and 200 mm detection range.
- VCNL4010 from Vishay - IR proximity sensor with 200 mm range and 16-bit ALS.
- GP2Y0D810Z0F from Sharp - IR proximity sensor with 100 mm range.
It's going to be hard to choose one from this list without testing them first, though VL53L0X and VL53L1X seem a good choices. Our primary requirement is to detect some range of distance accurately in varying environmental conditions. All of these sensors come with integrated ALS for compensation. Having programmable gain, integration time and IR LED current will come handy for accurate measurement in all situations.
Inertial Measurement Unit (IMU)
These include standalone MEMS (Micro-Electro-Mechanical Systems) based accelerometers, gyroscopes, magnetometers, and also multi-sensor packages. I think it's better to use any sensor that has all three sensors in a single package. One such sensor is the LSM9DS1 from ST which integrates 3-axis accelerometer, 3-axis gyro and 3-axis magnetometer in an LGA package.
Ambient Noise Level Sensor
For this, we could use any high sensitivity microphone with good audio frequency response and either digital or analog output. Sensors with integrated conditioning circuits and amplifier are preferred. Analog output will be needed to sampled by a precision ADC that has I2C interface. ADMP401 MEMS microphone from Analog Devices can fulfill our requirements. For ADC we could use MCP3421 18-bit single channel ADC from Microchip.