Commit 818340c1 authored by Frank Heuer's avatar Frank Heuer

Initial push to gitlab

This diff is collapsed.
"""Moduel holding the exceptions for use in SDS011 class"""
class Error(Exception):
"""Base class for exceptions in this module."""
class WorkStateError(Error):
"""Exception raised for errors in the workingmode."""
class GetStatusError(Error):
"""Exception raised when initial getting the current sensor status won't work."""
class ReportModeError(Error):
"""Exception raised when sensor is in wrong reportmode for requested operation."""
The Sensor comes with a Windows software but can be used with raspberry pi GPIO feature by using the serial in an d output channels.
In order to use it on raspberry pi one has to enshure that no other serial communication is happening.
So in /boot/cmdline the line
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
has to be changed to
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait quiet splash plymouth.ignore-serial-consoles
At the time writing this lines you can find many threads in the weg pointing to "edit the inittab". But today working with actual firmware there is no inittab.
Details about that could be found here:
So to disable getty just type
">sudo systemctl stop serial-getty@ttyAMA0.service"
in your terminal or disable it
">sudo systemctl disable serial-getty@ttyAMA0.service"
(here ist just a hint for me which wires I used on my bread board
yellow on sensor tx
green on sensor rx
Use extra power device for the sensor
My sensors is showing up with firmware version 160829 and ID=CC0B in the Windows software.
What I found out is
set ( cc:0a) aa:b4:05:00:00:00:00:00:00:00:00:00:00:cc:0a:ff:ff:d9:ab
Report Mode:
Initiative set aa:b4:02:01:00:00:00:00:00:00:00:00:00:00:00:ff:ff:01:ab Response aa:c5:02:01:00:00:cc:0b:da:ab
Passiv set aa:b4:02:01:01:00:00:00:00:00:00:00:00:00:00:ff:ff:02:ab Response aa:c5:02:01:01:00:cc:0b:db:ab
Botton Request once aa:b4:04:00:00:00:00:00:00:00:00:00:00:00:00:ff:ff:02:ab Response (Data!) aa:c0:86:00:42:01:cc:0b:a0:ab
Work state:
Sleeping set aa:b4:06:01:00:00:00:00:00:00:00:00:00:00:00:ff:ff:05:ab Response aa:c5:06:01:00:00:cc:0b:de:ab
Measureing set aa:b4:06:01:01:00:00:00:00:00:00:00:00:00:00:ff:ff:06:ab Response aa:c5:06:01:01:00:cc:0b:df:ab
Duty Cycle
1 set aa:b4:08:01:01:00:00:00:00:00:00:00:00:00:00:ff:ff:08:ab Response aa:c5:08:01:01:00:cc:0b:e1:ab
2 set aa:b4:08:01:02:00:00:00:00:00:00:00:00:00:00:ff:ff:09:ab Response aa:c5:08:01:02:00:cc:0b:e2:ab
3 set aa:b4:08:01:03:00:00:00:00:00:00:00:00:00:00:ff:ff:0a:ab Response aa:c5:08:01:03:00:cc:0b:e3:ab
3 get aa:b4:08:00:00:00:00:00:00:00:00:00:00:00:00:ff:ff:06:ab Response aa:c5:08:00:03:00:cc:0b:e2:ab
0 get aa:b4:08:00:00:00:00:00:00:00:00:00:00:00:00:ff:ff:06:ab Response aa:c5:08:00:00:00:cc:0b:df:ab
send 1 aa:b4:07:00:00:00:00:00:00:00:00:00:00:00:00:ff:ff:05:ab Response aa:c5:07:10:08:1d:cc:0b:13:ab
send 2 aa:b4:07:00:00:00:00:00:00:00:00:00:00:00:00:ff:ff:05:ab Response aa:c0:24:00:cd:00:cc:0b:c8:ab
So this is a good starting point to build a Sensor Class. It's my first python project
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment