Skip navigation

In the Air Design Challenge

11 Posts authored by: janisalnis

Previous post: In-the-Air-Challenge: Air filter checking with a home-built laser+photodiode dust counter

Roadtest winners: http://www.element14.com/community/community/design-challenges/in-the-air-design-challenge/blog/2015/03/17/in-the-air-de…

Community vote: Community Choice Poll - In the Air Challenge


Although invisible, air is the most important in our lives. We can survive days without food and water, but only minutes without breathing. So we should consider air quality seriously.


It was a great pleasure to participate In-the-Air-Challenge organized by Element 14 and supporting companies.

Compared to the previous roadtests this was a difficult contest as three kinds of microcontroller development boards were supplied.

Challenge was intended towards programming of internet connectivity of microcontrollers, and Farnell shop does not contain large variety of sensors that could be bought.

Blogging appears to be the most efficent way to summarize results online. Element 14 blog is very nice as people can post questions and visitor count is also displayed.


In-the-Air Challenge:  Texas Instruments MSP 430 FR5969 launchpad

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

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

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

In-the-Air-Challenge: Spending the 500 USD parts budget

In-the-Air-Challenge: Measuring CO2 levels during lectures with EXTECH CO2 monitor

In-the-Air-Challenge: Exploring internally NDIR CO2 monitor

In-the-Air-Challenge: NDIR CO2 meter connected to IoT via TI CC3200 Wi-Fi connectivity board

In-the-Air-Challenge: Laser-based dust counter using a photodiode, IoT connected

In-the-Air-Challenge: Air filter checking with a home-built laser+photodiode dust counter

In-the-Air-Challenge: AirSchool Project Summary


Multisensor box

I have built a box that included many cheap sensors: temperature, humidity, light, sound, air pressure, dust sensor from Sharp and electrochemical CO2 sensor. It was assembled for test of air quality in school during classes and showed that it is important to open the window  during breaks. Probably graphing data is not so essential and it would be enough to just indicate with LEDs if air is good, normal or poor. Two school students wrote their scientific report in physics about air quality sensing and presented it at school. They got promoted to a regional contest.

 

IMG_3988.JPG        dustCleaning room.png

 

 

CO2, infrared

Large part of roadtest budget was spent to acquire infrared CO2 detector. That is more precise than electrochemical. I interfaced it to the IoT and measured air quality at office and during meetings. As IoT provider I used Xively, the one that I had learned to use previously. AirVantage seems to be more complicated to get started with.

 

co2.png    co2.png



Dust detector, laser based

In one blog post  I demonstrated how to set-up Wi-Fi and webcamera on a Beagle Bone Black and it could be used to take pictures of dust flying through a laser beam. Such pictures could be sent to a server for image processing using for example LabVIEW. It appears that we swim in an ocean of dust of up to 50 particles/cm3 beig equivalent to 50 Million in a m3. For humans most dangerous are particles in the 1...10 um size that get stucked in the capillaries of lungs. Only HEPA rated filters can stop small dust. HEPA filter gets visually dark after a month. It is also nice to be able to measure particulate matter content outside the window in the city and not to depend on data from govermental agencies reporting in the newspaper just the average situation.

 

Laser-based dust counter that I constructed using recently available high-power blue diode laser makes it more sensitive for detection of smaller dust. This dust counter helps also my university carier as we got presentation about laser particle counter accepted in EuroNanoForum conference that wiill take place in Riga in June 2015. I was contacted by a nanosensor-on-a-chip company Applied Nanodetectors with offer to collaborate in interfacing their sensors to the IoT.

IMG_4093.JPG

dust in the lab.png

 

My former Swedish boss Prof. Sune Svanberg, a great expert in optical atmospheridc pollution measurements, was complaining that the sad thing is that one could only measure pollution, but not actually improve the air. So I am happy that this time could improve the air using HEPA filters. I have now an Electrolux anti-alergy-bag on the air inlet of the lab and sliced plastic film sheets covering the door isle and preventing dusty air to come in. Result is 10-fold decrease of dust content in the room.


 

 

 

 

 

In summary, here are all the devices built.

musu sensori.JPG

We have presented work done at COST EuNetAir workshop in Riga March 26-27, 2015. Presentation is attached.

Students have written their science project about air quality. Their work is attached (in Latvian).

Previous: In-the-Air Challenge:  Texas Instruments MSP 430 FR5969 launchpad

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


I bought three CO2 sensors and Arduino-nanos and gave one to high school students and one to  my collegue Ilja Feschenko who designed a great-looking electrochemical CO2 sensor box using SolidWorks and printed it on a 3D printer. There is USB output to a PC and a line with color LEDs. Simple LED indication is particulary suitable for checking air at home during nights. It is powered from external 9V supply and contains a miniature fan. After initial try Ilja saw that readings are temperatuire dependent and he actively stabilized the CO2 sensor temperature by an external heater transistor and a thermistor in Arduino PID loop. This decreased the temperature dependence, but there is still humidity dependence and warm-up time of hours. Ilja callibrated CO2 sensor against a commercial infrared photoaccoustic CO2 monitor.  High school students managed to make a setup on a breadboard, learned programming and averaging ADC reradings, but did not have time to make a box.

1.png  2.png  3.png


After digging into more scintific articles we understood that not only the air temperature but also air pressure has to be taken into account requirng to put more sensors into the box. And that is the story of the multi-sensor box described below that I built for In-the-Air-Challenge.

 



Here is a presentation of air quality sensor  to measure air quality in school classes. There are up to 30 students in a classroom. In winter windows are kept closed and air quickly deteriorates  without forced-air heat-recovery ventilation. Carbon dioxide (CO2) in air is responsible for tiredness. Dust and smog is a problem in large cities.  In winter might be too cold and in summer too hot and moist to feel comfortable. Knowing air quality might help teacher to optimize window opening.  Besides that it will play a large educational role teaching young people about sensors,  programming microcontrollers and Internet of Things.


IMG_3988.JPG

 

Idea was inspired by a sensor cube: http://habrahabr.ru/post/243669/ where all possible sensors were mounted in a plastic cube.  Probably  not all the existing sensors are needed at the same time. Commercial sensors exist: https://www.netatmo.com/. Here are the sensors that I decided to use:

  • CO2 concentration
  • Dust concentration
  • Air temperature
  • Air humidity
  • Air pressure
  • Sound level
  • Light level

 

Arduino micro pro is used because of small occupied space and availability of libraries for sensors and LCD.  Arduino is the microcontroller that school students who attend robotics club are familiar with. So they can modify the program.  Two-line LCD display displays sequentially 8 values from sensors. Values  from Arduino serial port are read on a PC by Processing 2.2.1 that is plotting data saving to disk and and uploading to the Internet of Things. Code is attached. I used a ready made library for IoT server Xively. Feed will not be available all the time: https://xively.com/feeds/1192364524

I tried bluetooth connection to a PC but it was unreliable and lost connection after several days. Idea was to run Processing scetch on an Android phone or tablet, but the sketch that run OK on a PC did not run on Android as Bluetooth serial port was named differently.


IMG_3996.JPG


Dust  sensor

Dust sensor GP2Y1010AU0F made by Sharp is sensitive to average dust level not for counting individual particles. There is a significant output offset from photodiode amplifier noise and from light scattered from the black sidewalls. This background has to be subtracted. Dust sensor feels when the room is swept  and the broom brings dust to air. It is very sensitive to (cigarette) smoke.

Sensor output voltage depends on supply voltage. In the datasheet calibration curve was showed for 5V sensor supply. When supplied from 3.3V the output signal is smaller. Internal IR LED is driven in pulsed mode 100 short pulses per second. This allows to have more light in IR LED emission peak as scattering effect is relatively weak.

Fan glued behind the sensor box is sucking air through the sensor. It is a 25x25 mm low noise (18 dB) fan operated from 5V with 100 Ohm resistor in series to reduce speed.  Visible dust layer accumulated on the propeller blades in a week.

Arduino 5V voltage from USB is not stable. It changes with USB connection at different PCs and wire length.  So I had to use a 3.3V LDO regulator (LM1117  with two 1uF blocking capacitors) that powers Sharp dust sensor and Arduino reference voltage.

 

dustCleaning room.png

Dust in air can be cleaned using HEPA filters. Such HEPA filters are used in industrial and research cleanrooms, hospital surgery halls and airplanes. HEPA13 class  filters are used in Electrolux dust cleaners stopping 99.95% of dust. When using such dust cleaner the room air stays pleasant after cleaning and there is no fine dust smell in the air. Electrostatic filters pose an interesting alternative.



CO2 sensor


CO2 is a greenhouse gas and it's concentration has increased from 300 to 400 ppm in last 70 years. See graph at co2now.org

Carbon dioxide (CO2) is responsible for tiredness. So we probably feel more tired than 70 years ago. Inside lungs CO2 concentration is up to 4%. If ambient air contains more CO2 we are breathing more frequently.


Among electrochemical sensors CO2 sensor is relatively expensive ca 30 USD because it contains gold and platin. Parallax CO2 sensor board with 7.67x preamplifier uses the CO2 gas sensor module  MG811. In electrochemical sensors the gas diffuses into the sensor, through the back of the porous membrane to the working electrode where it is oxidized or reduced. This electrochemical reaction results in an electric current that passes through the external circuit. There is no indication of sensor life-time in the data sheet. From comparison with a photoacoustic gas analyser got formula

ppm=346.3+581290*pow(2.718, -0.02387)*x


I have placed CO2 sensor board inside the air quality box after the dust sensor fan.

CO2 sensor needs 6V for the internal heater. It is more practical to to use a  step-up regulator to raise USB voltage than an external power supply. I wanted to  use some of the multitude of inductor coils donated by Wurth Elektronik for the Air Challenge, but found on Ebay cheap step-up modules. So I step up the USB voltage to 8V that is sent to CO2 sensor board. 8V is supplied also to the 3.3V LDO. CO2 sensor draws relatively much current and USB voltage drops to 4.2V not enough for 3.3V LDO.

 

Voltage from the CO2 sensor decreases with increasing CO2 concentration. CO2 sensor output voltage also strongle decreases with increasing temperature which is unfortunate artefact. CO2 sensor temperature is measured by 1-wire DS18B20 sensor taped with aluminum tape to the CO2 sensor. In principle, one would need to implement active temperature stabilization of the sensor. Electrochemical sensor output voltage is quite unreliable at small CO2 values. CO2 sensors need burn-in time 12-24 hours to dry the moisture accumulated inside the sensor.

 

Calibration could be done using 100% CO2 from sparkling water and further  diluting it with normal air. If a water tank is used to measure volume there should be oil layer on the water surface as CO2 dissolves in water.

 

Better would be to use near infrared CO2 sensors, for example, Telaire 6613 CO2 Module 400...2000 ppm, 50ppm or 5% . Or T7000 Series Handheld Indoor Air Quality (IAQ) Monitor sold by Farnell.

 

 

Measuring pollutant concentrations in ppm and ug/m3

 

Part per million (ppm) means parts per million. 1ppm is one pollutant molecule among 1 million air molecules.

ppm is a mixture ratio that does not change in mountains where the air pressure is low due to high altitude. ppm value does not change with gas temperature. When ppm is specified in sensor datasheet it is assumed that sensor is at normal conditions 25 deg.C and 1000 mbar.

 

Chemical sensors and living organisms sense number of molecules that enter the volume and ug/m3 concentration units are more practical to use. ug/m3 value is sensitive to ambient pressure. (Imagine that if the measurement volume was evacuated then there would be no signal at all). So ug/m3 value needs to be corrected for ambient pressure. ug/m2 needs to be corrected for temperature as well. Concentration n enters ideal gas law equation

pV=nkT,

where p is pressure, V is volume, n is concentration, k is Boltzman’s constant and T is temperature in degrees Kelvin.

At elevated temperature molecules move faster and push other molecules further apart. Intermolecular separation increases and there are less molecules in a volume unit.

 

Formulae how to convert ppm to ug/m3 are here.

 

In the sensor box C02 sensor generated voltage is measured together with the temperature of sensor’s enclosure and ambient pressure.

 

 

IMG_3993.JPG

 

Temperature sensors. In summer it gets quite hot inside. And one would need air conditioning. But summers in Europe are short so most buildings do not have air conditioning.  Digital temperature sensors DS18B20 provide 0.125 deg. C resolution and can be connected in parallel at 1-wire data line. One sensor is taped to the CO2 sensor and the second sensor measuring room temperature is outside the sensor box.


Humidity sensor Honeywell HIH5031 produces linear output voltage proportional to humidity, minus some DC offset. According to a datasheet slope is quite linear, but has a 2% hysteresis at 25C. Air humidity is important to know not only in school class but also at home in bathrooms, kitchens, basements. High humidity values can cause appearance of mold.


Air pressure sensor BMP180 is extremely tiny and very sensitive pressure sensor with 0.1 mbar resolution. Output can be compared and coincides well with actual meteorological data. Besides pressure it includes also a temperature sensor.


Ambient sound level is measured by amplifying microphone signal and sending with a diode to a capacitor with 10s time constant. You can find circuit here: http://www.instructables.com/files/orig/FB6/Q5DZ/H1QMLEJ0/FB6Q5DZH1QMLEJ0.pdf


Photodiode allows to monitor indoor light use in winter time and count sunny hours. It is reverse biased from 5V and loaded with 10 k resistor. In principle it would be better to use logarithmic digital light sensor from SiLabs as illumination changes by several orders of magnitude in sunny conditions.

 

 

 

Complications

 

Tight packaging of many sensors in one box caused some contradictions.

  • It gets warm inside because CO2 sensor heats up to +40…+50C. So the room temperature sensor is placed outside the box at the end of 10 cm cable.
  • Humidity value is influenced by elevated temperature inside the  box.  So the humidity sensor is placed directly after the fan where air has not heated up yet.
  • Pressure sensor BMP180 might feel increased pressure inside the box by the fan. To cope with that the fan rotates at slow speed.
  • Fan produces some noise that is felt by the microphone that measures sound level. Fan is mounted on the dust sensor and that is glued not directly to the wall but via a rubber pad to reduce vibration transfer.

 

 

Prospects


It might be good to include bad-air sensor into the air quality box. However this sensor is more appropriate for restrooms and farms.

It might be good to use near-infrared CO2 sensor that would have much better long-term stability compared to electrochemical sensor.  NIR CO2 sensor is available at Element14 for ca 200 USD.

Could also add oxygen (O2) sensor for 200 $.

As a dust sensor it would be optimal to count dust particles illuminated by powerful1-10W LED or a laser. As it is visible by eye there are around 25 particles per cm3 or 25000000 per m3.  I will try to use Beaglebone with a webcam and image processing to count dust particles and size.

Could use a I2C controlled graphical  display, Nokia5110  84x64LCD or larger to graph the signals for the past hour(s).

Could add Wi-Fi connectivity and a rotary encoder to enter Wi-Fi credentials on the LCD display.

 

 

Window actuators

 

By measuring air quality we can not directly improve it, but only learn how often to ventilate the room.  Modern windows do not have gaps that were ventilating rooms in old times. Modern windows allow to save heat. For saving heat it is good that windows are completely closed when no one is at home. But when people are in the room it is necessary to open some gap in window for ventilation.

One thing would be to automate window opening that would for example ventilate a bedroom briefly during the night when  a person is too lazy to stand up and open the window.

Commercial window openers can be bought on Ebay for ca 100 EUR from Germany and 60 EUR from Italy. We plan to try to make our own window actuator using a stepper motor, gearbox and threaded stick similar as in home-made 3D printers.

 

 

Tests at school class

 

I gave the sensor box to a student who took it to Riga 1st Gimnasium  to measure air quality in the class. Test at school was tried for 3 days and only the last day was successfull. First day there was no Wi-Fi connectivity. Second day GSM-USB Internet adapter was used to bring notebook to the Internet, but Processing script stopped working as there COM port settings had changed. Below is the picture of the sensor readings at school. Live: https://xively.com/feeds/1192364524

r1g measurement 18 dec thursday.png

 

Measurement was started on Dec. 18 at 8 am. CO2 sensor needed 1-hour warm up.

CO2 levels changed dramatically during the middle of the day when window was open. But this change was mainly due to decreased temperature.

Note that plotted is not the CO2 concentration, but voltage in ADC units. This voltage decreases with increasing CO2.

One could see slightly elevated dust level, but not too much.

Box was placed on the window aisle near heaters and room temperature reading was elevated.

After the school day around 2:30 pm the student took the sensor and notebook home. So there are no values for the time when noone was in the class.


After the Christmas and New Year holidays we need to install Wi-Fi or GSM module into the air sensor box. So that it can be left operatig at school 24/7 without a PC. Minimum would be to add a SD/card with RTC.

 


RESULTS:

 

1) There were some interesting results analysing the sensor data, for example CO2 increase during every lesson and dust from floor sweeping after the classes.

2) A webcam would greatly simplify the analysis showing the number of people in the class and state of the windows,  but webcam is not legal to use without permission from authorities.

3) Wi-Fi at school was problematic to arrange as one needed to register MAC address by the webadmin. GSM module would be best to use.

4) At school students were not allowed to leave electronics running during the night. So background data could not be collected.

5) Electrochemical CO2 module needs too much warm-up time. NDIR CO2 sensor described in the following blogposts is more accurate and has only few minutes of warm up time.

Previous post: In-the-Air-Challenge: Laser-based dust counter using a photodiode, IoT connected

Next post: In-the-Air-Challenge: AirSchool Project Summary


Air in a laminar flow box with 99.999% filter

 

I have attached a small speaker to the photodiode amplifier of the home-made laser dust counter described in the previous post. Speaker clicks after every dust particle and click loudness is proportional to the dust size. Dust content outside the window in the city is similar to what we have in the room and speaker clicks with similarity to a Geiger counter near a radioactive source. Video shows that inside a laminar-flow class-6 cleanroom box there are practically no clicks. So the air filter works. Sorry, the speaker is too small to be heard in video as the air fan is making noise. Can hear clicking around second 40.


 

 

HEPA anti-alergy filters of vacuum cleaners

 

HEPA - High Efficiency Particle Air filter.

 

With a dust home-made dust counter described in previous post, I checked air coming out from a vacuum cleaner with HEPA filter on the output. Filter was labeled as Class 13 and should stop 99.95% of dust. Filter has been in use for several months, nevertheless there was practically no dust leaking through it.

 

There are also dirt collection bags marked as Anti-alergy  S-bag by Electrolux. I put one of such bags on the output of air ventilation. Such bag filters air very good and, practically, stops all dust.

Air filter of the cars did not stop the dust. and could possibly be used as a pre-filter before a HEPA filter.

 

One of drawbacks is that HEPA filter needs high pressure air fan to get much air through.  In the vacuum cleaner power is >1000W. I use vacuum cleaner from Electrolux Ultrasilencer that is made to be very silent compared to regular models.  In home-built filters, probably, one should use large size HEPA filters to get more air through.

 

Probably vacuum cleaner with a HEPA filter could be used instead of expensive HEPA laminar flow module in the optics lab.

If I fill a 250 liter plastic bag from a vacuum cleaner then the air inside is clean. But just blowing the air in a whole lab is not making air much much cleaner. As there  is wind blowing dust into the room through wooden window isles and doors.

Since one year I have started a laser spectroscopy lab in Riga, Latvia and dust here is a major problem as it deposits on the optics and laser power drops within days. It would be nice to make overpressure in the whole lab, but it is easier to build a clean air cabin around the optical table using greenhouse plastic sheets.

 

 

I need to solve the problem how to callibrate click counts into ug/m3. I plan to get in touch with some people having a commercial particle counter.

 

 

Exercise: How much dust a person inhales in one year. If air contains 50ug/m3, I get ca 0.3 kg/year. This would become ca 15 kg over lifetime. Can lungs clean themselves or get congested after decades.

 

 

 

Fine dust regulations and situation in Europe

 

As a fine dust are called particles smaller than 10 microns in size PM10. Generally, the smaller are the particles, the deeper they can penetrate into lungs. WHO suggests limit of 20 ug/m3 averaged over year. EU limit is double as high 40 ug/m3 which many experts critisize already for longer time. Studies show that exposure to particulate matter  leads to increseased lung cancer risk rougly 1% for every 10 ug/m3: "Outdoor Particulate Matter Exposure and Lung Cancer: A Systematic Review and Meta-Analysis"

 

Particulate Matter (PM10): annual mean concentrations in Europe  —  European Environment Agency (EEA)             

SPIEGEL article describes that values are above threshold, for example in German cities Berlin, Munich, Stutgart.

Feinstaub-Prognose: Die schmutzigsten Städte Europas - SPIEGEL ONLINE

 

pm10.pngimage-813882-galleryV9-eqbn.jpg

Previous post: In-the-Air-Challenge: NDIR CO2 meter connected to IoT via TI CC3200 Wi-Fi connectivity board

Next post:  In-the-Air-Challenge: Air filter checking with a home-built laser+photodiode dust counter


After trying to count dust using image processing I turned to a classical dust counter approach with a laser and a photodiode.

Background materials to read: Measuring dust with a commercial "Dylos" air quality monitor. http://woodgears.ca/dust/dylos.html

My device is based on article by a A. Morpurgo "A low-cost instrument for environmental particulate analysis based on optical scattering".


scatter.png

 

I made a 445 nm 1W laser pointer salvaged from Casio beamer and tried first to use a commercial amplified photodiode Thorlabs PDA36A and see the video below how the signal looks on Iphone:


Summary of  observations

  • Light pulses are having length of 0.1...1 ms depending on air flow speed.
  • Number of particles detected depends on air flow speed.
  • Need ADC sampling frequency in >10 kHz range (10 samples/pulse).
  • Need a fast algorythm for finding maximum of the peak.
  • Need to solder Opamp amplifier. Gain ca 70 dB.
  • Prefered a large area photodiode or a lens to collect more light. 10 mm diameter PD from Thorlabs was great. But also 1 mm diameter photodiode is OK.
  • Photodiode signal can be  AC coupled to suppress light scattered from walls.
  • Need large area photodiode or large lense to collect light.
  • Can place a mirror on the other side of laser beam to double signal.
  • To generate clicks we need a thin sheet of light. That is why laser beam is focussed. With broad beam particles are so many in volume that they overlap and are impossible to count.
  • In a small focussed beam scattering intensity is high and disturbing background is less.
  • If air speed is increased there are more particles coming in a time unit. Pulses get shorter.
  • There is a huge number of small particles in air. They are not molecules. Something bigger. Smoke for example.

 

Some particles leave multiple peaks. This is due to interference-diffraction if particle size is close to wavelength of light. By pfotographing such diffraction patern one could calculate the size of particles as it was done on pollen:http://www-atom.fysik.lth.se/afdocs/progrep978/c43.htm

 

 

 

Home-built PHOTODETECTOR

 

 

Photodiode can be 1...2 mm active area size. I ordered from Farnell BPX65. I had in drawer older FND100 photodiode and it worked too.

First OP is a transimpedance amplifier. It keeps photodiode input at 0V using the 1M feedback resistor. The output voltage is very linearly proportional to the photocurrent. Photodiode generates negative current on OP inverting input that is compensated to 0V by feedback resistor. So OPamp output becomes positive.

I use Texas Instruments OPA350 that was recommended in the italian paper about dust detection. It is single-supply rail-to-rail OP. Dust produces weak scattered light, so amplifier has to be low noise.

Input noise of OPA350 is 5 nA. One of often used photodiode amplifiers in physics laboratories is OP27 that has twice smaller input noise but requires bipolar power supply.

Note that the OPA350 schematic in the original paper has some mistakes: OP legs are incorrectly numbered and photodiode leg connected to the + input is also grounded.


dust schema.png

Circuit has to be fast because the light burst is short. I dimension circuit to some 50 kHz bandwidth that is suitable for taking several consecuitive samples with ADC. It is not practical to use larger feedback resistor than 1 Meg as circuit becomes slow. Better is to add one more OP stage. As a rule of thumb OP DC gain should be below 100 and resistors used below few hundred kOhm.

The circuit self oscilates without the capacitors across feedback resistors. So I added a 10 pF capacitor across 1 Meg and a 100pF capacitor across 100k. Low pass filter is dimentioned for 1M+10pF=100k+100pF=100kHz.

 

At output is a high-pass filter to eliminate continuously scattered light and 50 Hz. 10k+100nF=1ms=1kHz.

 

Circuit diagram is drawn using  Eagle. Both opamps are assembled on a small SSOP chip breakout board. See the photo. The amplifier board is covered with insulating tape and aluminum tape for electric pickup shielding. Photodiode is fixed 3...5 mm from the beam. Position is not very sensitive.

 

photodiode.png


A thing to try: photodiode in a plastic chip with built-in preamplifierTexas Instruments OPT101P-J. But need to check noise specs first

 

 

LASER

 

First diode lasers available were near infrared around 800 nm as used in CD players. Then red lasers appeared and now blue diode lasers are used in blueray disks. Light scattering increases quadratically for shorter light wavelength. So I think it is advantageous to use blue laser. Si photodiodes have sensitivity peak around 900 nm, but around 400 nm signal is only 10%. This might be why

red lasers are  still used. I use a blue laser because I have many 1W laser diodes from an old Casio projector. To extend  the lifetime I run laser diode at a half of maximum power. I made current controller for laser diode from a  LM317 regulator and a 2 ohm resistor that stabilizes maximum current at 0.6A. Resistor is rated for 1W gets dissipation. Similar circuits can be found elsewhere, for example, here:

http://www.loneoceans.com/labs/project405/

 

Laser diode I soldered to a hole on a copper heat sink. I glued a glass lens with f=5 mm at some distance to make the beam focus at couple centimeters. There are 2 foil diafragms to reduce scattered light.

If you decide to build your own device, be extremely carefull with class 4 laser laser. You can permanently damage vision. (For comparison electricity is more dangerous as you can loose your life!) During alignment try to run laser at low power. Fix everything steadily on the table. Keep other people away from the room. According to safety measures you should wear color protective goggles.  Laser beam should be directed at  steady dark painted metal surface. Focused beam can start  fire and smoke.

When device will be ready  the beam will be enclosed inside the metal enclosure and that is considered safe. But the box needs a warning sticker about laser inside.

 

 

Enclosure and Signal


dust setup.png

Beam dump is a 90 degree copper plumbing piece sprayed with furnace black paint. Photodiode is looking at 90 degrees to the laser beam into another 90 degree black piece.

Air is sucked into the box through a tube. About 10 cm long tube is practical for checking air coming out from air ducts and filters. A small fan is placed not on the input but on the exit of the box because some dust sticks on the turning blades. Number of particles counted in a time interval depends on air flow speed. As there is relatively much heat from the laser diode and LM317 I had to use a cast aluminum enclosure by Hammond that I got  from Farnell as a gift for this challenge. As a 9V power supply I use Ansmann APS600 rated at 0.6A that I got from Element 14 for this challenge.  Here is a video showing assembly and dust signal on oscilloscope.

.

 



Particle counting


laser based dust counter.JPG

 

Texas instruments Launchpad supplied for this challenge does not fit inside the compact size metal enclosure. Microcontroller runs in a loop to find out when ADC voltage has reached some threshold. Then it samples and looks for maximum value. ADc peak value I think is proportional to the particle size. Microcontroller bins particles into small medium and large bins. And once in 10 seconds reports to display and serial. Previously I have experienced pickup  from Wi-Fi when measuring weak light levels and decided  not to use Wi-Ffi in this project.

 

