Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Hardware
  4. S0 - Signal mit Wemos D1 Mini erzeugen?

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    13
    1
    117

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    11
    1
    561

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    24
    1
    1.7k

S0 - Signal mit Wemos D1 Mini erzeugen?

Geplant Angeheftet Gesperrt Verschoben Hardware
wemos d1 minis0-signalwärmepumpepv-anlagepv-überschusswärmepumpe pv photovoltaikfronius wechselrichter
78 Beiträge 7 Kommentatoren 12.2k Aufrufe 7 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • D Dieter_P

    Hab leider kein Oszilloskop um das mal zu prüfen.

    Wenn Du mir einen "easy" weg erklärst wie ich das in den ESP32 reinbekomme, schließe ich mal ein Oszi dran an.

    A Offline
    A Offline
    Andy123Andy1
    schrieb am zuletzt editiert von Andy123Andy1
    #50

    @dieter_p Ich würde das mit Adurino IDE auf einen ESP flashen.

    Hier der Code vereinfacht und ohne Wifi & MQTT. Das sollte jetzt 5kwH abbilden.

    // S0 Pin configuration
    const int s0Pin = 7; // Pin connected to the S0 output signal
    
    // Timing variables
    unsigned long pulseDuration = 100; // Duration of each pulse in milliseconds
    // replaced with static value
    unsigned long pulseInterval = (3600 * 1000) / (5 * 1000) - pulseDuration; // Interval between pulses in milliseconds (initial value)
    
    
    void setup() {
      // Set the S0 pin as an output
      pinMode(s0Pin, OUTPUT);
    
      // Initialize Serial for debugging
      Serial.begin(115200);
    }
    
    void loop() {
      // Generate a pulse
      digitalWrite(s0Pin, HIGH);  // Set the S0 pin HIGH
      delay(pulseDuration);       // Wait for the pulse duration
      digitalWrite(s0Pin, LOW);   // Set the S0 pin LOW
      delay(pulseInterval);       // Wait for the interval before the next pulse
    }
    
    
    
    D 2 Antworten Letzte Antwort
    0
    • A Andy123Andy1

      @dieter_p Ich würde das mit Adurino IDE auf einen ESP flashen.

      Hier der Code vereinfacht und ohne Wifi & MQTT. Das sollte jetzt 5kwH abbilden.

      // S0 Pin configuration
      const int s0Pin = 7; // Pin connected to the S0 output signal
      
      // Timing variables
      unsigned long pulseDuration = 100; // Duration of each pulse in milliseconds
      // replaced with static value
      unsigned long pulseInterval = (3600 * 1000) / (5 * 1000) - pulseDuration; // Interval between pulses in milliseconds (initial value)
      
      
      void setup() {
        // Set the S0 pin as an output
        pinMode(s0Pin, OUTPUT);
      
        // Initialize Serial for debugging
        Serial.begin(115200);
      }
      
      void loop() {
        // Generate a pulse
        digitalWrite(s0Pin, HIGH);  // Set the S0 pin HIGH
        delay(pulseDuration);       // Wait for the pulse duration
        digitalWrite(s0Pin, LOW);   // Set the S0 pin LOW
        delay(pulseInterval);       // Wait for the interval before the next pulse
      }
      
      
      
      D Offline
      D Offline
      Dieter_P
      schrieb am zuletzt editiert von Dieter_P
      #51

      @andy123andy1 said in S0 - Signal mit Wemos D1 Mini erzeugen?:

      @dieter_p Ich würde das mit Adurino IDE auf einen ESP flashen.

      Bin Tasmota/ESPEasy verseucht, aber wird man ja nicht dümmer durch etwas Neues zu probieren. Starte mal bei mir die Umgebung aufzusetzen und melde mich.

      Alternativ die "dumme" Frage eine .bin datei daraus kannst Du mir nicht erzeugen und ich flashe sie einfach auf den ESP?

      A 1 Antwort Letzte Antwort
      0
      • D Dieter_P

        @andy123andy1 said in S0 - Signal mit Wemos D1 Mini erzeugen?:

        @dieter_p Ich würde das mit Adurino IDE auf einen ESP flashen.

        Bin Tasmota/ESPEasy verseucht, aber wird man ja nicht dümmer durch etwas Neues zu probieren. Starte mal bei mir die Umgebung aufzusetzen und melde mich.

        Alternativ die "dumme" Frage eine .bin datei daraus kannst Du mir nicht erzeugen und ich flashe sie einfach auf den ESP?

        A Offline
        A Offline
        Andy123Andy1
        schrieb am zuletzt editiert von
        #52

        Doch das geht ich müsste nur welchen welchen ESP.

        D 1 Antwort Letzte Antwort
        0
        • A Andy123Andy1

          Doch das geht ich müsste nur welchen welchen ESP.

          D Offline
          D Offline
          Dieter_P
          schrieb am zuletzt editiert von Dieter_P
          #53

          @andy123andy1

          Hab einen ESP32 S2 hier (wie auf der Zeichnung/Screenshot)

          Edit: den configurierten S0 Pin hast Du in der letzten Version rausgenommen, bleibt bei GPIO 7 ?

          A 1 Antwort Letzte Antwort
          0
          • D Dieter_P

            @andy123andy1

            Hab einen ESP32 S2 hier (wie auf der Zeichnung/Screenshot)

            Edit: den configurierten S0 Pin hast Du in der letzten Version rausgenommen, bleibt bei GPIO 7 ?

            A Offline
            A Offline
            Andy123Andy1
            schrieb am zuletzt editiert von Andy123Andy1
            #54

            @dieter_p

            sketch_jun25a.ino.bin

            ist die 7

            D 1 Antwort Letzte Antwort
            1
            • A Andy123Andy1

              @dieter_p

              sketch_jun25a.ino.bin

              ist die 7

              D Offline
              D Offline
              Dieter_P
              schrieb am zuletzt editiert von
              #55

              @andy123andy1

              kann keine Funktion/Signalpuls messen

              Hab zum Test nochmal ESPEasy zum Vergleich genutzt und hier lässt sich ein Puls messen.

              A 1 Antwort Letzte Antwort
              0
              • D Dieter_P

                @andy123andy1

                kann keine Funktion/Signalpuls messen

                Hab zum Test nochmal ESPEasy zum Vergleich genutzt und hier lässt sich ein Puls messen.

                A Offline
                A Offline
                Andy123Andy1
                schrieb am zuletzt editiert von
                #56

                Komisch nochmal das gleiche mit PIN 2

                sketch_jun25a.ino.bin

                D 1 Antwort Letzte Antwort
                0
                • A Andy123Andy1

                  Komisch nochmal das gleiche mit PIN 2

                  sketch_jun25a.ino.bin

                  D Offline
                  D Offline
                  Dieter_P
                  schrieb am zuletzt editiert von
                  #57

                  @andy123andy1

                  bisher nein und mit ESPEasy alles wie gehabt:
                  71546929-9cdb-465d-8acc-26a5739b9bca-grafik.png

                  Der ESP32S2 ist am seriellen Anschluß etwas speziell, daher sehe ich im Moment keine Log/Terminal Daten ob er überhaupt startet.

                  Gucke mal ob ich was anderes hier hab.

                  1 Antwort Letzte Antwort
                  0
                  • A Andy123Andy1

                    @dieter_p Ich würde das mit Adurino IDE auf einen ESP flashen.

                    Hier der Code vereinfacht und ohne Wifi & MQTT. Das sollte jetzt 5kwH abbilden.

                    // S0 Pin configuration
                    const int s0Pin = 7; // Pin connected to the S0 output signal
                    
                    // Timing variables
                    unsigned long pulseDuration = 100; // Duration of each pulse in milliseconds
                    // replaced with static value
                    unsigned long pulseInterval = (3600 * 1000) / (5 * 1000) - pulseDuration; // Interval between pulses in milliseconds (initial value)
                    
                    
                    void setup() {
                      // Set the S0 pin as an output
                      pinMode(s0Pin, OUTPUT);
                    
                      // Initialize Serial for debugging
                      Serial.begin(115200);
                    }
                    
                    void loop() {
                      // Generate a pulse
                      digitalWrite(s0Pin, HIGH);  // Set the S0 pin HIGH
                      delay(pulseDuration);       // Wait for the pulse duration
                      digitalWrite(s0Pin, LOW);   // Set the S0 pin LOW
                      delay(pulseInterval);       // Wait for the interval before the next pulse
                    }
                    
                    
                    
                    D Offline
                    D Offline
                    Dieter_P
                    schrieb am zuletzt editiert von
                    #58

                    @andy123andy1 said in S0 - Signal mit Wemos D1 Mini erzeugen?:

                    // S0 Pin configuration
                    const int s0Pin = 7; // Pin connected to the S0 output signal

                    // Timing variables
                    unsigned long pulseDuration = 100; // Duration of each pulse in milliseconds
                    // replaced with static value
                    unsigned long pulseInterval = (3600 * 1000) / (5 * 1000) - pulseDuration; // Interval between pulses in milliseconds (initial value)

                    void setup() {
                    // Set the S0 pin as an output
                    pinMode(s0Pin, OUTPUT);

                    // Initialize Serial for debugging
                    Serial.begin(115200);
                    }

                    void loop() {
                    // Generate a pulse
                    digitalWrite(s0Pin, HIGH); // Set the S0 pin HIGH
                    delay(pulseDuration); // Wait for the pulse duration
                    digitalWrite(s0Pin, LOW); // Set the S0 pin LOW
                    delay(pulseInterval); // Wait for the interval before the next pulse
                    }

                    So, hab das mal selbst unter Adruino IDE auf den ESP geladen.
                    Funtioniert:
                    8565b262-37ba-46b1-b844-bdba82af2544-grafik.png

                    A 1 Antwort Letzte Antwort
                    0
                    • D Dieter_P

                      @andy123andy1 said in S0 - Signal mit Wemos D1 Mini erzeugen?:

                      // S0 Pin configuration
                      const int s0Pin = 7; // Pin connected to the S0 output signal

                      // Timing variables
                      unsigned long pulseDuration = 100; // Duration of each pulse in milliseconds
                      // replaced with static value
                      unsigned long pulseInterval = (3600 * 1000) / (5 * 1000) - pulseDuration; // Interval between pulses in milliseconds (initial value)

                      void setup() {
                      // Set the S0 pin as an output
                      pinMode(s0Pin, OUTPUT);

                      // Initialize Serial for debugging
                      Serial.begin(115200);
                      }

                      void loop() {
                      // Generate a pulse
                      digitalWrite(s0Pin, HIGH); // Set the S0 pin HIGH
                      delay(pulseDuration); // Wait for the pulse duration
                      digitalWrite(s0Pin, LOW); // Set the S0 pin LOW
                      delay(pulseInterval); // Wait for the interval before the next pulse
                      }

                      So, hab das mal selbst unter Adruino IDE auf den ESP geladen.
                      Funtioniert:
                      8565b262-37ba-46b1-b844-bdba82af2544-grafik.png

                      A Offline
                      A Offline
                      Andy123Andy1
                      schrieb am zuletzt editiert von
                      #59

                      Richtig cool. Dann kann man dem code von oben und dem bischen Hardware sich das s0 signal für die lwp bauen. Ich hab mal 3 von den PC817 bestellt und werde mal testen, ob die lwp was versteht.

                      A 1 Antwort Letzte Antwort
                      0
                      • A Andy123Andy1

                        Richtig cool. Dann kann man dem code von oben und dem bischen Hardware sich das s0 signal für die lwp bauen. Ich hab mal 3 von den PC817 bestellt und werde mal testen, ob die lwp was versteht.

                        A Offline
                        A Offline
                        Andy123Andy1
                        schrieb am zuletzt editiert von Andy123Andy1
                        #60

                        Kleines update das ist jetzt das finale "script" auf einem Adurino Nano. Der sendet pauschal 2kwH an die LWP. Man kann wenn man will über eine USB/Serial Verbindung die richtige kwH in Fließkomma (1.3 etc) setzen. Bei mir hängt der Nano am USB vom "NAS".

                        const int s0Pin = 7; // Pin connected to the S0 output signal
                        
                        // Timing variables
                        unsigned long pulseDuration = 100; // Duration of each pulse in milliseconds
                        unsigned long pulseInterval = 3500; // Interval between pulses in milliseconds (initial value)
                        float kWh = 1.0; // Initial kWh value
                        
                        unsigned long previousMillis = 0; // Store the last time a pulse was generated
                        unsigned long pulseEndMillis = 0; // Store the end time of the pulse
                        bool pulseActive = false; // Flag to track pulse state
                        
                        void setup() {
                          // Set the S0 pin as an output
                          pinMode(s0Pin, OUTPUT);
                        
                          // Initialize Serial for communication
                          Serial.begin(115200);
                          while (!Serial) {
                            ; // Wait for the serial port to connect. Needed for native USB port only
                          }
                        
                          Serial.println("Enter kWh value:");
                        }
                        
                        void loop() {
                          // Check if data is available on the serial port
                          if (Serial.available() > 0) {
                            String input = Serial.readStringUntil('\n'); // Read the input
                            kWh = input.toFloat(); // Convert input to float
                        
                            if (kWh > 0) {
                              // Calculate pulse interval based on kWh value
                              pulseInterval = (3600.0 * 1000.0) / (kWh * 1000.0) - pulseDuration;
                              Serial.print("Updated kWh: ");
                              Serial.println(kWh);
                              Serial.print("Updated pulse interval: ");
                              Serial.println(pulseInterval);
                            }
                          }
                        
                          unsigned long currentMillis = millis();
                        
                          // Check if it's time to generate a new pulse
                          if (currentMillis - previousMillis >= pulseInterval && !pulseActive) {
                            // Save the last time a pulse was started
                            previousMillis = currentMillis;
                            
                            // Start the pulse
                            digitalWrite(s0Pin, HIGH);
                            pulseEndMillis = currentMillis + pulseDuration;
                            pulseActive = true;
                          }
                        
                          // Check if it's time to end the pulse
                          if (pulseActive && currentMillis >= pulseEndMillis) {
                            digitalWrite(s0Pin, LOW);
                            pulseActive = false;
                          }
                        }
                        

                        senden vom pc aus könnte so aussehen:

                        import serial
                        import time
                        
                        # Configure the serial port and baud rate
                        ser = serial.Serial('/dev/ttyUSB0', 115200)  # Change 'COM3' to the appropriate port for your system
                        time.sleep(2)  # Give some time to establish the connection
                        
                        def send_kwh_value(kwh):
                            ser.write(f"{kwh}\n".encode())  # Send kWh value as a string with newline
                            time.sleep(1)  # Give some time for the Arduino to process and respond
                        
                            # Read response lines from the serial port
                            response_lines = []
                            while ser.in_waiting > 0:
                                line = ser.readline().decode('utf-8').rstrip()
                                response_lines.append(line)
                            
                            return response_lines
                        
                        # Example usage
                        response = send_kwh_value(5.0)  # Send 5.0 kWh value
                        for line in response:
                            print(line)
                        
                        ser.close()
                        
                        
                        D 1 Antwort Letzte Antwort
                        0
                        • A Andy123Andy1

                          Kleines update das ist jetzt das finale "script" auf einem Adurino Nano. Der sendet pauschal 2kwH an die LWP. Man kann wenn man will über eine USB/Serial Verbindung die richtige kwH in Fließkomma (1.3 etc) setzen. Bei mir hängt der Nano am USB vom "NAS".

                          const int s0Pin = 7; // Pin connected to the S0 output signal
                          
                          // Timing variables
                          unsigned long pulseDuration = 100; // Duration of each pulse in milliseconds
                          unsigned long pulseInterval = 3500; // Interval between pulses in milliseconds (initial value)
                          float kWh = 1.0; // Initial kWh value
                          
                          unsigned long previousMillis = 0; // Store the last time a pulse was generated
                          unsigned long pulseEndMillis = 0; // Store the end time of the pulse
                          bool pulseActive = false; // Flag to track pulse state
                          
                          void setup() {
                            // Set the S0 pin as an output
                            pinMode(s0Pin, OUTPUT);
                          
                            // Initialize Serial for communication
                            Serial.begin(115200);
                            while (!Serial) {
                              ; // Wait for the serial port to connect. Needed for native USB port only
                            }
                          
                            Serial.println("Enter kWh value:");
                          }
                          
                          void loop() {
                            // Check if data is available on the serial port
                            if (Serial.available() > 0) {
                              String input = Serial.readStringUntil('\n'); // Read the input
                              kWh = input.toFloat(); // Convert input to float
                          
                              if (kWh > 0) {
                                // Calculate pulse interval based on kWh value
                                pulseInterval = (3600.0 * 1000.0) / (kWh * 1000.0) - pulseDuration;
                                Serial.print("Updated kWh: ");
                                Serial.println(kWh);
                                Serial.print("Updated pulse interval: ");
                                Serial.println(pulseInterval);
                              }
                            }
                          
                            unsigned long currentMillis = millis();
                          
                            // Check if it's time to generate a new pulse
                            if (currentMillis - previousMillis >= pulseInterval && !pulseActive) {
                              // Save the last time a pulse was started
                              previousMillis = currentMillis;
                              
                              // Start the pulse
                              digitalWrite(s0Pin, HIGH);
                              pulseEndMillis = currentMillis + pulseDuration;
                              pulseActive = true;
                            }
                          
                            // Check if it's time to end the pulse
                            if (pulseActive && currentMillis >= pulseEndMillis) {
                              digitalWrite(s0Pin, LOW);
                              pulseActive = false;
                            }
                          }
                          

                          senden vom pc aus könnte so aussehen:

                          import serial
                          import time
                          
                          # Configure the serial port and baud rate
                          ser = serial.Serial('/dev/ttyUSB0', 115200)  # Change 'COM3' to the appropriate port for your system
                          time.sleep(2)  # Give some time to establish the connection
                          
                          def send_kwh_value(kwh):
                              ser.write(f"{kwh}\n".encode())  # Send kWh value as a string with newline
                              time.sleep(1)  # Give some time for the Arduino to process and respond
                          
                              # Read response lines from the serial port
                              response_lines = []
                              while ser.in_waiting > 0:
                                  line = ser.readline().decode('utf-8').rstrip()
                                  response_lines.append(line)
                              
                              return response_lines
                          
                          # Example usage
                          response = send_kwh_value(5.0)  # Send 5.0 kWh value
                          for line in response:
                              print(line)
                          
                          ser.close()
                          
                          
                          D Offline
                          D Offline
                          Dieter_P
                          schrieb am zuletzt editiert von Dieter_P
                          #61

                          @andy123andy1

                          Bist Du sicher das es hier nicht um die Leistung -> W geht?

                          A 1 Antwort Letzte Antwort
                          0
                          • D Dieter_P

                            @andy123andy1

                            Bist Du sicher das es hier nicht um die Leistung -> W geht?

                            A Offline
                            A Offline
                            Andy123Andy1
                            schrieb am zuletzt editiert von
                            #62

                            @dieter_p

                            also laut wikipedia sind es kWh

                            https://de.wikipedia.org/wiki/Stromzähler

                            A 1 Antwort Letzte Antwort
                            0
                            • A Andy123Andy1

                              @dieter_p

                              also laut wikipedia sind es kWh

                              https://de.wikipedia.org/wiki/Stromzähler

                              A Offline
                              A Offline
                              Andy123Andy1
                              schrieb am zuletzt editiert von
                              #63

                              @andy123andy1

                              Mit Watt müsste das so aussehen.

                              const int s0Pin = 7; // Pin connected to the S0 output signal
                              
                              // Timing variables
                              unsigned long pulseDuration = 100; // Duration of each pulse in milliseconds
                              unsigned long pulseInterval = 3600000 / 1000 - pulseDuration; // Interval between pulses in milliseconds (initial value)
                              float watts = 1000.0; // Initial watts value
                              
                              unsigned long previousMillis = 0; // Store the last time a pulse was generated
                              unsigned long pulseEndMillis = 0; // Store the end time of the pulse
                              bool pulseActive = false; // Flag to track pulse state
                              
                              void setup() {
                                // Set the S0 pin as an output
                                pinMode(s0Pin, OUTPUT);
                              
                                // Initialize Serial for communication
                                Serial.begin(115200);
                                while (!Serial) {
                                  ; // Wait for the serial port to connect. Needed for native USB port only
                                }
                              
                                Serial.println("Enter watts value:");
                              }
                              
                              void loop() {
                                // Check if data is available on the serial port
                                if (Serial.available() > 0) {
                                  String input = Serial.readStringUntil('\n'); // Read the input
                                  watts = input.toFloat(); // Convert input to float
                              
                                  if (watts > 0) {
                                    // Calculate pulse interval based on watts value
                                    pulseInterval = (3600.0 * 1000.0) / watts - pulseDuration;
                                    Serial.print("Updated watts: ");
                                    Serial.println(watts);
                                    Serial.print("Updated pulse interval: ");
                                    Serial.println(pulseInterval);
                                  }
                                }
                              
                                unsigned long currentMillis = millis();
                              
                                // Check if it's time to generate a new pulse
                                if (currentMillis - previousMillis >= pulseInterval && !pulseActive) {
                                  // Save the last time a pulse was started
                                  previousMillis = currentMillis;
                                  
                                  // Start the pulse
                                  digitalWrite(s0Pin, HIGH);
                                  pulseEndMillis = currentMillis + pulseDuration;
                                  pulseActive = true;
                                }
                              
                                // Check if it's time to end the pulse
                                if (pulseActive && currentMillis >= pulseEndMillis) {
                                  digitalWrite(s0Pin, LOW);
                                  pulseActive = false;
                                }
                              }
                              

                              bzw.

                              import serial
                              import time
                              
                              # Configure the serial port and baud rate
                              ser = serial.Serial('COM3', 115200)  # Change 'COM3' to the appropriate port for your system
                              time.sleep(2)  # Give some time to establish the connection
                              
                              def send_watts_value(watts):
                                  ser.write(f"{watts}\n".encode())  # Send watts value as a string with newline
                                  time.sleep(1)  # Give some time for the Arduino to process and respond
                              
                                  # Read response lines from the serial port
                                  response_lines = []
                                  while ser.in_waiting > 0:
                                      line = ser.readline().decode('utf-8').rstrip()
                                      response_lines.append(line)
                                  
                                  return response_lines
                              
                              # Example usage
                              response = send_watts_value(1000.0)  # Send 1000 watts value
                              for line in response:
                                  print(line)
                              
                              response = send_watts_value(1500.5)  # Send 1500.5 watts value
                              for line in response:
                                  print(line)
                              
                              ser.close()
                              

                              Dann kann man Watt senden.

                              A 1 Antwort Letzte Antwort
                              0
                              • A Andy123Andy1

                                @andy123andy1

                                Mit Watt müsste das so aussehen.

                                const int s0Pin = 7; // Pin connected to the S0 output signal
                                
                                // Timing variables
                                unsigned long pulseDuration = 100; // Duration of each pulse in milliseconds
                                unsigned long pulseInterval = 3600000 / 1000 - pulseDuration; // Interval between pulses in milliseconds (initial value)
                                float watts = 1000.0; // Initial watts value
                                
                                unsigned long previousMillis = 0; // Store the last time a pulse was generated
                                unsigned long pulseEndMillis = 0; // Store the end time of the pulse
                                bool pulseActive = false; // Flag to track pulse state
                                
                                void setup() {
                                  // Set the S0 pin as an output
                                  pinMode(s0Pin, OUTPUT);
                                
                                  // Initialize Serial for communication
                                  Serial.begin(115200);
                                  while (!Serial) {
                                    ; // Wait for the serial port to connect. Needed for native USB port only
                                  }
                                
                                  Serial.println("Enter watts value:");
                                }
                                
                                void loop() {
                                  // Check if data is available on the serial port
                                  if (Serial.available() > 0) {
                                    String input = Serial.readStringUntil('\n'); // Read the input
                                    watts = input.toFloat(); // Convert input to float
                                
                                    if (watts > 0) {
                                      // Calculate pulse interval based on watts value
                                      pulseInterval = (3600.0 * 1000.0) / watts - pulseDuration;
                                      Serial.print("Updated watts: ");
                                      Serial.println(watts);
                                      Serial.print("Updated pulse interval: ");
                                      Serial.println(pulseInterval);
                                    }
                                  }
                                
                                  unsigned long currentMillis = millis();
                                
                                  // Check if it's time to generate a new pulse
                                  if (currentMillis - previousMillis >= pulseInterval && !pulseActive) {
                                    // Save the last time a pulse was started
                                    previousMillis = currentMillis;
                                    
                                    // Start the pulse
                                    digitalWrite(s0Pin, HIGH);
                                    pulseEndMillis = currentMillis + pulseDuration;
                                    pulseActive = true;
                                  }
                                
                                  // Check if it's time to end the pulse
                                  if (pulseActive && currentMillis >= pulseEndMillis) {
                                    digitalWrite(s0Pin, LOW);
                                    pulseActive = false;
                                  }
                                }
                                

                                bzw.

                                import serial
                                import time
                                
                                # Configure the serial port and baud rate
                                ser = serial.Serial('COM3', 115200)  # Change 'COM3' to the appropriate port for your system
                                time.sleep(2)  # Give some time to establish the connection
                                
                                def send_watts_value(watts):
                                    ser.write(f"{watts}\n".encode())  # Send watts value as a string with newline
                                    time.sleep(1)  # Give some time for the Arduino to process and respond
                                
                                    # Read response lines from the serial port
                                    response_lines = []
                                    while ser.in_waiting > 0:
                                        line = ser.readline().decode('utf-8').rstrip()
                                        response_lines.append(line)
                                    
                                    return response_lines
                                
                                # Example usage
                                response = send_watts_value(1000.0)  # Send 1000 watts value
                                for line in response:
                                    print(line)
                                
                                response = send_watts_value(1500.5)  # Send 1500.5 watts value
                                for line in response:
                                    print(line)
                                
                                ser.close()
                                

                                Dann kann man Watt senden.

                                A Offline
                                A Offline
                                Andy123Andy1
                                schrieb am zuletzt editiert von
                                #64

                                Ich hab mal alles angeschlossen wo sieht man den ob es funktioniert?

                                D 1 Antwort Letzte Antwort
                                0
                                • A Andy123Andy1

                                  Ich hab mal alles angeschlossen wo sieht man den ob es funktioniert?

                                  D Offline
                                  D Offline
                                  Dieter_P
                                  schrieb am zuletzt editiert von Dieter_P
                                  #65

                                  @andy123andy1
                                  "Da wo es qualmt". Sorry aber das klingt sehr "sportlich". Zu Deiner "lwp" nehme an Luftwärmepumpe, sollte sich etwas in deren Handbuch finden lassen und würde empfehlen vorher die erwartbaren Funktionen in Erfahrung zu bringen um keine Schäden & Gefahren zu erzeugen und die Funktion auch Bestimmungsgemäß zu nutzen.

                                  A 1 Antwort Letzte Antwort
                                  0
                                  • D Dieter_P

                                    @andy123andy1
                                    "Da wo es qualmt". Sorry aber das klingt sehr "sportlich". Zu Deiner "lwp" nehme an Luftwärmepumpe, sollte sich etwas in deren Handbuch finden lassen und würde empfehlen vorher die erwartbaren Funktionen in Erfahrung zu bringen um keine Schäden & Gefahren zu erzeugen und die Funktion auch Bestimmungsgemäß zu nutzen.

                                    A Offline
                                    A Offline
                                    Andy123Andy1
                                    schrieb am zuletzt editiert von Andy123Andy1
                                    #66

                                    hihi ja so ähnlich.

                                    Ich hab jetzt nochmal gemessen die 20mA kommen bei High an. Das Interval sollte stimmen aber die Luftwärmepume erkennt das Signal nicht. Hab erst mal keine Idee warum nicht.

                                    Vielleicht findet sich noch jemand bei dem es klappt. Vielleicht ist die Spannung zu gering ? Die Klemmen der LWP sind mit 5V beschriftet, wobei das eigentlich egal sein sollte.

                                    Mein Aufbau sieht so aus:

                                    Wemos D1 -> Optokoppler -> + 100 ohm Wiederstand -> LWP

                                    Und ein möglichst einfaches Program aufgespielt. Wärmepume auf 500 Impulse gestellt.

                                    #define S0_PIN D6 // Use the D6 pin on Wemos D1
                                    
                                    
                                    unsigned long pulseInterval;
                                    float kWh = 1.0; // Default kWh value (example value)
                                    unsigned long pulseDuration = 30; /
                                    
                                    void setup() {
                                    
                                      pinMode(S0_PIN, OUTPUT);
                                      
                                    
                                      pulseInterval = (3600.0 * 1000.0) / (kWh * 500.0); // 500 pulses per kWh
                                      
                                    
                                      Serial.begin(115200);
                                      while (!Serial) {
                                        ; // Wait for serial port to connect
                                      }
                                      
                                      Serial.println("S0 Signal Simulation Started");
                                      Serial.print("Initial kWh: ");
                                      Serial.println(kWh);
                                      Serial.print("Initial pulse interval: ");
                                      Serial.print(pulseInterval);
                                      Serial.println(" ms");
                                    }
                                    
                                    void loop() {
                                      unsigned long currentMillis = millis();
                                      digitalWrite(S0_PIN, HIGH);
                                      Serial.print("Pulse ON at ");
                                      Serial.print(currentMillis);
                                      Serial.println(" ms");
                                      delay(pulseDuration);
                                    
                                      digitalWrite(S0_PIN, LOW);
                                      currentMillis = millis();
                                      Serial.print("Pulse OFF at ");
                                      Serial.print(currentMillis);
                                      Serial.println(" ms");
                                      delay(pulseInterval - pulseDuration); 
                                    }
                                    

                                    Fall jemand eine Idee hat warum das nicht klappt immer her damit :)

                                    D 1 Antwort Letzte Antwort
                                    0
                                    • A Andy123Andy1

                                      hihi ja so ähnlich.

                                      Ich hab jetzt nochmal gemessen die 20mA kommen bei High an. Das Interval sollte stimmen aber die Luftwärmepume erkennt das Signal nicht. Hab erst mal keine Idee warum nicht.

                                      Vielleicht findet sich noch jemand bei dem es klappt. Vielleicht ist die Spannung zu gering ? Die Klemmen der LWP sind mit 5V beschriftet, wobei das eigentlich egal sein sollte.

                                      Mein Aufbau sieht so aus:

                                      Wemos D1 -> Optokoppler -> + 100 ohm Wiederstand -> LWP

                                      Und ein möglichst einfaches Program aufgespielt. Wärmepume auf 500 Impulse gestellt.

                                      #define S0_PIN D6 // Use the D6 pin on Wemos D1
                                      
                                      
                                      unsigned long pulseInterval;
                                      float kWh = 1.0; // Default kWh value (example value)
                                      unsigned long pulseDuration = 30; /
                                      
                                      void setup() {
                                      
                                        pinMode(S0_PIN, OUTPUT);
                                        
                                      
                                        pulseInterval = (3600.0 * 1000.0) / (kWh * 500.0); // 500 pulses per kWh
                                        
                                      
                                        Serial.begin(115200);
                                        while (!Serial) {
                                          ; // Wait for serial port to connect
                                        }
                                        
                                        Serial.println("S0 Signal Simulation Started");
                                        Serial.print("Initial kWh: ");
                                        Serial.println(kWh);
                                        Serial.print("Initial pulse interval: ");
                                        Serial.print(pulseInterval);
                                        Serial.println(" ms");
                                      }
                                      
                                      void loop() {
                                        unsigned long currentMillis = millis();
                                        digitalWrite(S0_PIN, HIGH);
                                        Serial.print("Pulse ON at ");
                                        Serial.print(currentMillis);
                                        Serial.println(" ms");
                                        delay(pulseDuration);
                                      
                                        digitalWrite(S0_PIN, LOW);
                                        currentMillis = millis();
                                        Serial.print("Pulse OFF at ");
                                        Serial.print(currentMillis);
                                        Serial.println(" ms");
                                        delay(pulseInterval - pulseDuration); 
                                      }
                                      

                                      Fall jemand eine Idee hat warum das nicht klappt immer her damit :)

                                      D Offline
                                      D Offline
                                      Dieter_P
                                      schrieb am zuletzt editiert von Dieter_P
                                      #67

                                      @andy123andy1 said in S0 - Signal mit Wemos D1 Mini erzeugen?:

                                      Fall jemand eine Idee hat warum das nicht klappt immer her damit :)

                                      Mein Idee ist den Typ Wärmepumpe mal zu nennen und wenn man nett ist, direkt das Datenblatt/Handbuch zu verlinken. Im Raten bin ich schlecht was dort wo passiert.

                                      A 1 Antwort Letzte Antwort
                                      0
                                      • D Dieter_P

                                        @andy123andy1 said in S0 - Signal mit Wemos D1 Mini erzeugen?:

                                        Fall jemand eine Idee hat warum das nicht klappt immer her damit :)

                                        Mein Idee ist den Typ Wärmepumpe mal zu nennen und wenn man nett ist, direkt das Datenblatt/Handbuch zu verlinken. Im Raten bin ich schlecht was dort wo passiert.

                                        A Offline
                                        A Offline
                                        Andy123Andy1
                                        schrieb am zuletzt editiert von
                                        #68

                                        @dieter_p das ist eine nibe s320

                                        https://www.photovoltaikforum.com/core/attachment/215014-ih-pv-modulsteuerung-allg-pdf/

                                        D 1 Antwort Letzte Antwort
                                        0
                                        • A Andy123Andy1

                                          @dieter_p das ist eine nibe s320

                                          https://www.photovoltaikforum.com/core/attachment/215014-ih-pv-modulsteuerung-allg-pdf/

                                          D Offline
                                          D Offline
                                          Dieter_P
                                          schrieb am zuletzt editiert von Dieter_P
                                          #69

                                          @andy123andy1

                                          Ich weiß nicht genau was Du vor hast, aber nach dem Handbuch wird über die S0 Schnittstelle der Eigenverbrauchszähler der Wärmepumpe angeklemmt.

                                          PV Erzeugungsdaten kommen per Modbus oder SunSpec Protokoll. Liegen die bereits an?

                                          Heißt vom Prinzip: Dein S0 gibt Vollgas, heißt maximaler Eigenverbrauch und die WP sollte tendentiell irgendwann runterregeln bzw sogar aus bleiben.

                                          Schließt Du gar keinen S0 an, wäre der Eigenverbrauch 0 und somit reagiert die WP "sofort" auf den Bedarf -> schaltet ein/regelt hoch.

                                          Oder wie ist Deine Erwartungshaltung?

                                          A 1 Antwort Letzte Antwort
                                          0
                                          Antworten
                                          • In einem neuen Thema antworten
                                          Anmelden zum Antworten
                                          • Älteste zuerst
                                          • Neuste zuerst
                                          • Meiste Stimmen


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          816

                                          Online

                                          32.5k

                                          Benutzer

                                          81.8k

                                          Themen

                                          1.3m

                                          Beiträge
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Anmelden

                                          • Du hast noch kein Konto? Registrieren

                                          • Anmelden oder registrieren, um zu suchen
                                          • Erster Beitrag
                                            Letzter Beitrag
                                          0
                                          • Home
                                          • Aktuell
                                          • Tags
                                          • Ungelesen 0
                                          • Kategorien
                                          • Unreplied
                                          • Beliebt
                                          • GitHub
                                          • Docu
                                          • Hilfe