jorgeassuncao / MAID-EM

The MAID - Energy Monitor is an energy monitor based on a ESP8266 board that uses the XTM18S (or compatible) single phase energy meter to get energy readings. The energy monitor is MQTT enabled and sends readings for power (W), consumption (kWh) and accumulated consumption (kWh), and with a couple tricks you can also get apparent power (kVA) and current (A).
GNU General Public License v3.0
8 stars 5 forks source link

ESP8285 allowed? #5

Open doreks opened 5 years ago

doreks commented 5 years ago

hi ! i have sonoff modue with chip esp8285. i was wondering if is there any way to test this project with this module, I have try to upload to my module sonoff this code , changing pinout, but seems that is not working, wifi doesnt work.. and there is no way to double check connectivity due i cannot reach the device.

i would like if you could give me support

BR

jorgeassuncao commented 5 years ago

The code was written for the ESP8266 and i'm not sure if your problem is related to that.

How did you change the pinout?

doreks commented 5 years ago

for the pinout for this esp8285 i have double check this web:

https://github.com/arendst/Sonoff-Tasmota/wiki/Sonoff-Basic

here you can find old model of sonoff basic with esp8266 and new model with esp8285. as you can see led pin is 13 and digital input sensor could be 3 or 2.

do you think after change numbers of pin could i reuse the code ? on the other hands to can run this code in my sonoff i have erased this line

attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, RISING);

with this line the program doesn run and i get following error;

isr not in iram

after erase this line i can access and ping the sonoff, but still witout see power of the line and this things, i can imagin that is because i need to solder pin 3 or 2 right?

and last question for xtm position pin 20 and 21 towards what pins are conected in our board?

thank you so much for your suppor!

jorgeassuncao commented 5 years ago

The header pinout is the same on both models, the diference is only internal.

What settings are you using when flashing the device?

doreks commented 5 years ago

so in this case i do not need to change pinout let or pinout digital input sensor..?

related with settings that i'm using to flash device I have followed this guide:

https://www.pcdemano.com/revisiones/235/2/

In the second screenshot that has configuration to flash with ArduinoIDE you can see the settings that im using to connect to this device and flash.

jorgeassuncao commented 5 years ago

On the screenshot I see that Placa is set as 8266 and you say your sonoff has a 8285. Can this be the reason for your error?

doreks commented 5 years ago

i dont think so because if i flash using this model of board that i have i'm getting the same error :

isr not in iram

so the way to can run sonoff i need to remove the line with attachInterrupt and i can do run the code. in this point where i can run the code the issue is, how connect the pinout towards XTM device, I mean what pin from sonoff towards what port of pinout in XTM..? because i can access to web server of sonoff to see values of energy but everything there, counters, are in 0

jorgeassuncao commented 5 years ago

The error isr not in iram has to do with the Espressif library.

https://community.platformio.org/t/how-to-fix-isr-not-in-iram/8031

Try to change the library to another version and test it. If you remove that line the code won't count the pulses from the XTM.

doreks commented 5 years ago

good point!!! but for me has been the beginning of a special relationship with windows 10 and their blue screenshots each time that i tried flash the code in my esp. at the end has been imposible flash the code using windows 10 with release 2.5.0 of esp8266. The only way to fix this issue has been installing arduino ide in mac os and flash the code with release 2.5.0 No errors of isr not in iram, and seems tha the code works fine now I just have to clarify which pinout to use in my sonoff towards XTM..:

in sonoff i have:

thank you so much @jorgeassuncao for your support!!!

jorgeassuncao commented 5 years ago

You have to choose gnd and another available pin (which is the one you have to put on #define DIGITAL_INPUT_SENSOR)

doreks commented 5 years ago

cool! i have defined this value with id pin 01, which is assigned to TX.

now i'm able to see the current power and curren consumption, but it's not stable i mean, it doesn't show always values as current consumption or curren power only some times, most of the times it show values with value 0.

:-/

any idea..?

jorgeassuncao commented 5 years ago

That is "normal". Try changing SEND_FREQUENCY to 30000 (30 seconds) or 60000 (1 minute) and see if it gets better.