element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
In the Air Design Challenge
  • Challenges & Projects
  • Design Challenges
  • In the Air Design Challenge
  • More
  • Cancel
In the Air Design Challenge
Blog In-the-Air-Challenge: Dust counting with Beagle Bone Black and a webcam
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: janisalnis
  • Date Created: 7 Dec 2014 12:40 AM Date Created
  • Views 1674 views
  • Likes 4 likes
  • Comments 7 comments
  • in_the_air_design_challenge_2014
  • school_air
  • in_the_air
Related
Recommended

In-the-Air-Challenge: Dust counting with Beagle Bone Black and a webcam

janisalnis
janisalnis
7 Dec 2014

Previous post: In-the-Air-Challenge: Air Quality Sensor Box

Next post: In-the-Air-Challenge: A sheet of laser light for 2D visualization of dust flow

 

Roadtesters for In-the-Air-Challenge received fom Element14 a free Beaglebone Black (BBB) microcomputer with Angstrom Linux on internal 4 GB flash. It has one USB port, where one could connect a HDD and make low power consumtion server for IoT data storing.

 

Dust particles in air scatter light when illuminated by a powerful LED or laser, floodlights or flashlight.  I have done dust counting in webcam images on a Windows PC using LabVIEW. I wanted to give a try and use  BBB for that purpose.  Particle identification and counting on BBB I planned to do using OpenCV. While OpenCV is ready to use in Processing on a Windows PC, it appeared that one needs to compile OpenCV for BBB and it could take hours and result with some error code meaning that your day has been wasted. Another approach could be used to send pictures from a BBB to a Windows server that is doing image processing and particle counting.

 

Home-built airborne particle counter using image processing

 

From your childhood probably you remember seeing dust flying around in a room in sunny days. Nowadays one can see dust flying in a dark room using a mobile phone LED. Physicists distinquish several types of scattering. Sky is blue because of Rayleigh scattering from air molecules that are smaller than the wavelength of light. Blue light is scattered more than red. Mie scattering is from particles comparable to the wavelenght of light. Unlike Rayleigh scattering Mie scattering is not strongly wavelength dependent. Geometrical scattering occures from larger particles.

 

About a year ago we vave installed a HEPA cleanroom box in a university optics lab and wanted to know if it really helps to filter air. Commercial cleanroom airborne particle detectors use a laser, cost thousands and can get polluted if used in dusty rooms.

 

I had a 1W output 445 nm blue laser diode lying around and togather with my student gave a try. LED would be better to use thinking about eye safety. Light output from a 10W LED measured with a laser power meter was 0.25W. So 10W is the electrical power, not the optical. In the case of laser diodes 1W is optical power and consumed power is just 2W. Laser diodes are more efficient than LEDs and can be focussed much tighter visualizing smaller dust.

 

image

We directed laser light into a darkened chamber and recorded scattered light from dust with a webcam. Using image processing tools allows to count the number of particles in air and determine their size from the scattering intensity. The light beam has to be terminated on a bent dark surface without causing too much scattering from surface. We used LabView 2012 for image processing. LabView .vi file is attached to this post. Camera lens was defocussed, to make circle detection easier.

image

 

We can clearly see increase of particle count after dry sweeping the room. 50 particles/cm3 is actually 50 million/m3. Quite a lot!

Inside a cleanroom flowbox after a HEPA filter air is clean. Recently Electrolux has started to use HEPA13 class filters stopping 99.95% of particles in vacuum cleaners keeping air fresh after cleaning.

There are also mechanical wirpool filters, electrostatic filters and active coal filters. Latest can remove cigarette smoke odor. Odor molecules are smaller than dust but larger than air molecules.

 

image

image

 

 

We got some limitations. Camera frame rate of 15 fps was not enough and when some air flow was present particles smeared out from circles into lines. Smearing into lines was more pronounced when using a macro lens because  particles quicker crossed the small field of view. But macro lens was esential to be able to see small size particles. I would say that human eye is still superiour to a webcam.

 

 

First steps with BeagleBone Black

 

The BeagleBone Black is relatively well described in Internet, so I only will write down some short notes:

Plugged into a USB appears as a SD disk. Installed drivers from the SD disk.

In Windows7 Device manager "cdc serial unknown" device still appears but it seems not to be  a problem.

 

Surprise: Could open in a webbrowser site 192.168.7.2  Cool! BBB acts like a USB network card.

 

Next will continue with terminal connection from Putty ssh  192.168.7.2  Default login: root  pass: <none>

Most things are like on regular Linux PCs.

Header 1Header 2

df -h

Size  Used Avail Use% Mounted on

rootfs  3.4G  1.5G  1.8G  45% /

free

shows ram usage

ps -ef

shows processes, among other also apache2 webserver running

ls /dev

shows watchdog present

top

