Getting Started with NodeMCU on Windows

Developing with NodeMCU on Windows

I’ve spent a considerable amount of time programming and learning about ESP8266 modules and NodeMCU. I started with the basic AT commands, tried the arduino interface for it, and finally settled on the NodeMCU solution. I put together a tutorial for NodeMCU on Windows. Basically, NodeMCU allows you to program the ESP8266 with the Lua language, which runs on an open-source C-based firmware. The caretakers of the firmware appear to be mostly Chinese-based, with a few others mixed in. I have faith it will do well, but my impression after working with it for some months is that it will be best for the DIY community, and not for consumer electronics, where reliability is key–at least, not using the latest firmware release…there are a few bugs, including one with the MQTT .

I’ve made some libraries for it, one creates a server at 192.168.4.1 (working on making it redirect any site request) and allows you to choose a network to join. These are a work in progress. Good luck and bless up…

To run ESPlorer in linux, download the zip file and run

1
java -jar ESPlorer.jar

Read more

DIY Arduino/microcontroller air quality device

Summary

Fine particulate matter in the air from cars and trucks, cooking, fires, and industry can give you cancer, heart attacks, and shorten your lifespan. Poor air quality can have a number of other bad effects. You can make a DIY air quality monitor (AQM) for about $20 that can warn you of poor air quality. You can add internet datalogging for another few bucks. This will give you a rough measurement of the air quality of your environment, and can help you determine if you should do anything about it (get an air filter, etc).

Background

Tiny particles in the air, generated from cars, trucks, powerplants, industry, and even cooking and burning fires at home, are causing cancer, heart attacks, and premature death among other ailments.

The risk of getting lung and brochus cancer stand at around 7% today, though around 80-90% of this is thought to be due to smoking.

Read more

New particulate sensors

New sensors for air particulate sensing

While ordering more Shinyei PPD42NS particle sensors off of aliexpress, I noticed a bunch of other particle sensors that I hadn’t seen before. It would appear measuring air quality is becoming more popular! I even found a full-on portable air quality monitor, but it appears it’s not wifi-connected, and apparantly has no documentation (common for Chinese goods). It’s by a company called Plantower out of China.

plantower.png

There’s also this, which I think is by Plantower too, the SDS011, the SM-PWM-01 (which is another ripoff of the Shinyei PPD42NS), the INSAN CP-15-A3 all in Chinese, and the PMS3003.

Of course there’s the Shinyei PPD42NS and it’s first ripoff, the Samyoung DSM501A, which have been out for a while.

Read more

Calibratin' air quality monitors

Calibrating air quality sensors

I’ve been working with the Shiyei PPD42NS sensor, and the cheaper (by %50) Samyoung DSM501A. My goal is to have a portable sensor that will keep track of the particulate matter you are breathing, and warn you if you hit dangerous levels.

The first step is making sure the sensors are accurate enough for this purpose. I bought a Dylos DC1100 Pro air quality monitor, which uses a laser and a fan to measure particles in the air. It puts out a number that is number of 1-micron or larger particles per 0.01 ft3 (and a number for 5-micron or larger).

Procedure

calib-setup.jpg

Read more

Python machine vision

Python machine vision LCD OCR WTF

I just finished getting a camera through a usb adapter visible in python, and now I’m getting the machine vision set up. I found someone who already did all the hard stuff. I used this LCD numbers image since it had the same font as the display on the Dylos air quality monitor. I had to adjust the perspective to make it flat for the machine vision training though, so I used gimp to do that. Then I realized there was a 0 with a line under it, so I replaced that with another 0 from lines below. After that, I started training the program, but it was seeing 4s and 1s. I had to change the threshhold for detection from

thresh = cv2.adaptiveThreshold(blur,255,1,1,11,2)

to this

thresh = cv2.adaptiveThreshold(blur,255,0,1,25,-2)

The docs describe this function a bit, although I can’t get the cv2.CV_ADAPTIVE_THRESH_MEAN_C to print, so I’m not entirely sure which adaptive_method I’m using (I think I changed it from gaussian, 1, to linear, 0). I empirically found the higher block size and lower constant seem to work best for this image. After that, it works well.

Read more