Coder Social home page Coder Social logo

sonoff-pow's Introduction

Sonoff-POW

Library and First Project for Sonoff POW switch The included libary is an enhanced version of the ITEAD.cc library

The library and the sketch reads the values from the Sonoff POW HLW8012 chip and calculates the respective Power, current, and oltage values. Only voltage or current reading can be chosen.

The sketch connects to the iopappstory.com and loads the assigned firmware down. It also asks for the WiFi credentials. and it connects to Adafruit.io as an MQTT broker. Pleas include the credentials in the credentials.h file and place this file in the libraries folder

The explanation of the project is on YouTube:

sonoff-pow's People

Contributors

sensorsiot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sonoff-pow's Issues

ESP8266 - Sonoff POW - Reading HLW8012 and Webclient = Exception (0)

Hello,
I am using your library and it is working very good, however from time to time I get an Exception and the sonoff reboots.

I have implemented a simple sketch which reads the power values and sends them using a webclient. The webclient parts works perfectly without the POWER code so I presume it might be related to an interrupt.

This is the stack error shown in the serial monitor...

connecting to xxxxx.xxx.me
Exception 0: Illegal instruction
Decoding 29 results
0x402034f4: ESP8266PowerClass::measureVoltageFreq() at C:\Users\Sergio\Documents\SERGIO\libraries\Sonoff_POW-master/power.cpp line 294
0x40107018: interrupt_handler at C:\Users\Sergio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_digital.c line 119
0x4010177d: ppEnqueueRxq at ?? line ?
0x40101433: ppProcessTxQ at ?? line ?
0x40106fe0: interrupt_handler at C:\Users\Sergio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_digital.c line 113
0x40103d19: lmacProcessTXStartData at ?? line ?
0x4010707c: interrupt_handler at C:\Users\Sergio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_digital.c line 135
0x401055c1: ets_timer_disarm at ?? line ?
0x40106fe0: interrupt_handler at C:\Users\Sergio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_digital.c line 113
0x4020954c: pm_get_sleep_type at ?? line ?
0x40105b26: spi_flash_read at ?? line ?
0x401074b8: pvPortZalloc at C:\Users\Sergio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 33
0x4020901d: pm_set_sleep_time at ?? line ?
0x402094b2: pm_get_sleep_type at ?? line ?
0x4020955f: pm_get_sleep_type at ?? line ?
0x4021ac3d: ets_timer_handler_isr at ?? line ?
0x4021ac82: ets_timer_handler_isr at ?? line ?

The reboot always happens in this code:

 Serial.print("connecting to ");
  Serial.print(host);
  
  // Use WiFiClient class to create TCP connections
   WiFiClient client;
  // const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("....connection failed");
    return;
  }
  Serial.println("....connected!");

I can see in the serial port the "connecting to host" message, but not the "connected.

Is there any chance the library is doing something during the "client.connect" which causes the exception:

EXCCAUSE Code Cause Name Cause Description Required Option EXCVADDR Loaded
0 IllegalInstructionCause Illegal instruction Exception No

thank you for your help

Set Param ?

Dear,

    this->power_param = {12.286,0};
    this->current_param = {14.818,0};
    this->voltage_param = {0.435,0};

I don't understand. how do caculator the parameter ?
Thanks!

Send Energy value increment between mqtt messages

I am saving the information received via mqtt into a MySQL database. If I store the energy value but the sonoff reboots I loose information as it starts back from zero. If an incremental value is send between mqtt messages then a simple SUM of rows would report the energy consumed during that period.
Is this possible?

Error in power_arduino.ino

Hey. On line 12 there is an error power_dev.selectMeasureCurrentOrValtage (VOLTAGE); In the word valtage. I found and corrected it, but still no indication of current. Although the voltage and power values are present ...

crashes on Sonoff POW v2

Guten Tag Herr Spiess
Vielen Dank für Ihre Bibliothek, die bald zwei Jahre klaglos ihren Dienst tut in meinen Sonoff POW v2 devices.
Mit neu kompiliertem Code funktioniert es leider nicht mehr. Der ESP Chip crasht sofort beim Aufruf einer Messung.
Ich bin nicht gut genug, das genauer zu analysieren.
Die Alternative Bibliothek von Xose Perez liefert zwar die Leistung (perfekt 25W bei einer alten 25Watt Birne), aber der Strom ist immer 0, auch wenn ich mich an seinen Beispiel-Code halte. Also auch nicht viel besser.

Haben Sie die Zeit, das Problem zu analysieren?
Wenn es nicht reproduzierbar ist, dann werde ich versuchen, einen minimalen Sketch zu bauen und den Crashdump zu analysieren.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.