项目作者: FastyBird

项目描述 :
Itead Sonoff SC atmega part
高级语言: C++
项目地址: git://github.com/FastyBird/sonoff-sc.git
创建时间: 2018-01-25T09:24:45Z
项目社区:https://github.com/FastyBird/sonoff-sc

开源协议:GNU General Public License v3.0

下载


Sonoff SC

Custom firmware for the Itead Sonoff SC environmental unit - sensors part.

version
travis
license

Features

  • Fully compatible with original EWeLink firmware
  • Support for two types of temperature and humidity sensors, DHT11 & DHT22
  • Optionally support Microwave based presence detector
  • Clap monitoring sends info when clapping is detected

Documentation

This firmware is only for the slave unit in the Sonoff SC device and could be only uploaded into ATMega328.

Communication from ATMega328 to ESP8266 master:

  1. AT+UPDATE="humidity":42,"temperature":20,"light":7,"noise":3,"dusty":1,"dust":0,"illuminance":150[1B]
  2. response: AT+SEND=ok[1B] or AT+SEND=fail[1B]
  3. AT+STATUS?[1B]
  4. response: AT+STATUS=4[1B]

Communication from ESP8266 master to ATMega328:

  1. AT+DEVCONFIG="uploadFreq":1800,"humiThreshold":2,"tempThreshold":1[1B]
  2. AT+NOTIFY="uploadFreq":1800,"humiThreshold":2,"tempThreshold":1[1B]
  3. response: AT+NOTIFY=ok[1B]
  4. AT+SEND=fail[1B]
  5. AT+SEND=ok[1B]
  6. AT+STATUS=4[1B]
  7. AT+STATUS[1B]
  8. AT+START[1B]

Communication sequence:

Data exchange:

Communication have to be started from the master unit (ESP8266):

  1. AT+START[1B]

Slave unit will respond with measured values:

  1. AT+UPDATE="humidity":42,"temperature":20,"light":7,"noise":3,"dusty":1,"dust":0,"illuminance":150[1B]

Master have to answer to this response. If data are ok, then:

  1. AT+SEND=ok[1B]

and if received data are not ok, then:

  1. AT+SEND=fail[1B]

Connection check:

Slave unit, will in defined periods check the connection to the master. So it will ask master if is ready and receiving:

  1. AT+STATUS?[1B]

Master have to answer with:

  1. AT+STATUS=4[1B]

In case master do not respond to this check connection request, slave will stop transmit data.

Display levels for measured values

This levels were measured during testing communication between this custom firmware and original EWeLink firmware.

Sound level

  • quiet - for values from 0.00 to 3.00
  • normal - for values from 3.01 to 6.00
  • noisy - for values from 6.01 to 10.00

Light intensity

  • bright - for values from 0.00 to 4.00
  • normal - for values from 4.01 to 8.00
  • dusky - for values from 8.01 to 10.00

Dust level or Air quality level

  • good - for values from 0.00 to 4.00
  • moderate - for values from 4.01 to 7.00
  • unhealthy - for values from 7.01 to 10.00

Microwave sensor

case microwave is present, ATMega328 will send extended data message:

  1. AT+UPDATE="humidity":42,"temperature":20,"light":7,"noise":3,"dusty":1,"dust":0,"illuminance":150,"movement":1[1B]

Value for movement parameter could be 0 or 1, when 0 mean no presence detected.

License

Copyright (C) 2017-2018 by FastyBird Ltd.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses.