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?