Download Print this page

Advertisement

Quick Links

Documentation Center
RAK12004 Quick Start Guide
Prerequisite
What Do You Need?
Before going through each and every step on using RAK12004 WisBlock MQ2 module, make sure to prepare the
necessary items listed below:
Hardware
RAK12004 WisBlock MQ2 Gas Sensor Module
Your choice of
WisBlock Base
Your choice of
WisBlock Core
USB Cable
Li-Ion/LiPo battery
(required)
Solar charger
(optional)
Software
Download and install
Arduino IDE
To add the RAKwireless Core boards on your Arduino project, install the RAKwireless Arduino BSP. Follow the
steps in the
RAKwireless Arduino BSP
Product Configuration
Hardware Setup
RAK12004 module is part of the WisBlock Sensor category and extends the WisBlock system with a gas sensor
alert system. The RAK12004 connects to the WisBlock Base Board through the IO slot. The Figure 1 shows the
assembly of a
WisBlock Core
secure the connection of the WisBlock module by using the compatible screws. For more information about
RAK12004, refer to the Datasheet.
with IO slot
.
.
highlighted in green and the module RAK12004 highlighted in red. Also, always
Figure 1: RAK12004 connection to WisBlock Base Board

Advertisement

loading

Summary of Contents for RAK WisBlock RAK12004

  • Page 1 Documentation Center RAK12004 Quick Start Guide Prerequisite What Do You Need? Before going through each and every step on using RAK12004 WisBlock MQ2 module, make sure to prepare the necessary items listed below: Hardware RAK12004 WisBlock MQ2 Gas Sensor Module Your choice of WisBlock Base with IO slot...
  • Page 2 Documentation Center Assembling and Disassembling of WisBlock Modules Assembling As shown in Figure 2, the location for the IO slot is properly marked by silkscreen. Follow carefully the procedure defined in WisBlock Base board assembly/disassembly instructions to attach a WisBlock module. Once attached, carefully fix the module with one or more pieces of M1.2 x 3 mm screws depending on the module.
  • Page 3 Documentation Center 3. Apply force to the module at the position of the connector, as shown in Figure 5, to detach the module from the baseboard. Figure 5: Applying even forces on the proper location of a WisBlock module NOTE If you will connect other modules to the remaining WisBlock Base slots, check on the WisBlock Pin Mapper...
  • Page 4 Documentation Center Figure 6: Selecting RAK4631 as WisBlock Core RAK11200 Board Figure 7: Selecting RAK11200 as WisBlock Core...
  • Page 5 Documentation Center RAK11310 Board Figure 8: Selecting RAK11310 as WisBlock Core 3. Install the RAKwireless MQx Library using Arduino Library Manager. 4. On the Arduino IDE, select Sketch -> Include Library -> Manage Libraries, as shown in Figure 9. 5. On the Library Manager text area, type RAKwireless MQx. Figure 9: Arduino Library Manager 6.
  • Page 6 Documentation Center Figure 10: Finish RAK-MQx library Installation 7. Once the library is installed, open the RAK12004_MQ2_Sampling example. 8. On the Arduino IDE, select File -> Examples -> RAKWireless MQx Libraries -> RAK12004_MQ2_Sampling, as shown in Figure 11. Figure 11: Open RAK12004 MQ2 Sampling Sketch...
  • Page 7 Documentation Center Figure 12: Selecting the correct Serial Port Figure 13: Uploading the RAK12004 example code on RAK4631 To extend the use of the RAK-MQx library, check the link RAK-MQx Library methods Build RAK12004 Example on PlatformIO IDE (optional) NOTE: This procedure was tested only on Windows 10 and Ubuntu.
  • Page 8 7. Build the project and ignore warnings and errors. 8. Download and install the RAK Patch script 9. Unzip the contents of RAK_PATCH.zip into the folder RAK_PATCH in your PlatformIO installation folder. The table below shows the PlatformIO installation directory for each operating system:...
  • Page 9 Documentation Center Figure 16: RAK patch folder on Windows 10. Open a command prompt in folder and execute python %UserProfile%.platformio\RAK_PATCH ./rak_patch.py Figure 17: RAK patch installed on Windows WARNING ⚠ In case of any platform update on PlatformIO, the RAK_PATH script must be executed again after the platform update.
  • Page 10 Documentation Center Figure 18: Import RAK12004 Arduino Project 13. Select your preferred WisBlock Core and check "Use Libraries installed by the Arduino IDE" option, as shown in Figure 19. 14. Then choose the directory of the original RAK12004 Arduino Project. Figure 19: Select Board and check Import Libraries 15.
  • Page 11 Documentation Center Figure 20: Select Board and check Import libraries 16. Build the imported project on the PlatformIO. Now, you can build the project by clicking on the highlighted icon, as shown in Figure 21. Figure 21: Build Arduino imported project 17.
  • Page 12 Documentation Center Figure 22: Upload Arduino imported project Last Updated: 7/29/2022, 10:17:19 PM...
  • Page 13 Documentation Center RAK12004 WisBlock MQ2 Gas Sensor Module Datasheet Overview Description The RAK12004 is a gas sensor module, part of the RAKWireless WisBlock Sensor series. The sensor used is the MQ-2 from Zhengzhou Winsen Electronics. Features MQ-2 gas sensor Sensitivity to LPG, butane, propane, methane, alcohol, hydrogen, smoke, and other flammable steam I2C Interface Alert function Detection Range: 300~10000 ppm (flammable gas)
  • Page 14: Pin Definition

    Documentation Center Pin Definition The RAK12004 WisBlock MQ2 Gas Sensor Module comprises a standard 40-pin WisConnector. The WisConnector allows the RAK12004 module to mounted to a WisBlock Base Board. The pin order of the connector and the pinout definition is shown in Figure 2. NOTE: I2C related pin, ALERT, EN, VBAT, 3V3, and GND are connected to 40-pin WisConnector.
  • Page 15: Schematic Diagram

    Documentation Center Figure 3: RAK12004 WisBlock MQ2 Gas Sensor Module Mechanic Drawing WisConnector PCB Layout Figure 4: WisConnector PCB Footprint and Recommendations Schematic Diagram Power Supply Circuit Figure 5 shows RAK12004 step-up power supply circuit. VBAT Battery voltage (max voltage is 4.2 V) EN Power enable pin (active high).
  • Page 16 Documentation Center Figure 5: RAK12004 WisBlock MQ2 Gas Sensor Module Power Supply Gas Detector Circuit Figure 6 shows the gas detector circuit. U2 Gas sensor The heater voltage requires a 5 V supply which is provided by the 5 V step-up converter. This is needed to achieve the standard working temperature of the sensor.
  • Page 17: J2 Connector Pinout

    Documentation Center Figure 7: Voltage Level Shifter Circuit I2C Address The I2C address of the Analog-to-Digital converter chip of RAK12004 can be configured via resistor jumpers as shown in Figure 8. Figure 8: RAK12004 I2C Address J2 Connector Pinout RAK12004 has an additional connector to provide an extra interface to the module. The pinout of J2 connector is shown in Figure 9.
  • Page 18 Documentation Center Figure 10 shows 40-pin WisConnector pinout. VBAT battery voltage I2C1_SDA and I2C1_SCL are I2C related pins EN is power chip enable pin ALERT is analog-to-digital converter alert pin Figure 10: RAK12004 MQ2 Gas Sensor Module 40-pin WisConnector Last Updated: 7/29/2022, 10:17:19 PM...