shows processes running

uname -a

Linux beaglebone 3.8.13-bone47 #1 SMP Fri Apr 11 01:36:09 UTC 2014 armv7l GNU/Linux
dmesgshows boot log
passwdsets password
ifconfigshows that there is an active network connection over usb
nano /etc/network/interfaces
ping google.comedit network settings
ntpdate -b -s -u pool.ntp.orgtime server

 

 

USB Wi-Fi donge to BBB Angstrom (no success)

 

Cable ethernet started to work after uncommenting lines in /etc/network/interfaces.

 

Wi-Fi setup described here:

https://learn.adafruit.com/setting-up-wifi-with-beaglebone-black/configuration

Connected external 5V power. Plugged in a USB Wi-Fi donge.

 

lsusb

Bus 001 Device 005 ID 7392:7811 Edimax Technology Co Ltd EW-7811Un 802.11n Wireless Adapter[Realtek RTL8188CUS

 

dmesg

[ 1065.852675] rtl8192cu 1-1:1.0: usb_probe_interface

[ 1065.978194] rtlwifi: wireless switch is on

 

iwlist scanning

shows Wi-Fi networks around

 

nano /etc/network/interfaces

--------------------------------------------------

auto wlan0

  iface wlan0 inet dhcp

  wpa-ssid "essid"

  wpa-psk  "password"

--------------------------------------------------

/etc/init.d/networking restart

iwconfig

ifconfig

 

Alternative:

ifconfig wlan0 up

iwlist wlan0 scan

iwconfig wlan0 essid Wifi2Home key s:ABCDE12345

dhclient wlan0

 

ping google.com

PING google.com (173.194.71.139) 56(84) bytes of data.

64 bytes from lb-in-f139.1e100.net (173.194.71.139): icmp_req=1 ttl=44 time=75.5 ms

 

I managed to connect only to password protected networks. Not to the open networks.

 

 

OpenCV image processing with BBB Angstrom (no success)

 

apt-get update

apt-get install OpenCV

E: Unable to locate package OpenCV

 

https://solarianprogrammer.com/2014/04/21/opencv-beaglebone-black-ubuntu/

 

It appears that thing is not so easy.

https://help.ubuntu.com/community/OpenCV

One needs to download OpenCV source code and to compile it takes 10 hours. It is a crazy long time. After waiting some hours got got make: *** [all] Error 2

Was no more space left on 4 GB. It is much easier in Processing on a PC. So I probably will not use OpenCV and make my own C or Python code to find dust spots in a picture.

 

 

Debian

Tried Debian. Flashed Debian transfer image from a 2GB card to emmc.

http://derekmolloy.ie/write-a-new-image-to-the-beaglebone-black/

During transfer external 5V power is needed.

Same Wi-Fi problems. Could not get it working. Probably I have an unsupported adapter.

 

 

Webcam and Ramdisk

 

Plugged in a USB webcam Logitech C270.

It appeared in ls/dev as video0

 

Next installed fswebcam programm to take photos

apt-get install fswebcam 

cd /tmp  # this is RAM 

fswebcam --device /dev/video0 `date +%y%m%d-%H%M%S`.jpg 

A .jpg file should should appear.

 

 

Next would like to store photos in a www directory to be able to see them over webbrowser. Usually Linux PCs store webpages here:

cd /var/www

But it is empty directory. Let's make a test html file.

 

nano index.html

<html>aaaaa</html>

chmod 777 index.html

 

Apache2 at port 80 is displaying Beaglebone page. So we need to look in settings how to display our page..

Apache2 settings are here.

cd /etc/apache2

I did not change them as read there that port 8080 is an alternative page.

 

Our test webpage should be displayed at

http://192.168.7.2:8080/

 

Lets make a Ramdisk under /var/www for storing webcam picture so that flash does not get weared out.

And add a line in fstab that Ramdisk gets mounted on the boot.

 

mkdir /var/www/tmp 

nano /etc/fstab 

tmpfs /var/www/tmp tmpfs size=10M,mode=0755 0 0

reboot

 

df -h    # shows that we have now a 10 MB ramdisk at /var/www/tmp

 

Filesystem  Size  Used Avail Use% Mounted on

rootfs      3.4G  1.7G  1.6G  51% /

tmpfs        10M    0  10M  0% /var/www/tmp

 

Now let's take a test photo.

cd /var/www/tmp/

fswebcam --device /dev/video0 -r 800x600 current.jpg

A picture appeared in
http://192.168.7.2:8080/tmp/current.jpg

 

image

The problem is that fswebcam programm compresses image to jpg. And quality goes down. Dust is much less visible than in uncompressed image.

It is possible to upload the photo file to a server where a mobilewebcam.php script  saves it:

     curl -F userfile=@/tmp/current.jpg asi.lv/alnis/webcam2/mobilewebcam.php

 

UVCCAPTURE

 

Tried to use another webcam programm.

 

apt-get install uvccapture

uvccapture -v -t1 -B148 -S128 -C32 -G4  -q90 -o/var/www/tmp/test.jpg

uvccapture -v -m -t1 -B96 -S32 -C32 -G16  -x640 -y480 -o/var/www/tmp/test.jpg

 

Using videodevice: /dev/video0  
Saving images to: /var/www/tmp/test.jpg

Image size: 320x240

Taking snapshot every 1 seconds

Taking images using mmap  

Setting camera brightness to 148

Setting camera contrast to 32

Setting camera saturation to 128

Setting camera gain to 4

Saving image to: /var/www/tmp/test.jpg

 

width=640 height=480 interval=4 output=/home/httpd/webcam.jpg capture=/usr/local/bin/capture.sh

uvccapture -v -m -t1 -B96 -S32 -C32 -G16  -x640 -y480 -o/var/www/tmp/test.jpg

 

Picture was saved OK, but despite trying I could not get  highter jpg resolution than 320x240. Seems that there is a bug and uvccapture on BBB is presently pretty unusable.

 

 

 

Conclusions:

 

  • Nowadays it is possible to make a low-cost dust detector using a Beagle Bone Black board and a webcam togather with a diode laser.
  • Camera is similar to a human eye. With an eye clearly see dust flashes. Image processing allows to count dust particles in a photo.
  • Image recognition allows to see large changes in air pollution when  when a room is dry-swept.
  • Bringing eye close to beam reveals much more small dust. Camera needs magnification or macro lens to see small dust.
  • There is a huge number of small particles in air. They are not molecules. Something bigger. For example pollen, aerosols, viruses.
  • Camera needs to look at a small-sized light beam. In a broad beam there are so many particles in a field of view that they overlap and are impossible to count. Some particles 20 per frame ar OK.
  • In a focussed beam light scattering intensity is higher and disturbing background is less.
  • Camera at 15 or 30 fps is quite slow and air velocity should be low. If air flow is fast then the dust tracks smear out and appear as lines. Then image recognition of circles does not work anymore.
  • Solution would be a strobe flashlight or pulsed laser or LED. I tried once and ended up with a burned out laser diode.

 

 

After spending a couple of weeks on BBB and  image processing I decided to try out a classical dust counter approach with a laser and a photodiode. Please see the upcoming blogposts.

 

Attachments:
Dust in air counting by image processing.zip
  • Sign in to reply
  • janisalnis
    janisalnis over 10 years ago in reply to Kilohercas

    Hello Linas!

     

    Thanks for your interest.

    I added a screenshot of Labview screen to the blogpost and attached a LabView vi file used to count particles.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • janisalnis
    janisalnis over 10 years ago in reply to amgalbu

    Hello!

     

    I have not learned how to callibrate particle size yet.  I am more interested how much air filtering helps.

     

    Mie scattering happens for particles larger than wavelength of light. Light wavelength is 0.5 um...1 um.  Rayleigh scattering allows to see particles smaller than light wavelength. Rayleigh scattering is stronger for blue color than red.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • janisalnis
    janisalnis over 10 years ago in reply to michaelwylie

    Hello!

     

    I have no way yet to callibrate particle size. Probably would need to compare with some commercial detector.


    I tried now a 10W LED as a light source. I can see dust by eye but not very well by a webcam. With a narrow laser beam dust particles are much more visible using a camera. And it makes difference if a 50 mW or 1W laser is used. If a 532 nm laser is used one could put 532 nm interference filter in front of camera to suppress ambient light.  As a beam dump for laser I am using 30 rasor blades stacked todgather. The knife edges make light go in and it does not come out. 


    Webcamera needs a macro lens as dust particles are small. Macro lens is larger than webcam lens and collects more scattered light. Such lenses can be bought on Ebay for Iphone: "3-in-1 Universal 180°Fish Eye Fisheye & Wide Angle & Macro Lens for iPhone 4s"



    Found some nice links.

    Photographing airborne dust:

    http://woodgears.ca/dust/photograph.html/

     

    Measuring dust with a Dylos laser air quality monitor:

    http://woodgears.ca/dust/dylos.html

     

    Recently a scientific article was published about home-made dust detector with a photodiode:

    http://aqicn.org/aqicn/doc/a-low-cost-instrument-for-environmental-particulate-analysis-based-on-optical-scattering.pdf

     

    Photographing under a microscope laser printer toner shows that toner particles are below 2.5 um:

    http://woodgears.ca/macro/index.html

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • amgalbu
    amgalbu over 10 years ago

    What is the actual size (in micron) of the particles you can detect with your device?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • michaelwylie
    michaelwylie over 10 years ago

    Any idea on the smallest size particle that can be detected?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube