Hacking The ZH03B Laser Particle Sensor

Laser particle detectors are a high-tech way for quantifying whats floating around in the air. With a fan, a laser, and a sensitive photodetector, they can measure smoke and other particulates in real-time. Surprisingly, they are also fairly cheap, going for less than $20 USD on some import sites. They just need a bit of encouragement to do our bidding.

[Dave Thompson] picked up a ZH03B recently and wanted to get it working with his favorite sensor platform, Mycodo. With a sprinkling of hardware and software, he was able to get these cheap laser particle sensors working on his Raspberry Pi, and his work was ultimately incorporated upstream into Mycodo. Truly living the open source dream.

The ZH03B has PWM and UART output modes, but [Dave] focused his attention on UART. With the addition of a CP2102 USB-UART adapter, he was able to connect it to his Pi and Mac, but still needed to figure out what it was saying. He eventually came up with some Python code that lets you use the sensor both as part of a larger network or service like Mycodo and as a stand-alone device.

His basic Python script (currently only tested on Linux and OS X), loops continuously and gives a running output of the PM1, PM2.5, and PM10 measurements. These correspond to particles with a diameter of 1, 2.5, and 10 micrometers respectively. If you want to plug the sensor into another service, the Python library is a bit more mature and lets you do things like turn off the ZH03B’s fan to save power.

These sensors are getting cheap enough that you can build distributed networks of them, a big breakthrough for crowd-sourced environmental monitoring; especially with hackers writing open source code to support them.

18 thoughts on “Hacking The ZH03B Laser Particle Sensor

  1. For those interested there was a big conference about Air Quality Sensor last month.
    All the proceedings are available here: https://asic.aqrc.ucdavis.edu/current-speakers
    Lots of interesting details about about how to calibrate them and improve their accuracy (they can be sensitive to change of relative humidity).
    There are many similar low cost network around the world. Most of them are built around the PMS5007 (from Plantower)

        1. You can get some pretty good measurement from a regular smoke detector. See this for example: berkeleyair.com/wp-content/publications/UCB-PATS_Specifications.pdf
          But the sensor in the article (or the PMS5003) are Particle Counter (they count individual particle) not photometer like in the smoke detectors who detect a bunch of particle at the same time. So the particle counters can usually detect much lower concentration.
          They also are active (they draw air), smoke detector are usually passive.

    1. These types of sensors are used in aspirated (forced air sampling, or active) smoke detection systems.

      This may not be the same sensor, but it is of the same type and may be useful in that application. I am actually looking to get one of these to play around with for the same purpose.

      The neat thing with aspirated systems is that you can use piping systems to sample the air in zones in a large area like a datacenter, or in the case of a home rooms vs floors.

    1. Yes. The title is very misleading.
      Whilst the article is interesting and shows what the sensor is capablel of and the pre-exisiting resource for it, the title should have been:
      Talking to the ZH03B particle sensor

      I was expecting a hack potentially showing how to improve the results the sensor produces, or something equally “hacky” that it doesn’t do out of the box.

      Here is a nice article on how to use it with arduino and code:
      Long overdue getting one of these and controlling my air filtering hepa fan with it.
      But backlog etc…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.