28841bc8cda77e17249d427fa6f2031aff96ea82
Chip-cn-dat/EDCT-dat/EDCT-dat.md
| ... | ... | @@ -19,4 +19,6 @@ ED-CTM-200-Z1 1000/1 20A/20mA |
| 19 | 19 | |
| 20 | 20 | ## ref |
| 21 | 21 | |
| 22 | -- [[current-transformer-dat]] |
|
| ... | ... | \ No newline at end of file |
| 0 | +- [[current-transformer-dat]] |
|
| 1 | + |
|
| 2 | +- [[EDCT]] - [[current-transformer]] |
|
| ... | ... | \ No newline at end of file |
Chip-cn-dat/HLW-dat/HLW8032-dat/HLW8032-DAT.md
| ... | ... | @@ -65,7 +65,7 @@ Data format of HLW8032: |
| 65 | 65 | |
| 66 | 66 | ## ref |
| 67 | 67 | |
| 68 | -- [[sample-resistor-dat]] - [[resistor-dat]] - [[Optical-Coupler-DAT]] |
|
| 68 | +- [[sample-resistor-dat]] - [[resistor-dat]] - [[Optical-Coupler-DAT]] - [[current-transformer-dat]] - [[78L05-dat]] - [[wire-2-wire-dat]] |
|
| 69 | 69 | |
| 70 | 70 | - [[HLW-dat]] |
| 71 | 71 |
Chip-cn-dat/HLW-dat/HLW8032-dat/HLW8032-reg-dat/HLW8032-reg-dat.md
| ... | ... | @@ -38,7 +38,7 @@ Voltage Coefficient = |
| 38 | 38 | |
| 39 | 39 | **Effective Voltage Calculation** |
| 40 | 40 | |
| 41 | - 1888800 / 1618 * (voltage Coefficient) 1.88 = 219.372V |
|
| 41 | + V_Para_Reg / V_reg * V_coefficient = 1888800 / 1618 * 1.88 = 219.372V |
|
| 42 | 42 | |
| 43 | 43 | Therefore, the effective voltage is approximately 219.372V. |
| 44 | 44 | |
| ... | ... | @@ -55,7 +55,7 @@ Therefore, the effective voltage is approximately 219.372V. |
| 55 | 55 | |
| 56 | 56 | seperated: F2 | 5A | 02 DC D0 | 04 C8 20 | 00 3E 4E | 03 7C A6 | 4E 2B B8 | B9 8A BB | 61 | 00 01 | DC |
| 57 | 57 | |
| 58 | - convert to int: 85 90 2 220 208 4 134 64 0 62 78 4 25 218 78 43 184 235 216 59 97 0 0 139 |
|
| 58 | + convert to int: 242 90 2 220 208 4 134 64 0 62 78 4 25 218 78 43 184 235 216 59 97 0 0 139 |
|
| 59 | 59 | |
| 60 | 60 | | | hex | dec / int | |
| 61 | 61 | | -------------------------- | -------- | ---------- | |
Chip-cn-dat/HLW-dat/HLW8032-dat/HLW8032-reg-dat/hlw8032-1.ino
| ... | ... | @@ -0,0 +1,129 @@ |
| 1 | +#include <SoftwareSerial.h> |
|
| 2 | + |
|
| 3 | +// Define SoftwareSerial pins: RX, TX |
|
| 4 | +// We'll use pin 2 for RX (receiving data from HLW8032) |
|
| 5 | +// Pin 3 for TX (not strictly needed for HLW8032 communication but required by library) |
|
| 6 | +SoftwareSerial hlwSerial(2, 3); |
|
| 7 | + |
|
| 8 | +void setup() { |
|
| 9 | + Serial.begin(9600); // Initialize hardware serial for debugging output to Serial Monitor |
|
| 10 | + while (!Serial) { |
|
| 11 | + ; // wait for hardware serial port to connect. |
|
| 12 | + } |
|
| 13 | + Serial.println("Arduino initialized. Hardware Serial for debugging active."); |
|
| 14 | + |
|
| 15 | + hlwSerial.begin(4800); // Initialize software serial for HLW8032 communication |
|
| 16 | + Serial.println("Software Serial on pins 2 (RX) and 3 (TX) initialized for HLW8032."); |
|
| 17 | + Serial.println("Waiting for HLW8032 data (starting with 0xF2 and Check Register 0x5A)..."); |
|
| 18 | +} |
|
| 19 | + |
|
| 20 | +void loop() { |
|
| 21 | + if (hlwSerial.available() > 0) { // Check if data is available on SoftwareSerial |
|
| 22 | + if (hlwSerial.peek() == 0xF2) { // Check if the first byte is the start byte without consuming it yet |
|
| 23 | + // Check if enough bytes for Start Byte (1) + Check Register (1) are available |
|
| 24 | + if (hlwSerial.available() >= 2) { |
|
| 25 | + byte startByte = hlwSerial.read(); // Read the start byte (confirmed 0xF2 by peek) |
|
| 26 | + byte checkRegister = hlwSerial.read(); // Read the next byte for Check Register |
|
| 27 | + |
|
| 28 | + if (checkRegister == 0x5A) { |
|
| 29 | + // Start byte is 0xF2 and Check Register is 0x5A, proceed |
|
| 30 | + Serial.print("Start Byte: 0x"); |
|
| 31 | + Serial.println(startByte, HEX); |
|
| 32 | + Serial.print("Check Register: 0x"); |
|
| 33 | + Serial.println(checkRegister, HEX); |
|
| 34 | + |
|
| 35 | + // Now check if enough bytes for the 4 registers (12 bytes) are available |
|
| 36 | + // Total bytes for the segment we want: Start(1) + Check(1) + VP(3) + V(3) + CP(3) + C(3) = 14 |
|
| 37 | + // We've read 2, so we need 12 more. |
|
| 38 | + if (hlwSerial.available() >= 12) { |
|
| 39 | + // Read Voltage Parameter Register (3 bytes) |
|
| 40 | + byte vpReg[3]; |
|
| 41 | + Serial.print("Voltage Parameter Register (hex): 0x"); |
|
| 42 | + for (int i = 0; i < 3; i++) { |
|
| 43 | + vpReg[i] = hlwSerial.read(); |
|
| 44 | + if (vpReg[i] < 0x10) Serial.print("0"); |
|
| 45 | + Serial.print(vpReg[i], HEX); |
|
| 46 | + Serial.print(" "); |
|
| 47 | + } |
|
| 48 | + Serial.println(); |
|
| 49 | + unsigned long voltageParam = ((unsigned long)vpReg[0] << 16) | ((unsigned long)vpReg[1] << 8) | vpReg[2]; |
|
| 50 | + Serial.print("Voltage Parameter Register (dec): "); |
|
| 51 | + Serial.println(voltageParam); |
|
| 52 | + |
|
| 53 | + // Read Voltage Register (3 bytes) |
|
| 54 | + byte vReg[3]; |
|
| 55 | +// ...existing code... |
|
| 56 | + Serial.print("Voltage Register (hex): 0x"); |
|
| 57 | + for (int i = 0; i < 3; i++) { |
|
| 58 | + vReg[i] = hlwSerial.read(); |
|
| 59 | + if (vReg[i] < 0x10) Serial.print("0"); |
|
| 60 | + Serial.print(vReg[i], HEX); |
|
| 61 | + Serial.print(" "); |
|
| 62 | + } |
|
| 63 | + Serial.println(); |
|
| 64 | + unsigned long voltageVal = ((unsigned long)vReg[0] << 16) | ((unsigned long)vReg[1] << 8) | vReg[2]; |
|
| 65 | + Serial.print("Voltage Register (dec): "); |
|
| 66 | + Serial.println(voltageVal); |
|
| 67 | + |
|
| 68 | + // Read Current Parameter Register (3 bytes) |
|
| 69 | + byte cpReg[3]; |
|
| 70 | + Serial.print("Current Parameter Register (hex): 0x"); |
|
| 71 | + for (int i = 0; i < 3; i++) { |
|
| 72 | + cpReg[i] = hlwSerial.read(); |
|
| 73 | + if (cpReg[i] < 0x10) Serial.print("0"); |
|
| 74 | + Serial.print(cpReg[i], HEX); |
|
| 75 | + Serial.print(" "); |
|
| 76 | + } |
|
| 77 | + Serial.println(); |
|
| 78 | + unsigned long currentParam = ((unsigned long)cpReg[0] << 16) | ((unsigned long)cpReg[1] << 8) | cpReg[2]; |
|
| 79 | + Serial.print("Current Parameter Register (dec): "); |
|
| 80 | + Serial.println(currentParam); |
|
| 81 | + |
|
| 82 | + // Read Current Register (3 bytes) |
|
| 83 | + byte cReg[3]; |
|
| 84 | + Serial.print("Current Register (hex): 0x"); |
|
| 85 | + for (int i = 0; i < 3; i++) { |
|
| 86 | + cReg[i] = hlwSerial.read(); |
|
| 87 | + if (cReg[i] < 0x10) Serial.print("0"); |
|
| 88 | + Serial.print(cReg[i], HEX); |
|
| 89 | + Serial.print(" "); |
|
| 90 | + } |
|
| 91 | + Serial.println(); |
|
| 92 | + unsigned long currentVal = ((unsigned long)cReg[0] << 16) | ((unsigned long)cReg[1] << 8) | cReg[2]; |
|
| 93 | + Serial.print("Current Register (dec): "); |
|
| 94 | + Serial.println(currentVal); |
|
| 95 | + |
|
| 96 | + Serial.println("--- End of Packet Segment ---"); |
|
| 97 | + |
|
| 98 | + // Consider reading the rest of the 24-byte packet here |
|
| 99 | + // if the HLW8032 always sends full packets, to keep the buffer clean. |
|
| 100 | + // int remainingBytesInFullPacket = 24 - 14; // Example if full packet is 24 bytes |
|
| 101 | + // for(int i=0; i < remainingBytesInFullPacket; i++){ |
|
| 102 | + // if(hlwSerial.available()) hlwSerial.read(); else break; |
|
| 103 | + // } |
|
| 104 | + |
|
| 105 | + } else { |
|
| 106 | + Serial.println("Error: Incomplete packet after valid Start (0xF2) and Check Register (0x5A). Waiting for more data."); |
|
| 107 | + // The first two bytes (0xF2 and 0x5A) are consumed. |
|
| 108 | + // The loop will re-evaluate on the next iteration. |
|
| 109 | + } |
|
| 110 | + } else { |
|
| 111 | + // Start byte was 0xF2, but Check Register is incorrect. |
|
| 112 | + Serial.print("Error: Start Byte 0xF2 found, but Check Register is 0x"); |
|
| 113 | + if (checkRegister < 0x10) Serial.print("0"); |
|
| 114 | + Serial.print(checkRegister, HEX); |
|
| 115 | + Serial.println(" (expected 0x5A). Discarding this packet attempt."); |
|
| 116 | + // Both startByte (0xF2) and the incorrect checkRegister are consumed. |
|
| 117 | + // The loop will continue to search for the next 0xF2. |
|
| 118 | + } |
|
| 119 | + } else { |
|
| 120 | + // Peeked 0xF2, but not enough bytes for Start + Check Register yet. |
|
| 121 | + // Loop will run again, hopefully more data will be available. |
|
| 122 | + } |
|
| 123 | + } else { |
|
| 124 | + // Byte is not the start byte (0xF2), discard it to find the next potential start. |
|
| 125 | + hlwSerial.read(); |
|
| 126 | + // Serial.println("Discarding non-start byte..."); // Optional: for debugging |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | +} |
|
| ... | ... | \ No newline at end of file |
Tech-dat/cable-dat/wire-2-wire-dat/2025-05-29-19-07-55.png
| ... | ... | Binary files /dev/null and b/Tech-dat/cable-dat/wire-2-wire-dat/2025-05-29-19-07-55.png differ |
Tech-dat/cable-dat/wire-2-wire-dat/wire-2-wire-dat.md
| ... | ... | @@ -35,4 +35,8 @@ |
| 35 | 35 | |
| 36 | 36 | - [[1.25-dat]] |
| 37 | 37 | |
| 38 | - |
|
| ... | ... | \ No newline at end of file |
| 0 | + |
|
| 1 | + |
|
| 2 | +## fast wire to wire connectors |
|
| 3 | + |
|
| 4 | + |
|
| ... | ... | \ No newline at end of file |