The purpose of this Instructable is to describe how to construct, attach, and operate Integrated Solutions Technology's environmental sensor system in conjunction with a DJI Phantom 4 drone. These sensor packages utilize the drone in order to transport into potentially hazardous environments to identify current risk levels of carbon monoxide (CO), carbon dioxide (CO2), and liquid propane gas (LPG) in comparison to OSHA and EPA standards. It is important to note that although a radiation sensor is also shown in this Instructable, it will operate as a separate entity to the gas sensors, and the final product shown will only include the gas sensor components listed above.
Step 1: Gather Necessary Tools, Software, and Materials
- Tools Used:
- Arduino Software (https://www.arduino.cc/en/Main/Software)
- Table Saw with Abrasive Blade
- Table Grinder
- Materials Used:
- DJI Phantom 4
- Arduino Uno
- Jackery External Battery 3350mAh
- Standard Breadboard
- Carbon Monoxide Sensor - MQ - 7
- Liquid Propane Gas Sensor - MQ - 6
- Carbon Dioxide CO2 Sensor - MG - 811
- AK9750 Si7021 Humidity and Temperature Sensor
- Pocket Geiger Radiation Sensor - Type 5
- Bluetooth Modem - BlueSMiRF Gold
- Soft Steel Hanger Straps
- SparkFun Inventor's Kit
- 3M Double Sided Mounting Tape
Step 2: Assemble Sensor and Microcontroller Wiring
Access all sensor datasheets from the product manufacturer to determine the input and output pins necessary for proper component operation. In order to construct an efficient orientation for all components provided in the gas and radiation packages, each sensor and module should be wired separately to ensure it is operational when connected to the microcontroller before integration onto a single breadboard. To ensure clarity, the process to construct each type of base circuit and code is contained within the following steps.
Step 3: Determine Input and Output Pins for Carbon Monoxide MQ - 7 Sensor
As shown in the diagram above, the CO component should have three input voltage pins on the rightmost rail that are connected to the 5V microcontroller power supply. The analog input pin will be connected to any one of the microcontroller pins labeled A0, A1, A2, etc., while the ground pins are connected to the microcontroller’s ground pins. Finally, a 10K ohm resistor is used to connect the bottom left sensor pin to ground. It is important to note that this pinout is applicable to the CO2 and LPG sensors also utilized in this system.
Step 4: Connect Sensor in Accordance With Pinout to Microcontroller Input and Output Pins
As discussed in the previous steps, one pin is designated as an analog input pin to the microcontroller. In the base code displayed above, and available for download in the next step, the defined analog pin is pin A0. In accordance with this designation, wire the upper left pin to the A0 pin of the microcontroller. Then, a common 5V input and ground rail can be established by connecting the leftmost breadboard power rail (designated by the "-" symbol) to the ground pin and the rightmost rail ("+") to the 5V pin. By wiring the breadboard this way, the sensor pins can be wired directly to the rails of the breadboard, allowing for clean connections to the microcontroller. This structure is presented in the pictures of the base circuit above.
Step 5: Download Gas Sensor Base Code
Once connected, upload the Arduino base code obtained from SparkFun’s product page (https://www.sparkfun.com/products/9403; attached) by pressing the arrow located on the top left of the interface to verify that the component is wired in accordance with the pinout.
Step 6: Open the Serial Monitor to Ensure Operability
Open the serial monitor by selecting the magnifying glass icon on the top right of the interface. This will open a separate window shown above, where the sensor output, originally a voltage reading, will be displayed. If the data is not being displayed in the serial monitor as indicated, verify that the analogRead function is referencing the correct number of the analog pin wired in earlier stages of this process.
Step 7: Repeat Steps 3-6 for LPG and Carbon Dioxide Gas Sensors
Repeat the definition of pins, sensor wiring, and code upload to ensure operability of the additional sensors.
Step 8: Wire SparkFun Si7021 Humidity and Temperature Sensor (Optional)
The same general process outlined for the gas sensors will be implemented for the temperature and humidity sensor. However, the pinout differs from the gas sensors and is displayed above. The VCC pin (second from the right on the sensor) will be connected to either a 5 or 3.3 V microcontroller power source and the ground pin will be connected to the ground of the microcontroller as seen in the gas sensor wiring. Instead of an analog output pin, this sensor contains SDA and SCL output pins that are responsible for transmitting data from the sensor to the microcontroller for processing. This sensor can be utilized to verify the accuracy of gas sensor measurements in comparison with their datasheet values.
Step 9: Download Si7021 Humidity and Temperature Sensor SparkFun Base Code
Upon completion of the wiring, the attached sample code (adapted from https://www.sparkfun.com/products/13763) should be uploaded to the microcontroller to ensure proper circuit construction. As was described with the gas sensor code, verify that the component is transmitting the temperature and humidity by accessing the serial monitor. It is important to note that this base code includes the use of two different SparkFun component libraries. In order for this code to compile and upload to the microcontroller, the user will need to install these libraries through the methods shown in Step 9.
Step 10: Add Component Arduino Libraries
The implementation of Arduino libraries in codes are identified through the use of an #include command as seen near the top of the Step 8's code. Without inclusion of these libraries, the code will not be able to compile or upload to the microcontroller. To access and install these libraries, go to the sketch tab, expand Include Library, and select Manage Libraries. Type the name of the library needed (text that appears after the #include command), click on the desired option, select a version, and press install.
Step 11: Wire Pocket Geiger Radiation Sensor - Type 5
As previously stated, this component will be included separately from the gas sensors. In setting up this product, the process is still the same; wire the component pins to their respective outputs as shown in the pinout above. Connect the VCC pin to the 5V source located on the microcontroller and the ground pin to the microcontroller ground as was done with the gas sensors. Then, connect the signal and noise pins to microcontroller pins 2 and 5, respectively. Upon completion of this task, upload the base code adapted from radiation-watch.org via Github (https://www.sparkfun.com/products/142090) and this component is ready for operation.
Step 12: Develop Integrated Sensor Wiring
After individually wiring each sensor to confirm its operability, begin integrating each sensor wiring in a condensed format so that all sensors described above are wired on the breadboard, as displayed in figures above. Reference the above table to correctly wire the necessary Arduino pins to their respective components so that the codes below do not need to be altered before uploading. To support a condensed format, use a common power and ground rail by wiring one breadboard power rail as 5V and the other as 3.3V. Connect the two ground rails together while providing a connection to the ground pin of the Arduino microcontroller. When completed, upload the attached code to access the gas sensor capabilities assembled on the board. The attached Arduino code will control the gas sensors, as well as the temperature and humidity sensor, and display their measurement data, in parts-per-million through the serial monitor. It will also provide the hazard level classification of the measured data. The radiation sensor can be reliant upon a time-bound measurement (i.e. counts-per-minute), so it is advised to operate this component separately from the gas sensors. To support this distinction, the CO, LPG, and CO2 sensors will the be the only components discussed when the microcontroller is paired with the Bluetooth module. However, it is important to note that the following process can be followed to achieve the same result with the radiation sensor.
Step 13: Initiate Bluetooth Connection Between Phone and Module.
Once the desired sensor system is assembled, coded, and condensed, the next step is to wirelessly connect a user device to the system. This will allow live sensor readings to be sent to the user at a distance removed from the hazard area. The connection of the sensor system and the user’s device will be facilitated with the Arduino BlueSMiRF Bluetooth module. This module will be connected to the “Arduino Bluetooth Data” mobile application which can be downloaded from the Google Play store. This interface will directly display the readings obtained from either the gas sensors, human presence, or radiation sensors, and will be accessible up to 350 feet and will alert the user to changes in sensor readings, while allowing the user to assess if dangerous levels of environmental hazards are detected with respect to OSHA and EPA regulations.
The component should be wired individually, as was demonstrated with the sensors, to initialize component setup and evaluate operability. Using the component diagram shown in figure above, the component will be wired with a 5V power input and a ground pin, while the TX and RX component pins will be wired to two user-defined digital pins. As shown by the figure, the TX pin was assigned to the second digital pin and the RX was defined as the third. Upon completion of this task, run the example code found below to start component setup. At this point, the component’s LED should be slowly blinking with a red tint. Access the serial monitor and toggle the options on the bottom of the window to read, “No line ending” and “9600 baud,” in the dropdown boxes, respectively. Then type “$$$” into the command box, and press “Send.” This will initiate “Command Mode” in the component, and cause the LED to rapidly blink a red tint. Additionally, the component will send a “CMD” message back to the serial monitor.
Toggle the serial monitor dropdown settings again to read “Newline” and “9600 baud,” before proceeding with setup. The send "D" and "E" commands to the serial monitor to display the component settings, including the factory name. To pair to your mobile phone, open Bluetooth settings, select the given name of the Bluetooth module (ECEbluesmirf for the example provided). After this selection, send an "I" command to scan for Bluetooth enabled devices. The first number will be used to sync the two devices, by sending a "C,First Number." When completed, the Bluetooth LED will turn to a solid green.
Step 14: Connect System to Mobile Application - Android Users
To access sensor data on an Android, download the mobile application "Arduino Bluetooth Data" from the Google Play store. Open up the mobile application and tap on the name of the Bluetooth module name on the user interface to connect. When prompted, select the application as a receiver. The interface displaying the sensor data will display and the module will contain a solid green LED. Upon completion, upload the attached code to activate the sensors and retrieve environmental hazard data. The sensor names can be updated to accommodate the sensors utilized, as was completed to achieve the screenshot above.
Step 15: Create Support Brackets to Attach Sensor System
The assembling the sensor system requires the use of two soft steel hanger straps and 3M double-sided adhesive mounting tape to attach to the DJI Phantom 4 drone. The first step is to bend and shape the soft steel hanger straps to the drone. This requires a total initial strap length of 23 inches. From this stock, cut equal straps using a table saw with an abrasive blade. Then, grind the ends to remove burrs. The result of the process is shown in the first of the figures displayed above. During this process you want to avoid cutting along the open slots, to avoid weakening the ends of the strap.
The next step will requires the bending of the straps in order to fit on the drone. It is recommended to use a pair of pliers to bend the steels and place the strap on bottom of the rails. Center the straps on the drone leg rails, and mark where the edge of the rail legs. This will serve as the visual for where to bend the steels. Bend the straps in small increments until they wrap around the railings, preventing sliding.
Step 16: Assemble System to the Drone
An example of assembling the sensor system will be demonstrated using soft steel hanger straps and adhesive tape. As previously discussed, the soft steel hanger straps were bent and placed on the bottom of the drone as to create a platform for the components to sit on. After this is completed, attach the components to the straps with the adhesive so they are secure, but do not interfere with the normal operation of the drone. To allow for ample space, the example utilizes two hanger straps supporting an external battery, microcontroller, and breadboard. Additionally, the sensors are placed toward the rear of the drone.
Step 17: Using This System to Evaluate Hazard Risk
To determine the severity of the hazard levels presented by this system, one should reference the following standards. Green indicates a safe environment for all present in the area of interest, whereas purple indicates the worst possible environmental concentration, leading to lethal effects. The color system used is derived from the EPA's Air Quality Flag Program.
Carbon Monoxide (OSHA)
- 0-50 PPM (Green)
- 50-100 PPM (Yellow)
- 100-150 PPM (Orange)
- 150-200 PPM (Red)
- >200 PPM (Purple)
Liquid Propane Gas (NCBI)
- 0-10,000 PPM (Green)
- 10,000-17,000 PPM (Yellow)
- >17,000 PPM (Red)
Carbon Dioxide (Global CCS Institute)
- 0-20,00 PPM (Green)
- 20,000-50,000 PPM (Yellow)
- 50,000-100,000 PPM (Orange)
- 100,000-150,000 PPM (Red)
- >150,000 PPM (Purple)
Step 18: Utilize System to Gather Measured Data
Now that the final assembly has been completed, the system is ready to operate. Since the code needed to allow the microcontroller to operate the sensor system is already uploaded, the microcontroller can be connected to the mobile battery pack to transmit data, in replacement of a computer. The system is now ready for use in environmental hazard assessment applications!