Forum Sensor.Community

SDS011 fan stopped suddenly

Hi all,

An electronics noob here trying to build an AQI station using Nova SDS011 and a Raspberry pi. The sensor was working flawlessly but suddenly the fan stopped working and now I see a red light with a blinking green light on the USB connector of the sensor along with a blinking red light on the back of the sensor. The sensor also makes two very faint click sounds every few seconds. Here is a short video of the usb connector for reference.

I wrote this python script to gather data from the sensor and send it to my feed on Adafruit IO:

import serial, time, urllib.request, urllib.error
from Adafruit_IO import RequestError, Client, Feed
#key removed for security purposes
aio = Client('wisekaiser', '')

ser = serial.Serial('/dev/ttyUSB0')

def wait_for_internet_connection():
    while True:
        try:
            response = urllib.request.urlopen('http://www.google.com/', timeout=1)
            return
        except urllib.error.URLError:
            pass

def main():
    while True:
        data = []
        for index in range(0,10):
            datum = ser.read()
            data.append(datum)
        
        pmtwofive = int.from_bytes(b''.join(data[2:4]), byteorder='little') / 10
        pmten = int.from_bytes(b''.join(data[4:6]), byteorder='little') / 10
        
        print('PM2.5: ', pmtwofive)
        print('PM10: ', pmten)

        aio.send('pragatitwofive', pmtwofive)
        aio.send('pragatiten', pmten)

        time.sleep(10)

wait_for_internet_connection()
main()

I’m running this as a cron job by using sudo crontab -e. This is the entry inside the crontab file:
@reboot python3 /home/raspberry/Desktop/airquality.py >>/home/raspberry/Desktop/log.text 2>&1

Any ideas on what’s wrong here and how to fix this?

The blinking led on the USB2TTL dongle seems normal to me anyway.
Can you plug the USB2TTL dongle directly on a normal computer and use the instruction screen or the serial monitor of the Arduino IDE to read what the SDS011 sends ?

Are you sure you are connected to the internet ? I don’t really understand the wait_for_internet_connection() function.

Long live the microcontrollers! Why don’t you use a small ESP8266 or ESP32 to do this?

Thanks a lot for your response, @pjg

I’ll try to connect this to a windows desktop and report the results. So far I have only run this on a raspberry pi where there was no instruction screen of any sort.

Are you sure you are connected to the internet ? I don’t really understand the wait_for_internet_connection() function.

Yes, the internet connection is fine. In fact, the sensor is also sending abnormally low values to the Adafruit io feed. The purpose of wait_for_internet_connection() function is to ensure that there is internet connection before the script tries to send the data to the feed. This is useful because we’re running this script through cron at reboot. Without the function, the cron job runs (and finishes) even before the raspberry pi has a chance to connect to wifi.

Long live the microcontrollers! Why don’t you use a small ESP8266 or ESP32 to do this?

I already had an old raspberry pi lying unused so I thought I’d put it to good use lol. But I’ll definitely consider getting one of those microcontrollers for future projects. Just the whole idea of microcontrollers sounds a little scary to me haha.

Could you please elaborate on this? I just installed Arduino IDE but not sure how to go about the next steps and what to select in the boards list since I don’t have an arduino.

Edit: @pjg I tried connecting the dongle on my windows pc with the Dust Viewer v1.3 and SPM25Data.exe (downloaded from Nova website). I’m getting very low readings ranging from 0.5 to 5 PM2.5 levels. This matches with the readings that I get via my python script. However, I’m 100% sure these readings are incorrect because I live in one of the most polluted cities on Earth. The correct reading in my room should be around 25-30. The sensor was able to produce this earlier (before the fans stopped spinning).

Edit2: directly blowing air into the sensor does spike the aqi. Not sure why is the fan not running like it was before.

The fan does not work at all ? Have you made some bad manipulation with the pins? I have already brnt a fan just by inverting two lines for one second… I hade to change the fan from another sensor with a dead diode.

Capture d’écran 2021-12-05 à 23.12.58

Capture d’écran 2021-12-05 à 23.13.23