Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use esp8266? #42

Open
tistructor opened this issue May 8, 2024 · 14 comments
Open

Is it possible to use esp8266? #42

tistructor opened this issue May 8, 2024 · 14 comments

Comments

@tistructor
Copy link

I repeat the title question: Is it possible to use esp8266?
In order to insert the firmware into the wifi antenna supplied to the inverter.

@tistructor
Copy link
Author

I did the test and it works correctly, we need to eliminate the temperature sensor inside the esp32 because the esp8266 doesn't have it.

I managed to insert this firmware into the wifi dongle supplied with the inverter.

Thanks, everything works.

In fact, I also inserted modbus commands to read the second mppt for those who have the firmware that accepts this command.

 - platform: modbus_controller
    modbus_controller_id: smg_inverter
    name: "PV Voltage2"
    id: pv_voltage2
    address: 4563
    register_type: holding
    value_type: U_WORD
    unit_of_measurement: "V"
    device_class: voltage
    state_class: measurement
    accuracy_decimals: 1
    lambda: |-
      return swapBytes(x);
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: smg_inverter
    name: "PV Power2"
    id: pv_power2
    address: 4564
    register_type: holding
    value_type: U_WORD
    unit_of_measurement: "W"
    device_class: power
    state_class: measurement
    accuracy_decimals: 1
    lambda: |-
     return swapBytes(x);

@lufton
Copy link

lufton commented Jun 9, 2024

@tistructor I kinda made the same for 10.2kW version. Are we talking about Wi-Fi Plug Pro-05? The only problem I found is it reboots every 15-30 seconds. I measured voltage on 3.3 rail and it drops down to 0.4V periodically witch lead to reboot. I don't think I managed to break something while flashing and debugging and also not sure there wasn't an issue before I made modifications though. If I hookup external power (e.g. from USB TTL converter) then everything is okay.

@tistructor
Copy link
Author

There is an esp8266 GPIO that generates a 2 HZ square wave that disables the 3.3v to turn off every 20 - 30 seconds. This problem can be eliminated by using a jumper or via firmware.
WhatsApp Image 2024-05-12 at 11 09 51

The gipio is the 13th, I put this file in the esphome project helper folder and compiled. it works well.

#include "esphome.h"
#include "Arduino.h"
//#include "pins_arduino.h" se si include questo file si possono utilizzare la codifica arduino per i gpio altrimenti si deve usare la codifica esp8266
class enDonglePWM : public Component {
 public:
  void setup() override {
    // This will be called once to set up the component
    // think of it as the setup() call in Arduino
    pinMode(0, OUTPUT);
    digitalWrite(0, LOW);
    pinMode(4, OUTPUT);
    digitalWrite(4, LOW);
    pinMode(5, OUTPUT);
    digitalWrite(5, LOW);
    pinMode(13, OUTPUT);  
  }

  void loop() override {

        static uint32_t timerPWM = millis();
        static bool state = false;
        if(millis() - timerPWM > 1000){
            timerPWM = millis();
            digitalWrite(13,!state);
            state = !state;
        }
  }
};

@lufton
Copy link

lufton commented Jun 19, 2024

Wow, @tistructor thanks, I'll try your solution! How did you manage to reverse-engineer that?

@lufton
Copy link

lufton commented Jun 19, 2024

I've fixed mine connecting input of additional 3.3V linear voltage regulator to output of 5V regulator and it's output to 3.3V rail.

@tistructor
Copy link
Author

Wow, @tistructor grazie, proverò la tua soluzione! Come sei riuscito a decodificarlo?

I checked the signals on the various pins of the esp8266 with the original firmware and saw that the gpio 13 performed this function of disabling autoreset.
If you perform the procedure via firmware you do not need to make any hardware changes and if you put the original firmware you get the same factory features.
I believe that some GPIOS have the function of updating the dongle's firmware remotely and with hardware modification it may present some problems in carrying out this operation.
It's just a guess.

@lufton
Copy link

lufton commented Jun 20, 2024

Do you think this will also work?

output:
  - platform: esp8266_pwm
    id: keep_alive_output
    pin: GPIO13
    frequency: 2Hz

upd: actually it will require some additional component like light and setting brightness to 50%.

@tistructor
Copy link
Author

Pensi che funzionerà anche questo?

output:
  - platform: esp8266_pwm
    id: keep_alive_output
    pin: GPIO13
    frequency: 2Hz

upd: in realtà richiederà alcuni componenti aggiuntivi come la luce e l'impostazione della luminosità al 50%.

Try.
I used the old method because I'm not an HA expert but I saw that it can also be done through HA configuration files.
It should work, there are several ways to do this.

@lufton
Copy link

lufton commented Jun 20, 2024

I think this should work:

interval:
  - interval: 250ms
    then:
      - output.toggle: keep_alive_output

output:
  - platform: gpio
    id: keep_alive_output
    pin: GPIO13

@tistructor
Copy link
Author

@tistructor
Copy link
Author

I haven't run trials, but one of these medoti should work.

@lufton
Copy link

lufton commented Jun 20, 2024

output should work the same way as switch, but configuration will be shorter and I believe firmware is gonna be smaller as switch implementation is much more complicated than output.

@lufton
Copy link

lufton commented Sep 1, 2024

@tistructor according to your code it looks like it pulses not 2Hz, but 0.5Hz (full cycle in 2 seconds). So what is the correct value?

@tistructor
Copy link
Author

@tistructor according to your code it looks like it pulses not 2Hz, but 0.5Hz (full cycle in 2 seconds). So what is the correct value?

Yes, that's correct, I wrote wrong. 0.5Hz is the correct value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants