1) Breaking news, literally... my wife accidentally dropped it to the floor and not a single piece survived!
The good news is that I redesigned the FULL enclosure from the ground up, correcting some small mistakes in the process. If anyone is interested, I can post the files.
2) I have almost completed the remaining board and I will sell it if anyone wants it, fully populated and tested.
3) A cool mod is in the pipeline, to allow the device to turn itself off from software. Useful when battery is depleted, instead of letting it die. Requires a very minor mod to the schematic, and it can be added to the current PCB. When i have a minute i will document & publish. With this one, Atmoscan is the only device i know of that uses ALL GPIOs in the ESP8266, including the ones that supposedly cannot be used! Stay tuned ;)
- Q & A SECTION ADDED
- All configurations (e.g. web services keys) are now done via the web portal.
ATMOSCAN is a multisensor device aimed at monitoring indoor air quality.
While many projects have been published that have similar purpose, this one is a complete system in a compact, self-contained package that summarises them all. It has an LCD color display, it is time & location aware, it is gesture controlled and it posts to ThingSpeak (or others) via MQTT, but can properly handle disconnected operations and reconnection. With its embedded rechargeable battery it lasts a full day when disconnected from power.
It uses a multitasking cooperative framework and is very responsive to user input while sampling sensors, handling UI, posting to MQTT. In fact it squeezes quite a bit out of the tiny ESP8266. It does so by integrating a number of open source libraries and leveraging internet web services.
Credits for libraries go to a number of contributors, see later.
Music in video can be found HERE
Step 1: Sensors
Atmoscan measures a number of variables:
- VOC (Volatile organic compounds, an Air Quality indicator)
- PM 01
To do so it integrates a number of discrete sensors
- BMP280 (e.g. Link)
- PMS7003 (e.g. Link)
- MH-Z19 (e.g. Link)
- HDC1080 (e.g. Link)
- MiCS6814 (Link)
- MP503 (Link)
- LND-712 Geiger tube (Link, i found it in Europe here Link or here Link) with high voltage module (Link)
Data Sheets are HERE.
Step 2: Electronics
Atmoscan can be easily built with a NodeMCU or any other ESP8266 board and some readily available components, such as level shifters and voltage regulators, if you give up on the integrated battery charger.
While I did prototype with separate components, for the final version I designed a specific board that integrates all functions and provides neat connectors for sensors, LEDs for status (Blue= power supply connected; Red = charging).
Eagle PCB files available HERE.
Specifically, the board integrates:
- Charging circuitry based on MAX8903A (Link)
- One-button on/off logic
- ESP12E module
- Programming logic
- Level shifter
- LCD Backlight driver
- 3.3V Step-Up/Step-Down Voltage Regulator based on Pololu S7V8F3 (Link)
- 5V Step-Up Voltage Regulator based on Pololu U1V10F5 (Link)
LiPo Fuel Gauge based on SparkFun TOL10617 (Link)
The display is a 2.8" TFT 320x240 based on an ILI9341 chip (Link).
The gesture sensor is based on the PAJ7620U2 chip (Link), way better than the cheap APDS9960 that generate continuous interrupts and cannot work through plexiglas.
The sensors are rather power hungry, so to guarantee at least 24h autonomy I made a pack with 3 x 5000mAh LiPo 105575 batteries (Link). In fact, 2 could have been enough. The MAX8903 charger struggles to charge the resulting 15,000mAh pack.
Step 3: Enclosure
The enclosure is derived from a plexiglas 10x10x10 cm cube container that i bought on ebay and was meant for an entirely different use. It had nice ventilation slots that were exactly what was needed. The volume was in principle sufficient to pack the whole set, except that it wasn't easy... some early attempts based on cardboards mockups failed miserably so I gave up and wasted some hours with a 3D CAD and I had the internal supports laser cut. The internal space is divided in compartments so that the temperature sensor is as far away as possible from internal heat sources. While the external enclosure is made of 3mm material, the top is made of 2+1mm sheets. This trick allowed having the gesture sensor covered with only 1mm acrylic and this is sufficient to make it work.
Some modifications had to be done with hand tools on the original enclosure, such as the fan, switch and USB holes. The result was nevertheless decent!
CAD files are HERE.
Step 4: Mechanical Assembly
The package is very dense but thanks to the 3D cad design I had few surprises when assembling it.
Air circulation (from top to bottom) is ensured by a small fan. After buying a fair number on Aliexpress / eBay, i realised that the noise of cheap fans was unbearable for an indoor device. I ended up buying a rather expensive, slow turning Papst 255M (Link) and I fed it with less than 5V via a couple of diodes. The result is rather good and is silent enough to be unnoticed (it is even wife-approved, the hardest certification).
Step 5: Software
The software architecture is based on an Object Oriented framework that runs multiple (cooperative) processes that handle UI, sensors and MQTT. It is location and time-aware but can handle disconnection / reconnection to WiFI.
The framework is open and can manage any number of screens, as long as their code and resources fit in Flash memory. The application framework handles the gestures and passes it on to the screens, for further handling or cancellation if needed. Gestures managed by the framework are:
- Swipe left / right - Change screen
- (Finger) Clockwise swirl - Turn screen
- (Finger) Counterclockwise swirl - Invoke setup screen
- (Hand) From far to close - Turn off display
Screens are inheriting from a base class and are managed via the following event model:
- activate - fired once, when screen is create
- update - called periodically to update the screen
- deactivate - called once, before screen is dismissed
- onUserEvent - called when gesture sensor is triggered. Allows to respond and also override the default event handling, e.g. abort swipe to change screen
Each screen declares its capabilities by providing the following information:
- getRefreshPeriod - how often the screen needs refresh
- getRefreshWithScreenOff - if the screen wants to be refreshed even when backlit is off. e.g. for charts
- getScreenName - name of the screen
- isFullScreen - take full control of the display, or allow the top bar with date/time/location/battery gauge/wifi gauge
The framework is able to instantiate and deallocate the screens via a declarative class factory. The dynamic allocation saves RAM and makes the device easily expandable. The overall application framework is also reusable for other projects.
Screens currently implemented in Atmoscan are:
- Sensors values
- Geiger meter / semilog chart
- System status
- Error log
- Weather Station
- Plane Spotter
- Low battery
The Setup screens allow setting Wifi credentials, MQTT channels, Syslog server.
NEW in v2.0: all web services keys are now configurable via the configuration portal. The only value that is still hardcoded is the OTA password (uppercase ATMOSCAN).
NOTE 1: First programming must be done with a USB-Serial cable connected to the programming connector. As the serial port is occupied by a sensor, debugging and programming that way is impractical after assembly as it would require detaching the sensor. Therefore the software supports SYSLOG debugging and OTA updates.
NOTE 2: The ATMOSCAN binary is over 700Kb and ArduinoOTA requires the program space to be at least twice the image size, which rules out the "4M (3M SPIFFS)" option. However, the standard "4M (1M SPIFFS)" option is also unsuitable as the SPIFFS partition would be insufficient for the graphical resources related to weather station, plane spotter and for the confing file. Therefore a custom configuration "4M (2M SPIFFS)" has been created to solve the issue. Explanation here.
Documentation and full source code are available here.
INCLUDES CODE & LIBRARIES FROM
INTEGRATES WEB SERVICES FROM
Step 6: Make It Better!
Result is not bad at all! Software looks good and is reliable, while it could be expanded with new features and perhaps cleaned up a bit to make the application framework truly reusable for other projects. Calibration of some sensors is not great, but test lab equipment would be needed. Time is precious and I don't have much, so progress was slow. By the time I was done, decent support for the ESP32 became available. If I started it now, I would use it and integrate external sensors via bluetooth.
NOTE: I still have a handful of PCBs so if anyone is interested they are available at nominal / postage price.
Step 7: Questions & Answers
First of all, THANK YOU for your overwhelmingly positive comments. I honestly did not expect that much interest.
I received a number of questions either via comments or private messages, so I thought of collecting the answers here. Should more come, I will add.
I found in the back of a drawer the 8 available PCBs - and they are on their way to Belgium, Germany, India, USA, Canada, UK, Australia. Wow, 3 continents! Amazing.
How to configure Thingspeak?
The server is: mqtt.thingspeak.com
Channels are in the following format: channels/<CHANNEL-ID>publish/<WRITE-API>
NOTE: you need 3 channels
The PCB is very compact. How do I solder the SMD devices, especially the MAX8903A IC?
First, I suggest you ask yourself if you want to get into SMD or if it is a one-off- If the latter, perhaps ask someone to do it for you. If you want to take the SMD challenge, invest a bit and get the proper tools (solder, flux, isopropylic alcohol small iron, hot gun, tweezers, a cheap USB camera, a PCB holder). Nowadays this is cheap stuff. Then watch a YouTube video – there are half a million – and spend some time with an old PCB that you can sacrifice and de-solder / clean / solder some components. You would not believe how instructive this is, to learn what to expect, get temperature right etc. Speaking from experience… I started SMD changing the display connector in an iPod touch and I killed the first one!
Indeed the Atmoscan PCB is compact and that IC is not an easy one. Again, I don’t recommend you do this as your first SMD soldering. The QFN is not a friendly package even though I soldered a number by now. You are never sure you got it right…
On Atmoscan I soldered it first, then its surrounding components so I could test that the charging portion of the board was working, then I completed all the rest. From the pictures attached you should be able to infer the orientation of the components. I used public domain component libraries and the orientation is not very evident in the silkscreen.
My way: I first put some solder on the pads with the iron. Then a lot of flux (SMD specific) and I carefully positioned the IC with tweezers. Then heated up the whole thing to around 200/220C (below melting point) to avoid tensions due to uneven heating. Then I boosted the temperature to 290C or so on and around the IC. If you put a bit of solder on a nearby pad you will see when the temperature is at melting point, as it will shine.
After that I cleaned it with isopropylic alcohol and carefully inspected it with a cheap USB cam. Typical issues are alignment and quantity of solder, as some pins might not be connected. In some cases I had to go back to it with a small soldering iron to add some more solder to some pins, as this IC has a thermal pad underneath that needs to be soldered too. This makes it a bit tricky to guess the amount of solder and it might happen that too much solder underneath might raise it so that the pins do not touch the PCB.
Having said so, I don’t want to scare you. I completed 3 boards and I never killed these ICs… Once I even had to remove it, clean up and restart from scratch but it worked in the end. Again, not super easy but doable.
Where did you buy the components?
Mostly on eBay and Aliexpress. However, the branded ones are original (Seeed, Pololu, Sparkfun).
Some INDICATIVE links follow. Note: look around, you might find even cheaper deals...
The Atmoscan board includes a programming circuitry that is in line with the NodeMCU. Serial connection is normally used for the first programming. After that, OTA programming via wifi is the preferred option, as it can be done with the unit fully assembled. Don't forget that the serial port is normally used by the particle sensor!
To program the board with serial, a USB-Serial adapter (e.g. FTDI232 or similar) must be connected to the J7 connector (next to the reset button) following the pinout in the schematic. Program can be uploaded without sensors connected, except that the interrupt line of the geiger sensor should be connected to GND, otherwise the board will not boot (to do so, connect pins 1 and 3 in in the RAD connector). The easiest way to test the board without using the main sketch - hence without the complexity of the sensors - is to upload THIS simple program via serial cable. It creates a wifi access point that allow further flashing with the main program.
IMPORTANT: Dont forget to use the 4M/2M SPIFFS configuration as per the instructable, otherwise the main program will not fit. The board must be initialised via serial programming with that configuration, otherwise you might have issues with OTA later.
Unfortunately some sensors initialisation is blocking if sensors are not present (depends on the provider of the library). One example is the multigas sensor library. To make sure Atmoscan boots properly with the full firmware, you could disable the related process, see the related Q&A point. A simple way to disable ALL sensors for testing is to comment out the line #define ENABLE_SENSORS in the GlobalDefinitions.h file.
When the board boots the main sketch for the first time, it should recognise that it is not configured and should open a wifi hotspot, to which you can connect and set it up. Among the settings, there is a syslog server that helps greatly debugging. You can also increase the logging level by uncommenting the #define DEBUG_SYSLOG in the GlobalDefinitions.h file. Please note that in the same file there is also a #define DEBUG_SERIAL that was used during initial debugging. If uncommented it outputs _some_ residual logging, but minimal. A ToDo item was always to make logging uniform and selectable but i never had the time to clean it up.
Have you modified the libraries you used, is there any configuration needed? (as opposed to download & compile)
Good question, I forgot to mention that point. Indeed there are a few mods / configs needed:
- Library https://github.com/Seeed-Studio/Mutichannel_Gas_Sensor - lots of serial debug statements. Need to be commented out, as the serial port is used for a sensor!
- Library https://github.com/Bodmer/TFT_eSPI - requires a config file where the pin assignment and the SPI frequency are specified
- Library https://github.com/MarcFinns/TimeSpaceLib - has a UserConfig.h file where the key of the web services invoked needs to be specified
- Library https://github.com/lucadentella/ArduinoLib_MAX1704... - Looking at the comments and pull requests i noticed there is a bug fix that was never merged
- File ScreenPlaneSpotterSettings.h - Google API key needed, to download the map for planespotter
- File ScreenWeatherStationSettings.h - WeatherUnderground key needed
As far as I remember that should be it. Let me know if any problems arise.
Why are some sensors reading red and some green in the video/pictures?
Color indicates trend. It starts white and if going up is red, if going down is green.
How do you handle drift of the sensors over time? How good are these sensors? What can I see with these sensors?
Honestly this is not a scientific measurement kit. To calibrate I would need equipment that I do not have available. This is really a pet project. I tried several sensors. The particle, CO2, temperature, humidity, pressure, Geiger are rather good in my opinion. On the NO2 I have reservations on calibration and overall design, but there is not much available. Overall, they are mainstream sensors.
However, the combination is good enough to show things you would not expect.
With the Atmoscan in the living room and the kitchen a room away, it detects huge peaks of particles when e.g. frying stuff. It feels the NO2 from the morning traffic even with the windows closed.
Was a Geiger counter really necessary? Does it show anything useful?
Luckily we haven't had nuclear incidents and war is not coming yet... Still, there are nuclear plants not that far away and the government distribute iodine pills for kids to be kept in the drawer in case of incidents... so I got suspicious. So far I have to say the readings are exactly in line with the expected background radiation (0.12 uSv/h)
What is the total cost of the device?
I already had many components at home and the links above give you an idea. Honestly, if you buy a ready-made NetAtmo or similar you save money. You can’t beat a Chinese company doing things at scale! However, if you enjoy making perhaps together with your kids, it is worth it. The good part is that I already tested (and discarded) a number of sensors for you....
How about PCBs? Can you sell me one?
I originally had 10 of them made by dirtypcbs.com and my files worked out just fine. Good quality and cheap enough, 25USD / 20Euro for 10 PCBs. I used two and I am happy to send the residual ones for the bare cost (2 Euro + shipment, depending on location and shipping preferences). I am afraid I will have to pick the first ones that send me a private message.
Can you make a kit or a kickstarter campaign?
Flattering, but honestly I never thought it was innovative enough… and besides, NO TIME!!
However, should someone pick up the idea, a second iteration would be needed. There are some sharp edges in the design that would be worth correcting, but again I never had enough time for V2.
On Hardware: Can I add / remove a sensor, the screen etc to expand capabilities / reduce power consumption?
The display is connected without using MISO hence the CPU never reads from the display. Therefore you could just not connect the display ant it would work just fine. Having said so, the display is on only for some time after the last gesture was detected so it is not really impacting power consumption.
The sensors are instead power hungry and the whole thing uses easily 400/500mA. Dont forget the fan and also the fact that the particle sensor also has a built-in fan. The ESP also does not go to sleep mode, due to lack of GPIO pons. However, that would have perhaps saved 20mA…
The software is modular and you can easily add/remove processes and screens so you can add sensors or make it light on power by removing some, if you wish. The only limitation is the number of GPIO pins. However, sensors can be easily added if I2C, or alternatively an I2C expander could be used to add GPIOs...
To disable a sensor, for example to test a partial build, the best way in my opinion would be not to start the related process. This can be accomplished by commenting out the related enable() call in the void startProcesses() function in the main .ino file. Unless you want to structurally modify the system, I would not remove the processes altogether as the screen and MQTT processes will poll them. In this way they should just return zero. Please note that the interrupt input for the geiger board shall be pulled down if unused, otherwise the board will not boot.
What are the improvements you would have made if you had the time for a V2.0?
Not in any particular order..
- The PCB could avoid copper behind the ESP8266 antenna. I totally forgot it and it makes the radiation diagram non-isotropic
- The charger in my opinion is undersized for such a large battery / the battery is too large for the charger. There are other ICs and I would try another one.
- There are better battery gauges.
- I would add an ozone sensor
- I would use an ESP32 for more GPIOs and Bluetooth sensors out of the main unit.
- If I had more GPIOs either with the ESP32 or with an I2C expander I would use one to control the fan and another to power off the unit from software. Now when low battery, the only thing it can do it to display a low battery screen. This is in fact the biggest drawback of the design, as low battery situation is not gracefully handled.
It took me longer than the hardware... I think it contains a number of good concepts, alas not fully implemented. Specifically, I believe it should be cleaned up, potentially expanded and a generic framework for ESP8266 applications could be easily derived from it. No time. Anyone picking up the challenge?
Can you add Voice control?
Should be feasible. There are a number of ready-made libraries to control an ESP8266 with Alexa and I don’t see why the integration should be a problem. The interesting question is what you want to do with it, functionality wise. I don’t own an Amazon Echo so I never tried.
How did you make the laser cuts?
The drawings are made with SketchUp. The program is nice but seriously lacks exporting capabilities. However, the 30 days trial version helps as it has additional functionality. I then imported it in Inkscape for final processing.
Can you switch on/off sensors to save power, via MOSFETs?
Nice idea in principle, but most of these sensors need to be powered all the time as they have a warm up time. Besides... I run out of GPIOs in the ESP8266. I even had to use GPIO10 that officially is not functional, but does work just fine on the ESP12E.
What skills would I need?
To build it from scratch you would need some electronics design background. Not much really, nowadays with internet you don’t really need to read datasheets line by line as in my early days... If you use the outcome of my experimentation, you need some SMD soldering skills, mechanical skills and some patience.
Is this your first project?
It is my first instructable but not my first project. I tinkered a lot in the past but I really don’t have much time nowadays. I resurrected my rusty skills as I am trying to teach something useful to my kids..! I made a few more projects that I might one day publish..
We have a be nice policy.
Please be positive and constructive.
Great! Can you implement voice control?
very nice king Project!
I have a probleme with Geolocation:
"Geolocation failure step 3 (Geocoding)"
Can i configure the Latiude and Longtiude manually?
i have a wlan connection and google api key configuret to the Atmoscan.
How i can configure the MQTT over the Atmoscan WEB configure interface
Can you help me please?
Hi PG103F, did you make a full atmoscan..?
Share the pictures!
MQTT, Thingspeak is working!
Thanks for the help!
This is my last two problemes:
The geiger counter and pressure BMP280 sensor.
I dont use the original HV module from this projekt.
I use this Theremino HV Module:
This Module works for annother Adruino and ESP8266
With Atmoscan not.
This module is very cheap. 15-20 Dollar.
Can i to adopt this Theremino Module in Atmoscan scatch?
Can i calibrate the BMP280 pressure module with my sea altitute (380m)
The reading is wrong: 975hpa, Normaly so 1016hPa
>>2) what do you mean that the widget is rotated 180 degree?
Is working, no probleme!
thank you and kindly regards!
In fact i did not specify how to configure MQTT.
The server is:
Channels are in the following format:
NOTE: you need 3 channels
Questions from my side:
1) Did you make the whole thing?
2) what do you mean that the widget is rotated 180 degree?
thank you very much for fast answer!
The mistake was I did not have a valid geolocation account.
I have created an account and now it works! Now I have the problem that the weather widget is rotated by 180 degrees, the other menus are normal.
I have an Thingspeak account but I do not know how to as configure it with atmoscan.
Thanks you !
Hi there, i am traveling and i dont have much with me... however, here is what comes to mind:
1) if you built the latest version fro github, there is nothing hardcoded anymore. From the configuration page you set all params including API keys of services etc
2) Specifically, if i remember correctly, Step3 goes to GeoNames.org. Have you created an account there? The username is one of the config parameters above.
Try adding some temporary log statements to see why it fails. let me know.
I eventually received my PCB's and have some surplus.I am willing to let them go at
$A 5.00 each plus postage via Australia Post to wherever you live at cost. I am away for a month, but you can email me at "firstname.lastname@example.org" if you have any interest and I will be in contact on my return.
Do you have a parts list of the components for the pcb
Follow the link above to github. In the Eagle directory there is a bill of material file
I have a question regarding programming the esp 12e. If I understand correctly programming has to be done after the board is populated and the sensors connected?
Added to Q&A
Hi Sanjoy, the ESP12E cannot be easily programmed stand alone. So either you connect it to another board to program it, or you program it when soldered to the atmoscan board. Specifically, the atmoscan board inclides a programming circuitry that is in line with the NodeMCU. To program it you should connect a USB-Serial adapter (e.g. FTDI232 or similar) to the J7 connector (next to the reset button). Program can be uploaded without sensors connected, except that you should ground the interrupt line of the geiger sensor, Pin3 in in the RAD connector, otherwise the board will not boot. If nothing is connected to the board i am not sure if it will boot. Some sensors initialisation is blocking, courtesy of the provider of the library. One example is the multigas library. However, you could disable the related process, see the Q&A section. When it boots, it should recognise that it is not configured and should open a wifi hotspot, to which you can connect and set it up. Among the settings, there is a syslog server that helps greatly debugging. You can increase the logging level by uncommenting the #define DEBUG_SYSLOG in the GlobalDefinitions.h file.
Serial is used only for first programming. After that, OTA programming via wifi is the preferred option.
Please let me know if you succeed.
It looks like a great project. I live in Kingston, Tasmania and would be interested in a pcb if you have any left?
Hi, i checked and in fact regular postage is cheap. Not sure if reliable though. I have the last PCB available and I would love to get it to the other side of the planet! Let me know if interested via private message.
hi there, greetings from Europe. See the new Q&A section!
Congratulations !!! fabulous project, just what I want to construct for home.
I would like a PCB if you have any left? ( I live in Australia Post Code 4810)
If not could you please give me the board dimensions so I can get a quote please
Hi, i checked and in fact regular postage is cheap. Not sure if reliable though. I have the last PCB available and I would love to get it to the other side of the planet! Let me know if interested via private message.
Hi there, thanks for your message. Honestly i believe the postage would make it not worth it. Check on the chinese site I used (https://dirtypcbs.com/store/pcbs). you can just upload my Eagle files, no edit needed unless you want to make mods. For 25USD you will get 10. Given the interest shown, some people could be interested in getting the other 9..! Let me know if you make it!
I am interested in 2 PCB. How much to Belgium and PayPal?
Do not send personal information via comments. Send me a private message instead