How to Build a Portable, Accurate, Low Cost, Open Source Air Particle Counter




Introduction: How to Build a Portable, Accurate, Low Cost, Open Source Air Particle Counter

I'm a grad student at UC Berkeley in the Hybrid Ecologies Lab.

This is the first Instructable in the series: How to Make, Calibrate, and Test a Portable, Accurate, Low Cost, Open Source Air Particle Counter. The second installment, How to Build a Test Chamber for Air Particle Sensors, can be found here. The third installment, How to Build a Monodisperse Particle Generator for around $300, can be found here.

This is a project by Rundong Tian, Sarah Sterman, Chris Myers, and Eric Paulos, members of the Hybrid Ecologies Lab at UC Berkeley.

One of the most harmful airborne pollutants with respect to human health is particulate matter. Airborne particles with a diameter of less than 10 microns (PM10) pose an especially large risk: they can travel deeply into the respiratory system, causing a variety of cardiovascular and respiratory diseases.

Combustion (e.g. burning wood; automobiles) can generate particles less than 2.5 microns in diameter (PM2.5). Between 2.5 and 10 microns are particles such as dust, pollen, and mold. (More information about particulate matter can be found here.)

While there are many devices currently available on the market that attempt to measure particulate matter, we wanted to make something that is simultaneously accurate, small, portable, low cost, and open source.

We call our sensor the MyPart.

Step 1: Design Goal: Accuracy

The plot shown is for a smoke test inside of our test chamber, where the concentration was allowed to decay naturally over ~2 hours. We see very good correlation against the MetOne HHPC-6 (a $5000 instrument), and also between the 3 MyPart prototypes.

Additional experiments were conducted with calibration particles of known sizes, as well as in outdoor ambient environments. For more in depth information about the tests we conducted, please see

Step 2: Design Goal - Size/portability

The overall size of the inner sensing chamber is 18mmx38mmx45mm. These dimensions include an onboard 400mAh battery. The components related to the sensing are completely separated from the outer casing, which allows various form factors to easily be explored, developed, and shared.

The MyPart sensor consumes ~2mA while sleeping, and ~70mA during sampling.

Step 3: Design Goal - Cost

The total cost for the bill of materials is around $75. Granted, this doesn’t take into account the digital fabrication tools required to make the components (3D printer and CNC mill), or the time required to assemble a full device.

The BOM prices for electrical components are listed for quantities of 1 or 2. These prices drop dramatically when purchased in bulk. If you are making a small quantity of devices, many of the ICs (ADC/LDO/OP Amp/Humidity sensor) can be sampled from TI for free.

One major source of cost is the precertified microcontroller module (RFduino). The tradeoff is that for small volumes, the design and hand assembly of the PCB becomes much simpler.

Step 4: Design Goal: Open Source

All of the original design files/source code can be found here. We hope that the MyPart will give people the base from which to make and modify their own sensors, to set up sensing in their own communities, and to generate reliable air quality data. There are still many improvements that can be made to this sensor, but we hope that this project will act as a starting point for individuals and communities to actively engage with air quality.

Step 5: High Level Overview

How does optical particle counting work?

A laser and photodiode are arranged orthogonally such that the focal point of the laser is located directly above the photodiode. A small fan draws air through the system and across the photodiode. Particles in the air stream that intersect the path of the laser scatter light onto the photodiode; the resulting voltage signal from the photodiode is amplified by an operational amplifier circuit and sampled by a micro-controller. Peaks in the resulting waveform correspond to particles crossing the photodiode, and can be counted. The amplitude of the peaks can be used to roughly approximate the size of particles (higher peaks correspond to larger particles).

What does each part do?

  • Top air channel - Contains the main flow channel, a light trap for the laser light, and the air inlet.
  • Bottom air channel - Contains features to hold the fan, and the air outlet
  • Analog cap - shields the sensitive analog circuitry from ambient light
  • Fan - pulls air through the channel
  • Laser - focused light source to illuminate particles in the airstream
  • Laser holder - aligns the laser to the photodiode

Design goals

Many of the features on the mechanical flow channel and case are designed to minimize the amount of ambient light leakage and promote 'smooth' airflow through the channel. In addition, the laser should be well aligned with the photodiode, and the overall size was iterated on heavily to maximize the packing density of the components. For more information, please see