void loop() {
  Value = analogRead(A0);
  if (Value>2)
  {
    Value1 = analogRead(A0);
    if (Value1>Value){Value=Value1;}
    else { if (Value1<20) {small=small+1;}
          if(Value1>19 && Value1<500){medium=medium+1;};
          if (Value1>501) {large=large+1;}
    Value=0; }

  }

  if(millis()>10000*time){
  time++;
  Serial.print(small);  Serial.print(" ");
  Serial.print(medium); Serial.print(" ");
  Serial.println(large);









































 

 

In ambient air there are 30...100 clicks per second. To my surprise outside the window the air was not cleaner than in the room. If I sweep the room there is a giant burst of large size dust. Only inside a cleanroom box there were no clicks.

50 dust particles in 1cm3 means 50 million in 1m3. That is a large number.


I attached the Processing 2.2.1 code for Windows PC that receives USB-serial data from the particle counter averaged for one minute, saves in file and posts  on Xively. Link to live Xively plot is here:

https://xively.com/feeds/859336258

 

proc.png




https://api.cosm.com/v2/feeds/859336258/datastreams/0.png?width=702&height=250&colour=F15A24&duration=1day&detailed_grid…



I left my dust counter on for a weekend in a 20 m2 lab with HEPA13 filter bag on the air duct. After a couple of weeks of running the filter bag color starts to darken from inside.

dust in the lab.png

Air gets cleaner in about 5 hours - counts dropped from 4000 to 200  per minute. Dust quickly enters into the lab from adjacent rooms when the doors are left open. So I installed a curtain in the doorway. Curtain helps but is not as good as closed doors. During the weekend levels change when there is wind outside. I will continue logging  and prepare a new picture during the week when the people will work in the lab.

https://xively.com/feeds/859336258

 

Below is a graph of two weeks of counting dust in the room.

dust 2 weeks.png


Exercise:

How many Element 14 carbon atoms contains 1 micron size soot particle? C molar mass 12 g/mol, density 2.26g/cm3.

Previous post: In-the-Air-Challenge: Exploring internally NDIR CO2 monitor

Next post: In-the-Air-Challenge: Laser-based dust counter using a photodiode, IoT connected

 

co2.png

EXTECH CO100 air quality monitor has a very compact CO2 sensor module made by SenseAir  that puts out a PWM type signal proportional to concentration. To interface the EXTECH NDIR CO2 monitor with IoT I could very well use the Texas Instruments CC3200 Wi-Fi connectivity board donated by Element 14 for In-the-Air-Challenge. +5V power to the CC3200 board comes from the EXTECH circuit. I had to use a linear regression to fit LCD data with CC3200 data:

 

    ppm = ms * 10 * 1.0013 + 86

 

CC3200 uploading values to Xively is described in my  previous Backyard Challenge roadtest posts:

CC3200-LAUNCHXL program uploading data to IoT and hibernating

http://www.element14.com/community/community/design-challenges/internet-of-the-backyard/blog/2014/09/20/energia-is-out-there-for-cc3200

 

CO2 IoT.png

You can visit the Xively feed here:

https://xively.com/feeds/1784300880

 

CC3200 demo board works well but is quite large and can not fit inside the monitor enclosure. (ArduinoPro mini+ ESP8266 fits inside the EXTECH enclosure.)

ESP8266-12E-CO2.png

 

 

Internet of Things simplifies life a lot. If there was no IoT then it would be much more effort and expensive to make a graph. Would need microcontroller, SD card, RTC, manually transfer file to a PC, plot it. So far I feel to be done with the CO2 monitoring electronics and next week will turn to photodiode circuit counting airborne dust  particles.

 

After a weekend there is some data to analyse:

co2 sun- mon.png

Sensor is inside the office in the downtown Riga. It shows that during working day air in the office is OK. In the city CO2 content decreases in the night and starts to rise  at 6:20 in the morning. After 19 pm the air becomes cleaner all over the night until at 6:20 morning traffic begins. Sensor is inside building so it takes extra hours until air ventilates.

 

On a short time scale there is some strange periodic spiking appearing roughly every 10 minutes. This could be some internal PID regulation inside the Sensair sensor.  There is a typical shape of the spike going upwards and then downwards. So the average value is not so much influenced. Spiking peak-to-peak amplitude is about 75 ppm that is consistent with the EXTECH datasheet specified precision of 75 ppm.

co2 spikes.png

Here is format how to get out picture from Xively for a defined period of time with manual vertical scale values:

https://api.cosm.com/v2/feeds/1784300880/datastreams/CO2.png?width=702&height=250&colour=F15A24&duration=7days&detailed_…

Previous post: In-the-Air-Challenge: Measuring CO2 levels during lectures with EXTECH CO2 monitor

Next post: In-the-Air-Challenge: NDIR CO2 meter connected to IoT via TI CC3200 Wi-Fi connectivity board

 

Opening the case of made in China EXTECH CO100 air quality monitor reveals a very compact NDIR CO2 sensor made by SenseAir.com (Sweden) type model S8 004-0-0062. Connected to other electronics with just 3 wires: 5V, GND and output signal. On the sensor output signal is present a TTL pulse once a second (exactly every 1009ms) with PWM lineary proportional to CO2 concentration.

 

At 500 ppm CO2 the pulse width is 50ms. That is what I got today by opening the room window.

At 1200 ppm warning starts beeping and oscilloscope shows 120 ms pulse length.

At 10000 ppm the pulse width is 1s. Basically only a very short peak going down that is useable for triggering.

 

P1060123.JPG P1060126.JPG

Visually one can see through the air diffusion membrane that a small lamp is turning on once a second for a short while, and it is not very bright, so emmision peak is in the Mid-IR and lamp can last for 15 years according to specs.

 

P1060122.JPG P1060121.JPG

 

Schematics is nicely designed and assembled. On one side of the PCB following components can be identified. Large chip - LCD display driver. Small chip - touch sensor buttons driver. Moisture/temperature sensor model SHT. 3V Li cell for clock backup. 5V regulator working from 6.2 V at the input jack.

On the other PCB  side is a MSP430F microcontroller. USB and FTDI chip place is not populated. No RX or TX signals coming from the microcontroller.

So the only way how to connect external electronics is to measure the output of the CO2 sensor directly.

 

Measuring precisely the pulse length on one second time scale should be an easy task to do with a CC3200 board (or TI MSP430 + ESP8266). It was nice to learn this methoid how to enclode analog signals using PWM.

 

Conclusion and recommendation to electronics guys is: Buy just the NDIR sensor!

 

Continue reading: David Giorni NDIR CO2 detector

L. Crawley 2008 Dr. Thesis about NDIR trace gas detection

Previous post: In-the-Air-Challenge: Spending the 500 USD parts budget

Next post: In-the-Air-Challenge: Inside the air quality CO2 monitor


EXTECH indoor air quality monitor model CO100 from Farnell is a great thing to have!

 

I tested the device during a lecture with ca 20 people. CO2 concentration raised to 2200 ppm after 50 minutes. During the next lecture one window was open to have a ca 10 cm gap and the CO2 concentration stabilized at 1500 ppm. This shows the importance of reasonable ventilation. After the lecture there were questions from attendants who asked what the device is doing and what it costs.

 

co2.png

 

This triggered me to search for information what are acceptable CO2 levels?

 

  • In Earth atmosphere CO2 content has increased from 300 to 400 ppm=0.04% during the last 60 years. It is a greenhouse gas responsible for global warming. Less in sommers when plants absorb it. I think there is some global warming taking place because of diminishing glaciers and polar ice.  Melting  is an integral effect over years, while just measuring temperature is not precise enough because of large scatter.
  • 2000...5000 ppm sleepyness, headaches, loss of concentration, increased heart rate.
  • maximum allowed concentration within a 8 hour working period: 5000 ppm = 0.5%
  • slightly intoxicating, breathing and pulse rate increase, nausea: 30,000 ppm = 3%
  • above plus headaches and sight impairment: 50,000 ppm = 5%
  • unconscious, further exposure death: 100,000 ppm = 10%

 

Breath contains almoust stable amount of 3.8% CO2 (38000 ppm). In other words, exaled air contains about 100 times the concentration of carbon dioxide that inhaled air does. If a healthy person were to voluntarily stop breathing (i.e. hold his or her breath) for a long enough amount of time, he or she would loose consiousness, and the body would resume breathing on its own.  If one does not inhale, the level of carbon dioxide builds up in the blood. Is monitored while performing artificial lung ventilation in hospitals during surgeries.

 

Accidents have happened inside beer cellars, garages with car motor running, or while sleeping in a car and running engine against cold. In such extreme environments as submarines and space ships caustic soda or limewater can be used to absorb CO2 from air.

 

The ability to measure carbon dioxide (CO2) in the breath of a patient or capnometry, is one of the fundamental technological advances of modern medicine

By blowing into the Extech analyser I easily reached the maximum reading of 9999 ppm and the device became saturated.

 

Found a great overview article about CO2 measurement history:

M. B. Jaffe, Infrared Measurement of Carbon Dioxide in the Human Breath: “Breathe-Through” Devices from Tyndall to the Present Day , 2008.

 

 

There seems to be some contraversy in values from different sources. Seems that CO2 is not very toxic. We exhale it so much 38000 ppm in breath!

When you use CO2 sensing, energy savings can result because ventilation is based on actual occupancy of the rooms. One can estimate if the rooms are overventilated or not enought ventilated.


Recommended levels

  • 250 ‐ 350 ppm – background (normal) outdoor air level
  • 350‐ 1,000 ppm ‐ typical level found in occupied spaces with good air exchange.
  • 1,000 – 2,000 ppm ‐ level associated with complaints of drowsiness and poor air.
  • 2,000 – 5,000 ppm – level associated with headaches, sleepiness, and stagnant, stale, stuffy air.  Poor concentration, loss of attention, increased heart rate and slight nausea may also be present.
  • >5,000 ppm – Exposure may lead to serious oxygen deprivation resulting in permanent brain damage, coma and even death.

 

Regulatory limits in different countries

 

  • ASHRAE 62‐1989: CO2 concentration in occupied building should not exceed 1000ppm.
  • Building bulletin 101 (Bb101). UK standards for schools say that CO2 averaged over the entire day (i.e. 9am to 3.30 pm) should not exceed 1500ppm.
  • OSHA, Germany, Japan, Australia, UK: 8 hours weighted average occupational exposure limit is 5000ppm.

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

Next post: In-the-Air-Challenge: Measuring CO2 levels during lectures with EXTECH CO2 monitor

 

Almoust at the last moment I compiled a list of 500 USD budget for the parts of the challenge that amounts ca 430 EUR in Jan. 2015.

 

I was very impressed that Christian Defeo at Element 14 ordered everything in a couple of hours after I sent him an email with the long list. I was mostly interested in optical CO2 meter. Price for it varied a lot at Farnell webshops in different countries. I used prices from Germany website http://de.farnell.com/ to add up to 430 EUR. And that was fine. No added VAT. Thanks a lot to Farnell.  The parts arrived to my home address with UPS truck in a couple of days. They were sent from UK location.

 

 

EXTECH INSTRUMENTS  CO100  METER, CO2, 9999PPM, 99.9%

197,71 €

http://de.farnell.com/extech-instruments/co100/meter-co2-9999ppm-99-9/dp/2081081?ost=co100&categoryId=700000005821

I will use this near-infrared non-dispersive type CO2 sensor to compare with electrochemical CO2 sensor module. NDIR sensor is callibrated against NIST traceable device, accuracy 75ppm or +-5%.

Good <800 ppm
Normal 800...1200 ppm
Bad >1200 ppm

IMG_4079.JPG

First tests in the sleeping room at home showed that air was OK bad during the night 700...800ppm. In a confined space like a toilet CO2  content rised to 2000 ppm within 5 minutes. I will test the device during the lecture with ca 20 people this week.


This model has an empty battery compartment and USB hole is not populated. I will try to see if there is some place inside where analog voltage could be accessed with MSP430 or CC3200 and sent to IoT over Wi-Fi.

 

 

TEXAS INSTRUMENTS  OPA350UA  OP-VERST., HIGH-SPEED, R/R-I/O, SOIC 350

2,35 € * 4 pieces

http://de.farnell.com/texas-instruments/opa350ua/op-verst-high-speed-r-r-i-o-soic/dp/1106197

This single-supply OPamp I plan to solder this week in a home-made dust particle counter to amplify photodiode signal after schematics in paper:

A. Morpurgo et al , "A low-cost instrument for environmental particulate analysis based on optical scattering"

 

 

ANSMANN  1209-0000  STROMVERSORGUNG AC/DC, APS600 TRAVELLER

19,42 €

http://de.farnell.com/ansmann/1209-0000/stromversorgung-ac-dc-aps600-traveller/dp/1973938

Adjustable voltage 3...12V in steps. Current 600 mA. switching power supply adapter.

 

 

RASPBERRY-PI  RPI CAMERA BOARD  RPI KAMERA-BOARD, 5MP, MIT FLACHKABEL

19,25 €

http://de.farnell.com/raspberry-pi/rpi-camera-board/rpi-kamera-board-5mp-mit-flachkabel/dp/2302279?ost=RASPBERRY-PI+-+RPI+CAMERA+BOARD+-+RASPBERRY+PI+CAMERA+BOARD%2C

I would like to test this camera with RPi and compare with USB camera Logitech C270 that I use on Beagleboard/Rpi.

 

 

HAMMOND  1590B  DRUCKGUSS-GEHÄUSE, 60.5X112X31MM

7,01 € * 2 pieces

http://de.farnell.com/hammond/1590b/druckguss-geh-use-60-5x112x31mm/dp/3061590?ost=HAMMOND++1590B++ENCLOSURE%2C+INSTRUMENT%2C+ALUMINIUM

Nice shielded alu boxes.

 

 

IST INNOVATIVE SENSOR TECHNOLOGY  P1K0.0805.2P.A  SENSOR, PT1000, SMD0805, KLASSE A

7,16

http://de.farnell.com/ist-innovative-sensor-technology/p1k0-0805-2p-a/sensor-pt1000-smd0805-klasse-a/dp/1266951

This platin wire sensor is good for absolute callibration of other sensors.

 

 

SAMSUNG  MMCTR08GUBCH-RMLMK-FARN/KIT  SPEICHERKARTE, MICRO-SD, NOOBS, JAVA 8GB

7,58 €  * 3 pieces

http://de.farnell.com/samsung/mmctr08gubch-rmlmk-farn-kit/speicherkarte-micro-sd-noobs-java/dp/2428393

 

 

BELDEN  8723  KABEL, GESCHIRMT 2PAARIG 22AWG GRAU LF.M

1,39 €    * 5 meters

http://de.farnell.com/belden/8723/kabel-geschirmt-2paarig-22awg/dp/1218667?ost=BELDEN+-+8723+-+SHLD+CABLE%2C+2+PAIR%2C+22AWG%2C+GREY%2C+PER+M&categoryId=700000006049

Basically similar cable as used for USB.

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

Next post: In-the-Air-Challenge: Spending the 500 USD parts budget

 

Greetings with the New Year 2015!

I decided to compose a new blog post this week instead of adding material to the previous post. Because older blog posts people might not check over again.

 

My collegue Ilja Fescenko came up with an idea  to bounce light between two parallel mirrors allowing to recycle laser power and monitor scattered light by dust in relatively large area.

 

sheet of light for dust visualization.JPG

Green laser pointer 5 mW is OK, with a 30 mW laser visibility is better.

Front coated alu mirrors from an old scanner are used. One mirror is fixed. Second mirror and laser direction can be fine adjusted.

 

If both mirrors are parallel then the spots make equidistant straight pattern. One can make a parabolic pattern or a spiraling one just by tilting laser beam and one mirror.

 

A sheet of laser light shows that we are swimming is a see of dust. Dust very nicely visualizes air turbulences.

 

 

We are testing now different filters.  HEPA13 from a vacuum cleaner, car air filters, cotton wool, electrostatic plastic spiral filter.

This method of observation from a 50 cm distance is sensitive to large dust particles. In order to see the fine dust one needs to use a macro lens (microscope) and then the observation gets smaller.

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.

 

puteklulazerablide.png

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.

dust.png

 

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.

 

dust signals.png

dustscreenshot1.png

 

 

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

 

dust beagle.png

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.

 

Previous: In the Air Design Challenge

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


Introduction


Thanks to Element14 and all the sponsors for selecting me as a rodtester for In the Air Challenge.  I have received Texas Instruments Beaglebone Black, MSP430 and CC3200 launchpads and inductors from Wurth Electronik. I registered at AirVantage and received a kind email with their offer to help me during the roadtester.  Cadsoft sent a licence for Eagle that will allow me to draw schematics and PCBs. Now I am preparing an order list for 500$ to spend. One wish would be that Element 14 as a distributor could get in their webshop sensors from SeedStudio or Adafruit.

 

I have proposed to study air quality during school classes. Most schools in Latvia are built in times when motorised ventilation was not used. Proposal is to measure carbon dioxide CO2 that is responsible for getting tired. This could teach the lecturer when is time to open the window. Other sensors will be dust, temperature, humidity, air pressure, light, sound level, oxygen O2.

 

As a dust sensor I have started to use Sharp sensor, but it is sensitive only to average dust level. I plan to detect scattered light from a 10W LED, using a webcam, Beaglebone and image recognition to count dust particles. That would allow to size dust particles. It is known that soot particles less than 10 um can cause lung cancer.

 

Data will be sent to the Internet of Things for plotting and later evaluation. One would be to look for correlation if air gets worse quicker during mental activities like a math test.

 

 

Customs problems

For 3 weeks I could not start the project as experienced problems in the customs with parcels from the USA. Import tax had to be payed but I could not do it as the packages were addressed for the University of Latvia, but in the university administration just kept sending me from one bureaucrat to another.  Best solution was found that Element14 payed the import tax and the packages were delivered to the university where I could pick them up.

 

 

 

MSP-EXP430FR5969 launchpad

  • 16MHz,1.8-3.6v power
  • Ultra-low power consumption mode, Deepsleep LPM 3.5 when only RTC active.
  • It has relatively new type of memory 64 kB of FRAM  that retains data after switching off and can be rewritten practically indefinitely (10E15 times) compared to EEPROM.
  • Analog to digital converter ADC has 12 bits resolution that is 4 times better compared to 10 bits of Arduino.
  • This MSP chip has a built-in temperature sensor. (2 deg.C precision).
  • Most impressive application for me is to run a temperature logger from a 0.1 F supercapacitor.
  • Launchpad  price  is 16 USD.

 

 

Out of the Box Demo


Getting started: MSP430FR5969 LaunchPad Development Kit - MSP-EXP430FR5969 - TI Tool Folder

Connected launchpad to PC  USB. Windows installed automatically MSP Tools Driver because I had CCstudio installed from the previous roadtest.

Downloaded software examples "MSP-EXP430FR5969 Software Examples" and read the pdf guides.


User's guide p.27 describes Out Of the Box example.

Programmed OutOfBox_FR5969.

Run /GUI/OutOfBox_FR5969_GUI on Windows. Connected to COM5 and looked at the live temperature data.


oob.pnggu.png

 

Activated "FRAM log mode". Green LED flashes briefly every 5s.

One could store in FRAM ca 8 hours of temperature and voltage as long as supercap lasts.

Set jumpers "use supercap" and "charge" the supercap. Should remove V+ jumper from J13.

Supplied from a from supercap LED stops blinking after a few minutes but the logging continues.

Exit from logger by pressing button 2 or reset button.

 

 

TI Energia

 

Would like to give a try with Energia that is very similar to Arduino IDE.

Downloaded Energia 13. Opened blink example. Tried to upload. Message came that need to run update /programmer

"A firmware update is required for the MSP430 Debug Interface (MSP-FET430UIF / MSP-FET / eZ-FET). "

"device inicialization failed"

 

It is a bug that several other roadtesters already encountered. Solution will be to wait until Energia 13+ appears.

http://energia.nu/pin-maps/guide_msp430fr5969launchpad/

 

I think Energia would not allow to use chip-internal temperature sensor and power down modes that are the major advantage of the MSP-EXP430FR5969

chip. Also in Energia is probably not implemented writing to FRAM.

 

 

 

CCStudio

 

I had CCStudio installed during previous CC3200 roadtest.

Pressed New project/Energia .  A project template came up and it could be compiled and  debuged (press the green bug icon)

Needs to update driver too. Update successful.

"MSP430: Loading complete. There were 506 (code) and 0 (data) bytes written to FLASH. The expected RAM usage is 20 (uninitialized data + stack) bytes."

 

Pasted Blink example from Energia, pressed "Debug" and after compilation MSP430 launchpad LED started blinking. So far OK.

Next I tried to make LED shine all the time and checked how long it shines from a supercap: 2 minutes and the MSP430 chip was in normal speed mode.

 

advanced tools/energy_trace  - I could not find where to select

project/properties/build/msp40 compiler/ulp advisor  was already checked active

 

CCStudio is described in MSP430 user guide from p.26.

I opened and compiled OutOfBox example.

tools/import ccs projects/outOfBox_FR5969

It worked by blinking red/green LEDs and the green LED blinks shorty every 5s  when activated FRAM storage from GUI demo o a PC.

 

So far OK.  CCStudio works More example code ADC_12, timer is at TI resource explorer.

 

 

Left the board runing OOB demo overnight powered from the supercap to see how long time it lasts. In the morning saw that data saving continued for 1/2 hour.

Possible time extension would be by disabling thermometer and LED flashing.

demo.png