Dcity_RD200M – Arduino and Particle library for interfacing to the RD200M Radon Sensor

Description

The rd200m library works with Arduino, Particle (Photon, Electron, etc.) and other related boards (ESP32, etc.) and it provides many functions to communicate with the RD200M radon sensor module using a serial interface.

Compatible Hardware

This library works with the RD200M radon sensor. This sensor is not sold by itself (let me know if you know where to purchase). This sensor is inside the RD200 radon unit,
which has a bluetooth interface. In order to collect radon data and send data via the Internet, a WiFi interface is needed. An Arduino with WiFi, Particle, or ESP32 are capable
microcontrollers, and all that is needed is a spare serial port to talk to the radon sensor. It’s advantageous to use a 2nd
serial port to talk to this radon sensor, so that you can use the primary serial port for software downloads and debugging.

Library Installation

The library files provide useful functions to make it easy
to communicate with the RD200M radon sensor.
The demo program shows the usage of the functions in the library.

Arduino IDE

Arduino provides several methods for installing libraries. The following is one of the easiest methods.

  • Importing a .zip Library into the Arduino IDE:
    1. At the Github repository for the Arduino version of Dcity_RD200M library click on “Download ZIP” button above the list of files (you may need to be signed in to Github to see this button).
    2. This will download the library files to your computer.
    3. Then in your Arduino IDE, click on the menu item Sketch > Include Library > Add .ZIP Library.
    4. Navigate to zip file you downloaded and open it.
    5. Then click on Sketch > Include Library.
    6. Select Dcity_RD200M from the list, and the library files will be ready to use in your sketch.
    7. You will need to restart the Arduino IDE in order to use the library and see the rd200mDemo.ino program listed.
    8. To run the demo program, click on the menu item File > Examples > Dcity_RD200M.

This Arduino library and demo program are located in our github repository.

Particle Web IDE

Using the Particle Web IDE

  • To run the rd200mDemo program:
    1. Click on the “library” icon on the far left side.
    2. Scroll to find the Dcity_RD200M Library, and click on it.
    3. Click on the file name “rd200mDemo.ino” (near the bottom left)
    4. Click on the button “USE THIS EXAMPLE”. This will create a new app with the demo program and the library files, which you can examine, compile or flash to a device. (Note: If you get an error saying that it can’t find the “Dcity_RD200M.h” file, add a blank line anywhere in the demo program and recompile again).
  • To add the Dcity_RD200M library to an existing app:
    1. Click on the “library” icon on the far left side.
    2. Scroll to find the Dcity_RD200M Library, and click on it.
    3. Click on “INCLUDE IN PROJECT”.
    4. Click on the app that you want to add the library to. Click on “CONFIRM”. An include statement will be added to the top of your app.

This Dcity_RD200M library and demo program are located in our github repository.

Functions in the Dcity_RD200M Library

  • available(unsigned long waitTimeMS) – check if new data is available from the sensor.
  • getRadon() – returns the current radon value in units of pCi/l
  • getMinutes() – returns the minutes of operation from the sensor… but this number resets to 0 every hour
  • getStatus() – returns the status value from the sensor. see the #define statements for their meaning (e.g. RD200M_STATUS_NORMAL)
  • setPeriod(uint8_t period) – tell the radon sensor to send data every x minutes (the period is specified in minutes)
  • reset() – reset the rd200m – the sensor will take 30 minutes to start sending data
  • requestData() – sends the readAllDataCommand to the sensor so that it will return the radon value, minutes, and status data (not needed if using available())

License Information

Our License Information is here.



Leave a Reply

Your email address will not be published. Required fields are marked *

*