Optical scattering: The quantity and direction of light scattered by a particle is dependent on the size, composition, and shape of the particle, as well as where it strikes the laser beam. Because of these factors, accurate sizing of particles tends to be difficult with optical scattering sensors. However, rough size cutoff bins can still be produced by using the amplitude of signal peaks.


The mechanical components were designed in Autodesk Inventor (free for anyone with a .edu email), the electrical schematic/layout was designed in Eagle, and the firmware was written using the Arduino IDE.

Step 6: Materials/Tools/Files

The full bill of materials can be found here. The fabrication files, as well as the original design files can be found here.


The mechanical components include ABS sheet stock for milling, self tapping plastic screws, and filament for 3D printing.


The more expensive items are the RFduino, laser, fan, and battery. Most of the ICs we used can be sampled from Texas Instruments if you have a .edu email. We sampled our op-amp, GPIO expander, low noise voltage regulator, humidity sensor, and the ADC from TI.


  • 3D printer (we used the Printrbot Simple Metal)
  • CNC mill (we used the Othermill)
  • Laser cutter
  • End mills (1/8th inch and 1/16th inch. check BOM for details)
  • SMD soldering supplies: iron/solder/flux/tweezers/etc..
  • 5 minute epoxy (optional: syringe for precisely dispensing epoxy)
  • Oscilloscope or logic analyzer
  • Adjustable power supply

Step 7: Fabrication and Assembly Preamble

All of the fabrication files can be found here. This includes the post-processed gcode for the Othermill, the STLs for 3D printing, and gerbers for a barebones PCB. A list of potential design improvements can be found here.

Step 8: Fabrication - PCBs

We got our circuits using the barebones quick turn service from Bay Area Circuits. However, a solder mask is highly recommended for easier soldering. Though it is possible, I would not recommend milling the board in house due to the high number of vias that may need to be manually through hole plated. A matte black soldermask would be ideal to absorb the most light, since the bottom of the PCB acts as the top of the air flow channel. For our sensor, we laser cut the PCB outline from black printer paper and used that as the 'soldermask' for the PCB.

In addition, another smaller PCB must be made to mate with the programming cable connector. We milled these boards in house.

Step 9: Fabrication - Mill All ABS Parts

The CNC parts include the top and bottom air flow channels, laser holder, and an eccentric cam lock to help with gluing the laser. The top air channel is milled from the 3/8in ABS, and all other parts are milled from the 1/4in ABS. The post-processed gcode for the Othermill can be found here. For postprocessing to other CNC machines, or tweaking with the toolpaths, the CAM files are in this directory.

Step 10: Fabrication - 3D Print the Case

This includes a ‘light shield’ for the analog portion of the circuit, the main body of the case, the lid, and a small button. For desktop 3D printers, we recommend printing in PLA for minimum warping/splitting.

  • For the light shield, we recommend printing at 100% fill using black PLA for maximum ambient light rejection.
  • There are currently four case designs: carabiner, wire loop, side mount, and bottom mount.
  • Only the side and bottom mount cases have a slot for the FPC cable that can be used to control the sensor from a computer.
  • Additional cases can be created by modifying the MyPart_V0_Cases.ipt file.
  • The small button can be printed from a white filament, so that the indicator light underneath it can show through the case. Alternatively, a more opaque color can be used, and a small hole drilled into the button to let the light through.

The prints may need some cleanup depending on the printer you are using; more details will be provided in the assembly instructions. We tested our device using black PLA for all of the case components. Other colors for the case and lid can be used, though they might need a coating of mirror spray/spray paint on the inside to be more opaque. Other colors have yet to be tested in our outdoor evaluations.

Step 11: Assembly - Mount the Laser

In this step, we will use the PCB to align and glue the laser assembly. This step should be easier if the board has yet to be soldered, though we did it after soldering. At the end of this step, the laser will be glued onto the laser holder with epoxy, and will need 24 hours to fully set.

    1. Chamfer the holes that the self tapping screws will go into. (2 holes on the laser, center hole on the cam lock). This helps the screw find the hole, and also prevents the self tapping screw from raising a small bump on the surface near the hole. This can be done by hand with a countersink, or a D bit.
    2. Push dowel pins into the laser holder
    3. Place black construction paper on the PCB, and push the laser holder (with dowel pins) into the PCB. screw in 2 6mm self tapping screws.
    4. Take off heat shrink from back of laser (this will help us clear the corner of the air channel more easily
    5. Unscrew the front barrel of the laser to be roughly 3.5 mm distance between the front barrel and the back.
    6. Push the front face of the laser to mate with the laser holder. Assemble the cam lock onto the PCB using another 6mm self tapping screw. Use the cam lock to secure the laser onto the holder. The lock is slightly elliptical such that when it rotates, it will push the laser against the holder.

    Step 12: Assembly - Focusing the Laser

    Now that the laser is in place, we need to adjust its focus such that the focal point is directly above the photodiode. This can be done by screwing/unscrewing the front barrel of the laser. Bringing the two parts of the laser body closer to each other will move the focal distance farther away, and moving them farther apart will move the focal distance closer. (The thread pitch was measured to be roughly .35mm per turn.)

    If we were to make another batch of sensors, we would probably design a jig to help with the alignment. For now, follow these steps to manually adjust the laser focus:

    1. Power the laser with a power supply. Lower the voltage of the power supply until the laser light is very weak, and the point at which it is focused can be easily gauged by eye. For us, this voltage was 1.8 volts.

    2. Put a piece of white printer paper perpendicular to the laser beam. The spot size changes as the piece of paper is moved closer or farther away from the laser.

    3. Observe the spot size on the paper when it is positioned at the same distance before and after the hole for the photodiode. We want the spot size to be symmetric at these two positions. This will mean that the focus point is centered on the hole for the photodiode.

    4. Undo the Cam lock, and screw/unscrew the front lens of the laser to adjust the focal length. Lock the laser back in place again.

    5. Repeat steps 3-4 until the spot size is visually symmetric before and after the photodiode hole.

    6. At this point, the laser is ready to be glued. We used 5 minute epoxy to glue the laser to the ABS laser holder.

    7. A syringe is prefered for precisely dispense the epoxy. With the plunger removed, the two part epoxy can be dispensed into the syringe from the back and mixed using a thin rod. Alternatively, a toothpick (or similar) can be used to brush the epoxy onto the joint between the ABS and laser.

    8. Wait 24 hours for epoxy to set.

    Step 13: Assembly - Solder the PCB

    After the epoxy has set, remove the laser assembly from the PCB.

    Following the Eagle layout, solder all the components onto the board.

    Some things to note:

    • A solder stencil is recommended, but we were able to solder each board by hand in 2-3 hours.

    • The photodiode should be soldered as quickly as possible since it is very heat sensitive.

    • The temperature/humidity sensor has no leads, and is difficult to solder. It was a little easier for us since there was no soldermask, and we could solder the pad of the device by heating up the trace leading up to it. Of the 3 sensors we made, all of them have fully functional temp/humidity sensors.

    Step 14: Assembly - Put the Air Channels Together

    1. Chamfer the holes for the self tapping screws.
    2. Put the fan in; it should drop in easily with very little resistance.
    3. Apply some double sided sticky tape to the outside pocket of the fan channel. This will help us with our wire routing.
    4. Tape the fan wires onto the bottom channel as shown. The yellow wire (a tachometer for the fan) was not used, and was cut off.
    5. This configuration provides strain relief for the wires, keeps them away from the antennae, and helps with our wire routing.
    6. While re-attaching the laser assembly, feed the laser’s wires through the bottom left hole of the PCB.
    7. Stack the top channel, bottom channel, and PCB.
    8. Put one 12mm screw through the hole next to the RFduino. We used a small plastic washer cut in half so that the screw would not directly push down on the RFduino.
    9. Screw in the other 12mm screw in the analog region of the board.
    10. Screw in the two 6mm screws. A washer is needed for the one of these screws to prevent shorting out the traces around the screw hole. If you have a soldermask, this will not be necessary.
    11. Attach the 400mAh battery to the back of the top channel with double sided tape.
    12. Place the wires from the fan and battery into the slot on the PCB.

    Step 15: Assembly - Solder Wires From Fan/laser/battery

    Solder the leads for the fan and laser. For the battery, solder temporary leads from the board so that power can be clipped on and off for testing. In the current PCB, the leads for the laser and fan are a little hard to get to, and may need some fiddling with tweezers.

    Step 16: Load the Firmware

    Using the Arduino software, follow these instructions for installing the RFduino libraries.

    Download the libraries for the I2C port expander, and the temperature/humidity sensor from the Github repo. A standard FTDI cable can be used to program the RFduino. However, a .1uF capacitor needs to be added inline to the DTR line. (reply #8) The official programmer from RFduino can also be used.

    Connect the cables from the FTDI to the small FPC adapter to the FPC connector on the MyPart. The firmware can now be loaded through the Arduino IDE.

    Step 17: Measure Analog Response

    We now need to find the noise floor for the analog signal. This can be found by turning on the analog components and the laser, keeping the fan off, and taping the inlet and outlet of the sensor so there is no airflow. When the fan is on, any peaks above the noise floor will be considered a particle, and binned based on the height of the peak.

    Solder temporary test leads to the test pins for analog ground, output of the transimpedance stage, and the final amplified output.

    Since the lid of the MyPart can’t be put on while test wires are attached, put the sensor under a cardboard or opaque plastic box to block ambient light. If you can, add a lip to the bottom of the box for the wires to pass under while still preventing light entrance.

    Attach the probes of a logic analyzer/oscilliscope to the test wires, and record the output.

    The output of the first stage should be around 0.2 volts. If the output is substantially higher, light may be leaking in. The output of the last amplification stage should be near ground as well, since the signal has passed through a DC block. The noise floors for two of our three devices was around 0.2V. For the third device, the noise floor was around 0.4V. One very important potential improvement is upgrading the analog front end for the sensor so it is more consistent and more noise immune. This seems like it would be a very good starting point.

    This stage one of the largest pain points. Some sort of a wire bundle or test probe jig would make this a great deal simpler. Ideally, the circuitboard will be inserted into the test jig, which will make all the test connections via pins and provide a light-isolated container. In this way you will not need to assemble the entire sensor before testing, nor solder on specific test leads, and the conditions will be controlled and repeatable.

    Step 18: Confirm Fully Operational

    When everything seems to work, the temporary leads for power can be removed. Clip off the JST connector from the battery, and solder the battery directly to the board.

    The battery can be charged through the micro USB port.

    Step 19: Put It in the Case

    1. Using a sharp XActo knife, remove any 3D printing artifacts from the case, analog cap, button, and lid.
    2. Mount the analog cap to the PCB by removing the 12mm screw on the USB port side of the board, aligning the analog cap with the board, and re-fastening the 12mm screw.
    3. Check the fit of the lid with the PCB and analog cap around the entire perimeter of the lid/PCB. The outer rib of the lid should sit flat along the PCB.
    4. Because some of the features are at the limit of sizes that can be accurately resolved with a desktop 3D printer, some additional parts may need to be cut off with an XActo knife for step 3.
    5. Slide the air channel/PCB assembly into the case. This sensor should be able to slide in and out the case with very little resistance. Double check that the wires are not snagged on the side of the case, and that all extra bumps/strings have been removed from the case.
    6. Push a small length of 1.75mm filament through the smaller hole on the button. I was able to get the filament in relatively easily by cutting the tip of the filament at an angle to help guide it through the hole. Pliers may be required.
    7. Trim off all excess on the side with the button that protrudes through the case
    8. Trim off excess on the other side, leave roughly 1 mm. Since the 3D printed button is directly above the LED, this protrusion off to the side allows the 3D printed button to press the actual button on the PCB.
    9. [optional] Use the shims to secure the sensor to the case. Place 3 shims in the locations indicated.
    10. Place the button onto the lid, and place the lid onto the case. The lid should snap nicely into the case.

    Step 20: Testing

    At this point, the sensor should be able to give relative particle counts.

    The code can be modified to map the values to the RGB LED, or broadcast over Bluetooth to a mobile phone.

    To test and calibrate your sensor(s) against a reference instrument, we recommend building a test chamber to collect lots of data across a broad range of particle concentrations. The instructions for building a simple chamber from a ‘weather-tight’ storage bin can be found here.

    Using this chamber, we can test with smoke, as well as calibration particles of a known size. For a more in depth description of the tests we conducted using this chamber, please see:

    Step 21: Future Improvements

    Many potential improvements can be made to the sensor. Some highlights are below, and the full list can be found at


    • More sophisticated/less noisy analog circuitry. Maybe something along the lines of:
    • More sophisticated particle counting scheme. The same link above has information about this as well.
    • Reroute placement of leads for the laser and fan. They are currently in places that are difficult to solder.
    • Microcontroller IC on board rather than pre-certified module.

    Other thoughts

    • Adaptive sampling? (sample more when particle concentration is low to get a better reading), sample less when it is extra high) - optimizing for accuracy/power consumption.
    • Fully laser cut assembly for the air flow channel? Since most features are straight extrusions.

    Be the First to Share


      • Colors of the Rainbow Contest

        Colors of the Rainbow Contest
      • Go Big Challenge

        Go Big Challenge
      • Make It Modular: Student Design Challenge

        Make It Modular: Student Design Challenge



      Question 1 year ago

      Could you please give the link or files of the Electrical Drawings and Schematics of the sensor circuitry?


      Question 2 years ago on Step 21

      please help me, I did not understand the logic of the program, how do you count and divide the size of the particles? (you can also explain it with a flowchart)
      pin c6 (mosi) which function does it perform?


      Question 3 years ago

      This is a great project, what is the maximum concentration you could detect with this module?


      Question 4 years ago on Step 8

      Could you please give the link of pcb, that is it's components and circuit diagram.


      Question 4 years ago

      I am interested in particle size cuts different from the typical 2.5 um and 10 um. Is there any theoretical information you can share regarding modification of flow channels to achieve larger size cuts? Thanks.


      Question 4 years ago on Introduction

      Hi there, I was wondering if the PCB is able to be etched instead of using the circuit board gerbers, as we dont have access to a circuit board printer?


      Answer 4 years ago

      Definitely possible, but difficult. If you're planning to etch the PCBs, the hardest part will be drilling and through hole plating the vias. There are many tiny vias, so it could be difficult to drill them all accurately by hand. Through hole plating may be tricky too, since the board needs to lie flat against the mechanical components. If it's an option, you could send the boards out to fab at somewhere like OSH park, and while you wait, try etching the boards in house.


      Answer 4 years ago

      Oh I see. If you have a spare PCB, would it be possible to purchase one from you?


      Answer 4 years ago

      I still have a some extras and I can send you a few. No need to purchase. Send me an email and we can work out the details!


      Answer 4 years ago

      Sorry for the delay! No worries in the end we managed to access a PCB printer but now are having trouble figuring out where abouts each of the components actually lie on the PCB board – I had a look at the circuit schematics in Eagle but I cant make any sense of them and was wondering if it was possible for you to send a high quality image of where all the circuit components are on the circuit board? Thanks once again!


      Answer 4 years ago

      Great thankyou! Is there some way to see the circuit layout from the circuit gerbers?


      5 years ago

      Hey Man. Wonderful project. I myself am a grad student at SRM University, India. Im adopting your idea for my final year major project. I have various doubts though. Is there any way i can contact you, like facebook or whatsapp or skype. Would be soo helpful to me and my batchmates.


      5 years ago

      Excellent! Thank You.


      5 years ago

      This project has the potential to grow far beyond this prototype. The accuracy is already pretty good, the cost fairly low and the overall design solid.

      If you want people to build upon this you should release the schematic and a mechanical drawing in pdf format. It would be also good to know why these are the components you've chosen and what their important key parameters are.


      Reply 5 years ago

      Thanks! Do you mean the schematic and mechanical drawing for the circuit board? All the original design files (circuit board, mechanical design of the sensor, firmware) are on github, but no pdfs yet of the mechanical drawings. Some of the design rationale have been posted here, but they are mostly on the mechanical design. 


      Reply 5 years ago

      Yes, this is exactly what I meant. There are plenty of PCB design tools and I don't want to install all of them just so I can read the files somebody uploaded.


      Reply 5 years ago

      pdf of schematic and image of layout updated. They are in this directory:


      Reply 5 years ago

      Thank You, this is perfect!!


      Reply 5 years ago

      yes please for schematic in pdf format

      Tecwyn Twmffat
      Tecwyn Twmffat

      5 years ago

      Impressive! Definitely worth having "Microcontroller IC on board rather than pre-certified module" - should not be too difficult.