├── KiCad └── openMicroInverter_dev │ ├── openMicroInverter_dev-cache.lib │ ├── openMicroInverter_dev-rescue.dcm │ ├── openMicroInverter_dev-rescue.lib │ ├── openMicroInverter_dev.pro │ ├── openMicroInverter_dev.sch │ └── sym-lib-table ├── LICENSE ├── README.md ├── datasheets ├── 58011.pdf ├── LEM_LA55-P.pdf ├── LEM_LV25-P.pdf └── hip4082.pdf ├── extra ├── sample-rate_selector.ods └── samplerate.ods ├── figures ├── SCR_comparator.GIF ├── Screenshot_2020-10-30_15-05-11.png ├── Screenshot_2020-10-30_17-32-35.png ├── clocking_scheme_1.odg ├── clocking_scheme_2.odg ├── clocking_scheme_2.png ├── clocking_scheme_2a.odg ├── clocking_scheme_2a.png ├── openmicroinverter-logo-small.png ├── openmicroinverter-logo.png ├── oshw-logo-100-px.png └── oui_with_elecrow_H-bridge_shield.jpg ├── libraries └── PowerSys │ ├── LICENSE │ ├── README.md │ ├── figures │ ├── AnalogDiscovery.jpg │ └── DDS_structure.odg │ ├── keywords.txt │ ├── library.properties │ └── src │ ├── PowerSys.cpp │ └── PowerSys.h ├── schematics └── openMicroInverter_dev.pdf └── sketches ├── Inverter1 └── Inverter1.ino ├── Inverter1b └── Inverter1b.ino ├── Inverter2 └── Inverter2.ino ├── Inverter3 └── Inverter3.ino ├── Metering └── Metering.ino └── ZeroCrossingDetector └── ZeroCrossingDetector.ino /KiCad/openMicroInverter_dev/openMicroInverter_dev-cache.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # Device_R_POT_US 5 | # 6 | DEF Device_R_POT_US RV 0 40 Y N 1 F N 7 | F0 "RV" -175 0 50 V V C CNN 8 | F1 "Device_R_POT_US" -100 0 50 V V C CNN 9 | F2 "" 0 0 50 H I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | $FPLIST 12 | Potentiometer* 13 | $ENDFPLIST 14 | DRAW 15 | P 2 0 1 0 0 -90 0 -100 N 16 | P 2 0 1 0 0 100 0 90 N 17 | P 2 0 1 0 100 0 60 0 N 18 | P 4 0 1 0 45 0 90 20 90 -20 45 0 F 19 | P 5 0 1 0 0 -30 40 -45 0 -60 -40 -75 0 -90 N 20 | P 5 0 1 0 0 30 40 15 0 0 -40 -15 0 -30 N 21 | P 5 0 1 0 0 90 40 75 0 60 -40 45 0 30 N 22 | X 1 1 0 150 50 D 50 50 1 1 P 23 | X 2 2 150 0 50 L 50 50 1 1 P 24 | X 3 3 0 -150 50 U 50 50 1 1 P 25 | ENDDRAW 26 | ENDDEF 27 | # 28 | # Graphic_Logo_Open_Hardware_Small 29 | # 30 | DEF Graphic_Logo_Open_Hardware_Small #LOGO 0 40 Y Y 1 F N 31 | F0 "#LOGO" 0 275 50 H I C CNN 32 | F1 "Graphic_Logo_Open_Hardware_Small" 0 -225 50 H I C CNN 33 | F2 "" 0 0 50 H I C CNN 34 | F3 "" 0 0 50 H I C CNN 35 | DRAW 36 | P 277 0 1 0 132 -171 130 -170 125 -167 118 -162 109 -156 100 -150 93 -146 88 -142 86 -141 85 -142 81 -144 75 -147 71 -149 66 -151 63 -151 63 -151 61 -147 58 -139 53 -130 49 -119 44 -107 38 -95 34 -83 29 -72 26 -64 24 -58 23 -55 23 -55 26 -52 31 -49 41 -40 51 -27 57 -13 60 3 58 18 52 32 42 45 30 54 16 60 0 62 -15 61 -29 55 -42 45 -48 39 -55 26 -60 12 -60 9 -59 -7 -55 -21 -47 -34 -36 -45 -34 -46 -29 -50 -25 -53 -23 -55 -42 -102 -45 -110 -51 -123 -55 -134 -59 -143 -62 -149 -63 -151 -63 -151 -65 -151 -68 -150 -75 -147 -79 -145 -84 -142 -87 -141 -89 -142 -93 -145 -100 -150 -109 -156 -117 -161 -124 -166 -130 -170 -132 -171 -133 -171 -135 -170 -139 -166 -146 -160 -155 -151 -156 -150 -164 -142 -170 -136 -174 -131 -175 -129 -175 -129 -174 -127 -170 -121 -166 -114 -160 -105 -144 -82 -153 -61 -155 -54 -159 -46 -161 -41 -162 -38 -165 -37 -170 -36 -179 -34 -189 -32 -199 -31 -207 -29 -214 -28 -217 -27 -217 -27 -218 -25 -218 -22 -218 -17 -219 -9 -219 3 -219 5 -218 16 -218 25 -218 30 -218 33 -218 33 -215 33 -209 35 -200 36 -190 38 -189 39 -179 41 -170 42 -164 44 -161 45 -161 45 -159 49 -156 56 -152 64 -149 72 -146 79 -144 85 -143 87 -143 87 -145 90 -148 95 -153 102 -160 111 -160 112 -166 121 -171 128 -174 133 -175 136 -175 136 -173 138 -169 143 -162 150 -155 158 -152 160 -144 169 -138 174 -134 177 -132 178 -132 178 -130 176 -124 172 -117 167 -108 161 -107 161 -98 155 -91 150 -86 146 -84 145 -83 145 -80 146 -73 148 -66 151 -58 155 -50 158 -45 160 -42 162 -42 162 -41 165 -40 171 -38 180 -36 191 -35 193 -33 203 -32 212 -31 218 -30 220 -28 221 -23 221 -16 221 -6 221 3 221 13 221 21 221 27 220 29 220 29 220 30 217 32 210 33 201 36 190 36 188 38 178 40 169 41 163 42 161 42 161 47 159 54 156 62 152 82 144 107 161 109 163 118 169 125 174 130 177 133 178 133 178 135 176 140 171 147 165 154 157 160 151 167 144 171 140 174 137 174 135 174 134 173 131 169 126 164 118 158 110 153 102 148 94 144 88 143 85 143 84 145 79 148 72 152 63 160 44 173 41 181 40 192 38 202 36 218 33 219 -26 216 -27 214 -27 208 -29 199 -30 189 -32 181 -34 172 -36 166 -37 163 -37 162 -38 160 -42 157 -49 154 -57 150 -65 147 -73 145 -79 144 -82 145 -84 149 -89 153 -97 159 -105 165 -114 170 -121 173 -126 175 -129 174 -131 171 -135 164 -141 155 -151 153 -152 145 -160 139 -166 134 -170 132 -171 F 37 | ENDDRAW 38 | ENDDEF 39 | # 40 | # openMicroInverter_dev-rescue_ARDUINO_SHIELD_R3-SmartInverter_proto-rescue 41 | # 42 | DEF openMicroInverter_dev-rescue_ARDUINO_SHIELD_R3-SmartInverter_proto-rescue P 0 40 Y Y 1 F N 43 | F0 "P" 250 -950 60 H V C CNN 44 | F1 "openMicroInverter_dev-rescue_ARDUINO_SHIELD_R3-SmartInverter_proto-rescue" 0 1150 60 H V C CNN 45 | F2 "" 2750 -1600 60 H V C CNN 46 | F3 "" 2750 -1600 60 H V C CNN 47 | DRAW 48 | S 400 1100 -400 -900 0 1 0 f 49 | X NC 1 -700 600 300 R 50 50 1 1 N 50 | X AD1 10 -700 -400 300 R 50 50 1 1 B 51 | X AD2 11 -700 -500 300 R 50 50 1 1 B 52 | X AD3 12 -700 -600 300 R 50 50 1 1 B 53 | X AD4/SDA 13 -700 -700 300 R 50 50 1 1 B 54 | X AD5/SCL 14 -700 -800 300 R 50 50 1 1 B 55 | X 0(RX) 15 700 -800 300 L 50 50 1 1 B 56 | X 1(TX) 16 700 -700 300 L 50 50 1 1 B 57 | X 2 17 700 -600 300 L 50 50 1 1 B 58 | X ~~3 18 700 -500 300 L 50 50 1 1 B 59 | X 4 19 700 -400 300 L 50 50 1 1 B 60 | X IOREF 2 -700 500 300 R 50 50 1 1 I 61 | X ~~5 20 700 -300 300 L 50 50 1 1 B 62 | X ~~6 21 700 -200 300 L 50 50 1 1 B 63 | X 7 22 700 -100 300 L 50 50 1 1 B 64 | X 8 23 700 100 300 L 50 50 1 1 B 65 | X ~~9 24 700 200 300 L 50 50 1 1 B 66 | X ~~10 25 700 300 300 L 50 50 1 1 B 67 | X ~~11 26 700 400 300 L 50 50 1 1 B 68 | X 12 27 700 500 300 L 50 50 1 1 B 69 | X 13 28 700 600 300 L 50 50 1 1 B 70 | X GND 29 700 700 300 L 50 50 1 1 W 71 | X RST 3 -700 400 300 R 50 50 1 1 I 72 | X AREF 30 700 800 300 L 50 50 1 1 I 73 | X AD4/SDA 31 700 900 300 L 50 50 1 1 B 74 | X AD5/SCL 32 700 1000 300 L 50 50 1 1 B 75 | X 3V3 4 -700 300 300 R 50 50 1 1 I 76 | X 5V 5 -700 200 300 R 50 50 1 1 I 77 | X GND 6 -700 100 300 R 50 50 1 1 W 78 | X GND 7 -700 0 300 R 50 50 1 1 W 79 | X V_IN 8 -700 -100 300 R 50 50 1 1 I 80 | X AD0 9 -700 -300 300 R 50 50 1 1 B 81 | ENDDRAW 82 | ENDDEF 83 | # 84 | # openMicroInverter_dev-rescue_C-SmartInverter_proto-rescue 85 | # 86 | DEF openMicroInverter_dev-rescue_C-SmartInverter_proto-rescue C 0 10 N Y 1 F N 87 | F0 "C" 25 100 50 H V L CNN 88 | F1 "openMicroInverter_dev-rescue_C-SmartInverter_proto-rescue" 25 -100 50 H V L CNN 89 | F2 "" 38 -150 50 H V C CNN 90 | F3 "" 0 0 50 H V C CNN 91 | $FPLIST 92 | C? 93 | C_????_* 94 | C_???? 95 | SMD*_c 96 | Capacitor* 97 | $ENDFPLIST 98 | DRAW 99 | P 2 0 1 20 -80 -30 80 -30 N 100 | P 2 0 1 20 -80 30 80 30 N 101 | X ~ 1 0 150 110 D 40 40 1 1 P 102 | X ~ 2 0 -150 110 U 40 40 1 1 P 103 | ENDDRAW 104 | ENDDEF 105 | # 106 | # openMicroInverter_dev-rescue_CONN_01X02-SmartInverter_proto-rescue 107 | # 108 | DEF openMicroInverter_dev-rescue_CONN_01X02-SmartInverter_proto-rescue P 0 40 Y N 1 F N 109 | F0 "P" 0 150 50 H V C CNN 110 | F1 "openMicroInverter_dev-rescue_CONN_01X02-SmartInverter_proto-rescue" 100 0 50 V V C CNN 111 | F2 "" 0 0 50 H V C CNN 112 | F3 "" 0 0 50 H V C CNN 113 | $FPLIST 114 | Pin_Header_Straight_1X02 115 | Pin_Header_Angled_1X02 116 | Socket_Strip_Straight_1X02 117 | Socket_Strip_Angled_1X02 118 | $ENDFPLIST 119 | DRAW 120 | S -50 -45 10 -55 0 1 0 N 121 | S -50 55 10 45 0 1 0 N 122 | S -50 100 50 -100 0 1 0 N 123 | X P1 1 -200 50 150 R 50 50 1 1 P 124 | X P2 2 -200 -50 150 R 50 50 1 1 P 125 | ENDDRAW 126 | ENDDEF 127 | # 128 | # openMicroInverter_dev-rescue_CP-SmartInverter_proto-rescue 129 | # 130 | DEF openMicroInverter_dev-rescue_CP-SmartInverter_proto-rescue C 0 10 N Y 1 F N 131 | F0 "C" 25 100 50 H V L CNN 132 | F1 "openMicroInverter_dev-rescue_CP-SmartInverter_proto-rescue" 25 -100 50 H V L CNN 133 | F2 "" 38 -150 50 H V C CNN 134 | F3 "" 0 0 50 H V C CNN 135 | $FPLIST 136 | CP* 137 | Elko* 138 | TantalC* 139 | C*elec 140 | c_elec* 141 | SMD*_Pol 142 | $ENDFPLIST 143 | DRAW 144 | S -90 20 -90 40 0 1 0 N 145 | S -90 20 90 20 0 1 0 N 146 | S 90 -20 -90 -40 0 1 0 F 147 | S 90 40 -90 40 0 1 0 N 148 | S 90 40 90 20 0 1 0 N 149 | P 2 0 1 0 -70 90 -30 90 N 150 | P 2 0 1 0 -50 110 -50 70 N 151 | X ~ 1 0 150 110 D 40 40 1 1 P 152 | X ~ 2 0 -150 110 U 40 40 1 1 P 153 | ENDDRAW 154 | ENDDEF 155 | # 156 | # openMicroInverter_dev-rescue_D-SmartInverter_proto-rescue 157 | # 158 | DEF openMicroInverter_dev-rescue_D-SmartInverter_proto-rescue D 0 40 N N 1 F N 159 | F0 "D" 0 100 50 H V C CNN 160 | F1 "openMicroInverter_dev-rescue_D-SmartInverter_proto-rescue" 0 -100 50 H V C CNN 161 | F2 "" 0 0 50 H V C CNN 162 | F3 "" 0 0 50 H V C CNN 163 | $FPLIST 164 | Diode_* 165 | D-Pak_TO252AA 166 | *SingleDiode 167 | *_Diode_* 168 | *SingleDiode* 169 | $ENDFPLIST 170 | DRAW 171 | P 2 0 1 6 -50 50 -50 -50 N 172 | P 3 0 1 0 50 50 -50 0 50 -50 F 173 | X K 1 -150 0 100 R 50 50 1 1 P 174 | X A 2 150 0 100 L 50 50 1 1 P 175 | ENDDRAW 176 | ENDDEF 177 | # 178 | # openMicroInverter_dev-rescue_GND-SmartInverter_proto-rescue 179 | # 180 | DEF openMicroInverter_dev-rescue_GND-SmartInverter_proto-rescue #PWR 0 0 Y Y 1 F P 181 | F0 "#PWR" 0 -250 50 H I C CNN 182 | F1 "openMicroInverter_dev-rescue_GND-SmartInverter_proto-rescue" 0 -150 50 H V C CNN 183 | F2 "" 0 0 50 H V C CNN 184 | F3 "" 0 0 50 H V C CNN 185 | DRAW 186 | P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N 187 | X GND 1 0 0 0 D 50 50 1 1 W N 188 | ENDDRAW 189 | ENDDEF 190 | # 191 | # openMicroInverter_dev-rescue_HIP4082-SmartInverter_proto-rescue 192 | # 193 | DEF openMicroInverter_dev-rescue_HIP4082-SmartInverter_proto-rescue U 0 40 Y Y 1 F N 194 | F0 "U" 300 -1100 60 H V C CNN 195 | F1 "openMicroInverter_dev-rescue_HIP4082-SmartInverter_proto-rescue" 0 900 60 H V C CNN 196 | F2 "" -100 0 60 H V C CNN 197 | F3 "" -100 0 60 H V C CNN 198 | DRAW 199 | S -400 800 400 -1000 0 1 10 N 200 | X BHB 1 -600 600 200 R 50 50 1 1 I 201 | X AHO 10 600 -600 200 L 50 50 1 1 O 202 | X AHS 11 600 -400 200 L 50 50 1 1 I 203 | X VDD 12 600 -200 200 L 50 50 1 1 W 204 | X ALO 13 600 0 200 L 50 50 1 1 O 205 | X BLO 14 600 200 200 L 50 50 1 1 O 206 | X BHS 15 600 400 200 L 50 50 1 1 I 207 | X BHO 16 600 600 200 L 50 50 1 1 O 208 | X BHI 2 -600 400 200 R 50 50 1 1 I 209 | X BLI 3 -600 200 200 R 50 50 1 1 I 210 | X ALI 4 -600 0 200 R 50 50 1 1 I 211 | X DEL 5 -600 -200 200 R 50 50 1 1 I 212 | X VSS 6 -600 -400 200 R 50 50 1 1 W 213 | X AHI 7 -600 -600 200 R 50 50 1 1 I 214 | X DIS 8 -600 -800 200 R 50 50 1 1 I 215 | X AHB 9 600 -800 200 L 50 50 1 1 I 216 | ENDDRAW 217 | ENDDEF 218 | # 219 | # openMicroInverter_dev-rescue_INDUCTOR-SmartInverter_proto-rescue 220 | # 221 | DEF openMicroInverter_dev-rescue_INDUCTOR-SmartInverter_proto-rescue L 0 40 N N 1 F N 222 | F0 "L" -50 0 50 V V C CNN 223 | F1 "openMicroInverter_dev-rescue_INDUCTOR-SmartInverter_proto-rescue" 100 0 50 V V C CNN 224 | F2 "" 0 0 50 H V C CNN 225 | F3 "" 0 0 50 H V C CNN 226 | DRAW 227 | A 0 -150 50 -889 889 0 1 0 N 1 -199 1 -100 228 | A 0 -49 51 -889 889 0 1 0 N 1 -99 1 2 229 | A 0 51 51 -889 889 0 1 0 N 1 1 1 102 230 | A 0 148 48 -889 889 0 1 0 N 1 101 1 196 231 | X 1 1 0 300 100 D 50 50 1 1 P 232 | X 2 2 0 -300 100 U 50 50 1 1 P 233 | ENDDRAW 234 | ENDDEF 235 | # 236 | # openMicroInverter_dev-rescue_LEM_LA55-P-SmartInverter_proto-rescue 237 | # 238 | DEF openMicroInverter_dev-rescue_LEM_LA55-P-SmartInverter_proto-rescue T 0 40 Y Y 1 F N 239 | F0 "T" 150 -300 60 H V C CNN 240 | F1 "openMicroInverter_dev-rescue_LEM_LA55-P-SmartInverter_proto-rescue" 350 350 60 H V C CNN 241 | F2 "" 0 0 60 H V C CNN 242 | F3 "" 0 0 60 H V C CNN 243 | DRAW 244 | A -250 0 112 -634 634 0 1 0 N -200 -100 -200 100 245 | S -200 200 200 -200 0 1 10 f 246 | X + 1 0 300 100 D 50 50 1 1 W 247 | X - 2 0 -300 100 U 50 50 1 1 W 248 | X M 3 300 0 100 L 50 50 1 1 O 249 | X in 4 -300 100 100 R 50 50 1 1 P 250 | X out 5 -300 -100 100 R 50 50 1 1 P 251 | ENDDRAW 252 | ENDDEF 253 | # 254 | # openMicroInverter_dev-rescue_LEM_LV25-P-SmartInverter_proto-rescue 255 | # 256 | DEF openMicroInverter_dev-rescue_LEM_LV25-P-SmartInverter_proto-rescue T 0 40 Y Y 1 F N 257 | F0 "T" 150 -300 60 H V C CNN 258 | F1 "openMicroInverter_dev-rescue_LEM_LV25-P-SmartInverter_proto-rescue" 350 300 60 H V C CNN 259 | F2 "" 0 0 60 H V C CNN 260 | F3 "" 0 0 60 H V C CNN 261 | DRAW 262 | S -200 200 200 -200 0 1 10 f 263 | X + 1 0 300 100 D 50 50 1 1 W 264 | X - 2 0 -300 100 U 50 50 1 1 W 265 | X M 3 300 0 100 L 50 50 1 1 O 266 | X Ipn_in 4 -300 100 100 R 50 50 1 1 P 267 | X Ipn_out 5 -300 -100 100 R 50 50 1 1 P 268 | ENDDRAW 269 | ENDDEF 270 | # 271 | # openMicroInverter_dev-rescue_MCP6004-SmartInverter_proto-rescue 272 | # 273 | DEF openMicroInverter_dev-rescue_MCP6004-SmartInverter_proto-rescue U 0 20 Y Y 4 F N 274 | F0 "U" 200 -200 60 H V C CNN 275 | F1 "openMicroInverter_dev-rescue_MCP6004-SmartInverter_proto-rescue" 250 200 50 H V C CNN 276 | F2 "" 100 0 60 H V C CNN 277 | F3 "" 100 0 60 H V C CNN 278 | DRAW 279 | P 4 0 1 6 -100 200 300 0 -100 -200 -100 200 N 280 | X V- 11 0 -400 250 U 40 40 0 1 W 281 | X V+ 4 0 400 250 D 40 40 0 1 W 282 | X ~ 1 600 0 300 L 40 40 1 1 O 283 | X - 2 -400 100 300 R 40 40 1 1 I 284 | X + 3 -400 -100 300 R 40 40 1 1 I 285 | X + 5 -400 -100 300 R 40 40 2 1 I 286 | X - 6 -400 100 300 R 40 40 2 1 I 287 | X ~ 7 600 0 300 L 40 40 2 1 O 288 | X + 10 -400 -100 300 R 40 40 3 1 I 289 | X ~ 8 600 0 300 L 40 40 3 1 O 290 | X - 9 -400 100 300 R 40 40 3 1 I 291 | X + 12 -400 -100 300 R 40 40 4 1 I 292 | X - 13 -400 100 300 R 40 40 4 1 I 293 | X ~ 14 600 0 300 L 40 40 4 1 O 294 | ENDDRAW 295 | ENDDEF 296 | # 297 | # openMicroInverter_dev-rescue_Q_NPN_CBE-SmartInverter_proto-rescue 298 | # 299 | DEF openMicroInverter_dev-rescue_Q_NPN_CBE-SmartInverter_proto-rescue Q 0 0 Y N 1 F N 300 | F0 "Q" 300 50 50 H V R CNN 301 | F1 "openMicroInverter_dev-rescue_Q_NPN_CBE-SmartInverter_proto-rescue" 600 -50 50 H V R CNN 302 | F2 "" 200 100 50 H V C CNN 303 | F3 "" 0 0 50 H V C CNN 304 | DRAW 305 | C 50 0 111 0 1 10 N 306 | P 2 0 1 0 25 25 100 100 N 307 | P 3 0 1 0 25 -25 100 -100 100 -100 N 308 | P 3 0 1 20 25 75 25 -75 25 -75 N 309 | P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F 310 | X C 1 100 200 100 D 50 50 1 1 P 311 | X B 2 -200 0 225 R 50 50 1 1 I 312 | X E 3 100 -200 100 U 50 50 1 1 P 313 | ENDDRAW 314 | ENDDEF 315 | # 316 | # openMicroInverter_dev-rescue_Q_POWERMOSFET_GDS-SmartInverter_proto-rescue 317 | # 318 | DEF openMicroInverter_dev-rescue_Q_POWERMOSFET_GDS-SmartInverter_proto-rescue Q 0 0 Y N 1 F N 319 | F0 "Q" 300 -150 50 H V R CNN 320 | F1 "openMicroInverter_dev-rescue_Q_POWERMOSFET_GDS-SmartInverter_proto-rescue" 1010 70 50 H V R CNN 321 | F2 "" 200 100 50 H V C CNN 322 | F3 "" 0 0 50 H V C CNN 323 | DRAW 324 | P 2 0 1 0 30 -70 100 -70 N 325 | P 2 0 1 10 30 -50 30 -90 N 326 | P 2 0 1 0 30 0 100 0 N 327 | P 2 0 1 10 30 20 30 -20 N 328 | P 2 0 1 0 30 70 100 70 N 329 | P 2 0 1 10 30 90 30 50 N 330 | P 2 0 1 0 100 -70 100 -100 N 331 | P 2 0 1 0 100 -70 100 0 N 332 | P 2 0 1 0 100 100 100 70 N 333 | P 2 0 1 5 140 20 180 20 N 334 | P 3 0 1 10 10 75 10 -75 10 -75 N 335 | P 3 0 1 5 100 100 160 100 160 20 N 336 | P 3 0 1 5 160 -20 160 -100 100 -100 N 337 | P 4 0 1 0 40 0 80 15 80 -15 40 0 F 338 | P 4 0 1 5 160 20 140 -20 180 -20 160 20 N 339 | X G 1 -200 0 210 R 50 50 1 1 I 340 | X D 2 100 200 100 D 50 50 1 1 P 341 | X S 3 100 -200 100 U 50 50 1 1 P 342 | ENDDRAW 343 | ENDDEF 344 | # 345 | # openMicroInverter_dev-rescue_R-SmartInverter_proto-rescue 346 | # 347 | DEF openMicroInverter_dev-rescue_R-SmartInverter_proto-rescue R 0 0 N Y 1 F N 348 | F0 "R" 80 0 50 V V C CNN 349 | F1 "openMicroInverter_dev-rescue_R-SmartInverter_proto-rescue" 0 0 50 V V C CNN 350 | F2 "" -70 0 50 V V C CNN 351 | F3 "" 0 0 50 H V C CNN 352 | $FPLIST 353 | R_* 354 | Resistor_* 355 | $ENDFPLIST 356 | DRAW 357 | S -40 -100 40 100 0 1 10 N 358 | X ~ 1 0 150 50 D 50 50 1 1 P 359 | X ~ 2 0 -150 50 U 50 50 1 1 P 360 | ENDDRAW 361 | ENDDEF 362 | # 363 | # openMicroInverter_dev-rescue_RELAY_DPST_NO-SmartInverter_proto-rescue 364 | # 365 | DEF openMicroInverter_dev-rescue_RELAY_DPST_NO-SmartInverter_proto-rescue K 0 40 Y Y 1 F N 366 | F0 "K" 500 -250 60 H V C CNN 367 | F1 "openMicroInverter_dev-rescue_RELAY_DPST_NO-SmartInverter_proto-rescue" 800 200 60 H V C CNN 368 | F2 "" -50 0 60 H V C CNN 369 | F3 "" -50 0 60 H V C CNN 370 | DRAW 371 | S -600 300 400 -300 0 1 0 N 372 | P 2 0 1 0 -350 100 -450 -100 N 373 | P 2 0 1 10 -250 0 -200 0 N 374 | P 2 0 1 10 -150 0 -100 0 N 375 | P 2 0 1 10 -50 0 0 0 N 376 | P 2 0 1 0 -50 100 -100 -100 N 377 | P 2 0 1 0 -50 100 -100 -100 N 378 | P 2 0 1 0 -50 100 -100 -100 N 379 | P 2 0 1 0 -50 100 -100 -100 N 380 | P 2 0 1 10 50 0 100 0 N 381 | P 2 0 1 10 150 0 200 0 N 382 | P 2 0 1 0 250 100 200 -100 N 383 | P 2 0 1 0 250 100 200 -100 N 384 | P 2 0 1 0 250 100 200 -100 N 385 | P 2 0 1 0 250 100 200 -100 N 386 | P 5 0 1 0 -550 100 -250 100 -250 -100 -550 -100 -550 100 N 387 | X ~ 1 -400 400 300 D 50 50 1 1 I 388 | X ~ 2 -400 -400 300 U 50 50 1 1 I 389 | X ~ ~ -50 -400 300 U 50 50 1 1 P 390 | X ~ ~ -50 -400 300 U 50 50 1 1 P 391 | X ~ ~ -50 -400 300 U 50 50 1 1 P 392 | X ~ ~ -50 -400 300 U 50 50 1 1 P 393 | X ~ ~ -50 400 300 D 50 50 1 1 P 394 | X ~ ~ -50 400 300 D 50 50 1 1 P 395 | X ~ ~ -50 400 300 D 50 50 1 1 P 396 | X ~ ~ -50 400 300 D 50 50 1 1 P 397 | X ~ ~ 250 -400 300 U 50 50 1 1 P 398 | X ~ ~ 250 -400 300 U 50 50 1 1 P 399 | X ~ ~ 250 -400 300 U 50 50 1 1 P 400 | X ~ ~ 250 -400 300 U 50 50 1 1 P 401 | X ~ ~ 250 400 300 D 50 50 1 1 P 402 | X ~ ~ 250 400 300 D 50 50 1 1 P 403 | X ~ ~ 250 400 300 D 50 50 1 1 P 404 | X ~ ~ 250 400 300 D 50 50 1 1 P 405 | ENDDRAW 406 | ENDDEF 407 | # 408 | # openMicroInverter_dev-rescue_TRANSFO-SmartInverter_proto-rescue 409 | # 410 | DEF openMicroInverter_dev-rescue_TRANSFO-SmartInverter_proto-rescue T 0 40 Y N 1 F N 411 | F0 "T" 0 250 50 H V C CNN 412 | F1 "openMicroInverter_dev-rescue_TRANSFO-SmartInverter_proto-rescue" 0 -300 50 H V C CNN 413 | F2 "" 0 0 50 H V C CNN 414 | F3 "" 0 0 50 H V C CNN 415 | DRAW 416 | A -100 -150 50 899 1 0 1 0 N -100 -100 -50 -150 417 | A -100 -150 50 -1 -899 0 1 0 N -50 -150 -100 -199 418 | A -100 -50 50 899 1 0 1 0 N -100 0 -50 -50 419 | A -100 -50 50 -1 -899 0 1 0 N -50 -50 -100 -99 420 | A -100 50 50 899 1 0 1 0 N -100 100 -50 50 421 | A -100 50 50 -1 -899 0 1 0 N -50 50 -100 1 422 | A -100 150 50 899 1 0 1 0 N -100 200 -50 150 423 | A -100 150 50 -1 -899 0 1 0 N -50 150 -100 101 424 | A 100 -50 50 899 -1799 0 1 0 N 100 0 51 -50 425 | A 100 -50 50 1799 -899 0 1 0 N 51 -50 100 -99 426 | A 100 50 50 899 -1799 0 1 0 N 100 100 51 50 427 | A 100 50 50 1799 -899 0 1 0 N 51 50 100 1 428 | A 100 150 50 899 -1799 0 1 0 N 100 200 51 150 429 | A 100 150 50 1799 -899 0 1 0 N 51 150 100 101 430 | A 101 -150 50 910 -1799 0 1 0 N 101 -100 52 -150 431 | A 101 -150 50 -912 -1799 0 1 0 N 101 -199 52 -150 432 | P 2 0 1 0 -25 200 -25 -200 N 433 | P 2 0 1 0 25 -200 25 200 N 434 | X AA 1 -400 200 300 R 50 50 1 1 P 435 | X AB 2 -400 -200 300 R 50 50 1 1 P 436 | X SA 3 400 -200 300 L 50 50 1 1 P 437 | X SB 4 400 200 300 L 50 50 1 1 P 438 | ENDDRAW 439 | ENDDEF 440 | # 441 | #End Library 442 | -------------------------------------------------------------------------------- /KiCad/openMicroInverter_dev/openMicroInverter_dev-rescue.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /KiCad/openMicroInverter_dev/openMicroInverter_dev-rescue.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # ARDUINO_SHIELD_R3-SmartInverter_proto-rescue 5 | # 6 | DEF ARDUINO_SHIELD_R3-SmartInverter_proto-rescue P 0 40 Y Y 1 F N 7 | F0 "P" 250 -950 60 H V C CNN 8 | F1 "ARDUINO_SHIELD_R3-SmartInverter_proto-rescue" 0 1150 60 H V C CNN 9 | F2 "" 2750 -1600 60 H V C CNN 10 | F3 "" 2750 -1600 60 H V C CNN 11 | DRAW 12 | S 400 1100 -400 -900 0 1 0 f 13 | X NC 1 -700 600 300 R 50 50 1 1 N 14 | X AD1 10 -700 -400 300 R 50 50 1 1 B 15 | X AD2 11 -700 -500 300 R 50 50 1 1 B 16 | X AD3 12 -700 -600 300 R 50 50 1 1 B 17 | X AD4/SDA 13 -700 -700 300 R 50 50 1 1 B 18 | X AD5/SCL 14 -700 -800 300 R 50 50 1 1 B 19 | X 0(RX) 15 700 -800 300 L 50 50 1 1 B 20 | X 1(TX) 16 700 -700 300 L 50 50 1 1 B 21 | X 2 17 700 -600 300 L 50 50 1 1 B 22 | X ~~3 18 700 -500 300 L 50 50 1 1 B 23 | X 4 19 700 -400 300 L 50 50 1 1 B 24 | X IOREF 2 -700 500 300 R 50 50 1 1 I 25 | X ~~5 20 700 -300 300 L 50 50 1 1 B 26 | X ~~6 21 700 -200 300 L 50 50 1 1 B 27 | X 7 22 700 -100 300 L 50 50 1 1 B 28 | X 8 23 700 100 300 L 50 50 1 1 B 29 | X ~~9 24 700 200 300 L 50 50 1 1 B 30 | X ~~10 25 700 300 300 L 50 50 1 1 B 31 | X ~~11 26 700 400 300 L 50 50 1 1 B 32 | X 12 27 700 500 300 L 50 50 1 1 B 33 | X 13 28 700 600 300 L 50 50 1 1 B 34 | X GND 29 700 700 300 L 50 50 1 1 W 35 | X RST 3 -700 400 300 R 50 50 1 1 I 36 | X AREF 30 700 800 300 L 50 50 1 1 I 37 | X AD4/SDA 31 700 900 300 L 50 50 1 1 B 38 | X AD5/SCL 32 700 1000 300 L 50 50 1 1 B 39 | X 3V3 4 -700 300 300 R 50 50 1 1 I 40 | X 5V 5 -700 200 300 R 50 50 1 1 I 41 | X GND 6 -700 100 300 R 50 50 1 1 W 42 | X GND 7 -700 0 300 R 50 50 1 1 W 43 | X V_IN 8 -700 -100 300 R 50 50 1 1 I 44 | X AD0 9 -700 -300 300 R 50 50 1 1 B 45 | ENDDRAW 46 | ENDDEF 47 | # 48 | # C-SmartInverter_proto-rescue 49 | # 50 | DEF C-SmartInverter_proto-rescue C 0 10 N Y 1 F N 51 | F0 "C" 25 100 50 H V L CNN 52 | F1 "C-SmartInverter_proto-rescue" 25 -100 50 H V L CNN 53 | F2 "" 38 -150 50 H V C CNN 54 | F3 "" 0 0 50 H V C CNN 55 | $FPLIST 56 | C? 57 | C_????_* 58 | C_???? 59 | SMD*_c 60 | Capacitor* 61 | $ENDFPLIST 62 | DRAW 63 | P 2 0 1 20 -80 -30 80 -30 N 64 | P 2 0 1 20 -80 30 80 30 N 65 | X ~ 1 0 150 110 D 40 40 1 1 P 66 | X ~ 2 0 -150 110 U 40 40 1 1 P 67 | ENDDRAW 68 | ENDDEF 69 | # 70 | # CONN_01X02-SmartInverter_proto-rescue 71 | # 72 | DEF CONN_01X02-SmartInverter_proto-rescue P 0 40 Y N 1 F N 73 | F0 "P" 0 150 50 H V C CNN 74 | F1 "CONN_01X02-SmartInverter_proto-rescue" 100 0 50 V V C CNN 75 | F2 "" 0 0 50 H V C CNN 76 | F3 "" 0 0 50 H V C CNN 77 | $FPLIST 78 | Pin_Header_Straight_1X02 79 | Pin_Header_Angled_1X02 80 | Socket_Strip_Straight_1X02 81 | Socket_Strip_Angled_1X02 82 | $ENDFPLIST 83 | DRAW 84 | S -50 -45 10 -55 0 1 0 N 85 | S -50 55 10 45 0 1 0 N 86 | S -50 100 50 -100 0 1 0 N 87 | X P1 1 -200 50 150 R 50 50 1 1 P 88 | X P2 2 -200 -50 150 R 50 50 1 1 P 89 | ENDDRAW 90 | ENDDEF 91 | # 92 | # CP-SmartInverter_proto-rescue 93 | # 94 | DEF CP-SmartInverter_proto-rescue C 0 10 N Y 1 F N 95 | F0 "C" 25 100 50 H V L CNN 96 | F1 "CP-SmartInverter_proto-rescue" 25 -100 50 H V L CNN 97 | F2 "" 38 -150 50 H V C CNN 98 | F3 "" 0 0 50 H V C CNN 99 | $FPLIST 100 | CP* 101 | Elko* 102 | TantalC* 103 | C*elec 104 | c_elec* 105 | SMD*_Pol 106 | $ENDFPLIST 107 | DRAW 108 | S -90 20 -90 40 0 1 0 N 109 | S -90 20 90 20 0 1 0 N 110 | S 90 -20 -90 -40 0 1 0 F 111 | S 90 40 -90 40 0 1 0 N 112 | S 90 40 90 20 0 1 0 N 113 | P 2 0 1 0 -70 90 -30 90 N 114 | P 2 0 1 0 -50 110 -50 70 N 115 | X ~ 1 0 150 110 D 40 40 1 1 P 116 | X ~ 2 0 -150 110 U 40 40 1 1 P 117 | ENDDRAW 118 | ENDDEF 119 | # 120 | # D-SmartInverter_proto-rescue 121 | # 122 | DEF D-SmartInverter_proto-rescue D 0 40 N N 1 F N 123 | F0 "D" 0 100 50 H V C CNN 124 | F1 "D-SmartInverter_proto-rescue" 0 -100 50 H V C CNN 125 | F2 "" 0 0 50 H V C CNN 126 | F3 "" 0 0 50 H V C CNN 127 | $FPLIST 128 | Diode_* 129 | D-Pak_TO252AA 130 | *SingleDiode 131 | *_Diode_* 132 | *SingleDiode* 133 | $ENDFPLIST 134 | DRAW 135 | P 2 0 1 6 -50 50 -50 -50 N 136 | P 3 0 1 0 50 50 -50 0 50 -50 F 137 | X K 1 -150 0 100 R 50 50 1 1 P 138 | X A 2 150 0 100 L 50 50 1 1 P 139 | ENDDRAW 140 | ENDDEF 141 | # 142 | # GND-SmartInverter_proto-rescue 143 | # 144 | DEF GND-SmartInverter_proto-rescue #PWR 0 0 Y Y 1 F P 145 | F0 "#PWR" 0 -250 50 H I C CNN 146 | F1 "GND-SmartInverter_proto-rescue" 0 -150 50 H V C CNN 147 | F2 "" 0 0 50 H V C CNN 148 | F3 "" 0 0 50 H V C CNN 149 | DRAW 150 | P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N 151 | X GND 1 0 0 0 D 50 50 1 1 W N 152 | ENDDRAW 153 | ENDDEF 154 | # 155 | # HIP4082-SmartInverter_proto-rescue 156 | # 157 | DEF HIP4082-SmartInverter_proto-rescue U 0 40 Y Y 1 F N 158 | F0 "U" 300 -1100 60 H V C CNN 159 | F1 "HIP4082-SmartInverter_proto-rescue" 0 900 60 H V C CNN 160 | F2 "" -100 0 60 H V C CNN 161 | F3 "" -100 0 60 H V C CNN 162 | DRAW 163 | S -400 800 400 -1000 0 1 10 N 164 | X BHB 1 -600 600 200 R 50 50 1 1 I 165 | X AHO 10 600 -600 200 L 50 50 1 1 O 166 | X AHS 11 600 -400 200 L 50 50 1 1 I 167 | X VDD 12 600 -200 200 L 50 50 1 1 W 168 | X ALO 13 600 0 200 L 50 50 1 1 O 169 | X BLO 14 600 200 200 L 50 50 1 1 O 170 | X BHS 15 600 400 200 L 50 50 1 1 I 171 | X BHO 16 600 600 200 L 50 50 1 1 O 172 | X BHI 2 -600 400 200 R 50 50 1 1 I 173 | X BLI 3 -600 200 200 R 50 50 1 1 I 174 | X ALI 4 -600 0 200 R 50 50 1 1 I 175 | X DEL 5 -600 -200 200 R 50 50 1 1 I 176 | X VSS 6 -600 -400 200 R 50 50 1 1 W 177 | X AHI 7 -600 -600 200 R 50 50 1 1 I 178 | X DIS 8 -600 -800 200 R 50 50 1 1 I 179 | X AHB 9 600 -800 200 L 50 50 1 1 I 180 | ENDDRAW 181 | ENDDEF 182 | # 183 | # INDUCTOR-SmartInverter_proto-rescue 184 | # 185 | DEF INDUCTOR-SmartInverter_proto-rescue L 0 40 N N 1 F N 186 | F0 "L" -50 0 50 V V C CNN 187 | F1 "INDUCTOR-SmartInverter_proto-rescue" 100 0 50 V V C CNN 188 | F2 "" 0 0 50 H V C CNN 189 | F3 "" 0 0 50 H V C CNN 190 | DRAW 191 | A 0 -150 50 -889 889 0 1 0 N 1 -199 1 -100 192 | A 0 -49 51 -889 889 0 1 0 N 1 -99 1 2 193 | A 0 51 51 -889 889 0 1 0 N 1 1 1 102 194 | A 0 148 48 -889 889 0 1 0 N 1 101 1 196 195 | X 1 1 0 300 100 D 50 50 1 1 P 196 | X 2 2 0 -300 100 U 50 50 1 1 P 197 | ENDDRAW 198 | ENDDEF 199 | # 200 | # LEM_LA55-P-SmartInverter_proto-rescue 201 | # 202 | DEF LEM_LA55-P-SmartInverter_proto-rescue T 0 40 Y Y 1 F N 203 | F0 "T" 150 -300 60 H V C CNN 204 | F1 "LEM_LA55-P-SmartInverter_proto-rescue" 350 350 60 H V C CNN 205 | F2 "" 0 0 60 H V C CNN 206 | F3 "" 0 0 60 H V C CNN 207 | DRAW 208 | A -250 0 112 -634 634 0 1 0 N -200 -100 -200 100 209 | S -200 200 200 -200 0 1 10 f 210 | X + 1 0 300 100 D 50 50 1 1 W 211 | X - 2 0 -300 100 U 50 50 1 1 W 212 | X M 3 300 0 100 L 50 50 1 1 O 213 | X in 4 -300 100 100 R 50 50 1 1 P 214 | X out 5 -300 -100 100 R 50 50 1 1 P 215 | ENDDRAW 216 | ENDDEF 217 | # 218 | # LEM_LV25-P-SmartInverter_proto-rescue 219 | # 220 | DEF LEM_LV25-P-SmartInverter_proto-rescue T 0 40 Y Y 1 F N 221 | F0 "T" 150 -300 60 H V C CNN 222 | F1 "LEM_LV25-P-SmartInverter_proto-rescue" 350 300 60 H V C CNN 223 | F2 "" 0 0 60 H V C CNN 224 | F3 "" 0 0 60 H V C CNN 225 | DRAW 226 | S -200 200 200 -200 0 1 10 f 227 | X + 1 0 300 100 D 50 50 1 1 W 228 | X - 2 0 -300 100 U 50 50 1 1 W 229 | X M 3 300 0 100 L 50 50 1 1 O 230 | X Ipn_in 4 -300 100 100 R 50 50 1 1 P 231 | X Ipn_out 5 -300 -100 100 R 50 50 1 1 P 232 | ENDDRAW 233 | ENDDEF 234 | # 235 | # MCP6004-SmartInverter_proto-rescue 236 | # 237 | DEF MCP6004-SmartInverter_proto-rescue U 0 20 Y Y 4 F N 238 | F0 "U" 200 -200 60 H V C CNN 239 | F1 "MCP6004-SmartInverter_proto-rescue" 250 200 50 H V C CNN 240 | F2 "" 100 0 60 H V C CNN 241 | F3 "" 100 0 60 H V C CNN 242 | DRAW 243 | P 4 0 1 6 -100 200 300 0 -100 -200 -100 200 N 244 | X V- 11 0 -400 250 U 40 40 0 1 W 245 | X V+ 4 0 400 250 D 40 40 0 1 W 246 | X ~ 1 600 0 300 L 40 40 1 1 O 247 | X - 2 -400 100 300 R 40 40 1 1 I 248 | X + 3 -400 -100 300 R 40 40 1 1 I 249 | X + 5 -400 -100 300 R 40 40 2 1 I 250 | X - 6 -400 100 300 R 40 40 2 1 I 251 | X ~ 7 600 0 300 L 40 40 2 1 O 252 | X + 10 -400 -100 300 R 40 40 3 1 I 253 | X ~ 8 600 0 300 L 40 40 3 1 O 254 | X - 9 -400 100 300 R 40 40 3 1 I 255 | X + 12 -400 -100 300 R 40 40 4 1 I 256 | X - 13 -400 100 300 R 40 40 4 1 I 257 | X ~ 14 600 0 300 L 40 40 4 1 O 258 | ENDDRAW 259 | ENDDEF 260 | # 261 | # Q_NPN_CBE-SmartInverter_proto-rescue 262 | # 263 | DEF Q_NPN_CBE-SmartInverter_proto-rescue Q 0 0 Y N 1 F N 264 | F0 "Q" 300 50 50 H V R CNN 265 | F1 "Q_NPN_CBE-SmartInverter_proto-rescue" 600 -50 50 H V R CNN 266 | F2 "" 200 100 50 H V C CNN 267 | F3 "" 0 0 50 H V C CNN 268 | DRAW 269 | C 50 0 111 0 1 10 N 270 | P 2 0 1 0 25 25 100 100 N 271 | P 3 0 1 0 25 -25 100 -100 100 -100 N 272 | P 3 0 1 20 25 75 25 -75 25 -75 N 273 | P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F 274 | X C 1 100 200 100 D 50 50 1 1 P 275 | X B 2 -200 0 225 R 50 50 1 1 I 276 | X E 3 100 -200 100 U 50 50 1 1 P 277 | ENDDRAW 278 | ENDDEF 279 | # 280 | # Q_POWERMOSFET_GDS-SmartInverter_proto-rescue 281 | # 282 | DEF Q_POWERMOSFET_GDS-SmartInverter_proto-rescue Q 0 0 Y N 1 F N 283 | F0 "Q" 300 -150 50 H V R CNN 284 | F1 "Q_POWERMOSFET_GDS-SmartInverter_proto-rescue" 1010 70 50 H V R CNN 285 | F2 "" 200 100 50 H V C CNN 286 | F3 "" 0 0 50 H V C CNN 287 | DRAW 288 | P 2 0 1 0 30 -70 100 -70 N 289 | P 2 0 1 10 30 -50 30 -90 N 290 | P 2 0 1 0 30 0 100 0 N 291 | P 2 0 1 10 30 20 30 -20 N 292 | P 2 0 1 0 30 70 100 70 N 293 | P 2 0 1 10 30 90 30 50 N 294 | P 2 0 1 0 100 -70 100 -100 N 295 | P 2 0 1 0 100 -70 100 0 N 296 | P 2 0 1 0 100 100 100 70 N 297 | P 2 0 1 5 140 20 180 20 N 298 | P 3 0 1 10 10 75 10 -75 10 -75 N 299 | P 3 0 1 5 100 100 160 100 160 20 N 300 | P 3 0 1 5 160 -20 160 -100 100 -100 N 301 | P 4 0 1 0 40 0 80 15 80 -15 40 0 F 302 | P 4 0 1 5 160 20 140 -20 180 -20 160 20 N 303 | X G 1 -200 0 210 R 50 50 1 1 I 304 | X D 2 100 200 100 D 50 50 1 1 P 305 | X S 3 100 -200 100 U 50 50 1 1 P 306 | ENDDRAW 307 | ENDDEF 308 | # 309 | # R-SmartInverter_proto-rescue 310 | # 311 | DEF R-SmartInverter_proto-rescue R 0 0 N Y 1 F N 312 | F0 "R" 80 0 50 V V C CNN 313 | F1 "R-SmartInverter_proto-rescue" 0 0 50 V V C CNN 314 | F2 "" -70 0 50 V V C CNN 315 | F3 "" 0 0 50 H V C CNN 316 | $FPLIST 317 | R_* 318 | Resistor_* 319 | $ENDFPLIST 320 | DRAW 321 | S -40 -100 40 100 0 1 10 N 322 | X ~ 1 0 150 50 D 50 50 1 1 P 323 | X ~ 2 0 -150 50 U 50 50 1 1 P 324 | ENDDRAW 325 | ENDDEF 326 | # 327 | # RELAY_DPST_NO-SmartInverter_proto-rescue 328 | # 329 | DEF RELAY_DPST_NO-SmartInverter_proto-rescue K 0 40 Y Y 1 F N 330 | F0 "K" 500 -250 60 H V C CNN 331 | F1 "RELAY_DPST_NO-SmartInverter_proto-rescue" 800 200 60 H V C CNN 332 | F2 "" -50 0 60 H V C CNN 333 | F3 "" -50 0 60 H V C CNN 334 | DRAW 335 | S -600 300 400 -300 0 1 0 N 336 | P 2 0 1 0 -350 100 -450 -100 N 337 | P 2 0 1 10 -250 0 -200 0 N 338 | P 2 0 1 10 -150 0 -100 0 N 339 | P 2 0 1 10 -50 0 0 0 N 340 | P 2 0 1 0 -50 100 -100 -100 N 341 | P 2 0 1 0 -50 100 -100 -100 N 342 | P 2 0 1 0 -50 100 -100 -100 N 343 | P 2 0 1 0 -50 100 -100 -100 N 344 | P 2 0 1 10 50 0 100 0 N 345 | P 2 0 1 10 150 0 200 0 N 346 | P 2 0 1 0 250 100 200 -100 N 347 | P 2 0 1 0 250 100 200 -100 N 348 | P 2 0 1 0 250 100 200 -100 N 349 | P 2 0 1 0 250 100 200 -100 N 350 | P 5 0 1 0 -550 100 -250 100 -250 -100 -550 -100 -550 100 N 351 | X ~ 1 -400 400 300 D 50 50 1 1 I 352 | X ~ 2 -400 -400 300 U 50 50 1 1 I 353 | X ~ ~ -50 -400 300 U 50 50 1 1 P 354 | X ~ ~ -50 -400 300 U 50 50 1 1 P 355 | X ~ ~ -50 -400 300 U 50 50 1 1 P 356 | X ~ ~ -50 -400 300 U 50 50 1 1 P 357 | X ~ ~ -50 400 300 D 50 50 1 1 P 358 | X ~ ~ -50 400 300 D 50 50 1 1 P 359 | X ~ ~ -50 400 300 D 50 50 1 1 P 360 | X ~ ~ -50 400 300 D 50 50 1 1 P 361 | X ~ ~ 250 -400 300 U 50 50 1 1 P 362 | X ~ ~ 250 -400 300 U 50 50 1 1 P 363 | X ~ ~ 250 -400 300 U 50 50 1 1 P 364 | X ~ ~ 250 -400 300 U 50 50 1 1 P 365 | X ~ ~ 250 400 300 D 50 50 1 1 P 366 | X ~ ~ 250 400 300 D 50 50 1 1 P 367 | X ~ ~ 250 400 300 D 50 50 1 1 P 368 | X ~ ~ 250 400 300 D 50 50 1 1 P 369 | ENDDRAW 370 | ENDDEF 371 | # 372 | # TRANSFO-SmartInverter_proto-rescue 373 | # 374 | DEF TRANSFO-SmartInverter_proto-rescue T 0 40 Y N 1 F N 375 | F0 "T" 0 250 50 H V C CNN 376 | F1 "TRANSFO-SmartInverter_proto-rescue" 0 -300 50 H V C CNN 377 | F2 "" 0 0 50 H V C CNN 378 | F3 "" 0 0 50 H V C CNN 379 | DRAW 380 | A -100 -150 50 899 1 0 1 0 N -100 -100 -50 -150 381 | A -100 -150 50 -1 -899 0 1 0 N -50 -150 -100 -199 382 | A -100 -50 50 899 1 0 1 0 N -100 0 -50 -50 383 | A -100 -50 50 -1 -899 0 1 0 N -50 -50 -100 -99 384 | A -100 50 50 899 1 0 1 0 N -100 100 -50 50 385 | A -100 50 50 -1 -899 0 1 0 N -50 50 -100 1 386 | A -100 150 50 899 1 0 1 0 N -100 200 -50 150 387 | A -100 150 50 -1 -899 0 1 0 N -50 150 -100 101 388 | A 100 -50 50 899 -1799 0 1 0 N 100 0 51 -50 389 | A 100 -50 50 1799 -899 0 1 0 N 51 -50 100 -99 390 | A 100 50 50 899 -1799 0 1 0 N 100 100 51 50 391 | A 100 50 50 1799 -899 0 1 0 N 51 50 100 1 392 | A 100 150 50 899 -1799 0 1 0 N 100 200 51 150 393 | A 100 150 50 1799 -899 0 1 0 N 51 150 100 101 394 | A 101 -150 50 910 -1799 0 1 0 N 101 -100 52 -150 395 | A 101 -150 50 -912 -1799 0 1 0 N 101 -199 52 -150 396 | P 2 0 1 0 -25 200 -25 -200 N 397 | P 2 0 1 0 25 -200 25 200 N 398 | X AA 1 -400 200 300 R 50 50 1 1 P 399 | X AB 2 -400 -200 300 R 50 50 1 1 P 400 | X SA 3 400 -200 300 L 50 50 1 1 P 401 | X SB 4 400 200 300 L 50 50 1 1 P 402 | ENDDRAW 403 | ENDDEF 404 | # 405 | #End Library 406 | -------------------------------------------------------------------------------- /KiCad/openMicroInverter_dev/openMicroInverter_dev.pro: -------------------------------------------------------------------------------- 1 | update=di 09 jun 2020 18:13:19 CEST 2 | version=1 3 | last_client=kicad 4 | [pcbnew] 5 | version=1 6 | LastNetListRead= 7 | UseCmpFile=1 8 | PadDrill=0.600000000000 9 | PadDrillOvalY=0.600000000000 10 | PadSizeH=1.500000000000 11 | PadSizeV=1.500000000000 12 | PcbTextSizeV=1.500000000000 13 | PcbTextSizeH=1.500000000000 14 | PcbTextThickness=0.300000000000 15 | ModuleTextSizeV=1.000000000000 16 | ModuleTextSizeH=1.000000000000 17 | ModuleTextSizeThickness=0.150000000000 18 | SolderMaskClearance=0.000000000000 19 | SolderMaskMinWidth=0.000000000000 20 | DrawSegmentWidth=0.200000000000 21 | BoardOutlineThickness=0.100000000000 22 | ModuleOutlineThickness=0.150000000000 23 | [cvpcb] 24 | version=1 25 | NetIExt=net 26 | [general] 27 | version=1 28 | [eeschema] 29 | version=1 30 | LibDir= 31 | [schematic_editor] 32 | version=1 33 | PageLayoutDescrFile= 34 | PlotDirectoryName= 35 | SubpartIdSeparator=0 36 | SubpartFirstId=65 37 | NetFmtName= 38 | SpiceAjustPassiveValues=0 39 | LabSize=50 40 | ERC_TestSimilarLabels=1 41 | -------------------------------------------------------------------------------- /KiCad/openMicroInverter_dev/openMicroInverter_dev.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 4 2 | EELAYER 30 0 3 | EELAYER END 4 | $Descr A2 23386 16535 5 | encoding utf-8 6 | Sheet 1 1 7 | Title "open Micro Inverter with Arduino - development model" 8 | Date "2020-06-11" 9 | Rev "1.2" 10 | Comp "" 11 | Comment1 "Design by: M. Stokroos" 12 | Comment2 "" 13 | Comment3 "" 14 | Comment4 "" 15 | $EndDescr 16 | $Comp 17 | L openMicroInverter_dev-rescue:ARDUINO_SHIELD_R3-SmartInverter_proto-rescue P3 18 | U 1 1 56D75177 19 | P 9800 11500 20 | F 0 "P3" H 10050 10550 60 0000 C CNN 21 | F 1 "ARDUINO_R3" H 9800 12650 60 0000 C CNN 22 | F 2 "" H 12550 9900 60 0000 C CNN 23 | F 3 "" H 12550 9900 60 0000 C CNN 24 | 1 9800 11500 25 | 1 0 0 -1 26 | $EndComp 27 | $Comp 28 | L openMicroInverter_dev-rescue:LEM_LA55-P-SmartInverter_proto-rescue T3 29 | U 1 1 56D75178 30 | P 19100 3500 31 | F 0 "T3" H 19250 3200 60 0000 C CNN 32 | F 1 "LEM_LA55-P" H 19450 3850 60 0000 C CNN 33 | F 2 "" H 19100 3500 60 0000 C CNN 34 | F 3 "" H 19100 3500 60 0000 C CNN 35 | 1 19100 3500 36 | -1 0 0 -1 37 | $EndComp 38 | $Comp 39 | L openMicroInverter_dev-rescue:LEM_LV25-P-SmartInverter_proto-rescue T2 40 | U 1 1 56D75179 41 | P 14900 3500 42 | F 0 "T2" H 15100 3800 60 0000 C CNN 43 | F 1 "LEM_LV25-P" H 14550 3200 60 0000 C CNN 44 | F 2 "" H 14900 3500 60 0000 C CNN 45 | F 3 "" H 14900 3500 60 0000 C CNN 46 | 1 14900 3500 47 | -1 0 0 -1 48 | $EndComp 49 | $Comp 50 | L openMicroInverter_dev-rescue:HIP4082-SmartInverter_proto-rescue U1 51 | U 1 1 56D7517A 52 | P 3100 3600 53 | F 0 "U1" H 3350 2550 60 0000 C CNN 54 | F 1 "HIP4082" H 3100 4450 60 0000 C CNN 55 | F 2 "" H 3000 3600 60 0000 C CNN 56 | F 3 "" H 3000 3600 60 0000 C CNN 57 | 1 3100 3600 58 | 1 0 0 -1 59 | $EndComp 60 | $Comp 61 | L openMicroInverter_dev-rescue:Q_POWERMOSFET_GDS-SmartInverter_proto-rescue Q1 62 | U 1 1 56D7517B 63 | P 5900 3000 64 | F 0 "Q1" H 6200 2850 50 0000 R CNN 65 | F 1 "N-CHANNEL" H 5950 3200 50 0001 R CNN 66 | F 2 "" H 6100 3100 50 0000 C CNN 67 | F 3 "" H 5900 3000 50 0000 C CNN 68 | 1 5900 3000 69 | 1 0 0 -1 70 | $EndComp 71 | $Comp 72 | L openMicroInverter_dev-rescue:Q_POWERMOSFET_GDS-SmartInverter_proto-rescue Q2 73 | U 1 1 56D7517D 74 | P 7600 3000 75 | F 0 "Q2" H 7900 2850 50 0000 R CNN 76 | F 1 "N-CHANNEL" H 8250 3150 50 0001 R CNN 77 | F 2 "" H 7800 3100 50 0000 C CNN 78 | F 3 "" H 7600 3000 50 0000 C CNN 79 | 1 7600 3000 80 | -1 0 0 -1 81 | $EndComp 82 | $Comp 83 | L openMicroInverter_dev-rescue:Q_POWERMOSFET_GDS-SmartInverter_proto-rescue Q4 84 | U 1 1 56D7517E 85 | P 7600 4100 86 | F 0 "Q4" H 7900 3950 50 0000 R CNN 87 | F 1 "N-CHANNEL" H 8200 4300 50 0001 R CNN 88 | F 2 "" H 7800 4200 50 0000 C CNN 89 | F 3 "" H 7600 4100 50 0000 C CNN 90 | 1 7600 4100 91 | -1 0 0 -1 92 | $EndComp 93 | $Comp 94 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R3 95 | U 1 1 56D7517F 96 | P 5450 3000 97 | F 0 "R3" V 5530 3000 50 0000 C CNN 98 | F 1 "15" V 5450 3000 50 0000 C CNN 99 | F 2 "" V 5380 3000 50 0000 C CNN 100 | F 3 "" H 5450 3000 50 0000 C CNN 101 | 1 5450 3000 102 | 0 1 1 0 103 | $EndComp 104 | $Comp 105 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R13 106 | U 1 1 56D75180 107 | P 5450 4100 108 | F 0 "R13" V 5530 4100 50 0000 C CNN 109 | F 1 "15" V 5450 4100 50 0000 C CNN 110 | F 2 "" V 5380 4100 50 0000 C CNN 111 | F 3 "" H 5450 4100 50 0000 C CNN 112 | 1 5450 4100 113 | 0 1 1 0 114 | $EndComp 115 | $Comp 116 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R4 117 | U 1 1 56D75181 118 | P 8050 3000 119 | F 0 "R4" V 8130 3000 50 0000 C CNN 120 | F 1 "15" V 8050 3000 50 0000 C CNN 121 | F 2 "" V 7980 3000 50 0000 C CNN 122 | F 3 "" H 8050 3000 50 0000 C CNN 123 | 1 8050 3000 124 | 0 1 1 0 125 | $EndComp 126 | $Comp 127 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R14 128 | U 1 1 56D75182 129 | P 8050 4100 130 | F 0 "R14" V 8130 4100 50 0000 C CNN 131 | F 1 "15" V 8050 4100 50 0000 C CNN 132 | F 2 "" V 7980 4100 50 0000 C CNN 133 | F 3 "" H 8050 4100 50 0000 C CNN 134 | 1 8050 4100 135 | 0 1 1 0 136 | $EndComp 137 | Text Label 8500 3000 2 60 ~ 0 138 | AHO 139 | Text Label 8500 4100 2 60 ~ 0 140 | ALO 141 | Text Label 4050 4000 2 60 ~ 0 142 | AHS 143 | Text Label 4050 4200 2 60 ~ 0 144 | AHO 145 | Text Label 4050 3600 2 60 ~ 0 146 | ALO 147 | $Comp 148 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C5 149 | U 1 1 56D75183 150 | P 3800 2700 151 | F 0 "C5" H 3825 2800 50 0000 L CNN 152 | F 1 "100n" H 3825 2600 50 0000 L CNN 153 | F 2 "" H 3838 2550 50 0000 C CNN 154 | F 3 "" H 3800 2700 50 0000 C CNN 155 | 1 3800 2700 156 | 1 0 0 -1 157 | $EndComp 158 | $Comp 159 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C7 160 | U 1 1 56D75184 161 | P 4300 4200 162 | F 0 "C7" H 4325 4300 50 0000 L CNN 163 | F 1 "100n" H 4325 4100 50 0000 L CNN 164 | F 2 "" H 4338 4050 50 0000 C CNN 165 | F 3 "" H 4300 4200 50 0000 C CNN 166 | 1 4300 4200 167 | 1 0 0 -1 168 | $EndComp 169 | Text Label 6500 3500 2 60 ~ 0 170 | OUT_A 171 | Text Label 7000 3500 0 60 ~ 0 172 | OUT_B 173 | Text Label 5200 2000 0 60 ~ 0 174 | P12V0 175 | $Comp 176 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R22 177 | U 1 1 56D75185 178 | P 3350 6900 179 | F 0 "R22" V 3430 6900 50 0000 C CNN 180 | F 1 "22K" V 3350 6900 50 0000 C CNN 181 | F 2 "" V 3280 6900 50 0000 C CNN 182 | F 3 "" H 3350 6900 50 0000 C CNN 183 | 1 3350 6900 184 | 0 1 1 0 185 | $EndComp 186 | $Comp 187 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R24 188 | U 1 1 56D75186 189 | P 3350 7100 190 | F 0 "R24" V 3430 7100 50 0000 C CNN 191 | F 1 "1K" V 3350 7100 50 0000 C CNN 192 | F 2 "" V 3280 7100 50 0000 C CNN 193 | F 3 "" H 3350 7100 50 0000 C CNN 194 | 1 3350 7100 195 | 0 1 1 0 196 | $EndComp 197 | $Comp 198 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R26 199 | U 1 1 56D75187 200 | P 3850 7450 201 | F 0 "R26" V 3930 7450 50 0000 C CNN 202 | F 1 "330" V 3850 7450 50 0000 C CNN 203 | F 2 "" V 3780 7450 50 0000 C CNN 204 | F 3 "" H 3850 7450 50 0000 C CNN 205 | 1 3850 7450 206 | -1 0 0 1 207 | $EndComp 208 | $Comp 209 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R20 210 | U 1 1 56D75188 211 | P 4450 6000 212 | F 0 "R20" V 4530 6000 50 0000 C CNN 213 | F 1 "22K" V 4450 6000 50 0000 C CNN 214 | F 2 "" V 4380 6000 50 0000 C CNN 215 | F 3 "" H 4450 6000 50 0000 C CNN 216 | 1 4450 6000 217 | 0 1 1 0 218 | $EndComp 219 | $Comp 220 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R23 221 | U 1 1 56D75189 222 | P 5500 7000 223 | F 0 "R23" V 5580 7000 50 0000 C CNN 224 | F 1 "220" V 5500 7000 50 0000 C CNN 225 | F 2 "" V 5430 7000 50 0000 C CNN 226 | F 3 "" H 5500 7000 50 0000 C CNN 227 | 1 5500 7000 228 | 0 1 1 0 229 | $EndComp 230 | $Comp 231 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C9 232 | U 1 1 56D7518A 233 | P 4450 5700 234 | F 0 "C9" V 4250 5650 50 0000 L CNN 235 | F 1 "10n" V 4350 5800 50 0000 L CNN 236 | F 2 "" H 4488 5550 50 0000 C CNN 237 | F 3 "" H 4450 5700 50 0000 C CNN 238 | 1 4450 5700 239 | 0 1 1 0 240 | $EndComp 241 | $Comp 242 | L openMicroInverter_dev-rescue:TRANSFO-SmartInverter_proto-rescue T5 243 | U 1 1 56D7518B 244 | P 17800 4900 245 | F 0 "T5" H 17800 5150 50 0000 C CNN 246 | F 1 "XFMR 18V/240V" H 17750 4550 50 0000 C CNN 247 | F 2 "" H 17800 4900 50 0000 C CNN 248 | F 3 "" H 17800 4900 50 0000 C CNN 249 | 1 17800 4900 250 | 1 0 0 -1 251 | $EndComp 252 | $Comp 253 | L openMicroInverter_dev-rescue:CP-SmartInverter_proto-rescue C1 254 | U 1 1 56D7518C 255 | P 6500 2250 256 | F 0 "C1" H 6525 2350 50 0000 L CNN 257 | F 1 "3300uF" H 6525 2150 50 0000 L CNN 258 | F 2 "" H 6538 2100 50 0000 C CNN 259 | F 3 "" H 6500 2250 50 0000 C CNN 260 | 1 6500 2250 261 | 1 0 0 -1 262 | $EndComp 263 | $Comp 264 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR01 265 | U 1 1 56D7518D 266 | P 6500 2450 267 | F 0 "#PWR01" H 6500 2200 50 0001 C CNN 268 | F 1 "GND" H 6500 2300 50 0000 C CNN 269 | F 2 "" H 6500 2450 50 0000 C CNN 270 | F 3 "" H 6500 2450 50 0000 C CNN 271 | 1 6500 2450 272 | 1 0 0 -1 273 | $EndComp 274 | $Comp 275 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR010 276 | U 1 1 56D7518E 277 | P 6750 4700 278 | F 0 "#PWR010" H 6750 4450 50 0001 C CNN 279 | F 1 "GND" H 6750 4550 50 0000 C CNN 280 | F 2 "" H 6750 4700 50 0000 C CNN 281 | F 3 "" H 6750 4700 50 0000 C CNN 282 | 1 6750 4700 283 | 1 0 0 -1 284 | $EndComp 285 | Text Label 16900 4700 0 60 ~ 0 286 | OUT_A 287 | Text Label 16900 5100 0 60 ~ 0 288 | OUT_B 289 | $Comp 290 | L openMicroInverter_dev-rescue:INDUCTOR-SmartInverter_proto-rescue L1 291 | U 1 1 56D7518F 292 | P 18700 4400 293 | F 0 "L1" V 18650 4400 50 0000 C CNN 294 | F 1 "INDUCTOR" V 18800 4400 50 0000 C CNN 295 | F 2 "" H 18700 4400 50 0000 C CNN 296 | F 3 "" H 18700 4400 50 0000 C CNN 297 | 1 18700 4400 298 | 0 -1 -1 0 299 | $EndComp 300 | $Comp 301 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C8 302 | U 1 1 56D75190 303 | P 19100 4750 304 | F 0 "C8" H 19125 4850 50 0000 L CNN 305 | F 1 "1uF/400Vac" H 19125 4650 50 0000 L CNN 306 | F 2 "" H 19138 4600 50 0000 C CNN 307 | F 3 "" H 19100 4750 50 0000 C CNN 308 | 1 19100 4750 309 | 1 0 0 -1 310 | $EndComp 311 | $Comp 312 | L openMicroInverter_dev-rescue:RELAY_DPST_NO-SmartInverter_proto-rescue K1 313 | U 1 1 56D75191 314 | P 17200 2650 315 | F 0 "K1" V 16900 2250 60 0000 C CNN 316 | F 1 "ISLANDING RELAY" V 17750 2600 60 0000 C CNN 317 | F 2 "" H 17200 2650 60 0000 C CNN 318 | F 3 "" H 17200 2650 60 0000 C CNN 319 | 1 17200 2650 320 | 0 -1 -1 0 321 | $EndComp 322 | $Comp 323 | L openMicroInverter_dev-rescue:D-SmartInverter_proto-rescue D2 324 | U 1 1 56D75192 325 | P 17200 3500 326 | F 0 "D2" H 17200 3600 50 0000 C CNN 327 | F 1 "D" H 17200 3400 50 0000 C CNN 328 | F 2 "" H 17200 3500 50 0000 C CNN 329 | F 3 "" H 17200 3500 50 0000 C CNN 330 | 1 17200 3500 331 | -1 0 0 1 332 | $EndComp 333 | $Comp 334 | L openMicroInverter_dev-rescue:CONN_01X02-SmartInverter_proto-rescue P1 335 | U 1 1 56D75193 336 | P 14200 2550 337 | F 0 "P1" H 14200 2700 50 0000 C CNN 338 | F 1 "CONN_01X02" V 14300 2550 50 0001 C CNN 339 | F 2 "" H 14200 2550 50 0000 C CNN 340 | F 3 "" H 14200 2550 50 0000 C CNN 341 | 1 14200 2550 342 | -1 0 0 1 343 | $EndComp 344 | Text Notes 13400 2650 0 60 ~ 0 345 | grid\n230V/50Hz 346 | Text Notes 14050 2550 0 60 ~ 0 347 | L 348 | Text Notes 14050 2650 0 60 ~ 0 349 | N 350 | $Comp 351 | L openMicroInverter_dev-rescue:CONN_01X02-SmartInverter_proto-rescue P2 352 | U 1 1 56D75194 353 | P 21450 2550 354 | F 0 "P2" H 21450 2400 50 0000 C CNN 355 | F 1 "CONN_01X02" V 21550 2550 50 0001 C CNN 356 | F 2 "" H 21450 2550 50 0000 C CNN 357 | F 3 "" H 21450 2550 50 0000 C CNN 358 | 1 21450 2550 359 | 1 0 0 -1 360 | $EndComp 361 | Text Notes 21650 2550 0 60 ~ 0 362 | local load 363 | Text Notes 18400 5300 0 60 ~ 0 364 | output filter can be: L, LC or LCL 365 | $Comp 366 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R5 367 | U 1 1 56D75195 368 | P 15450 3400 369 | F 0 "R5" V 15530 3400 50 0000 C CNN 370 | F 1 "8K2" V 15450 3400 50 0000 C CNN 371 | F 2 "" V 15380 3400 50 0000 C CNN 372 | F 3 "" H 15450 3400 50 0000 C CNN 373 | 1 15450 3400 374 | 0 -1 -1 0 375 | $EndComp 376 | $Comp 377 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R7 378 | U 1 1 56D75196 379 | P 15450 3600 380 | F 0 "R7" V 15530 3600 50 0000 C CNN 381 | F 1 "8K2" V 15450 3600 50 0000 C CNN 382 | F 2 "" V 15380 3600 50 0000 C CNN 383 | F 3 "" H 15450 3600 50 0000 C CNN 384 | 1 15450 3600 385 | 0 1 1 0 386 | $EndComp 387 | $Comp 388 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R1 389 | U 1 1 56D75197 390 | P 15700 3050 391 | F 0 "R1" V 15780 3050 50 0000 C CNN 392 | F 1 "8K2" V 15700 3050 50 0000 C CNN 393 | F 2 "" V 15630 3050 50 0000 C CNN 394 | F 3 "" H 15700 3050 50 0000 C CNN 395 | 1 15700 3050 396 | -1 0 0 1 397 | $EndComp 398 | $Comp 399 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R2 400 | U 1 1 56D75198 401 | P 16000 3050 402 | F 0 "R2" V 16080 3050 50 0000 C CNN 403 | F 1 "8K2" V 16000 3050 50 0000 C CNN 404 | F 2 "" V 15930 3050 50 0000 C CNN 405 | F 3 "" H 16000 3050 50 0000 C CNN 406 | 1 16000 3050 407 | 1 0 0 -1 408 | $EndComp 409 | $Comp 410 | L openMicroInverter_dev-rescue:LEM_LV25-P-SmartInverter_proto-rescue T4 411 | U 1 1 56D75199 412 | P 21500 4700 413 | F 0 "T4" H 21650 4400 60 0000 C CNN 414 | F 1 "LEM_LV25-P" H 21850 5000 60 0000 C CNN 415 | F 2 "" H 21500 4700 60 0000 C CNN 416 | F 3 "" H 21500 4700 60 0000 C CNN 417 | 1 21500 4700 418 | 1 0 0 -1 419 | $EndComp 420 | $Comp 421 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R16 422 | U 1 1 56D7519A 423 | P 22000 5050 424 | F 0 "R16" V 22080 5050 50 0000 C CNN 425 | F 1 "100" V 22000 5050 50 0000 C CNN 426 | F 2 "" V 21930 5050 50 0000 C CNN 427 | F 3 "" H 22000 5050 50 0000 C CNN 428 | 1 22000 5050 429 | 1 0 0 -1 430 | $EndComp 431 | $Comp 432 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R8 433 | U 1 1 56D7519B 434 | P 18600 3700 435 | F 0 "R8" V 18680 3700 50 0000 C CNN 436 | F 1 "56" V 18600 3700 50 0000 C CNN 437 | F 2 "" V 18530 3700 50 0000 C CNN 438 | F 3 "" H 18600 3700 50 0000 C CNN 439 | 1 18600 3700 440 | 1 0 0 -1 441 | $EndComp 442 | $Comp 443 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R9 444 | U 1 1 56D7519C 445 | P 14400 3850 446 | F 0 "R9" V 14480 3850 50 0000 C CNN 447 | F 1 "100" V 14400 3850 50 0000 C CNN 448 | F 2 "" V 14330 3850 50 0000 C CNN 449 | F 3 "" H 14400 3850 50 0000 C CNN 450 | 1 14400 3850 451 | 1 0 0 -1 452 | $EndComp 453 | $Comp 454 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR07 455 | U 1 1 56D7519D 456 | P 14400 4200 457 | F 0 "#PWR07" H 14400 3950 50 0001 C CNN 458 | F 1 "GND" H 14400 4050 50 0000 C CNN 459 | F 2 "" H 14400 4200 50 0000 C CNN 460 | F 3 "" H 14400 4200 50 0000 C CNN 461 | 1 14400 4200 462 | 1 0 0 -1 463 | $EndComp 464 | $Comp 465 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR06 466 | U 1 1 56D7519E 467 | P 18600 3900 468 | F 0 "#PWR06" H 18600 3650 50 0001 C CNN 469 | F 1 "GND" H 18600 3750 50 0000 C CNN 470 | F 2 "" H 18600 3900 50 0000 C CNN 471 | F 3 "" H 18600 3900 50 0000 C CNN 472 | 1 18600 3900 473 | 1 0 0 -1 474 | $EndComp 475 | $Comp 476 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR011 477 | U 1 1 56D7519F 478 | P 22000 5400 479 | F 0 "#PWR011" H 22000 5150 50 0001 C CNN 480 | F 1 "GND" H 22000 5250 50 0000 C CNN 481 | F 2 "" H 22000 5400 50 0000 C CNN 482 | F 3 "" H 22000 5400 50 0000 C CNN 483 | 1 22000 5400 484 | 1 0 0 -1 485 | $EndComp 486 | $Comp 487 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C3 488 | U 1 1 56D751A0 489 | P 4600 2350 490 | F 0 "C3" H 4625 2450 50 0000 L CNN 491 | F 1 "100n" H 4625 2250 50 0000 L CNN 492 | F 2 "" H 4638 2200 50 0000 C CNN 493 | F 3 "" H 4600 2350 50 0000 C CNN 494 | 1 4600 2350 495 | 1 0 0 -1 496 | $EndComp 497 | $Comp 498 | L openMicroInverter_dev-rescue:CP-SmartInverter_proto-rescue C4 499 | U 1 1 56D751A1 500 | P 4900 2350 501 | F 0 "C4" H 4925 2450 50 0000 L CNN 502 | F 1 "10uF" H 4925 2250 50 0000 L CNN 503 | F 2 "" H 4938 2200 50 0000 C CNN 504 | F 3 "" H 4900 2350 50 0000 C CNN 505 | 1 4900 2350 506 | 1 0 0 -1 507 | $EndComp 508 | $Comp 509 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR03 510 | U 1 1 56D751A2 511 | P 4600 2600 512 | F 0 "#PWR03" H 4600 2350 50 0001 C CNN 513 | F 1 "GND" H 4600 2450 50 0000 C CNN 514 | F 2 "" H 4600 2600 50 0000 C CNN 515 | F 3 "" H 4600 2600 50 0000 C CNN 516 | 1 4600 2600 517 | 1 0 0 -1 518 | $EndComp 519 | $Comp 520 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR04 521 | U 1 1 56D751A3 522 | P 4900 2600 523 | F 0 "#PWR04" H 4900 2350 50 0001 C CNN 524 | F 1 "GND" H 4900 2450 50 0000 C CNN 525 | F 2 "" H 4900 2600 50 0000 C CNN 526 | F 3 "" H 4900 2600 50 0000 C CNN 527 | 1 4900 2600 528 | 1 0 0 -1 529 | $EndComp 530 | Text Label 11500 2000 0 60 ~ 0 531 | VDC+ 532 | $Comp 533 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R29 534 | U 1 1 56D751A4 535 | P 3600 9600 536 | F 0 "R29" V 3680 9600 50 0000 C CNN 537 | F 1 "22K" V 3600 9600 50 0000 C CNN 538 | F 2 "" V 3530 9600 50 0000 C CNN 539 | F 3 "" H 3600 9600 50 0000 C CNN 540 | 1 3600 9600 541 | 0 1 1 0 542 | $EndComp 543 | $Comp 544 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R31 545 | U 1 1 56D751A5 546 | P 3600 9800 547 | F 0 "R31" V 3680 9800 50 0000 C CNN 548 | F 1 "1K" V 3600 9800 50 0000 C CNN 549 | F 2 "" V 3530 9800 50 0000 C CNN 550 | F 3 "" H 3600 9800 50 0000 C CNN 551 | 1 3600 9800 552 | 0 1 1 0 553 | $EndComp 554 | $Comp 555 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R28 556 | U 1 1 56D751A6 557 | P 4400 9100 558 | F 0 "R28" V 4480 9100 50 0000 C CNN 559 | F 1 "22K" V 4400 9100 50 0000 C CNN 560 | F 2 "" V 4330 9100 50 0000 C CNN 561 | F 3 "" H 4400 9100 50 0000 C CNN 562 | 1 4400 9100 563 | 0 1 1 0 564 | $EndComp 565 | $Comp 566 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R30 567 | U 1 1 56D751A7 568 | P 5500 9700 569 | F 0 "R30" V 5580 9700 50 0000 C CNN 570 | F 1 "220" V 5500 9700 50 0000 C CNN 571 | F 2 "" V 5430 9700 50 0000 C CNN 572 | F 3 "" H 5500 9700 50 0000 C CNN 573 | 1 5500 9700 574 | 0 1 1 0 575 | $EndComp 576 | $Comp 577 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C19 578 | U 1 1 56D751A8 579 | P 4400 8800 580 | F 0 "C19" V 4200 8750 50 0000 L CNN 581 | F 1 "1n5" V 4300 8900 50 0000 L CNN 582 | F 2 "" H 4438 8650 50 0000 C CNN 583 | F 3 "" H 4400 8800 50 0000 C CNN 584 | 1 4400 8800 585 | 0 1 1 0 586 | $EndComp 587 | $Comp 588 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R38 589 | U 1 1 56D751A9 590 | P 3600 12100 591 | F 0 "R38" V 3680 12100 50 0000 C CNN 592 | F 1 "22K" V 3600 12100 50 0000 C CNN 593 | F 2 "" V 3530 12100 50 0000 C CNN 594 | F 3 "" H 3600 12100 50 0000 C CNN 595 | 1 3600 12100 596 | 0 1 1 0 597 | $EndComp 598 | $Comp 599 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R40 600 | U 1 1 56D751AA 601 | P 3600 12300 602 | F 0 "R40" V 3680 12300 50 0000 C CNN 603 | F 1 "1K" V 3600 12300 50 0000 C CNN 604 | F 2 "" V 3530 12300 50 0000 C CNN 605 | F 3 "" H 3600 12300 50 0000 C CNN 606 | 1 3600 12300 607 | 0 1 1 0 608 | $EndComp 609 | $Comp 610 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R37 611 | U 1 1 56D751AB 612 | P 4400 11600 613 | F 0 "R37" V 4480 11600 50 0000 C CNN 614 | F 1 "22K" V 4400 11600 50 0000 C CNN 615 | F 2 "" V 4330 11600 50 0000 C CNN 616 | F 3 "" H 4400 11600 50 0000 C CNN 617 | 1 4400 11600 618 | 0 1 1 0 619 | $EndComp 620 | $Comp 621 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R39 622 | U 1 1 56D751AC 623 | P 5500 12200 624 | F 0 "R39" V 5580 12200 50 0000 C CNN 625 | F 1 "220" V 5500 12200 50 0000 C CNN 626 | F 2 "" V 5430 12200 50 0000 C CNN 627 | F 3 "" H 5500 12200 50 0000 C CNN 628 | 1 5500 12200 629 | 0 1 1 0 630 | $EndComp 631 | $Comp 632 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C21 633 | U 1 1 56D751AD 634 | P 4400 11300 635 | F 0 "C21" V 4200 11250 50 0000 L CNN 636 | F 1 "1n5" V 4300 11400 50 0000 L CNN 637 | F 2 "" H 4438 11150 50 0000 C CNN 638 | F 3 "" H 4400 11300 50 0000 C CNN 639 | 1 4400 11300 640 | 0 1 1 0 641 | $EndComp 642 | $Comp 643 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R46 644 | U 1 1 56D751AE 645 | P 3600 14600 646 | F 0 "R46" V 3680 14600 50 0000 C CNN 647 | F 1 "22K" V 3600 14600 50 0000 C CNN 648 | F 2 "" V 3530 14600 50 0000 C CNN 649 | F 3 "" H 3600 14600 50 0000 C CNN 650 | 1 3600 14600 651 | 0 1 1 0 652 | $EndComp 653 | $Comp 654 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R48 655 | U 1 1 56D751AF 656 | P 3600 14800 657 | F 0 "R48" V 3680 14800 50 0000 C CNN 658 | F 1 "1K" V 3600 14800 50 0000 C CNN 659 | F 2 "" V 3530 14800 50 0000 C CNN 660 | F 3 "" H 3600 14800 50 0000 C CNN 661 | 1 3600 14800 662 | 0 1 1 0 663 | $EndComp 664 | $Comp 665 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R44 666 | U 1 1 56D751B0 667 | P 4400 14100 668 | F 0 "R44" V 4480 14100 50 0000 C CNN 669 | F 1 "22K" V 4400 14100 50 0000 C CNN 670 | F 2 "" V 4330 14100 50 0000 C CNN 671 | F 3 "" H 4400 14100 50 0000 C CNN 672 | 1 4400 14100 673 | 0 1 1 0 674 | $EndComp 675 | $Comp 676 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R47 677 | U 1 1 56D751B1 678 | P 5500 14700 679 | F 0 "R47" V 5580 14700 50 0000 C CNN 680 | F 1 "220" V 5500 14700 50 0000 C CNN 681 | F 2 "" V 5430 14700 50 0000 C CNN 682 | F 3 "" H 5500 14700 50 0000 C CNN 683 | 1 5500 14700 684 | 0 1 1 0 685 | $EndComp 686 | $Comp 687 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C22 688 | U 1 1 56D751B2 689 | P 4400 13800 690 | F 0 "C22" V 4200 13800 50 0000 L CNN 691 | F 1 "1n5" V 4300 13900 50 0000 L CNN 692 | F 2 "" H 4438 13650 50 0000 C CNN 693 | F 3 "" H 4400 13800 50 0000 C CNN 694 | 1 4400 13800 695 | 0 1 1 0 696 | $EndComp 697 | Text Label 13700 3500 0 60 ~ 0 698 | Vgrid_sense 699 | Text Label 18000 3500 0 60 ~ 0 700 | Iinv_sense 701 | Text Label 22600 4700 2 60 ~ 0 702 | Vinv_sense 703 | $Comp 704 | L openMicroInverter_dev-rescue:LEM_LA55-P-SmartInverter_proto-rescue T1 705 | U 1 1 56D751B3 706 | P 10400 2400 707 | F 0 "T1" H 10550 2100 60 0000 C CNN 708 | F 1 "LEM_LA55-P" V 10200 2950 60 0000 C CNN 709 | F 2 "" H 10400 2400 60 0000 C CNN 710 | F 3 "" H 10400 2400 60 0000 C CNN 711 | 1 10400 2400 712 | 0 1 1 0 713 | $EndComp 714 | $Comp 715 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R6 716 | U 1 1 56D751B4 717 | P 10400 3150 718 | F 0 "R6" V 10480 3150 50 0000 C CNN 719 | F 1 "56" V 10400 3150 50 0000 C CNN 720 | F 2 "" V 10330 3150 50 0000 C CNN 721 | F 3 "" H 10400 3150 50 0000 C CNN 722 | 1 10400 3150 723 | 1 0 0 -1 724 | $EndComp 725 | $Comp 726 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR05 727 | U 1 1 56D751B5 728 | P 10400 3400 729 | F 0 "#PWR05" H 10400 3150 50 0001 C CNN 730 | F 1 "GND" H 10400 3250 50 0000 C CNN 731 | F 2 "" H 10400 3400 50 0000 C CNN 732 | F 3 "" H 10400 3400 50 0000 C CNN 733 | 1 10400 3400 734 | 1 0 0 -1 735 | $EndComp 736 | Text Label 11100 2800 2 60 ~ 0 737 | Ibatt_sense 738 | $Comp 739 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R19 740 | U 1 1 56D751B6 741 | P 10000 6850 742 | F 0 "R19" V 10080 6850 50 0000 C CNN 743 | F 1 "56K" V 10000 6850 50 0000 C CNN 744 | F 2 "" V 9930 6850 50 0000 C CNN 745 | F 3 "" H 10000 6850 50 0000 C CNN 746 | 1 10000 6850 747 | 1 0 0 -1 748 | $EndComp 749 | $Comp 750 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R25 751 | U 1 1 56D751B7 752 | P 10000 8150 753 | F 0 "R25" V 10080 8150 50 0000 C CNN 754 | F 1 "8.2K" V 10000 8150 50 0000 C CNN 755 | F 2 "" V 9930 8150 50 0000 C CNN 756 | F 3 "" H 10000 8150 50 0000 C CNN 757 | 1 10000 8150 758 | 1 0 0 -1 759 | $EndComp 760 | $Comp 761 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR015 762 | U 1 1 56D751B8 763 | P 10000 8500 764 | F 0 "#PWR015" H 10000 8250 50 0001 C CNN 765 | F 1 "GND" H 10000 8350 50 0000 C CNN 766 | F 2 "" H 10000 8500 50 0000 C CNN 767 | F 3 "" H 10000 8500 50 0000 C CNN 768 | 1 10000 8500 769 | 1 0 0 -1 770 | $EndComp 771 | Text Label 9300 7800 0 60 ~ 0 772 | Vdc_scaled 773 | Text Label 2500 6900 0 60 ~ 0 774 | Vgrid_sense 775 | Text Label 2750 9600 0 60 ~ 0 776 | Iinv_sense 777 | Text Label 2850 12100 0 60 ~ 0 778 | Vinv_sense 779 | Text Label 2800 14600 0 60 ~ 0 780 | Ibatt_sense 781 | Text Label 6000 7000 0 60 ~ 0 782 | Vgrid_scaled 783 | Text Label 6000 9700 0 60 ~ 0 784 | Iinv_scaled 785 | Text Label 6000 12200 0 60 ~ 0 786 | Vinv_scaled 787 | Text Label 6000 14700 0 60 ~ 0 788 | Ibatt_scaled 789 | Text Label 8500 11800 0 60 ~ 0 790 | Vgrid_scaled 791 | Text Label 8500 11900 0 60 ~ 0 792 | Iinv_scaled 793 | Text Label 8500 12000 0 60 ~ 0 794 | Vinv_scaled 795 | Text Label 8500 12100 0 60 ~ 0 796 | Ibatt_scaled 797 | Text Label 8500 12200 0 60 ~ 0 798 | Vdc_scaled 799 | Text Label 10700 11000 0 50 ~ 0 800 | ZCD_OUT 801 | Text Label 12400 11900 2 60 ~ 0 802 | ~grid_connect_relay 803 | Text Label 10700 11400 0 50 ~ 0 804 | H_DIS 805 | Text Label 10700 11300 0 50 ~ 0 806 | H_PWMB 807 | Text Label 10700 11200 0 50 ~ 0 808 | H_PWMA 809 | Text Label 10700 10900 0 50 ~ 0 810 | PLL_LOCK 811 | Text Label 11200 11500 0 60 ~ 0 812 | Vgrid_scaled 813 | Text Notes 11200 11600 0 60 ~ 0 814 | (ZCD input) 815 | $Comp 816 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR014 817 | U 1 1 56D751BC 818 | P 4350 7500 819 | F 0 "#PWR014" H 4350 7250 50 0001 C CNN 820 | F 1 "GND" H 4350 7350 50 0000 C CNN 821 | F 2 "" H 4350 7500 50 0000 C CNN 822 | F 3 "" H 4350 7500 50 0000 C CNN 823 | 1 4350 7500 824 | 1 0 0 -1 825 | $EndComp 826 | Text Label 11500 4600 0 60 ~ 0 827 | VDC- 828 | $Comp 829 | L openMicroInverter_dev-rescue:CP-SmartInverter_proto-rescue C2 830 | U 1 1 56D751BD 831 | P 7000 2250 832 | F 0 "C2" H 7025 2350 50 0000 L CNN 833 | F 1 "3300uF" H 7025 2150 50 0000 L CNN 834 | F 2 "" H 7038 2100 50 0000 C CNN 835 | F 3 "" H 7000 2250 50 0000 C CNN 836 | 1 7000 2250 837 | 1 0 0 -1 838 | $EndComp 839 | $Comp 840 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR02 841 | U 1 1 56D751BE 842 | P 7000 2450 843 | F 0 "#PWR02" H 7000 2200 50 0001 C CNN 844 | F 1 "GND" H 7000 2300 50 0000 C CNN 845 | F 2 "" H 7000 2450 50 0000 C CNN 846 | F 3 "" H 7000 2450 50 0000 C CNN 847 | 1 7000 2450 848 | 1 0 0 -1 849 | $EndComp 850 | $Comp 851 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R36 852 | U 1 1 56D751BF 853 | P 10850 12100 854 | F 0 "R36" V 10930 12100 50 0000 C CNN 855 | F 1 "10K" V 10850 12100 50 0000 C CNN 856 | F 2 "" V 10780 12100 50 0000 C CNN 857 | F 3 "" H 10850 12100 50 0000 C CNN 858 | 1 10850 12100 859 | 0 1 1 0 860 | $EndComp 861 | $Comp 862 | L openMicroInverter_dev-rescue:Q_NPN_CBE-SmartInverter_proto-rescue Q5 863 | U 1 1 56D751C0 864 | P 11400 12300 865 | F 0 "Q5" H 11700 12350 50 0000 R CNN 866 | F 1 "Q_NPN_CBE" H 12000 12250 50 0000 R CNN 867 | F 2 "" H 11600 12400 50 0000 C CNN 868 | F 3 "" H 11400 12300 50 0000 C CNN 869 | 1 11400 12300 870 | 1 0 0 -1 871 | $EndComp 872 | $Comp 873 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR020 874 | U 1 1 56D751C1 875 | P 11500 12550 876 | F 0 "#PWR020" H 11500 12300 50 0001 C CNN 877 | F 1 "GND" H 11500 12400 50 0000 C CNN 878 | F 2 "" H 11500 12550 50 0000 C CNN 879 | F 3 "" H 11500 12550 50 0000 C CNN 880 | 1 11500 12550 881 | 1 0 0 -1 882 | $EndComp 883 | Text Label 15750 4150 0 60 ~ 0 884 | ~grid_connect_relay 885 | Text Label 18100 3050 2 60 ~ 0 886 | P12V0 887 | $Comp 888 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R12 889 | U 1 1 56D751C2 890 | P 20800 4400 891 | F 0 "R12" V 20880 4400 50 0000 C CNN 892 | F 1 "8K2" V 20800 4400 50 0000 C CNN 893 | F 2 "" V 20730 4400 50 0000 C CNN 894 | F 3 "" H 20800 4400 50 0000 C CNN 895 | 1 20800 4400 896 | 0 1 1 0 897 | $EndComp 898 | $Comp 899 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R11 900 | U 1 1 56D751C3 901 | P 20350 4400 902 | F 0 "R11" V 20430 4400 50 0000 C CNN 903 | F 1 "8K2" V 20350 4400 50 0000 C CNN 904 | F 2 "" V 20280 4400 50 0000 C CNN 905 | F 3 "" H 20350 4400 50 0000 C CNN 906 | 1 20350 4400 907 | 0 1 1 0 908 | $EndComp 909 | $Comp 910 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R18 911 | U 1 1 56D751C4 912 | P 20800 5100 913 | F 0 "R18" V 20880 5100 50 0000 C CNN 914 | F 1 "8K2" V 20800 5100 50 0000 C CNN 915 | F 2 "" V 20730 5100 50 0000 C CNN 916 | F 3 "" H 20800 5100 50 0000 C CNN 917 | 1 20800 5100 918 | 0 1 1 0 919 | $EndComp 920 | $Comp 921 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R17 922 | U 1 1 56D751C5 923 | P 20350 5100 924 | F 0 "R17" V 20430 5100 50 0000 C CNN 925 | F 1 "8K2" V 20350 5100 50 0000 C CNN 926 | F 2 "" V 20280 5100 50 0000 C CNN 927 | F 3 "" H 20350 5100 50 0000 C CNN 928 | 1 20350 5100 929 | 0 1 1 0 930 | $EndComp 931 | Text Notes 20200 4800 0 60 ~ 0 932 | PR02 RESISTORS 933 | Text Notes 16250 3650 1 60 ~ 0 934 | PR02 RESISTORS 935 | Text Notes 6300 1850 0 60 ~ 0 936 | H-BRIDGE 937 | Text Label 2000 3400 0 50 ~ 0 938 | H_PWMB 939 | Text Label 2000 3600 0 50 ~ 0 940 | H_PWMA 941 | $Comp 942 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR09 943 | U 1 1 56D751C6 944 | P 1700 4300 945 | F 0 "#PWR09" H 1700 4050 50 0001 C CNN 946 | F 1 "GND" H 1700 4150 50 0000 C CNN 947 | F 2 "" H 1700 4300 50 0000 C CNN 948 | F 3 "" H 1700 4300 50 0000 C CNN 949 | 1 1700 4300 950 | 1 0 0 -1 951 | $EndComp 952 | $Comp 953 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R10 954 | U 1 1 56D751C7 955 | P 2050 3800 956 | F 0 "R10" V 2130 3800 50 0000 C CNN 957 | F 1 "33K" V 2050 3800 50 0000 C CNN 958 | F 2 "" V 1980 3800 50 0000 C CNN 959 | F 3 "" H 2050 3800 50 0000 C CNN 960 | 1 2050 3800 961 | 0 1 1 0 962 | $EndComp 963 | Text Label 8500 11300 0 60 ~ 0 964 | P5V0 965 | $Comp 966 | L openMicroInverter_dev-rescue:MCP6004-SmartInverter_proto-rescue U2 967 | U 1 1 56D751CA 968 | P 4350 7000 969 | F 0 "U2" H 4550 6800 60 0000 C CNN 970 | F 1 "MCP6004" H 4600 7200 50 0000 C CNN 971 | F 2 "" H 4450 7000 60 0000 C CNN 972 | F 3 "" H 4450 7000 60 0000 C CNN 973 | 1 4350 7000 974 | 1 0 0 -1 975 | $EndComp 976 | $Comp 977 | L openMicroInverter_dev-rescue:MCP6004-SmartInverter_proto-rescue U2 978 | U 2 1 56D751CB 979 | P 4350 9700 980 | F 0 "U2" H 4550 9500 60 0000 C CNN 981 | F 1 "MCP6004" H 4600 9900 50 0000 C CNN 982 | F 2 "" H 4450 9700 60 0000 C CNN 983 | F 3 "" H 4450 9700 60 0000 C CNN 984 | 2 4350 9700 985 | 1 0 0 -1 986 | $EndComp 987 | $Comp 988 | L openMicroInverter_dev-rescue:MCP6004-SmartInverter_proto-rescue U2 989 | U 3 1 56D751CC 990 | P 4350 12200 991 | F 0 "U2" H 4550 12000 60 0000 C CNN 992 | F 1 "MCP6004" H 4600 12400 50 0000 C CNN 993 | F 2 "" H 4450 12200 60 0000 C CNN 994 | F 3 "" H 4450 12200 60 0000 C CNN 995 | 3 4350 12200 996 | 1 0 0 -1 997 | $EndComp 998 | $Comp 999 | L openMicroInverter_dev-rescue:MCP6004-SmartInverter_proto-rescue U2 1000 | U 4 1 56D751CD 1001 | P 4350 14700 1002 | F 0 "U2" H 4550 14500 60 0000 C CNN 1003 | F 1 "MCP6004" H 4600 14900 50 0000 C CNN 1004 | F 2 "" H 4450 14700 60 0000 C CNN 1005 | F 3 "" H 4450 14700 60 0000 C CNN 1006 | 4 4350 14700 1007 | 1 0 0 -1 1008 | $EndComp 1009 | $Comp 1010 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C14 1011 | U 1 1 56D751CE 1012 | P 6000 6450 1013 | F 0 "C14" H 6025 6550 50 0000 L CNN 1014 | F 1 "100n" H 6025 6350 50 0000 L CNN 1015 | F 2 "" H 6038 6300 50 0000 C CNN 1016 | F 3 "" H 6000 6450 50 0000 C CNN 1017 | 1 6000 6450 1018 | 1 0 0 -1 1019 | $EndComp 1020 | $Comp 1021 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR012 1022 | U 1 1 56D751CF 1023 | P 6000 6650 1024 | F 0 "#PWR012" H 6000 6400 50 0001 C CNN 1025 | F 1 "GND" H 6000 6500 50 0000 C CNN 1026 | F 2 "" H 6000 6650 50 0000 C CNN 1027 | F 3 "" H 6000 6650 50 0000 C CNN 1028 | 1 6000 6650 1029 | 1 0 0 -1 1030 | $EndComp 1031 | $Comp 1032 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R27 1033 | U 1 1 56D751D0 1034 | P 3850 7850 1035 | F 0 "R27" V 3930 7850 50 0000 C CNN 1036 | F 1 "3.3" V 3850 7850 50 0000 C CNN 1037 | F 2 "" V 3780 7850 50 0000 C CNN 1038 | F 3 "" H 3850 7850 50 0000 C CNN 1039 | 1 3850 7850 1040 | 1 0 0 -1 1041 | $EndComp 1042 | $Comp 1043 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR016 1044 | U 1 1 56D751D1 1045 | P 3850 8100 1046 | F 0 "#PWR016" H 3850 7850 50 0001 C CNN 1047 | F 1 "GND" H 3850 7950 50 0000 C CNN 1048 | F 2 "" H 3850 8100 50 0000 C CNN 1049 | F 3 "" H 3850 8100 50 0000 C CNN 1050 | 1 3850 8100 1051 | 1 0 0 -1 1052 | $EndComp 1053 | $Comp 1054 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R32 1055 | U 1 1 56D751D2 1056 | P 3850 10050 1057 | F 0 "R32" V 3930 10050 50 0000 C CNN 1058 | F 1 "330" V 3850 10050 50 0000 C CNN 1059 | F 2 "" V 3780 10050 50 0000 C CNN 1060 | F 3 "" H 3850 10050 50 0000 C CNN 1061 | 1 3850 10050 1062 | -1 0 0 1 1063 | $EndComp 1064 | $Comp 1065 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R34 1066 | U 1 1 56D751D3 1067 | P 3850 10400 1068 | F 0 "R34" V 3930 10400 50 0000 C CNN 1069 | F 1 "3.3" V 3850 10400 50 0000 C CNN 1070 | F 2 "" V 3780 10400 50 0000 C CNN 1071 | F 3 "" H 3850 10400 50 0000 C CNN 1072 | 1 3850 10400 1073 | 1 0 0 -1 1074 | $EndComp 1075 | $Comp 1076 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR017 1077 | U 1 1 56D751D4 1078 | P 3850 10600 1079 | F 0 "#PWR017" H 3850 10350 50 0001 C CNN 1080 | F 1 "GND" H 3850 10450 50 0000 C CNN 1081 | F 2 "" H 3850 10600 50 0000 C CNN 1082 | F 3 "" H 3850 10600 50 0000 C CNN 1083 | 1 3850 10600 1084 | 1 0 0 -1 1085 | $EndComp 1086 | $Comp 1087 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R41 1088 | U 1 1 56D751D5 1089 | P 3850 12550 1090 | F 0 "R41" V 3930 12550 50 0000 C CNN 1091 | F 1 "330" V 3850 12550 50 0000 C CNN 1092 | F 2 "" V 3780 12550 50 0000 C CNN 1093 | F 3 "" H 3850 12550 50 0000 C CNN 1094 | 1 3850 12550 1095 | -1 0 0 1 1096 | $EndComp 1097 | $Comp 1098 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R42 1099 | U 1 1 56D751D6 1100 | P 3850 12900 1101 | F 0 "R42" V 3930 12900 50 0000 C CNN 1102 | F 1 "3.3" V 3850 12900 50 0000 C CNN 1103 | F 2 "" V 3780 12900 50 0000 C CNN 1104 | F 3 "" H 3850 12900 50 0000 C CNN 1105 | 1 3850 12900 1106 | 1 0 0 -1 1107 | $EndComp 1108 | $Comp 1109 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR021 1110 | U 1 1 56D751D7 1111 | P 3850 13100 1112 | F 0 "#PWR021" H 3850 12850 50 0001 C CNN 1113 | F 1 "GND" H 3850 12950 50 0000 C CNN 1114 | F 2 "" H 3850 13100 50 0000 C CNN 1115 | F 3 "" H 3850 13100 50 0000 C CNN 1116 | 1 3850 13100 1117 | 1 0 0 -1 1118 | $EndComp 1119 | $Comp 1120 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R49 1121 | U 1 1 56D751D8 1122 | P 3850 15050 1123 | F 0 "R49" V 3930 15050 50 0000 C CNN 1124 | F 1 "330" V 3850 15050 50 0000 C CNN 1125 | F 2 "" V 3780 15050 50 0000 C CNN 1126 | F 3 "" H 3850 15050 50 0000 C CNN 1127 | 1 3850 15050 1128 | -1 0 0 1 1129 | $EndComp 1130 | $Comp 1131 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R50 1132 | U 1 1 56D751D9 1133 | P 3850 15400 1134 | F 0 "R50" V 3930 15400 50 0000 C CNN 1135 | F 1 "3.3" V 3850 15400 50 0000 C CNN 1136 | F 2 "" V 3780 15400 50 0000 C CNN 1137 | F 3 "" H 3850 15400 50 0000 C CNN 1138 | 1 3850 15400 1139 | 1 0 0 -1 1140 | $EndComp 1141 | $Comp 1142 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR023 1143 | U 1 1 56D751DA 1144 | P 3850 15600 1145 | F 0 "#PWR023" H 3850 15350 50 0001 C CNN 1146 | F 1 "GND" H 3850 15450 50 0000 C CNN 1147 | F 2 "" H 3850 15600 50 0000 C CNN 1148 | F 3 "" H 3850 15600 50 0000 C CNN 1149 | 1 3850 15600 1150 | 1 0 0 -1 1151 | $EndComp 1152 | Text Label 2500 7100 0 60 ~ 0 1153 | P5V0 1154 | Text Label 2750 9800 0 60 ~ 0 1155 | P5V0 1156 | Text Label 2850 12300 0 60 ~ 0 1157 | P5V0 1158 | Text Label 2800 14800 0 60 ~ 0 1159 | P5V0 1160 | Text Notes 3950 7250 0 60 ~ 0 1161 | 1.25V 1162 | Text Notes 4900 7150 0 60 ~ 0 1163 | 2.5V 1164 | Text Label 6350 6200 0 60 ~ 0 1165 | P5V0 1166 | $Comp 1167 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R15 1168 | U 1 1 56D751DB 1169 | P 2250 4400 1170 | F 0 "R15" V 2330 4400 50 0000 C CNN 1171 | F 1 "10K" V 2250 4400 50 0000 C CNN 1172 | F 2 "" V 2180 4400 50 0000 C CNN 1173 | F 3 "" H 2250 4400 50 0000 C CNN 1174 | 1 2250 4400 1175 | 0 1 1 0 1176 | $EndComp 1177 | Text Label 1900 4400 0 50 ~ 0 1178 | P5V0 1179 | Text Label 1900 4650 0 50 ~ 0 1180 | H_DIS 1181 | $Comp 1182 | L openMicroInverter_dev-rescue:D-SmartInverter_proto-rescue D1 1183 | U 1 1 56D751DC 1184 | P 4050 2000 1185 | F 0 "D1" H 4050 2100 50 0000 C CNN 1186 | F 1 "1N4935" H 4050 1900 50 0000 C CNN 1187 | F 2 "" H 4050 2000 50 0000 C CNN 1188 | F 3 "" H 4050 2000 50 0000 C CNN 1189 | 1 4050 2000 1190 | 1 0 0 -1 1191 | $EndComp 1192 | $Comp 1193 | L openMicroInverter_dev-rescue:D-SmartInverter_proto-rescue D3 1194 | U 1 1 56D751DD 1195 | P 4550 3800 1196 | F 0 "D3" H 4550 3900 50 0000 C CNN 1197 | F 1 "1N4935" H 4550 3700 50 0000 C CNN 1198 | F 2 "" H 4550 3800 50 0000 C CNN 1199 | F 3 "" H 4550 3800 50 0000 C CNN 1200 | 1 4550 3800 1201 | -1 0 0 1 1202 | $EndComp 1203 | $Comp 1204 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R43 1205 | U 1 1 56D751DE 1206 | P 10000 14100 1207 | F 0 "R43" V 10080 14100 50 0000 C CNN 1208 | F 1 "1K" V 10000 14100 50 0000 C CNN 1209 | F 2 "" V 9930 14100 50 0000 C CNN 1210 | F 3 "" H 10000 14100 50 0000 C CNN 1211 | 1 10000 14100 1212 | 1 0 0 -1 1213 | $EndComp 1214 | $Comp 1215 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R45 1216 | U 1 1 56D751DF 1217 | P 10000 14850 1218 | F 0 "R45" V 10080 14850 50 0000 C CNN 1219 | F 1 "1K" V 10000 14850 50 0000 C CNN 1220 | F 2 "" V 9930 14850 50 0000 C CNN 1221 | F 3 "" H 10000 14850 50 0000 C CNN 1222 | 1 10000 14850 1223 | 1 0 0 -1 1224 | $EndComp 1225 | $Comp 1226 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR022 1227 | U 1 1 56D751E0 1228 | P 10000 15150 1229 | F 0 "#PWR022" H 10000 14900 50 0001 C CNN 1230 | F 1 "GND" H 10000 15000 50 0000 C CNN 1231 | F 2 "" H 10000 15150 50 0000 C CNN 1232 | F 3 "" H 10000 15150 50 0000 C CNN 1233 | 1 10000 15150 1234 | 1 0 0 -1 1235 | $EndComp 1236 | Text Label 10300 13800 2 60 ~ 0 1237 | P5V0 1238 | Text Label 10400 14500 0 60 ~ 0 1239 | VREF_CP 1240 | Text Label 10700 11700 0 50 ~ 0 1241 | VREF_CP 1242 | $Comp 1243 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R21 1244 | U 1 1 56D751E1 1245 | P 10000 7350 1246 | F 0 "R21" V 10080 7350 50 0000 C CNN 1247 | F 1 "1K" V 10000 7350 50 0000 C CNN 1248 | F 2 "" V 9930 7350 50 0000 C CNN 1249 | F 3 "" H 10000 7350 50 0000 C CNN 1250 | 1 10000 7350 1251 | 1 0 0 -1 1252 | $EndComp 1253 | Text Notes 10100 7850 0 60 ~ 0 1254 | FS=39.75V 1255 | $Comp 1256 | L openMicroInverter_dev-rescue:R-SmartInverter_proto-rescue R35 1257 | U 1 1 56D751E2 1258 | P 10850 11500 1259 | F 0 "R35" V 10930 11500 50 0000 C CNN 1260 | F 1 "R" V 10850 11500 50 0000 C CNN 1261 | F 2 "" V 10780 11500 50 0000 C CNN 1262 | F 3 "" H 10850 11500 50 0000 C CNN 1263 | 1 10850 11500 1264 | 0 1 1 0 1265 | $EndComp 1266 | Text Label 21700 4200 0 60 ~ 0 1267 | P15V0 1268 | Text Label 21600 5200 0 60 ~ 0 1269 | N15V0 1270 | Text Label 19200 4000 0 60 ~ 0 1271 | N15V0 1272 | Text Label 19200 3000 0 60 ~ 0 1273 | P15V0 1274 | Text Label 15100 3000 0 60 ~ 0 1275 | P15V0 1276 | Text Label 15100 4100 0 60 ~ 0 1277 | N15V0 1278 | Text Label 9800 2400 0 60 ~ 0 1279 | N15V0 1280 | Text Label 10900 2400 0 60 ~ 0 1281 | P15V0 1282 | Text Label 20200 10000 2 60 ~ 0 1283 | P15V0 1284 | Text Label 20200 11400 2 60 ~ 0 1285 | N15V0 1286 | $Comp 1287 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C10 1288 | U 1 1 56D751E3 1289 | P 17000 10350 1290 | F 0 "C10" H 17025 10450 50 0000 L CNN 1291 | F 1 "100n" H 17025 10250 50 0000 L CNN 1292 | F 2 "" H 17038 10200 50 0000 C CNN 1293 | F 3 "" H 17000 10350 50 0000 C CNN 1294 | 1 17000 10350 1295 | 1 0 0 -1 1296 | $EndComp 1297 | $Comp 1298 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C15 1299 | U 1 1 56D751E4 1300 | P 17000 11050 1301 | F 0 "C15" H 17025 11150 50 0000 L CNN 1302 | F 1 "100n" H 17025 10950 50 0000 L CNN 1303 | F 2 "" H 17038 10900 50 0000 C CNN 1304 | F 3 "" H 17000 11050 50 0000 C CNN 1305 | 1 17000 11050 1306 | 1 0 0 -1 1307 | $EndComp 1308 | $Comp 1309 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C11 1310 | U 1 1 56D751E5 1311 | P 17500 10350 1312 | F 0 "C11" H 17525 10450 50 0000 L CNN 1313 | F 1 "100n" H 17525 10250 50 0000 L CNN 1314 | F 2 "" H 17538 10200 50 0000 C CNN 1315 | F 3 "" H 17500 10350 50 0000 C CNN 1316 | 1 17500 10350 1317 | 1 0 0 -1 1318 | $EndComp 1319 | $Comp 1320 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C16 1321 | U 1 1 56D751E6 1322 | P 17500 11050 1323 | F 0 "C16" H 17525 11150 50 0000 L CNN 1324 | F 1 "100n" H 17525 10950 50 0000 L CNN 1325 | F 2 "" H 17538 10900 50 0000 C CNN 1326 | F 3 "" H 17500 11050 50 0000 C CNN 1327 | 1 17500 11050 1328 | 1 0 0 -1 1329 | $EndComp 1330 | $Comp 1331 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C12 1332 | U 1 1 56D751E7 1333 | P 18000 10350 1334 | F 0 "C12" H 18025 10450 50 0000 L CNN 1335 | F 1 "100n" H 18025 10250 50 0000 L CNN 1336 | F 2 "" H 18038 10200 50 0000 C CNN 1337 | F 3 "" H 18000 10350 50 0000 C CNN 1338 | 1 18000 10350 1339 | 1 0 0 -1 1340 | $EndComp 1341 | $Comp 1342 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C17 1343 | U 1 1 56D751E8 1344 | P 18000 11050 1345 | F 0 "C17" H 18025 11150 50 0000 L CNN 1346 | F 1 "100n" H 18025 10950 50 0000 L CNN 1347 | F 2 "" H 18038 10900 50 0000 C CNN 1348 | F 3 "" H 18000 11050 50 0000 C CNN 1349 | 1 18000 11050 1350 | 1 0 0 -1 1351 | $EndComp 1352 | $Comp 1353 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C13 1354 | U 1 1 56D751E9 1355 | P 18500 10350 1356 | F 0 "C13" H 18525 10450 50 0000 L CNN 1357 | F 1 "100n" H 18525 10250 50 0000 L CNN 1358 | F 2 "" H 18538 10200 50 0000 C CNN 1359 | F 3 "" H 18500 10350 50 0000 C CNN 1360 | 1 18500 10350 1361 | 1 0 0 -1 1362 | $EndComp 1363 | $Comp 1364 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C18 1365 | U 1 1 56D751EA 1366 | P 18500 11050 1367 | F 0 "C18" H 18525 11150 50 0000 L CNN 1368 | F 1 "100n" H 18525 10950 50 0000 L CNN 1369 | F 2 "" H 18538 10900 50 0000 C CNN 1370 | F 3 "" H 18500 11050 50 0000 C CNN 1371 | 1 18500 11050 1372 | 1 0 0 -1 1373 | $EndComp 1374 | Wire Wire Line 1375 | 6000 3200 6000 3500 1376 | Wire Wire Line 1377 | 7500 3500 7500 3750 1378 | Wire Wire Line 1379 | 6000 3500 6500 3500 1380 | Wire Wire Line 1381 | 7500 3500 7000 3500 1382 | Connection ~ 7500 3500 1383 | Wire Wire Line 1384 | 6000 2800 6000 2000 1385 | Wire Wire Line 1386 | 7500 2800 7500 2000 1387 | Wire Wire Line 1388 | 7500 4600 7500 4300 1389 | Wire Wire Line 1390 | 6000 4600 6000 4300 1391 | Connection ~ 6000 3500 1392 | Wire Wire Line 1393 | 5200 3400 5200 4100 1394 | Wire Wire Line 1395 | 5600 3000 5700 3000 1396 | Wire Wire Line 1397 | 5200 4100 5300 4100 1398 | Wire Wire Line 1399 | 5600 4100 5700 4100 1400 | Wire Wire Line 1401 | 7800 3000 7900 3000 1402 | Wire Wire Line 1403 | 7800 4100 7900 4100 1404 | Wire Wire Line 1405 | 8200 3000 8500 3000 1406 | Wire Wire Line 1407 | 8200 4100 8500 4100 1408 | Wire Wire Line 1409 | 3700 4000 4300 4000 1410 | Wire Wire Line 1411 | 3700 4200 4050 4200 1412 | Wire Wire Line 1413 | 3700 3600 4050 3600 1414 | Wire Wire Line 1415 | 3700 3000 5300 3000 1416 | Wire Wire Line 1417 | 3700 3200 3800 3200 1418 | Wire Wire Line 1419 | 3800 3200 5450 3200 1420 | Wire Wire Line 1421 | 5450 3200 5450 3500 1422 | Wire Wire Line 1423 | 5450 3500 6000 3500 1424 | Wire Wire Line 1425 | 3700 3400 5200 3400 1426 | Wire Wire Line 1427 | 3700 3800 4300 3800 1428 | Wire Wire Line 1429 | 4300 3800 4400 3800 1430 | Wire Wire Line 1431 | 4300 2000 4300 3800 1432 | Connection ~ 4300 3800 1433 | Wire Wire Line 1434 | 3800 2850 3800 3200 1435 | Connection ~ 3800 3200 1436 | Wire Wire Line 1437 | 2300 2000 3800 2000 1438 | Wire Wire Line 1439 | 3800 2000 3900 2000 1440 | Wire Wire Line 1441 | 2300 2000 2300 3000 1442 | Wire Wire Line 1443 | 2300 3000 2500 3000 1444 | Connection ~ 3800 2000 1445 | Wire Wire Line 1446 | 3800 2000 3800 2550 1447 | Wire Wire Line 1448 | 4200 2000 4300 2000 1449 | Wire Wire Line 1450 | 4300 2000 4600 2000 1451 | Wire Wire Line 1452 | 4600 2000 4900 2000 1453 | Wire Wire Line 1454 | 4900 2000 5200 2000 1455 | Wire Wire Line 1456 | 3700 4400 4300 4400 1457 | Wire Wire Line 1458 | 4300 4400 4800 4400 1459 | Wire Wire Line 1460 | 4800 4400 4800 3800 1461 | Wire Wire Line 1462 | 4800 3800 4700 3800 1463 | Wire Wire Line 1464 | 4300 4350 4300 4400 1465 | Connection ~ 4300 4400 1466 | Wire Wire Line 1467 | 4300 4000 4300 4050 1468 | Connection ~ 4300 2000 1469 | Wire Wire Line 1470 | 6500 2400 6500 2450 1471 | Wire Wire Line 1472 | 6500 2100 6500 2000 1473 | Wire Wire Line 1474 | 6750 4600 6750 4700 1475 | Wire Wire Line 1476 | 17400 4700 16900 4700 1477 | Wire Wire Line 1478 | 17400 5100 16900 5100 1479 | Wire Wire Line 1480 | 18200 4700 18200 4400 1481 | Wire Wire Line 1482 | 18200 4400 18400 4400 1483 | Wire Wire Line 1484 | 19100 4400 19100 4600 1485 | Connection ~ 19100 4400 1486 | Wire Wire Line 1487 | 18200 5100 19100 5100 1488 | Wire Wire Line 1489 | 19100 5100 20000 5100 1490 | Wire Wire Line 1491 | 20000 5100 20200 5100 1492 | Wire Wire Line 1493 | 19100 4900 19100 5100 1494 | Connection ~ 19100 5100 1495 | Wire Wire Line 1496 | 17600 3050 17700 3050 1497 | Wire Wire Line 1498 | 17700 3050 18100 3050 1499 | Wire Wire Line 1500 | 17700 3050 17700 3500 1501 | Wire Wire Line 1502 | 17700 3500 17350 3500 1503 | Wire Wire Line 1504 | 16800 3050 16700 3050 1505 | Wire Wire Line 1506 | 16700 3050 16700 3500 1507 | Wire Wire Line 1508 | 16700 3500 16700 4150 1509 | Wire Wire Line 1510 | 16700 3500 17050 3500 1511 | Wire Wire Line 1512 | 14500 2400 15700 2400 1513 | Wire Wire Line 1514 | 15700 2400 16800 2400 1515 | Wire Wire Line 1516 | 14500 2700 16000 2700 1517 | Wire Wire Line 1518 | 16000 2700 16800 2700 1519 | Wire Wire Line 1520 | 14500 2400 14500 2500 1521 | Wire Wire Line 1522 | 14500 2500 14400 2500 1523 | Wire Wire Line 1524 | 14500 2700 14500 2600 1525 | Wire Wire Line 1526 | 14500 2600 14400 2600 1527 | Wire Wire Line 1528 | 17600 2400 19700 2400 1529 | Wire Wire Line 1530 | 19700 2400 21250 2400 1531 | Wire Wire Line 1532 | 17600 2700 20000 2700 1533 | Wire Wire Line 1534 | 20000 2700 21250 2700 1535 | Wire Wire Line 1536 | 21250 2400 21250 2500 1537 | Wire Wire Line 1538 | 21250 2700 21250 2600 1539 | Wire Wire Line 1540 | 15200 3400 15300 3400 1541 | Wire Wire Line 1542 | 15200 3600 15300 3600 1543 | Wire Wire Line 1544 | 15600 3400 15700 3400 1545 | Wire Wire Line 1546 | 15700 3400 15700 3200 1547 | Wire Wire Line 1548 | 15600 3600 16000 3600 1549 | Wire Wire Line 1550 | 16000 3600 16000 3200 1551 | Wire Wire Line 1552 | 15700 2900 15700 2400 1553 | Connection ~ 15700 2400 1554 | Wire Wire Line 1555 | 16000 2900 16000 2700 1556 | Connection ~ 16000 2700 1557 | Wire Wire Line 1558 | 20000 5100 20000 2700 1559 | Wire Wire Line 1560 | 21200 4600 21100 4600 1561 | Wire Wire Line 1562 | 21100 4600 21100 4400 1563 | Wire Wire Line 1564 | 19000 4400 19100 4400 1565 | Wire Wire Line 1566 | 19100 4400 19700 4400 1567 | Wire Wire Line 1568 | 19700 4400 20200 4400 1569 | Wire Wire Line 1570 | 19400 3600 19700 3600 1571 | Wire Wire Line 1572 | 19700 3600 19700 4400 1573 | Connection ~ 19700 4400 1574 | Wire Wire Line 1575 | 19400 3400 19700 3400 1576 | Wire Wire Line 1577 | 19700 3400 19700 2400 1578 | Connection ~ 19700 2400 1579 | Connection ~ 20000 2700 1580 | Wire Wire Line 1581 | 21200 4800 21100 4800 1582 | Wire Wire Line 1583 | 21100 4800 21100 5100 1584 | Connection ~ 20000 5100 1585 | Wire Wire Line 1586 | 21800 4700 22000 4700 1587 | Wire Wire Line 1588 | 22000 4700 22600 4700 1589 | Wire Wire Line 1590 | 22000 4700 22000 4900 1591 | Connection ~ 22000 4700 1592 | Wire Wire Line 1593 | 22000 5400 22000 5200 1594 | Wire Wire Line 1595 | 18600 3500 18600 3550 1596 | Wire Wire Line 1597 | 18000 3500 18600 3500 1598 | Wire Wire Line 1599 | 18600 3500 18800 3500 1600 | Wire Wire Line 1601 | 18600 3900 18600 3850 1602 | Wire Wire Line 1603 | 13700 3500 14400 3500 1604 | Wire Wire Line 1605 | 14400 3500 14600 3500 1606 | Wire Wire Line 1607 | 14400 3500 14400 3700 1608 | Wire Wire Line 1609 | 14400 4000 14400 4200 1610 | Wire Wire Line 1611 | 4600 2200 4600 2000 1612 | Connection ~ 4600 2000 1613 | Wire Wire Line 1614 | 4900 2200 4900 2000 1615 | Connection ~ 4900 2000 1616 | Wire Wire Line 1617 | 4600 2500 4600 2600 1618 | Wire Wire Line 1619 | 4900 2500 4900 2600 1620 | Wire Wire Line 1621 | 3500 7100 3850 7100 1622 | Wire Wire Line 1623 | 3850 7100 3950 7100 1624 | Wire Wire Line 1625 | 3850 7300 3850 7100 1626 | Connection ~ 3850 7100 1627 | Wire Wire Line 1628 | 3500 6900 3850 6900 1629 | Wire Wire Line 1630 | 3850 6900 3950 6900 1631 | Wire Wire Line 1632 | 4950 7000 5000 7000 1633 | Wire Wire Line 1634 | 5000 7000 5350 7000 1635 | Wire Wire Line 1636 | 5650 7000 6000 7000 1637 | Wire Wire Line 1638 | 4300 6000 3850 6000 1639 | Connection ~ 3850 6900 1640 | Wire Wire Line 1641 | 4600 6000 5000 6000 1642 | Connection ~ 5000 7000 1643 | Wire Wire Line 1644 | 4600 5700 5000 5700 1645 | Wire Wire Line 1646 | 4300 5700 3850 5700 1647 | Wire Wire Line 1648 | 3200 6900 2500 6900 1649 | Wire Wire Line 1650 | 3200 7100 2500 7100 1651 | Wire Wire Line 1652 | 3750 9800 3850 9800 1653 | Wire Wire Line 1654 | 3850 9800 3950 9800 1655 | Wire Wire Line 1656 | 3850 9900 3850 9800 1657 | Connection ~ 3850 9800 1658 | Wire Wire Line 1659 | 3750 9600 3850 9600 1660 | Wire Wire Line 1661 | 3850 9600 3950 9600 1662 | Wire Wire Line 1663 | 4950 9700 5000 9700 1664 | Wire Wire Line 1665 | 5000 9700 5350 9700 1666 | Wire Wire Line 1667 | 5650 9700 6000 9700 1668 | Wire Wire Line 1669 | 4250 9100 3850 9100 1670 | Connection ~ 3850 9600 1671 | Wire Wire Line 1672 | 4550 9100 5000 9100 1673 | Connection ~ 5000 9700 1674 | Wire Wire Line 1675 | 4550 8800 5000 8800 1676 | Wire Wire Line 1677 | 4250 8800 3850 8800 1678 | Wire Wire Line 1679 | 3450 9600 2750 9600 1680 | Wire Wire Line 1681 | 3450 9800 2750 9800 1682 | Wire Wire Line 1683 | 3750 12300 3850 12300 1684 | Wire Wire Line 1685 | 3850 12300 3950 12300 1686 | Wire Wire Line 1687 | 3850 12400 3850 12300 1688 | Connection ~ 3850 12300 1689 | Wire Wire Line 1690 | 3750 12100 3850 12100 1691 | Wire Wire Line 1692 | 3850 12100 3950 12100 1693 | Wire Wire Line 1694 | 4950 12200 5000 12200 1695 | Wire Wire Line 1696 | 5000 12200 5350 12200 1697 | Wire Wire Line 1698 | 5650 12200 6000 12200 1699 | Wire Wire Line 1700 | 4250 11600 3850 11600 1701 | Connection ~ 3850 12100 1702 | Wire Wire Line 1703 | 4550 11600 5000 11600 1704 | Connection ~ 5000 12200 1705 | Wire Wire Line 1706 | 4550 11300 5000 11300 1707 | Wire Wire Line 1708 | 4250 11300 3850 11300 1709 | Wire Wire Line 1710 | 3450 12100 2850 12100 1711 | Wire Wire Line 1712 | 3450 12300 2850 12300 1713 | Wire Wire Line 1714 | 3750 14800 3850 14800 1715 | Wire Wire Line 1716 | 3850 14800 3950 14800 1717 | Wire Wire Line 1718 | 3850 14900 3850 14800 1719 | Connection ~ 3850 14800 1720 | Wire Wire Line 1721 | 3750 14600 3850 14600 1722 | Wire Wire Line 1723 | 3850 14600 3950 14600 1724 | Wire Wire Line 1725 | 4950 14700 5000 14700 1726 | Wire Wire Line 1727 | 5000 14700 5350 14700 1728 | Wire Wire Line 1729 | 5650 14700 6000 14700 1730 | Wire Wire Line 1731 | 4250 14100 3850 14100 1732 | Connection ~ 3850 14600 1733 | Wire Wire Line 1734 | 4550 14100 5000 14100 1735 | Connection ~ 5000 14700 1736 | Wire Wire Line 1737 | 4550 13800 5000 13800 1738 | Wire Wire Line 1739 | 4250 13800 3850 13800 1740 | Wire Wire Line 1741 | 3450 14600 2800 14600 1742 | Wire Wire Line 1743 | 3450 14800 2800 14800 1744 | Connection ~ 18600 3500 1745 | Connection ~ 14400 3500 1746 | Wire Wire Line 1747 | 10300 2000 10300 2100 1748 | Wire Wire Line 1749 | 10500 2100 10500 2000 1750 | Wire Wire Line 1751 | 10500 2000 11500 2000 1752 | Wire Wire Line 1753 | 10400 2700 10400 2800 1754 | Wire Wire Line 1755 | 10400 2800 10400 3000 1756 | Wire Wire Line 1757 | 10400 3300 10400 3400 1758 | Wire Wire Line 1759 | 10400 2800 11100 2800 1760 | Connection ~ 10400 2800 1761 | Wire Wire Line 1762 | 10000 7500 10000 7800 1763 | Wire Wire Line 1764 | 10000 7800 10000 8000 1765 | Wire Wire Line 1766 | 10000 8300 10000 8500 1767 | Wire Wire Line 1768 | 10000 7800 9300 7800 1769 | Connection ~ 10000 7800 1770 | Wire Wire Line 1771 | 9100 11800 8500 11800 1772 | Wire Wire Line 1773 | 9100 11900 8500 11900 1774 | Wire Wire Line 1775 | 9100 12000 8500 12000 1776 | Wire Wire Line 1777 | 9100 12100 8500 12100 1778 | Wire Wire Line 1779 | 9100 12200 8500 12200 1780 | Wire Wire Line 1781 | 10500 11000 10700 11000 1782 | Wire Wire Line 1783 | 10500 12100 10700 12100 1784 | Wire Wire Line 1785 | 10500 11400 10700 11400 1786 | Wire Wire Line 1787 | 10500 11700 10700 11700 1788 | Wire Wire Line 1789 | 10500 10900 10700 10900 1790 | Wire Wire Line 1791 | 10500 11200 10700 11200 1792 | Wire Wire Line 1793 | 10500 11300 10700 11300 1794 | Wire Wire Line 1795 | 7000 2400 7000 2450 1796 | Wire Wire Line 1797 | 7000 2100 7000 2000 1798 | Wire Wire Line 1799 | 11000 12100 11100 12100 1800 | Wire Wire Line 1801 | 11100 12100 11100 12300 1802 | Wire Wire Line 1803 | 11100 12300 11200 12300 1804 | Wire Wire Line 1805 | 11500 12500 11500 12550 1806 | Wire Wire Line 1807 | 11500 11900 11500 12100 1808 | Wire Wire Line 1809 | 12400 11900 11500 11900 1810 | Wire Wire Line 1811 | 16700 4150 15750 4150 1812 | Connection ~ 16700 3500 1813 | Connection ~ 17700 3050 1814 | Wire Wire Line 1815 | 20500 5100 20650 5100 1816 | Wire Wire Line 1817 | 21100 5100 20950 5100 1818 | Wire Wire Line 1819 | 21100 4400 20950 4400 1820 | Wire Wire Line 1821 | 20650 4400 20500 4400 1822 | Wire Wire Line 1823 | 2500 3400 2000 3400 1824 | Wire Wire Line 1825 | 2500 3600 2000 3600 1826 | Wire Wire Line 1827 | 2500 4000 1700 4000 1828 | Wire Wire Line 1829 | 1700 3800 1700 4000 1830 | Wire Wire Line 1831 | 1700 4000 1700 4300 1832 | Wire Wire Line 1833 | 2500 3800 2200 3800 1834 | Wire Wire Line 1835 | 1700 3800 1900 3800 1836 | Connection ~ 1700 4000 1837 | Wire Wire Line 1838 | 9100 11300 8500 11300 1839 | Wire Wire Line 1840 | 4350 6600 4350 6200 1841 | Wire Wire Line 1842 | 4350 6200 6000 6200 1843 | Wire Wire Line 1844 | 6000 6300 6000 6200 1845 | Wire Wire Line 1846 | 6000 6600 6000 6650 1847 | Wire Wire Line 1848 | 3850 7600 3850 7700 1849 | Wire Wire Line 1850 | 3850 8000 3850 8100 1851 | Wire Wire Line 1852 | 3850 10200 3850 10250 1853 | Wire Wire Line 1854 | 3850 10550 3850 10600 1855 | Wire Wire Line 1856 | 3850 12700 3850 12750 1857 | Wire Wire Line 1858 | 3850 13050 3850 13100 1859 | Wire Wire Line 1860 | 3850 15200 3850 15250 1861 | Wire Wire Line 1862 | 3850 15550 3850 15600 1863 | Wire Wire Line 1864 | 2100 4400 1900 4400 1865 | Wire Wire Line 1866 | 2400 4400 2450 4400 1867 | Wire Wire Line 1868 | 2450 4400 2500 4400 1869 | Wire Wire Line 1870 | 2450 4400 2450 4650 1871 | Wire Wire Line 1872 | 2450 4650 1900 4650 1873 | Connection ~ 2450 4400 1874 | Wire Wire Line 1875 | 2500 4200 2000 4200 1876 | Wire Wire Line 1877 | 10000 15000 10000 15150 1878 | Wire Wire Line 1879 | 10000 14250 10000 14500 1880 | Wire Wire Line 1881 | 10000 14500 10000 14700 1882 | Wire Wire Line 1883 | 10000 13950 10000 13800 1884 | Wire Wire Line 1885 | 10000 13800 10300 13800 1886 | Wire Wire Line 1887 | 10000 14500 10400 14500 1888 | Connection ~ 10000 14500 1889 | Wire Wire Line 1890 | 10000 7000 10000 7200 1891 | Wire Wire Line 1892 | 10500 11600 10600 11600 1893 | Wire Wire Line 1894 | 10600 11600 10600 11500 1895 | Wire Wire Line 1896 | 10600 11500 10700 11500 1897 | Wire Wire Line 1898 | 11000 11500 11200 11500 1899 | Wire Wire Line 1900 | 19200 3000 19100 3000 1901 | Wire Wire Line 1902 | 19100 3000 19100 3200 1903 | Wire Wire Line 1904 | 19100 3800 19100 4000 1905 | Wire Wire Line 1906 | 19100 4000 19200 4000 1907 | Wire Wire Line 1908 | 21500 4400 21500 4200 1909 | Wire Wire Line 1910 | 21500 4200 21700 4200 1911 | Wire Wire Line 1912 | 21500 5000 21500 5200 1913 | Wire Wire Line 1914 | 21500 5200 21600 5200 1915 | Wire Wire Line 1916 | 14900 3200 14900 3000 1917 | Wire Wire Line 1918 | 14900 3000 15100 3000 1919 | Wire Wire Line 1920 | 14900 3800 14900 4100 1921 | Wire Wire Line 1922 | 14900 4100 15100 4100 1923 | Wire Wire Line 1924 | 9800 2400 10100 2400 1925 | Wire Wire Line 1926 | 10700 2400 10900 2400 1927 | Wire Wire Line 1928 | 17000 10000 17500 10000 1929 | Wire Wire Line 1930 | 17500 10000 18000 10000 1931 | Wire Wire Line 1932 | 18000 10000 18500 10000 1933 | Wire Wire Line 1934 | 18500 10000 20200 10000 1935 | Wire Wire Line 1936 | 17000 11400 17500 11400 1937 | Wire Wire Line 1938 | 17500 11400 18000 11400 1939 | Wire Wire Line 1940 | 18000 11400 18500 11400 1941 | Wire Wire Line 1942 | 18500 11400 20200 11400 1943 | Wire Wire Line 1944 | 17000 10200 17000 10000 1945 | Wire Wire Line 1946 | 17000 11400 17000 11200 1947 | Wire Wire Line 1948 | 17500 10200 17500 10000 1949 | Connection ~ 17500 10000 1950 | Wire Wire Line 1951 | 17500 11200 17500 11400 1952 | Connection ~ 17500 11400 1953 | Wire Wire Line 1954 | 18000 10200 18000 10000 1955 | Connection ~ 18000 10000 1956 | Wire Wire Line 1957 | 18500 10200 18500 10000 1958 | Connection ~ 18500 10000 1959 | Wire Wire Line 1960 | 18500 11200 18500 11400 1961 | Connection ~ 18500 11400 1962 | Wire Wire Line 1963 | 18000 11200 18000 11400 1964 | Connection ~ 18000 11400 1965 | Wire Wire Line 1966 | 17000 10500 17000 10700 1967 | Wire Wire Line 1968 | 17000 10700 17000 10900 1969 | Wire Wire Line 1970 | 17500 10500 17500 10700 1971 | Wire Wire Line 1972 | 17500 10700 17500 10900 1973 | Wire Wire Line 1974 | 18000 10500 18000 10700 1975 | Wire Wire Line 1976 | 18000 10700 18000 10900 1977 | Wire Wire Line 1978 | 18500 10500 18500 10700 1979 | Wire Wire Line 1980 | 18500 10700 18500 10900 1981 | Wire Wire Line 1982 | 17000 10700 17500 10700 1983 | Wire Wire Line 1984 | 17500 10700 18000 10700 1985 | Wire Wire Line 1986 | 18000 10700 18500 10700 1987 | Wire Wire Line 1988 | 18500 10700 18900 10700 1989 | Connection ~ 17500 10700 1990 | Connection ~ 17000 10700 1991 | Connection ~ 18000 10700 1992 | Connection ~ 18500 10700 1993 | Wire Wire Line 1994 | 18900 10700 18900 10800 1995 | $Comp 1996 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR013 1997 | U 1 1 56D751EB 1998 | P 18900 10800 1999 | F 0 "#PWR013" H 18900 10550 50 0001 C CNN 2000 | F 1 "GND" H 18900 10650 50 0000 C CNN 2001 | F 2 "" H 18900 10800 50 0000 C CNN 2002 | F 3 "" H 18900 10800 50 0000 C CNN 2003 | 1 18900 10800 2004 | 1 0 0 -1 2005 | $EndComp 2006 | Text Notes 15650 10750 0 60 ~ 0 2007 | power decoupling caps\nfor LEM transducers 2008 | Wire Wire Line 2009 | 9100 11600 8500 11600 2010 | Text Label 8500 11600 0 60 ~ 0 2011 | P12V0 2012 | Text Notes 8800 11300 0 60 ~ 0 2013 | (out) 2014 | Text Notes 8800 11600 0 60 ~ 0 2015 | (in) 2016 | Wire Wire Line 2017 | 9100 11400 8000 11400 2018 | Wire Wire Line 2019 | 8000 11400 8000 11500 2020 | Wire Wire Line 2021 | 8000 11500 8000 11700 2022 | Wire Wire Line 2023 | 9100 11500 8000 11500 2024 | Connection ~ 8000 11500 2025 | $Comp 2026 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR019 2027 | U 1 1 56D751EC 2028 | P 8000 11700 2029 | F 0 "#PWR019" H 8000 11450 50 0001 C CNN 2030 | F 1 "GND" H 8000 11550 50 0000 C CNN 2031 | F 2 "" H 8000 11700 50 0000 C CNN 2032 | F 3 "" H 8000 11700 50 0000 C CNN 2033 | 1 8000 11700 2034 | 1 0 0 -1 2035 | $EndComp 2036 | Wire Wire Line 2037 | 10000 6700 10000 6500 2038 | Wire Wire Line 2039 | 10000 6500 10250 6500 2040 | Text Label 10250 6500 0 60 ~ 0 2041 | VDC+ 2042 | Text Notes 18300 4600 0 60 ~ 0 2043 | 48.2mH / 1.8E 2044 | Text Notes 7750 2600 0 60 ~ 0 2045 | use 80V low \nRDS-on MOSFET\n 2046 | Text Notes 19450 3550 0 60 ~ 0 2047 | 20 wdg. 2048 | Text Notes 5000 7650 0 60 ~ 0 2049 | Use rail-to-rail in- and output type OPAMP. 2050 | Text Notes 16350 5750 0 60 ~ 0 2051 | Transformer used with the development model: 240V / 18V - 200VA\nTransformer ratio and power rating may vary depending on the application.\n 2052 | Text Notes 16150 1700 0 100 ~ 0 2053 | Check the Inverter output phase and amplitude\nbefore closing the Islanding Relay! 2054 | Text Notes 20500 15200 0 50 ~ 0 2055 | MIT License\nCopyright (c) 2019 Martin Stokroos 2056 | $Comp 2057 | L openMicroInverter_dev-rescue:Q_POWERMOSFET_GDS-SmartInverter_proto-rescue Q3 2058 | U 1 1 56D7517C 2059 | P 5900 4100 2060 | F 0 "Q3" H 6200 3950 50 0000 R CNN 2061 | F 1 "N-CHANNEL" H 5950 4300 50 0001 R CNN 2062 | F 2 "" H 6100 4200 50 0000 C CNN 2063 | F 3 "" H 5900 4100 50 0000 C CNN 2064 | 1 5900 4100 2065 | 1 0 0 -1 2066 | $EndComp 2067 | Text Notes 16350 5900 0 50 ~ 0 2068 | L1 used, is a power factor correction coil from ATX power supply. 2069 | Text Notes 17650 11800 0 50 ~ 0 2070 | NOTE: Circuit power supplies are not drawn. 2071 | Text Notes 15350 7000 0 200 ~ 0 2072 | WARNING: High voltages present !\nUse an isolation transformer ! 2073 | $Comp 2074 | L Graphic:Logo_Open_Hardware_Small LOGO1 2075 | U 1 1 5EE1BCF2 2076 | P 22600 15100 2077 | F 0 "LOGO1" H 22600 15375 50 0001 C CNN 2078 | F 1 "Logo_Open_Hardware_Small" H 22600 14875 50 0001 C CNN 2079 | F 2 "" H 22600 15100 50 0001 C CNN 2080 | F 3 "~" H 22600 15100 50 0001 C CNN 2081 | 1 22600 15100 2082 | 1 0 0 -1 2083 | $EndComp 2084 | Wire Wire Line 2085 | 2000 3200 2500 3200 2086 | Text Label 2000 3200 0 50 ~ 0 2087 | H_BHI 2088 | Text Label 2000 4200 0 50 ~ 0 2089 | H_AHI 2090 | Wire Wire Line 2091 | 10500 12000 10700 12000 2092 | Text Label 10700 12000 0 50 ~ 0 2093 | H_AHI 2094 | Wire Wire Line 2095 | 10500 11100 10700 11100 2096 | Text Label 10700 11100 0 50 ~ 0 2097 | H_BHI 2098 | Connection ~ 7500 2000 2099 | Wire Wire Line 2100 | 7500 2000 10300 2000 2101 | Connection ~ 7500 4600 2102 | Wire Wire Line 2103 | 7500 4600 11500 4600 2104 | Connection ~ 7000 2000 2105 | Wire Wire Line 2106 | 7000 2000 7500 2000 2107 | Connection ~ 6500 2000 2108 | Wire Wire Line 2109 | 6500 2000 7000 2000 2110 | Wire Wire Line 2111 | 6000 2000 6500 2000 2112 | Connection ~ 6750 4600 2113 | Wire Wire Line 2114 | 6750 4600 7500 4600 2115 | Wire Wire Line 2116 | 6000 4600 6750 4600 2117 | $Comp 2118 | L openMicroInverter_dev-rescue:C-SmartInverter_proto-rescue C6 2119 | U 1 1 5EF760C1 2120 | P 9500 14850 2121 | F 0 "C6" H 9525 14950 50 0000 L CNN 2122 | F 1 "100n" H 9525 14750 50 0000 L CNN 2123 | F 2 "" H 9538 14700 50 0000 C CNN 2124 | F 3 "" H 9500 14850 50 0000 C CNN 2125 | 1 9500 14850 2126 | 1 0 0 -1 2127 | $EndComp 2128 | $Comp 2129 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR0101 2130 | U 1 1 5EF77AEF 2131 | P 9500 15150 2132 | F 0 "#PWR0101" H 9500 14900 50 0001 C CNN 2133 | F 1 "GND" H 9500 15000 50 0000 C CNN 2134 | F 2 "" H 9500 15150 50 0000 C CNN 2135 | F 3 "" H 9500 15150 50 0000 C CNN 2136 | 1 9500 15150 2137 | 1 0 0 -1 2138 | $EndComp 2139 | Wire Wire Line 2140 | 9500 15000 9500 15150 2141 | Wire Wire Line 2142 | 9500 14700 9500 14500 2143 | Wire Wire Line 2144 | 9500 14500 10000 14500 2145 | NoConn ~ 9100 11000 2146 | NoConn ~ 9100 11100 2147 | NoConn ~ 9100 11200 2148 | NoConn ~ 10500 10500 2149 | NoConn ~ 10500 10600 2150 | NoConn ~ 10500 10700 2151 | NoConn ~ 10500 11800 2152 | NoConn ~ 10500 11900 2153 | NoConn ~ 10500 12200 2154 | NoConn ~ 10500 12300 2155 | Wire Wire Line 2156 | 10500 10800 10700 10800 2157 | Text Label 10700 10800 0 50 ~ 0 2158 | GND 2159 | $Comp 2160 | L Device:R_POT_US RV1 2161 | U 1 1 5EE68759 2162 | P 8000 13000 2163 | F 0 "RV1" H 7932 13046 50 0000 R CNN 2164 | F 1 "10k" H 7932 12955 50 0000 R CNN 2165 | F 2 "" H 8000 13000 50 0001 C CNN 2166 | F 3 "~" H 8000 13000 50 0001 C CNN 2167 | 1 8000 13000 2168 | 1 0 0 -1 2169 | $EndComp 2170 | Wire Wire Line 2171 | 8500 12300 8500 13000 2172 | Wire Wire Line 2173 | 8500 13000 8150 13000 2174 | Wire Wire Line 2175 | 8500 12300 9100 12300 2176 | Wire Wire Line 2177 | 8000 13150 8000 13500 2178 | Wire Wire Line 2179 | 8000 12850 8000 12650 2180 | Wire Wire Line 2181 | 8000 12650 7750 12650 2182 | $Comp 2183 | L openMicroInverter_dev-rescue:GND-SmartInverter_proto-rescue #PWR? 2184 | U 1 1 5EF09665 2185 | P 8000 13500 2186 | F 0 "#PWR?" H 8000 13250 50 0001 C CNN 2187 | F 1 "GND" H 8000 13350 50 0000 C CNN 2188 | F 2 "" H 8000 13500 50 0000 C CNN 2189 | F 3 "" H 8000 13500 50 0000 C CNN 2190 | 1 8000 13500 2191 | 1 0 0 -1 2192 | $EndComp 2193 | Text Label 7750 12650 0 50 ~ 0 2194 | P5V0 2195 | Text Label 8500 12300 0 50 ~ 0 2196 | VPOT 2197 | Connection ~ 3850 11600 2198 | Wire Wire Line 2199 | 3850 11600 3850 12100 2200 | Connection ~ 5000 11600 2201 | Wire Wire Line 2202 | 5000 11600 5000 12200 2203 | Wire Wire Line 2204 | 3850 11300 3850 11600 2205 | Wire Wire Line 2206 | 5000 11300 5000 11600 2207 | Connection ~ 3850 14100 2208 | Wire Wire Line 2209 | 3850 14100 3850 14600 2210 | Connection ~ 5000 14100 2211 | Wire Wire Line 2212 | 5000 14100 5000 14700 2213 | Wire Wire Line 2214 | 3850 13800 3850 14100 2215 | Wire Wire Line 2216 | 5000 13800 5000 14100 2217 | Connection ~ 3850 9100 2218 | Wire Wire Line 2219 | 3850 9100 3850 9600 2220 | Connection ~ 5000 9100 2221 | Wire Wire Line 2222 | 5000 9100 5000 9700 2223 | Wire Wire Line 2224 | 3850 8800 3850 9100 2225 | Wire Wire Line 2226 | 5000 8800 5000 9100 2227 | Wire Wire Line 2228 | 3850 6000 3850 6900 2229 | Wire Wire Line 2230 | 5000 6000 5000 7000 2231 | Wire Wire Line 2232 | 3850 5700 3850 6000 2233 | Connection ~ 3850 6000 2234 | Wire Wire Line 2235 | 5000 5700 5000 6000 2236 | Connection ~ 5000 6000 2237 | Wire Wire Line 2238 | 4350 7400 4350 7500 2239 | Connection ~ 6000 6200 2240 | Wire Wire Line 2241 | 6000 6200 6350 6200 2242 | Wire Wire Line 2243 | 6000 3500 6000 3900 2244 | Wire Wire Line 2245 | 4300 4000 5000 4000 2246 | Wire Wire Line 2247 | 5000 4000 5000 4400 2248 | Wire Wire Line 2249 | 5000 4400 6750 4400 2250 | Wire Wire Line 2251 | 6750 4400 6750 3750 2252 | Wire Wire Line 2253 | 6750 3750 7500 3750 2254 | Connection ~ 4300 4000 2255 | Connection ~ 7500 3750 2256 | Wire Wire Line 2257 | 7500 3750 7500 3900 2258 | Wire Wire Line 2259 | 7500 3200 7500 3500 2260 | $EndSCHEMATC 2261 | -------------------------------------------------------------------------------- /KiCad/openMicroInverter_dev/sym-lib-table: -------------------------------------------------------------------------------- 1 | (sym_lib_table 2 | (lib (name openMicroInverter_dev-rescue)(type Legacy)(uri ${KIPRJMOD}/openMicroInverter_dev-rescue.lib)(options "")(descr "")) 3 | ) 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Martin Stokroos 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ![ Fig. 0.](figures/openmicroinverter-logo-small.png "oμiv logo") openMicroInverter ![ Fig. 1.](figures/oshw-logo-100-px.png "oshw logo") 2 | ### An open source hardware platform for experimenting with DC-to-AC conversion, power and energy metering and (possibly) grid tie inverters. 3 | 4 | ### What does the openMicroInverter? 5 | The *openMicroInverter*, or in short *oμiv*, is an **Arduino-UNO based** DC-to-AC power converter. The *oμiv* platform is meant for doing experiments with power electronics and energy systems. The *oμiv* is intended to be configurable as: 6 | 7 | 1. DC-to-AC power inverter for off the grid applications, 8 | 2. AC-power and energy metering device, 9 | 3. inverter which phase-locks to the grid, 10 | 4. uninterruptible power supply, 11 | 5. solar-inverter or inverter for energy storage systems or as 12 | 6. bi-directional power converter. 13 | 14 | Why then using the 8-bit Arduino-UNO? Just because it is fun to squeeze the most out of it:-) Furthermore, this project shows the full capabilities of the [TrueRMS](https://github.com/MartinStokroos/TrueRMS) Arduino library from one of my other repositories. Applications i, ii and iii have been successfully realized so far... 15 | 16 | This is work in progress... 17 | 18 | ### How does it work? 19 | The converter topology of the *oμiv* is a single-phase, single-step, transformer coupled power converter with a full-bridge inverter. This type of converter is not as efficient as the combination of a high frequency switching boost converter with DC-to-AC converter, but the *oμiv* is simple to build and it is relatively safe to operate. 20 | 21 | ### The Hardware 22 | There are two versions of the hardware. The first design is the development model and second design is the final design of the *oμiv* platform. The development model has been used for the development of the software. Please refer to the schematic diagrams to understand further explanation. 23 | 24 | **The openMicroInverter development hardware** 25 | A rapid prototype of the inverter was realized for doing software development. The schematic of the development model is named *openMicroInverter_dev.pdf*. 26 | A somewhat older H-bridge driver, the [HIP4082](/datasheets/hip4082.pdf), is used for the design. The HIP4082 is a medium voltage, medium frequency full-bridge driver, nowadays by *Renesas*. The driver has a build in turn-on delay to create dead time required for switching between the top and the bottom FET's. With this feature it is possible to drive the chip directly from the PWM generators of the ATmega328P (which are less sophisticated than the timers of STM32 micro-controllers...). 27 | 28 | Currently I am investigating to use the [Dual Channel H-bridge Motor Shield from Elecrow](https://www.elecrow.com/wiki/index.php?title=Dual_Channel_H-Bridge_Motor_Shield) to enable experimenting with the inverter without to overcome too many hurdles to set up the hardware. The high power DC-motor shield from Elecrow is a relatively new shield for *Arduino* including two 8A full H-bridges with discrete power MOSFET's. 29 | 30 | **The openMicroInverter hardware** 31 | The plan is to design a single PCB module for the *oμiv* and to use low-cost components. 32 | 33 | To be continued... 34 | 35 | ### Software Description 36 | Arduino-UNO Pin-out: 37 | 38 | Pin | In/Out | Function 39 | --- | ------ | -------- 40 | A0 | input | scaled ac mains voltage biased on 2.5V DC 41 | A1 | input | scaled ac inverter current biased on 2.5V DC 42 | A2 | input | scaled ac inverter voltage biased on 2.5V DC 43 | A3 | input | scaled battery current biased on 2.5V DC 44 | A4 | input | scaled battery voltage input 45 | A5 | input | optional analog input, currently used as potmeter control input 46 | D2 | output | islanding relay (future function) 47 | D3 | output | AHI control signal to HIP4082 H-bridge driver 48 | D4 | output | debug output pin 49 | D6 | input | external reference voltage input of the analog comparator (ZCD). 50 | D8 | output | inverter enable output (a high=ON) 51 | D9 | output | PWMB signal to HIP4082 H-bridge driver 52 | D10 | output | PWMA signal to HIP4082 H-bridge driver 53 | D7 | input | analog comparator input (AIN1) for zero-cross detection (ZCD) of the grid voltage. The analog comparator input is connected in parallel with A0. 54 | D11 | output | BHI control signal to HIP4082 H-bridge driver 55 | D13 | output | Arduino LED (future *PLL-locking* indicator) 56 | 57 | **The use of Timers** 58 | The standard Arduino library functions like *analogRead, analogWrite* and *digitalWrite* are very time consuming and can not be used with the *oμiv*. The software requirements are: 59 | 60 | * The PWM frequency to steer the H-bridge must be chosen as high as possible. 61 | * The ADC sampling frequency must be a multiple of 50Hz for stable RMS readings. 62 | * If possible, the ADC should be synchronized to the timer used for the PWM generation to force the sampling to happen inbetween the switching transients. 63 | * The PWM duty-cycle is limited by the hardware and can only be used up to about 90%. This is because of the charge pumps from the hi-side FET drivers of the HIP-4082 full-bridge driver. The dynamic range for control is limited in particular when using a 8-bit timer. 64 | * TIM0 should not be used, to keep the *Arduino* time and delay functions functional. It is still possible to use the time functions in the program main loop. 65 | 66 | Different schemes are are now being investigated to fit it all inside the Arduino and are:: 67 | 68 | Scheme | Description | Remarks 69 | ------ | ----------- | ------- 70 | *scheme-1* | TIM1 generates a PWM-frequency of 16MHz/512/4 = 7812.5Hz (128μs). The 50Hz reference waveform is generated by the DDS algorithm inside the TIM1 ISR. Each TIM1 interrupt the PWM is updated. The ADC-start is triggered by TIM1 and stays synced with TIM1. Six ADC-channels are time-multiplexed. A complete sequence of six channels takes 768us. The closesed whole number of samples that does fit in a 20ms mains cycle is 26.041. This causes a small ripple in the RMS readings. | With scheme, 1 the remaining available processing time in the TIM1 ISR is not enough for implementing power measurements. 71 | *scheme-2* | TIM1 generates a PWM-frequency of 16MHz/(2*1333) = 6000Hz (166.67us). The TIM1 ISR function is empty and only needed to trigger the ADC. All DSP work is done inside the ADC ISR. The 50Hz reference waveform is generated by a DDS algorithm. Each ADC interrupt the PWM is updated and a single analog to digital conversion is processed. Six ADC-channels are time multiplexed. A complete sequence of six channels takes 1ms. Exactly 20 samples do fit in one mains cycle of 20ms. | So far the best scheme. Switching frequency is rather low and the duty-cycle ranges from about 12% to 88%. This is a little too limited and more than needed to keep the HIP-4082 hi-side chargepumps running... 72 | *scheme-3* | TIM1 running at 6kHz triggers the ADC. The PWM is generated with TIM2 at the highest possible frequency. The PWM is not synchronized with the sampling proces and the wave amplitude resolution is only 8-bits. | To be confirmed... 73 | *scheme-4* | ADC is free running and the PWM is generated by TIM1 or TIM2 for respectively 10- or 8-bit amplitude resolution in the output wave. The ADC frequency can not be a multiple of 50Hz and a ripple occurs in the RMS readings. | Scheme 4 doesn´t work. There is too much jitter in the sampling frequency when the ADC is in free running mode to be useful. 74 | 75 | **Clocking scheme** 76 | The implementation for the clocking scheme 2 as selected above, is shown in the following figure: 77 | 78 | ![ Fig. 3.](figures/clocking_scheme_2.png "oμiv clocking scheme") 79 | 80 | In this scheme, the zero crossing detector is no longer needed. The phase is detected by using quadrature sampling of the input signal and a CORDIC algorithm for calculating the phase angle relative to the ADC sampling clock. Both, the phase of the grid voltage and the phase of the DDS reference wave (switch to A), or the measured phase of the inverter output voltage (switch to B) are detected. 81 | Example sketch *Inverter2.ino* is with the switch to position A sketch *Inverter3.ino* is with the switch to position B. 82 | The phase offset makes no sense in closed loop with the switch set to position B because the loop compensates for phase offsets. This simplifies the signal generator. The clocking scheme simplifies to the diagram shown below. 83 | The idea behind the structure of Inverter2 might be interesting for future applications. For now the development continues with Inverter3... 84 | 85 | ![ Fig. 4.](figures/clocking_scheme_2a.png "alternative oμiv clocking scheme") 86 | 87 | **H-bridge switching mode** 88 | The following switching schemes have been implemented: 89 | 90 | * unipolar switching 91 | * bi-polar switching 92 | * hybrid switching 93 | 94 | **The *PowerSys* Library** 95 | Refer to the readme file of the [PowerSys](/libraries/PowerSys/README.md) Library. 96 | 97 | **The project's to do list** 98 | 1. evaluating the ACS712 series current sensors 99 | 2. optimizing the hybrid switching mode 100 | 3. increasing the effective duty-cycle range to 98% in hybrid-mode by using the AHI and BHI control signals to the HIP-4082 (or Elecrow motor shield) 101 | 4. implementing amplitude control in inverter mode 102 | 5. Now the inverter synchronizes to the grid but can not operate grid-connected since there is no output current control yet (It was tested only in a very controlled experimental setting) 103 | 6. Supply documentation and examples with the *PowerSys* library 104 | 7. Final *oμiv* hardware design and PCB lay-out. 105 | 106 | ### Example Sketches 107 | - ZeroCrossingDetector.ino 108 | This example demonstrates Zero Crossing Detection (ZCD) with the analog comparator of the ATMEGA328. The comparator interrupts on output toggle. The sign of the sine wave is determined from the ADC input. The output of the ZCD only toggles from high to low when the sign of the AC input is positive and vice verse. 109 | 110 | ![ Fig. 5.](figures/SCR_comparator.GIF "ZCD in- and output signals") 111 | 112 | ------ 113 | 114 | - Inverter1.ino 115 | Sketch to evaluate the different ways of gating the H-bridge to generate a sine wave output. This sketch works on the *openMicroInverter_dev* hardware. The inverter works in voltage-mode without output voltage control (open loop). The timing is according to *scheme-2*, which gives stable readings of the measurements but the switching frequency is on the low side and the duty-cycle range is limited between 12% and 88%. Unipolar switching runs the most smoothly. 116 | 117 | ------ 118 | 119 | - Inverter1b.ino 120 | This sketch is the same as for example *Inverter1.ino* but it was modified for use with Elecrow's Dual Channel H-bridge Motor Shield. The picture shows the sandwich from the bottom to the top of the Arduino UNO, the Elecrow H-bridge Motor Shield and the prototype shield for the analog readings. The lamp at the right side forms the small ballast of the inverter. 121 | 122 | ![ Fig. 6.](figures/oui_with_elecrow_H-bridge_shield.jpg "Using the Elecrow H-bridge shield") 123 | 124 | Connecting the transformer: Both legs of each H-bridge are in-phase, simultaneously switching. Tie M1_A and M1_B together and also tie M2_A and M2_B together. Connect the low voltage winding of the transformer between M1_A (M1_B) and M2_A (M2_B) or with double low voltage windings; connect the low voltage winding-1 between M1_A, M2_A and low voltage winding-2 between M1_B and M2_B. Check the phase of the windings first! 125 | 126 | Conclusions: 127 | 128 | - The voltage rating of the power MOSFET's from the Elecrow motor shield is 55V. This is rather low to have a save margin. 129 | - There should be a large capacitor (e.g. 1000μF or more) at the (motor) supply input of the motor shield. Cable inductance can cause high voltage spikes at the supply terminals which could damage the MOSFET's. 130 | - I expected lower losses from the IRF3205S MOSFET's with an rds_on of 8mOhm. Probably the switching losses are quite high because of the high value gate resistors (51 Ohm). The switching takes 200-300ns. The gate voltage might be increased to 15V. 131 | - The motor shield works for demonstration purpose, but the board needs modifications to be useful with power converters. 132 | 133 | ------ 134 | 135 | - Inverter2.ino 136 | This sketch synchronizes the internal reference generator to the grid voltage. The DDS (inverter) output wave phase offset can be controlled with a potmeter connected with input A5 (see schematic *openMicroInverter_dev.pdf* on how to connect the potentiometer) 137 | The plot below shows the grid phase and the inverter phase (arbitrary units) when locked. In the locked state the Arduino LED will turn on. 138 | If both lines run perfectly horizontal then the ADC sampling frequency is an exact multiple of 120 times the grid frequency. The grid frequency normally drifts around 50Hz and the *Arduino* crystal oscillator frequency drifts because of temperature effects and aging. The lines are usually not running horizontal, which is normal. 139 | 140 | ![ Fig. 6.](figures/Screenshot_2020-10-30_15-05-11.png "Phase comparison") 141 | 142 | ------ 143 | 144 | - Inverter3.ino 145 | This sketch synchronizes the measured inverter output voltage to the grid voltage. The plot below shows the phase locking when the grid connection is turned on around time stamp 1140. 146 | 147 | ![ Fig. 7.](figures/Screenshot_2020-10-30_17-32-35.png "Phase comparison") 148 | 149 | ------ 150 | 151 | - Metering.ino 152 | This sketch is a power meter and energy metering example that works for the *openMicroInverter_dev* hardware. 153 | This sketch uses a time base on interrupt basis and uses an ADC multiplexer running at 6kHz (120*50Hz). Each ADC-channel samples at 1kHz. This example is without inverter drive (H-bridge + transformer and output filter). Re-wire the circuit such that A0 and A2 measure the AC-voltage and A1 the load current. The power is calculated from inputs A1 and A2. 154 | 155 | ### Acknowledgements 156 | A lot of time was saved in development time by using the alternative Arduino-IDE *Sloeber*. Sloeber is a wonderful Arduino plugin for Eclipse. 157 | -------------------------------------------------------------------------------- /datasheets/58011.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/datasheets/58011.pdf -------------------------------------------------------------------------------- /datasheets/LEM_LA55-P.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/datasheets/LEM_LA55-P.pdf -------------------------------------------------------------------------------- /datasheets/LEM_LV25-P.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/datasheets/LEM_LV25-P.pdf -------------------------------------------------------------------------------- /datasheets/hip4082.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/datasheets/hip4082.pdf -------------------------------------------------------------------------------- /extra/sample-rate_selector.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/extra/sample-rate_selector.ods -------------------------------------------------------------------------------- /extra/samplerate.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/extra/samplerate.ods -------------------------------------------------------------------------------- /figures/SCR_comparator.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/SCR_comparator.GIF -------------------------------------------------------------------------------- /figures/Screenshot_2020-10-30_15-05-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/Screenshot_2020-10-30_15-05-11.png -------------------------------------------------------------------------------- /figures/Screenshot_2020-10-30_17-32-35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/Screenshot_2020-10-30_17-32-35.png -------------------------------------------------------------------------------- /figures/clocking_scheme_1.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/clocking_scheme_1.odg -------------------------------------------------------------------------------- /figures/clocking_scheme_2.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/clocking_scheme_2.odg -------------------------------------------------------------------------------- /figures/clocking_scheme_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/clocking_scheme_2.png -------------------------------------------------------------------------------- /figures/clocking_scheme_2a.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/clocking_scheme_2a.odg -------------------------------------------------------------------------------- /figures/clocking_scheme_2a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/clocking_scheme_2a.png -------------------------------------------------------------------------------- /figures/openmicroinverter-logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/openmicroinverter-logo-small.png -------------------------------------------------------------------------------- /figures/openmicroinverter-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/openmicroinverter-logo.png -------------------------------------------------------------------------------- /figures/oshw-logo-100-px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/oshw-logo-100-px.png -------------------------------------------------------------------------------- /figures/oui_with_elecrow_H-bridge_shield.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/figures/oui_with_elecrow_H-bridge_shield.jpg -------------------------------------------------------------------------------- /libraries/PowerSys/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Martin Stokroos 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /libraries/PowerSys/README.md: -------------------------------------------------------------------------------- 1 | # PowerSys Library 2 | This library contains modules used to control power converter. One of the basic functions of the library is generating the reference waveform. The generator is based on Direct Digital Synthesis and has special features to keep it in sync with the grid voltage. 3 | 4 | Library is under construction... 5 | 6 | # 7 | 8 | Testing the software with input signals generated with the Digilent *Analog Discovery*. The two-channel function generator of the *Analog Discovery* is very handy when simulating phase shifts between voltage and current input signals. 9 | 10 | ![Analog Discovery](figures/AnalogDiscovery.jpg "Testing with the Analog Discovery.") 11 | -------------------------------------------------------------------------------- /libraries/PowerSys/figures/AnalogDiscovery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/libraries/PowerSys/figures/AnalogDiscovery.jpg -------------------------------------------------------------------------------- /libraries/PowerSys/figures/DDS_structure.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/libraries/PowerSys/figures/DDS_structure.odg -------------------------------------------------------------------------------- /libraries/PowerSys/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax coloring map for PowerSystems lib 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | PowerControl KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | osgBegin KEYWORD2 16 | osgUpdate1 KEYWORD2 17 | osgMaSlUpdate1 KEYWORD2 18 | osgMaSlUpdate2 KEYWORD2 19 | osgMaSlUpdate3 KEYWORD2 20 | osgMaSlUpdate4 KEYWORD2 21 | osgMaSlUpdate5 KEYWORD2 22 | park KEYWORD2 23 | ipark KEYWORD2 24 | 25 | ####################################### 26 | # Constants (LITERAL1) 27 | ####################################### 28 | 29 | -------------------------------------------------------------------------------- /libraries/PowerSys/library.properties: -------------------------------------------------------------------------------- 1 | name=PowerSys 2 | version=1.1.1 3 | author=Martin Stokroos 4 | maintainer=Martin Stokroos 5 | sentence=Power Systems Library 6 | paragraph= 7 | category=Device Control 8 | url=https://github.com/MartinStokroos/openMicroInverter/libraries/PowerSys 9 | architectures=avr 10 | -------------------------------------------------------------------------------- /libraries/PowerSys/src/PowerSys.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * File: PowerSys.cpp 4 | * Purpose: 5 | * Version: 1.1.1 6 | * Initial release date: 17-10-2019 7 | * Date: 01-12-2020 8 | * URL: https://github.com/MartinStokroos/openMicroInverter 9 | * License: MIT License 10 | * 11 | * 12 | * Copyright (c) M.Stokroos 2019 13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 15 | * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, 16 | * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 17 | * Software is furnished to do so, subject to the following conditions: 18 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 21 | * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 22 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | */ 26 | 27 | #include "PowerSys.h" 28 | 29 | #if defined(ARDUINO) && ARDUINO >= 100 30 | #include "Arduino.h" 31 | #else 32 | #include "WProgram.h" 33 | #endif 34 | 35 | 36 | 37 | /* 38 | * Orthogonal Signal Generator (OSG) initialize 39 | * 40 | * 41 | * 42 | */ 43 | void PowerControl::osgBegin(float _freq, float _deltat) { 44 | // calculate DDS tuning word 45 | tuningWord=(unsigned long)(pow(2,32) * _freq * _deltat); 46 | } 47 | 48 | 49 | 50 | /* 51 | * Orthogonal Signal Generators (OSG) 52 | * 53 | * 54 | */ 55 | // FULL WAVE LUT, 10-bit OSG with raised (>=0) sin and cos outputs and cumulative phase increment. 56 | void PowerControl::osgUpdate1(unsigned long _phaseInc) { 57 | phaseAccu1 += (tuningWord + _phaseInc); 58 | rsin = pgm_read_word(fullwave_lut1024 + (unsigned int)(phaseAccu1>>22)); // reference sine output 59 | rcos = pgm_read_word(fullwave_lut1024 + (unsigned int)((phaseAccu1 + PHASE_OFFS_270)>>22)); // reference cosine output 60 | } 61 | 62 | // To do: also do for all simple OSG's 63 | 64 | 65 | 66 | 67 | 68 | /* 69 | * Orthogonal Signal Generators (OSG) of Master-Slave type with cumulative phase increment and phase offset. 70 | * 71 | * 72 | */ 73 | // FULL WAVE LUT, 10-bit Master-Slave OSG with raised (>=0) sin and cos outputs. 74 | void PowerControl::osgMaSlUpdate1(unsigned long _phaseInc, unsigned long _phaseOffset) { 75 | phaseAccu1 += (tuningWord + _phaseInc); 76 | phaseAccu2 = (phaseAccu1 + _phaseOffset); 77 | rfbk = pgm_read_word(fullwave_lut1024 + (unsigned int)(phaseAccu1>>22)) - 0x1FF; // PLL feedback output (signed) 78 | rsin = pgm_read_word(fullwave_lut1024 + (unsigned int)(phaseAccu2>>22)); // reference sine output 79 | rcos = pgm_read_word(fullwave_lut1024 + (unsigned int)((phaseAccu2 + PHASE_OFFS_270)>>22)); // reference cosine output 80 | } 81 | 82 | // FULL WAVE LUT, 10-bit Master-Slave OSG. rsin and rcos are signed (for use with Park transforms) 83 | void PowerControl::osgMaSlUpdate2(unsigned long _phaseInc, unsigned long _phaseOffset) { 84 | phaseAccu1 += (tuningWord + _phaseInc); 85 | phaseAccu2 = (phaseAccu1 + _phaseOffset); 86 | rfbk = pgm_read_word(fullwave_lut1024 + (unsigned int)(phaseAccu1>>22)) - 0x1FF; // PLL feedback output 87 | rsin = pgm_read_word(fullwave_lut1024 + (unsigned int)(phaseAccu2>>22)) - 0x1FF; // reference sine output 88 | rcos = pgm_read_word(fullwave_lut1024 + (unsigned int)((phaseAccu2 + PHASE_OFFS_270)>>22))-0x1FF; // reference cosine output 89 | } 90 | 91 | // HALF WAVE LUT, 11-bit Master-Slave OSG. rsin and rcos are signed (for use with Park transforms) 92 | void PowerControl::osgMaSlUpdate3(unsigned long _phaseInc, unsigned long _phaseOffset) { 93 | phaseAccu1 += (tuningWord + _phaseInc); 94 | phaseAccu2 = (phaseAccu1 + _phaseOffset); 95 | phaseIdx1 = phaseAccu1>>21; 96 | phaseIdx2 = phaseAccu2>>21; 97 | phaseIdx3 = (phaseAccu2 + PHASE_OFFS_270)>>21; 98 | 99 | if(phaseIdx1>=0 && phaseIdx1<1024) //to do: use 32 bit phase limits 100 | { 101 | rfbk = pgm_read_word(quarterwave_lut1024 + phaseIdx1); 102 | } 103 | else if(phaseIdx1>=1024 && phaseIdx1<2048) 104 | { 105 | rfbk = -pgm_read_word(quarterwave_lut1024 + (2048 - phaseIdx1)); 106 | } 107 | rfbk = rfbk>>1; // 10-bit test output 108 | 109 | if(phaseIdx2>=0 && phaseIdx2<1024) 110 | { 111 | rsin = pgm_read_word(quarterwave_lut1024 + phaseIdx2); 112 | } 113 | else if(phaseIdx2>=1024 && phaseIdx2<2048) 114 | { 115 | rsin = -pgm_read_word(quarterwave_lut1024 + (2048 - phaseIdx2)); 116 | } 117 | rsin = rsin>>1; // 10-bit test output 118 | 119 | if(phaseIdx3>=0 && phaseIdx3<1024) 120 | { 121 | rcos = pgm_read_word(quarterwave_lut1024 + phaseIdx3); 122 | } 123 | else if(phaseIdx3>=1024 && phaseIdx3<2048) 124 | { 125 | rcos = -pgm_read_word(quarterwave_lut1024 + (2048 - phaseIdx3)); 126 | } 127 | rcos = rcos>>1; // 10-bit test output 128 | } 129 | 130 | 131 | // HALF WAVE LUT, 11-bit Master-Slave OSG. rsin and rcos are unsigned (rectified wave) 132 | void PowerControl::osgMaSlUpdate4(unsigned long _phaseInc, unsigned long _phaseOffset) { 133 | phaseAccu1 += (tuningWord + _phaseInc); 134 | phaseAccu2 = (phaseAccu1 + _phaseOffset); 135 | phaseIdx1 = phaseAccu1>>21; 136 | phaseIdx2 = phaseAccu2>>21; 137 | phaseIdx3 = (phaseAccu2 + PHASE_OFFS_270)>>21; 138 | 139 | if(phaseIdx1>=0 && phaseIdx1<1024) 140 | { 141 | rfbk = pgm_read_word(quarterwave_lut1024 + phaseIdx1); 142 | } 143 | else if(phaseIdx1>=1024 && phaseIdx1<2048) 144 | { 145 | rfbk = -pgm_read_word(quarterwave_lut1024 + (2048 - phaseIdx1)); 146 | } 147 | rfbk = rfbk>>1; // 10-bit test output 148 | 149 | if(phaseIdx2>=0 && phaseIdx2<1024) 150 | { 151 | rsin = pgm_read_word(quarterwave_lut1024 + phaseIdx2); 152 | } 153 | else if(phaseIdx2>=1024 && phaseIdx2<2048) 154 | { 155 | rsin = pgm_read_word(quarterwave_lut1024 + (2048 - phaseIdx2)); 156 | } 157 | rsin = rsin>>1; // 10-bit test output 158 | 159 | if(phaseIdx3>=0 && phaseIdx3<1024) 160 | { 161 | rcos = pgm_read_word(quarterwave_lut1024 + phaseIdx3); 162 | } 163 | else if(phaseIdx3>=1024 && phaseIdx3<2048) 164 | { 165 | rcos = pgm_read_word(quarterwave_lut1024 + (2048 - phaseIdx3)); 166 | } 167 | rcos = rcos>>1; // 10-bit test output 168 | } 169 | 170 | 171 | 172 | // QUARTER WAVE LUT, 12-bit Master-Slave OSG. rsin and rcos are signed (for use with Park transforms) 173 | void PowerControl::osgMaSlUpdate5(unsigned long _phaseInc, unsigned long _phaseOffset) { 174 | phaseAccu1 += (tuningWord + _phaseInc); 175 | phaseAccu2 = (phaseAccu1 + _phaseOffset); 176 | phaseIdx1 = phaseAccu1>>20; 177 | phaseIdx2 = phaseAccu2>>20; 178 | phaseIdx3 = (phaseAccu2 + PHASE_OFFS_270)>>20; 179 | 180 | if(phaseIdx1>=0 && phaseIdx1<1024) 181 | { 182 | rfbk = pgm_read_word(quarterwave_lut1024 + phaseIdx1); 183 | } 184 | else if(phaseIdx1>=1024 && phaseIdx1<2048) 185 | { 186 | rfbk = -pgm_read_word(quarterwave_lut1024 + (2048 - phaseIdx1)); 187 | } 188 | else if(phaseIdx1>=2048 && phaseIdx1<3072) 189 | { 190 | rfbk = -pgm_read_word(quarterwave_lut1024 + (phaseIdx1 - 2048)); 191 | } 192 | else if(phaseIdx1>=3072 && phaseIdx1<4096) 193 | { 194 | rfbk = pgm_read_word(quarterwave_lut1024 + (4096 - phaseIdx1)); 195 | } 196 | rfbk -= 0x3FF; // PLL feedback output 197 | rfbk = rfbk>>2; // 10-bit test output 198 | 199 | if(phaseIdx2>=0 && phaseIdx2<1024) 200 | { 201 | rsin = pgm_read_word(quarterwave_lut1024 + phaseIdx2); 202 | } 203 | else if(phaseIdx2>=1024 && phaseIdx2<2048) 204 | { 205 | rsin = -pgm_read_word(quarterwave_lut1024 + (2048 - phaseIdx2)); 206 | } 207 | else if(phaseIdx2>=2048 && phaseIdx2<3072) 208 | { 209 | rsin = -pgm_read_word(quarterwave_lut1024 + (phaseIdx2 - 2048)); 210 | } 211 | else if(phaseIdx2>=3072 && phaseIdx2<4096) 212 | { 213 | rsin = pgm_read_word(quarterwave_lut1024 + (4096 - phaseIdx2)); 214 | } 215 | rsin -= 0x3FF; 216 | rsin = rsin>>2; // 10-bit test output 217 | 218 | if(phaseIdx3>=0 && phaseIdx3<1024) 219 | { 220 | rcos = pgm_read_word(quarterwave_lut1024 + phaseIdx3); 221 | } 222 | else if(phaseIdx3>=1024 && phaseIdx3<2048) 223 | { 224 | rcos = -pgm_read_word(quarterwave_lut1024 + (2048 - phaseIdx3)); 225 | } 226 | else if(phaseIdx3>=2048 && phaseIdx3<3072) 227 | { 228 | rcos = -pgm_read_word(quarterwave_lut1024 + (phaseIdx3 - 2048)); 229 | } 230 | else if(phaseIdx3>=3072 && phaseIdx3<4096) 231 | { 232 | rcos = pgm_read_word(quarterwave_lut1024 + (4096 - phaseIdx3)); 233 | } 234 | rcos -= 0x3FF; 235 | rcos = rcos>>2; // 10-bit test output 236 | } 237 | 238 | 239 | 240 | 241 | /* 242 | * Park transform 243 | * 244 | */ 245 | void PowerControl::park(long _alpha, long _beta) { 246 | alpha = _alpha; 247 | beta = _beta; 248 | d = alpha*rcos + beta*rsin; 249 | q = beta*rcos - alpha*rsin; 250 | } 251 | 252 | 253 | 254 | /* 255 | * Inverse Park transform 256 | * 257 | */ 258 | void PowerControl::ipark(long _d, long _q) { 259 | d=_d; 260 | q=_q; 261 | alpha = d*rcos - q*rsin; 262 | beta = d*rsin + q*rcos; 263 | } 264 | -------------------------------------------------------------------------------- /libraries/PowerSys/src/PowerSys.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * File: PowerSys.h 4 | * Purpose: 5 | * Version: 1.1.1 6 | * Initial release date: 17-10-2019 7 | * Date: 01-12-2020 8 | * URL: https://github.com/MartinStokroos/PowerSys 9 | * License: MIT License 10 | * 11 | * 12 | * Copyright (c) M.Stokroos 2019 13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 15 | * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, 16 | * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 17 | * Software is furnished to do so, subject to the following conditions: 18 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 21 | * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 22 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 23 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | */ 26 | 27 | #ifndef PowerSys_H_ 28 | #define PowerSys_H_ 29 | 30 | #include "Arduino.h" 31 | #include "avr/pgmspace.h" 32 | 33 | #define PHASE_OFFS_90 1073741824UL 34 | #define PHASE_OFFS_120 1431655765UL 35 | #define PHASE_OFFS_240 2863311531UL 36 | #define PHASE_OFFS_270 3221225472UL 37 | 38 | // 2pi sin LUT 39 | const int fullwave_lut1024[] PROGMEM = { 40 | 511, 514, 517, 520, 524, 527, 530, 533, 41 | 536, 539, 542, 545, 549, 552, 555, 558, 42 | 561, 564, 567, 570, 574, 577, 580, 583, 43 | 586, 589, 592, 595, 598, 601, 605, 608, 44 | 611, 614, 617, 620, 623, 626, 629, 632, 45 | 635, 638, 641, 644, 647, 650, 653, 656, 46 | 659, 662, 665, 668, 671, 674, 677, 680, 47 | 683, 686, 689, 692, 695, 698, 701, 704, 48 | 707, 709, 712, 715, 718, 721, 724, 727, 49 | 729, 732, 735, 738, 741, 744, 746, 749, 50 | 752, 755, 757, 760, 763, 766, 768, 771, 51 | 774, 776, 779, 782, 784, 787, 790, 792, 52 | 795, 797, 800, 803, 805, 808, 810, 813, 53 | 815, 818, 820, 823, 825, 828, 830, 833, 54 | 835, 838, 840, 842, 845, 847, 849, 852, 55 | 854, 856, 859, 861, 863, 866, 868, 870, 56 | 872, 875, 877, 879, 881, 883, 885, 888, 57 | 890, 892, 894, 896, 898, 900, 902, 904, 58 | 906, 908, 910, 912, 914, 916, 918, 920, 59 | 921, 923, 925, 927, 929, 931, 932, 934, 60 | 936, 938, 939, 941, 943, 944, 946, 948, 61 | 949, 951, 952, 954, 956, 957, 959, 960, 62 | 962, 963, 965, 966, 967, 969, 970, 972, 63 | 973, 974, 976, 977, 978, 979, 981, 982, 64 | 983, 984, 985, 987, 988, 989, 990, 991, 65 | 992, 993, 994, 995, 996, 997, 998, 999, 66 | 1000, 1001, 1002, 1003, 1003, 1004, 1005, 1006, 67 | 1007, 1007, 1008, 1009, 1010, 1010, 1011, 1012, 68 | 1012, 1013, 1013, 1014, 1014, 1015, 1016, 1016, 69 | 1016, 1017, 1017, 1018, 1018, 1019, 1019, 1019, 70 | 1020, 1020, 1020, 1020, 1021, 1021, 1021, 1021, 71 | 1021, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 72 | 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 73 | 1021, 1021, 1021, 1021, 1021, 1020, 1020, 1020, 74 | 1020, 1019, 1019, 1019, 1018, 1018, 1017, 1017, 75 | 1016, 1016, 1016, 1015, 1014, 1014, 1013, 1013, 76 | 1012, 1012, 1011, 1010, 1010, 1009, 1008, 1007, 77 | 1007, 1006, 1005, 1004, 1003, 1003, 1002, 1001, 78 | 1000, 999, 998, 997, 996, 995, 994, 993, 79 | 992, 991, 990, 989, 988, 987, 985, 984, 80 | 983, 982, 981, 979, 978, 977, 976, 974, 81 | 973, 972, 970, 969, 967, 966, 965, 963, 82 | 962, 960, 959, 957, 956, 954, 952, 951, 83 | 949, 948, 946, 944, 943, 941, 939, 938, 84 | 936, 934, 932, 931, 929, 927, 925, 923, 85 | 921, 920, 918, 916, 914, 912, 910, 908, 86 | 906, 904, 902, 900, 898, 896, 894, 892, 87 | 890, 888, 885, 883, 881, 879, 877, 875, 88 | 872, 870, 868, 866, 863, 861, 859, 856, 89 | 854, 852, 849, 847, 845, 842, 840, 838, 90 | 835, 833, 830, 828, 825, 823, 820, 818, 91 | 815, 813, 810, 808, 805, 803, 800, 797, 92 | 795, 792, 790, 787, 784, 782, 779, 776, 93 | 774, 771, 768, 766, 763, 760, 757, 755, 94 | 752, 749, 746, 744, 741, 738, 735, 732, 95 | 729, 727, 724, 721, 718, 715, 712, 709, 96 | 707, 704, 701, 698, 695, 692, 689, 686, 97 | 683, 680, 677, 674, 671, 668, 665, 662, 98 | 659, 656, 653, 650, 647, 644, 641, 638, 99 | 635, 632, 629, 626, 623, 620, 617, 614, 100 | 611, 608, 605, 601, 598, 595, 592, 589, 101 | 586, 583, 580, 577, 574, 570, 567, 564, 102 | 561, 558, 555, 552, 549, 545, 542, 539, 103 | 536, 533, 530, 527, 524, 520, 517, 514, 104 | 511, 508, 505, 502, 498, 495, 492, 489, 105 | 486, 483, 480, 477, 473, 470, 467, 464, 106 | 461, 458, 455, 452, 448, 445, 442, 439, 107 | 436, 433, 430, 427, 424, 421, 417, 414, 108 | 411, 408, 405, 402, 399, 396, 393, 390, 109 | 387, 384, 381, 378, 375, 372, 369, 366, 110 | 363, 360, 357, 354, 351, 348, 345, 342, 111 | 339, 336, 333, 330, 327, 324, 321, 318, 112 | 315, 313, 310, 307, 304, 301, 298, 295, 113 | 293, 290, 287, 284, 281, 278, 276, 273, 114 | 270, 267, 265, 262, 259, 256, 254, 251, 115 | 248, 246, 243, 240, 238, 235, 232, 230, 116 | 227, 225, 222, 219, 217, 214, 212, 209, 117 | 207, 204, 202, 199, 197, 194, 192, 189, 118 | 187, 184, 182, 180, 177, 175, 173, 170, 119 | 168, 166, 163, 161, 159, 156, 154, 152, 120 | 150, 147, 145, 143, 141, 139, 137, 134, 121 | 132, 130, 128, 126, 124, 122, 120, 118, 122 | 116, 114, 112, 110, 108, 106, 104, 102, 123 | 101, 99, 97, 95, 93, 91, 90, 88, 124 | 86, 84, 83, 81, 79, 78, 76, 74, 125 | 73, 71, 70, 68, 66, 65, 63, 62, 126 | 60, 59, 57, 56, 55, 53, 52, 50, 127 | 49, 48, 46, 45, 44, 43, 41, 40, 128 | 39, 38, 37, 35, 34, 33, 32, 31, 129 | 30, 29, 28, 27, 26, 25, 24, 23, 130 | 22, 21, 20, 19, 19, 18, 17, 16, 131 | 15, 15, 14, 13, 12, 12, 11, 10, 132 | 10, 9, 9, 8, 8, 7, 6, 6, 133 | 6, 5, 5, 4, 4, 3, 3, 3, 134 | 2, 2, 2, 2, 1, 1, 1, 1, 135 | 1, 0, 0, 0, 0, 0, 0, 0, 136 | 0, 0, 0, 0, 0, 0, 0, 0, 137 | 1, 1, 1, 1, 1, 2, 2, 2, 138 | 2, 3, 3, 3, 4, 4, 5, 5, 139 | 6, 6, 6, 7, 8, 8, 9, 9, 140 | 10, 10, 11, 12, 12, 13, 14, 15, 141 | 15, 16, 17, 18, 19, 19, 20, 21, 142 | 22, 23, 24, 25, 26, 27, 28, 29, 143 | 30, 31, 32, 33, 34, 35, 37, 38, 144 | 39, 40, 41, 43, 44, 45, 46, 48, 145 | 49, 50, 52, 53, 55, 56, 57, 59, 146 | 60, 62, 63, 65, 66, 68, 70, 71, 147 | 73, 74, 76, 78, 79, 81, 83, 84, 148 | 86, 88, 90, 91, 93, 95, 97, 99, 149 | 101, 102, 104, 106, 108, 110, 112, 114, 150 | 116, 118, 120, 122, 124, 126, 128, 130, 151 | 132, 134, 137, 139, 141, 143, 145, 147, 152 | 150, 152, 154, 156, 159, 161, 163, 166, 153 | 168, 170, 173, 175, 177, 180, 182, 184, 154 | 187, 189, 192, 194, 197, 199, 202, 204, 155 | 207, 209, 212, 214, 217, 219, 222, 225, 156 | 227, 230, 232, 235, 238, 240, 243, 246, 157 | 248, 251, 254, 256, 259, 262, 265, 267, 158 | 270, 273, 276, 278, 281, 284, 287, 290, 159 | 293, 295, 298, 301, 304, 307, 310, 313, 160 | 315, 318, 321, 324, 327, 330, 333, 336, 161 | 339, 342, 345, 348, 351, 354, 357, 360, 162 | 363, 366, 369, 372, 375, 378, 381, 384, 163 | 387, 390, 393, 396, 399, 402, 405, 408, 164 | 411, 414, 417, 421, 424, 427, 430, 433, 165 | 436, 439, 442, 445, 448, 452, 455, 458, 166 | 461, 464, 467, 470, 473, 477, 480, 483, 167 | 486, 489, 492, 495, 498, 502, 505, 508 168 | }; 169 | 170 | 171 | 172 | // pi sin LUT 173 | const int halfwave_lut1024[] PROGMEM = { 174 | 0, 2, 3, 5, 6, 8, 9, 11, 175 | 13, 14, 16, 17, 19, 20, 22, 24, 176 | 25, 27, 28, 30, 31, 33, 34, 36, 177 | 38, 39, 41, 42, 44, 45, 47, 49, 178 | 50, 52, 53, 55, 56, 58, 59, 61, 179 | 63, 64, 66, 67, 69, 70, 72, 73, 180 | 75, 77, 78, 80, 81, 83, 84, 86, 181 | 87, 89, 90, 92, 94, 95, 97, 98, 182 | 100, 101, 103, 104, 106, 107, 109, 110, 183 | 112, 113, 115, 117, 118, 120, 121, 123, 184 | 124, 126, 127, 129, 130, 132, 133, 135, 185 | 136, 138, 139, 141, 142, 144, 145, 147, 186 | 148, 150, 151, 153, 154, 156, 157, 159, 187 | 160, 162, 163, 165, 166, 168, 169, 171, 188 | 172, 174, 175, 177, 178, 180, 181, 182, 189 | 184, 185, 187, 188, 190, 191, 193, 194, 190 | 196, 197, 198, 200, 201, 203, 204, 206, 191 | 207, 209, 210, 211, 213, 214, 216, 217, 192 | 218, 220, 221, 223, 224, 226, 227, 228, 193 | 230, 231, 233, 234, 235, 237, 238, 239, 194 | 241, 242, 244, 245, 246, 248, 249, 251, 195 | 252, 253, 255, 256, 257, 259, 260, 261, 196 | 263, 264, 265, 267, 268, 269, 271, 272, 197 | 273, 275, 276, 277, 279, 280, 281, 283, 198 | 284, 285, 286, 288, 289, 290, 292, 293, 199 | 294, 296, 297, 298, 299, 301, 302, 303, 200 | 304, 306, 307, 308, 309, 311, 312, 313, 201 | 314, 316, 317, 318, 319, 321, 322, 323, 202 | 324, 325, 327, 328, 329, 330, 331, 333, 203 | 334, 335, 336, 337, 338, 340, 341, 342, 204 | 343, 344, 345, 347, 348, 349, 350, 351, 205 | 352, 353, 355, 356, 357, 358, 359, 360, 206 | 361, 362, 364, 365, 366, 367, 368, 369, 207 | 370, 371, 372, 373, 374, 375, 377, 378, 208 | 379, 380, 381, 382, 383, 384, 385, 386, 209 | 387, 388, 389, 390, 391, 392, 393, 394, 210 | 395, 396, 397, 398, 399, 400, 401, 402, 211 | 403, 404, 405, 406, 407, 408, 409, 410, 212 | 410, 411, 412, 413, 414, 415, 416, 417, 213 | 418, 419, 420, 420, 421, 422, 423, 424, 214 | 425, 426, 427, 427, 428, 429, 430, 431, 215 | 432, 433, 433, 434, 435, 436, 437, 437, 216 | 438, 439, 440, 441, 441, 442, 443, 444, 217 | 445, 445, 446, 447, 448, 448, 449, 450, 218 | 451, 451, 452, 453, 454, 454, 455, 456, 219 | 456, 457, 458, 459, 459, 460, 461, 461, 220 | 462, 463, 463, 464, 465, 465, 466, 467, 221 | 467, 468, 468, 469, 470, 470, 471, 472, 222 | 472, 473, 473, 474, 474, 475, 476, 476, 223 | 477, 477, 478, 478, 479, 480, 480, 481, 224 | 481, 482, 482, 483, 483, 484, 484, 485, 225 | 485, 486, 486, 487, 487, 488, 488, 489, 226 | 489, 489, 490, 490, 491, 491, 492, 492, 227 | 492, 493, 493, 494, 494, 495, 495, 495, 228 | 496, 496, 496, 497, 497, 498, 498, 498, 229 | 499, 499, 499, 500, 500, 500, 501, 501, 230 | 501, 501, 502, 502, 502, 503, 503, 503, 231 | 503, 504, 504, 504, 505, 505, 505, 505, 232 | 505, 506, 506, 506, 506, 507, 507, 507, 233 | 507, 507, 508, 508, 508, 508, 508, 508, 234 | 509, 509, 509, 509, 509, 509, 509, 509, 235 | 510, 510, 510, 510, 510, 510, 510, 510, 236 | 510, 510, 511, 511, 511, 511, 511, 511, 237 | 511, 511, 511, 511, 511, 511, 511, 511, 238 | 511, 511, 511, 511, 511, 511, 511, 511, 239 | 511, 511, 511, 511, 511, 511, 511, 510, 240 | 510, 510, 510, 510, 510, 510, 510, 510, 241 | 510, 509, 509, 509, 509, 509, 509, 509, 242 | 509, 508, 508, 508, 508, 508, 508, 507, 243 | 507, 507, 507, 507, 506, 506, 506, 506, 244 | 505, 505, 505, 505, 505, 504, 504, 504, 245 | 503, 503, 503, 503, 502, 502, 502, 501, 246 | 501, 501, 501, 500, 500, 500, 499, 499, 247 | 499, 498, 498, 498, 497, 497, 496, 496, 248 | 496, 495, 495, 495, 494, 494, 493, 493, 249 | 492, 492, 492, 491, 491, 490, 490, 489, 250 | 489, 489, 488, 488, 487, 487, 486, 486, 251 | 485, 485, 484, 484, 483, 483, 482, 482, 252 | 481, 481, 480, 480, 479, 478, 478, 477, 253 | 477, 476, 476, 475, 474, 474, 473, 473, 254 | 472, 472, 471, 470, 470, 469, 468, 468, 255 | 467, 467, 466, 465, 465, 464, 463, 463, 256 | 462, 461, 461, 460, 459, 459, 458, 457, 257 | 456, 456, 455, 454, 454, 453, 452, 451, 258 | 451, 450, 449, 448, 448, 447, 446, 445, 259 | 445, 444, 443, 442, 441, 441, 440, 439, 260 | 438, 437, 437, 436, 435, 434, 433, 433, 261 | 432, 431, 430, 429, 428, 427, 427, 426, 262 | 425, 424, 423, 422, 421, 420, 420, 419, 263 | 418, 417, 416, 415, 414, 413, 412, 411, 264 | 410, 410, 409, 408, 407, 406, 405, 404, 265 | 403, 402, 401, 400, 399, 398, 397, 396, 266 | 395, 394, 393, 392, 391, 390, 389, 388, 267 | 387, 386, 385, 384, 383, 382, 381, 380, 268 | 379, 378, 377, 375, 374, 373, 372, 371, 269 | 370, 369, 368, 367, 366, 365, 364, 362, 270 | 361, 360, 359, 358, 357, 356, 355, 353, 271 | 352, 351, 350, 349, 348, 347, 345, 344, 272 | 343, 342, 341, 340, 338, 337, 336, 335, 273 | 334, 333, 331, 330, 329, 328, 327, 325, 274 | 324, 323, 322, 321, 319, 318, 317, 316, 275 | 314, 313, 312, 311, 309, 308, 307, 306, 276 | 304, 303, 302, 301, 299, 298, 297, 296, 277 | 294, 293, 292, 290, 289, 288, 286, 285, 278 | 284, 283, 281, 280, 279, 277, 276, 275, 279 | 273, 272, 271, 269, 268, 267, 265, 264, 280 | 263, 261, 260, 259, 257, 256, 255, 253, 281 | 252, 251, 249, 248, 246, 245, 244, 242, 282 | 241, 239, 238, 237, 235, 234, 233, 231, 283 | 230, 228, 227, 226, 224, 223, 221, 220, 284 | 218, 217, 216, 214, 213, 211, 210, 209, 285 | 207, 206, 204, 203, 201, 200, 198, 197, 286 | 196, 194, 193, 191, 190, 188, 187, 185, 287 | 184, 182, 181, 180, 178, 177, 175, 174, 288 | 172, 171, 169, 168, 166, 165, 163, 162, 289 | 160, 159, 157, 156, 154, 153, 151, 150, 290 | 148, 147, 145, 144, 142, 141, 139, 138, 291 | 136, 135, 133, 132, 130, 129, 127, 126, 292 | 124, 123, 121, 120, 118, 117, 115, 113, 293 | 112, 110, 109, 107, 106, 104, 103, 101, 294 | 100, 98, 97, 95, 94, 92, 90, 89, 295 | 87, 86, 84, 83, 81, 80, 78, 77, 296 | 75, 73, 72, 70, 69, 67, 66, 64, 297 | 63, 61, 59, 58, 56, 55, 53, 52, 298 | 50, 49, 47, 45, 44, 42, 41, 39, 299 | 38, 36, 34, 33, 31, 30, 28, 27, 300 | 25, 24, 22, 20, 19, 17, 16, 14, 301 | 13, 11, 9, 8, 6, 5, 3, 2 302 | }; 303 | 304 | 305 | // pi/2 sin LUT 306 | const int quarterwave_lut1024[] PROGMEM = { 307 | 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 308 | 2048, 2048, 2048, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 309 | 2047, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2045, 2045, 2045, 310 | 2045, 2045, 2045, 2044, 2044, 2044, 2044, 2044, 2043, 2043, 2043, 2043, 311 | 2042, 2042, 2042, 2042, 2041, 2041, 2041, 2041, 2040, 2040, 2040, 2040, 312 | 2039, 2039, 2039, 2038, 2038, 2038, 2038, 2037, 2037, 2037, 2036, 2036, 313 | 2036, 2035, 2035, 2034, 2034, 2034, 2033, 2033, 2033, 2032, 2032, 2031, 314 | 2031, 2031, 2030, 2030, 2029, 2029, 2029, 2028, 2028, 2027, 2027, 2026, 315 | 2026, 2025, 2025, 2024, 2024, 2023, 2023, 2022, 2022, 2021, 2021, 2020, 316 | 2020, 2019, 2019, 2018, 2018, 2017, 2017, 2016, 2016, 2015, 2015, 2014, 317 | 2013, 2013, 2012, 2012, 2011, 2010, 2010, 2009, 2009, 2008, 2007, 2007, 318 | 2006, 2006, 2005, 2004, 2004, 2003, 2002, 2002, 2001, 2000, 2000, 1999, 319 | 1998, 1998, 1997, 1996, 1995, 1995, 1994, 1993, 1993, 1992, 1991, 1990, 320 | 1990, 1989, 1988, 1987, 1987, 1986, 1985, 1984, 1984, 1983, 1982, 1981, 321 | 1980, 1980, 1979, 1978, 1977, 1976, 1975, 1975, 1974, 1973, 1972, 1971, 322 | 1970, 1970, 1969, 1968, 1967, 1966, 1965, 1964, 1963, 1963, 1962, 1961, 323 | 1960, 1959, 1958, 1957, 1956, 1955, 1954, 1953, 1952, 1951, 1950, 1950, 324 | 1949, 1948, 1947, 1946, 1945, 1944, 1943, 1942, 1941, 1940, 1939, 1938, 325 | 1937, 1936, 1935, 1934, 1932, 1931, 1930, 1929, 1928, 1927, 1926, 1925, 326 | 1924, 1923, 1922, 1921, 1920, 1919, 1917, 1916, 1915, 1914, 1913, 1912, 327 | 1911, 1910, 1908, 1907, 1906, 1905, 1904, 1903, 1902, 1900, 1899, 1898, 328 | 1897, 1896, 1895, 1893, 1892, 1891, 1890, 1888, 1887, 1886, 1885, 1884, 329 | 1882, 1881, 1880, 1879, 1877, 1876, 1875, 1874, 1872, 1871, 1870, 1868, 330 | 1867, 1866, 1865, 1863, 1862, 1861, 1859, 1858, 1857, 1855, 1854, 1853, 331 | 1851, 1850, 1849, 1847, 1846, 1845, 1843, 1842, 1840, 1839, 1838, 1836, 332 | 1835, 1834, 1832, 1831, 1829, 1828, 1826, 1825, 1824, 1822, 1821, 1819, 333 | 1818, 1816, 1815, 1814, 1812, 1811, 1809, 1808, 1806, 1805, 1803, 1802, 334 | 1800, 1799, 1797, 1796, 1794, 1793, 1791, 1790, 1788, 1787, 1785, 1783, 335 | 1782, 1780, 1779, 1777, 1776, 1774, 1773, 1771, 1769, 1768, 1766, 1765, 336 | 1763, 1761, 1760, 1758, 1757, 1755, 1753, 1752, 1750, 1749, 1747, 1745, 337 | 1744, 1742, 1740, 1739, 1737, 1735, 1734, 1732, 1730, 1729, 1727, 1725, 338 | 1724, 1722, 1720, 1718, 1717, 1715, 1713, 1712, 1710, 1708, 1706, 1705, 339 | 1703, 1701, 1699, 1698, 1696, 1694, 1692, 1691, 1689, 1687, 1685, 1683, 340 | 1682, 1680, 1678, 1676, 1674, 1673, 1671, 1669, 1667, 1665, 1663, 1662, 341 | 1660, 1658, 1656, 1654, 1652, 1651, 1649, 1647, 1645, 1643, 1641, 1639, 342 | 1637, 1636, 1634, 1632, 1630, 1628, 1626, 1624, 1622, 1620, 1618, 1616, 343 | 1615, 1613, 1611, 1609, 1607, 1605, 1603, 1601, 1599, 1597, 1595, 1593, 344 | 1591, 1589, 1587, 1585, 1583, 1581, 1579, 1577, 1575, 1573, 1571, 1569, 345 | 1567, 1565, 1563, 1561, 1559, 1557, 1555, 1553, 1551, 1549, 1547, 1545, 346 | 1543, 1540, 1538, 1536, 1534, 1532, 1530, 1528, 1526, 1524, 1522, 1520, 347 | 1517, 1515, 1513, 1511, 1509, 1507, 1505, 1503, 1500, 1498, 1496, 1494, 348 | 1492, 1490, 1488, 1485, 1483, 1481, 1479, 1477, 1475, 1472, 1470, 1468, 349 | 1466, 1464, 1461, 1459, 1457, 1455, 1453, 1450, 1448, 1446, 1444, 1441, 350 | 1439, 1437, 1435, 1433, 1430, 1428, 1426, 1424, 1421, 1419, 1417, 1414, 351 | 1412, 1410, 1408, 1405, 1403, 1401, 1398, 1396, 1394, 1392, 1389, 1387, 352 | 1385, 1382, 1380, 1378, 1375, 1373, 1371, 1368, 1366, 1364, 1361, 1359, 353 | 1357, 1354, 1352, 1350, 1347, 1345, 1342, 1340, 1338, 1335, 1333, 1331, 354 | 1328, 1326, 1323, 1321, 1319, 1316, 1314, 1311, 1309, 1307, 1304, 1302, 355 | 1299, 1297, 1294, 1292, 1289, 1287, 1285, 1282, 1280, 1277, 1275, 1272, 356 | 1270, 1267, 1265, 1262, 1260, 1258, 1255, 1253, 1250, 1248, 1245, 1243, 357 | 1240, 1238, 1235, 1233, 1230, 1228, 1225, 1223, 1220, 1217, 1215, 1212, 358 | 1210, 1207, 1205, 1202, 1200, 1197, 1195, 1192, 1190, 1187, 1184, 1182, 359 | 1179, 1177, 1174, 1172, 1169, 1166, 1164, 1161, 1159, 1156, 1153, 1151, 360 | 1148, 1146, 1143, 1140, 1138, 1135, 1133, 1130, 1127, 1125, 1122, 1119, 361 | 1117, 1114, 1112, 1109, 1106, 1104, 1101, 1098, 1096, 1093, 1090, 1088, 362 | 1085, 1082, 1080, 1077, 1074, 1072, 1069, 1066, 1064, 1061, 1058, 1056, 363 | 1053, 1050, 1047, 1045, 1042, 1039, 1037, 1034, 1031, 1029, 1026, 1023, 364 | 1020, 1018, 1015, 1012, 1009, 1007, 1004, 1001, 999, 996, 993, 990, 365 | 988, 985, 982, 979, 976, 974, 971, 968, 965, 963, 960, 957, 366 | 954, 952, 949, 946, 943, 940, 938, 935, 932, 929, 926, 924, 367 | 921, 918, 915, 912, 910, 907, 904, 901, 898, 895, 893, 890, 368 | 887, 884, 881, 878, 876, 873, 870, 867, 864, 861, 859, 856, 369 | 853, 850, 847, 844, 841, 839, 836, 833, 830, 827, 824, 821, 370 | 818, 816, 813, 810, 807, 804, 801, 798, 795, 792, 790, 787, 371 | 784, 781, 778, 775, 772, 769, 766, 763, 760, 758, 755, 752, 372 | 749, 746, 743, 740, 737, 734, 731, 728, 725, 722, 719, 717, 373 | 714, 711, 708, 705, 702, 699, 696, 693, 690, 687, 684, 681, 374 | 678, 675, 672, 669, 666, 663, 660, 657, 654, 651, 648, 645, 375 | 642, 639, 636, 633, 630, 627, 624, 622, 619, 616, 613, 610, 376 | 607, 604, 601, 598, 595, 591, 588, 585, 582, 579, 576, 573, 377 | 570, 567, 564, 561, 558, 555, 552, 549, 546, 543, 540, 537, 378 | 534, 531, 528, 525, 522, 519, 516, 513, 510, 507, 504, 501, 379 | 498, 495, 492, 488, 485, 482, 479, 476, 473, 470, 467, 464, 380 | 461, 458, 455, 452, 449, 446, 443, 440, 436, 433, 430, 427, 381 | 424, 421, 418, 415, 412, 409, 406, 403, 400, 396, 393, 390, 382 | 387, 384, 381, 378, 375, 372, 369, 366, 363, 359, 356, 353, 383 | 350, 347, 344, 341, 338, 335, 332, 328, 325, 322, 319, 316, 384 | 313, 310, 307, 304, 301, 297, 294, 291, 288, 285, 282, 279, 385 | 276, 273, 269, 266, 263, 260, 257, 254, 251, 248, 244, 241, 386 | 238, 235, 232, 229, 226, 223, 219, 216, 213, 210, 207, 204, 387 | 201, 198, 194, 191, 188, 185, 182, 179, 176, 173, 169, 166, 388 | 163, 160, 157, 154, 151, 148, 144, 141, 138, 135, 132, 129, 389 | 126, 122, 119, 116, 113, 110, 107, 104, 100, 97, 94, 91, 390 | 88, 85, 82, 79, 75, 72, 69, 66, 63, 60, 57, 53, 391 | 50, 47, 44, 41, 38, 35, 31, 28, 25, 22, 19, 16, 392 | 13, 9, 6, 3 393 | }; 394 | 395 | 396 | 397 | 398 | class PowerControl 399 | { 400 | public: 401 | void osgBegin(float _freq, float _deltat); 402 | void osgUpdate1(unsigned long _phaseInc); 403 | void osgMaSlUpdate1(unsigned long _phaseInc, unsigned long _phaseOffset); 404 | void osgMaSlUpdate2(unsigned long _phaseInc, unsigned long _phaseOffset); 405 | void osgMaSlUpdate3(unsigned long _phaseInc, unsigned long _phaseOffset); 406 | void osgMaSlUpdate4(unsigned long _phaseInc, unsigned long _phaseOffset); 407 | void osgMaSlUpdate5(unsigned long _phaseInc, unsigned long _phaseOffset); 408 | void park(long _alpha, long _beta); 409 | void ipark(long _d, long _q); 410 | 411 | volatile unsigned long tuningWord; 412 | int rsin; 413 | int rcos; 414 | int rfbk; 415 | long alpha; 416 | long beta; 417 | long d; 418 | long q; 419 | 420 | private: 421 | volatile unsigned long phaseAccu1; 422 | volatile unsigned long phaseAccu2; 423 | volatile unsigned int phaseIdx1; 424 | volatile unsigned int phaseIdx2; 425 | volatile unsigned int phaseIdx3; 426 | }; 427 | 428 | #endif /* PowerSys_H_ */ 429 | 430 | 431 | 432 | -------------------------------------------------------------------------------- /schematics/openMicroInverter_dev.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartinStokroos/openMicroInverter/217f7103656b8cb4b2f439d4636f740f98ff0eab/schematics/openMicroInverter_dev.pdf -------------------------------------------------------------------------------- /sketches/Inverter1/Inverter1.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Inverter1.ino 3 | * Purpose: openMicroInverter example project. This sketch establishes a voltage-mode inverter without output voltage control (open loop). 4 | * Version: 1.2.1 5 | * Release date: 02-12-2019 6 | * 7 | * Last update: 01-12-2020 8 | * 9 | * Changes in 1.2.1: Compatibility with PowerSys lib 1.1.1 10 | * 11 | * Changes in 1.2.0 12 | * - Inverter amplitude control by potmeter (0-5V) on ADC input A5. 13 | * - RMS voltage readout on ADC input A0 (meant for Vgrid). 14 | * 15 | * Changes in 1.1.0: 16 | * - Works with powerSys library v1.1.0. 17 | * - Fluctuations in output voltage reading fixed by changing ADC clock prescaler from 128 to 64 (250kHz). 18 | * 19 | * URL: https://github.com/MartinStokroos/openMicroInverter 20 | * 21 | * License: MIT License 22 | * 23 | * Copyright (c) M.Stokroos 2019 24 | * 25 | * 26 | * 27 | * This sketch has been tested with the openMicroInverter_dev hardware. 28 | * 29 | */ 30 | 31 | #include // library for high performance digital reads and writes by jrraines 32 | // see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267553811/0 33 | // and http://code.google.com/p/digitalwritefast/ 34 | 35 | #include // https://github.com/MartinStokroos/TrueRMS 36 | #include // https://github.com/MartinStokroos/openMicroInverter 37 | 38 | // H-bridge switching mode: 39 | #define UNIPOL // unipolar switching 40 | //#define BIPOL // bipolar switching 41 | //#define HYBRID // bipolar switching, bottom H-bridge=LF 42 | 43 | #define LPPERIOD 1000000 // main loop period time in us. In this case 1s. 44 | #define RMSWINDOW 20 // RMS window, number of samples used for the RMS calculation. 45 | 46 | #define PIN_LED 13 // PLL locking status indicator LED 47 | #define PIN_H_PWMA 9 // Timer1 OCR1A 10-bit PWM 48 | #define PIN_H_PWMB 10 // Timer1 OCR1B 10-bit PWM 49 | #define PIN_H_AHI 3 // H-bridge control pin 50 | #define PIN_H_BHI 11 // H-bridge control pin 51 | #define PIN_H_DIS 8 // enable inverter 52 | #define PIN_GRID_RELAY 2 // output relay 53 | #define PIN_DEBUG 4 // debugging output pin 54 | 55 | //scaling calibration 56 | const float gridVoltRange = 660.0; //Vp-p full scale. 57 | const float outputVoltRange = 668.0; //Vp-p full scale. 58 | const float outputCurrRange = 4.5; //Ap-p full scale. 59 | const float vBattRange = 5.00; //Vbatt scaled max, not scaled correctly yet. 60 | const float iBattRange = 5.00; //Ibatt scaled max, not scaled correctly yet. 61 | const float vPotRange = 1.00; //Vpotmeter scaled max, used for amplitude control of the output wave. 62 | 63 | // ADC vars 64 | volatile int adcVal; 65 | volatile int adcMuxIdx = 0; // multiplexer index 66 | 67 | // PWM DAC 68 | float mgain = 1.0; 69 | float amplitude; 70 | unsigned int ndac_out; // DAC magnitude value 71 | unsigned int pdac_out; 72 | int dac_out; 73 | 74 | // inverter 75 | const float TD = 1/6000.0; //time step for f=6000 Hz 76 | const float f0 = 50.0; // output frequency in Hz 77 | 78 | // define instances for ac/dc voltage, current and power measurements and wave generation 79 | Rms2 gridVolt; 80 | Power2 acOutput; 81 | Average vBatt; 82 | Average iBatt; 83 | Average vPot; 84 | PowerControl outputWave; 85 | 86 | unsigned long nextLoop; 87 | 88 | 89 | 90 | // ****************************************************************** 91 | // Setup 92 | // ****************************************************************** 93 | void setup(){ 94 | cli(); // enable interrupts 95 | 96 | // initialize serial communications: 97 | Serial.begin(115200); 98 | pinMode(PIN_LED, OUTPUT); 99 | pinMode(PIN_H_PWMA, OUTPUT); 100 | pinMode(PIN_H_PWMB, OUTPUT); 101 | pinMode(PIN_H_AHI, OUTPUT); 102 | pinMode(PIN_H_BHI, OUTPUT); 103 | pinMode(PIN_GRID_RELAY, OUTPUT); 104 | pinMode(PIN_H_DIS, OUTPUT); 105 | pinMode(PIN_DEBUG, OUTPUT); 106 | 107 | // initialize ADC for continuous sampling mode 108 | DIDR0 = 0x3F; // digital inputs disabled for ADC0D to ADC5D 109 | bitSet(ADMUX, REFS0); // Select Vcc=5V as the ADC reference voltage 110 | bitClear(ADMUX, REFS1); 111 | bitClear(ADMUX, MUX0); // selecting ADC CH# 0 112 | bitClear(ADMUX, MUX1); 113 | bitClear(ADMUX, MUX2); 114 | bitClear(ADMUX, MUX3); 115 | bitSet(ADCSRA, ADEN); // AD-converter enabled 116 | bitSet(ADCSRA, ADATE); // auto-trigger enabled 117 | bitSet(ADCSRA, ADIE); // ADC interrupt enabled 118 | 119 | bitClear(ADCSRA, ADPS0); // ADC clock prescaler set to 64 (250kHz) 120 | bitSet(ADCSRA, ADPS1); 121 | bitSet(ADCSRA, ADPS2); 122 | 123 | bitClear(ADCSRB, ACME); // Analog Comparator (ADC)Multiplexer enable OFF 124 | bitClear(ADCSRB, ADTS0); // triggered by Timer/Counter1 Overflow 125 | bitSet(ADCSRB, ADTS1); 126 | bitSet(ADCSRB, ADTS2); 127 | bitSet(ADCSRA, ADSC); // start conversion 128 | 129 | /* TIMER1 configured for phase and frequency correct PWM-mode 8, top=ICR1 */ 130 | // prescaler = 1: 131 | bitSet(TCCR1B, CS10); 132 | bitClear(TCCR1B, CS11); 133 | bitClear(TCCR1B, CS12); 134 | // mode 8: 135 | bitClear(TCCR1A, WGM10); 136 | bitClear(TCCR1A, WGM11); 137 | bitClear(TCCR1B, WGM12); 138 | bitSet(TCCR1B, WGM13); 139 | // top value. f_TIM1 = fclk/(2*N*TOP) 140 | ICR1 = 0x0536; //0x0535, f=6kHz, min 0x03FF; 141 | 142 | #ifdef UNIPOL 143 | #define ICR1_OFFSET 0x09B; 144 | digitalWriteFast(PIN_H_AHI, HIGH); 145 | digitalWriteFast(PIN_H_BHI, HIGH); 146 | bitClear(TCCR1A, COM1A0); // Compare Match PWM 10 147 | bitSet(TCCR1A, COM1A1); 148 | bitClear(TCCR1A, COM1B0); // Compare Match PWM 9 149 | bitSet(TCCR1A, COM1B1); 150 | #endif 151 | 152 | #ifdef BIPOL 153 | #define ICR1_OFFSET 0x09B; 154 | digitalWriteFast(PIN_H_AHI, HIGH); 155 | digitalWriteFast(PIN_H_BHI, HIGH); 156 | bitClear(TCCR1A, COM1A0); // Compare Match PWM 10 157 | bitSet(TCCR1A, COM1A1); 158 | bitSet(TCCR1A, COM1B0); // Compare Match PWM9, inverted 159 | bitSet(TCCR1A, COM1B1); 160 | #endif 161 | 162 | #ifdef HYBRID 163 | #define ICR1_OFFSET 0x09B; 164 | digitalWriteFast(PIN_H_AHI, LOW); 165 | digitalWriteFast(PIN_H_BHI, LOW); 166 | bitSet(TCCR1A, COM1A0); // Compare Match PWM 10 167 | bitSet(TCCR1A, COM1A1); 168 | bitSet(TCCR1A, COM1B0); // Compare Match PWM 9 169 | bitSet(TCCR1A, COM1B1); 170 | #endif 171 | 172 | // enable timer compare interrupt 173 | bitSet(TIMSK1, TOIE1); // enable Timer1 Interrupt 174 | 175 | gridVolt.begin(gridVoltRange, RMSWINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 176 | acOutput.begin(outputCurrRange, outputVoltRange, RMSWINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 177 | vBatt.begin(vBattRange, RMSWINDOW, ADC_10BIT, CNT_SCAN); 178 | iBatt.begin(iBattRange, RMSWINDOW, ADC_10BIT, CNT_SCAN); 179 | vPot.begin(vPotRange, 4, ADC_10BIT, CNT_SCAN); 180 | 181 | gridVolt.start(); 182 | acOutput.start(); 183 | vBatt.start(); 184 | iBatt.start(); 185 | vPot.start(); 186 | outputWave.osgBegin(f0, TD); // initilize the DDS (frequency, timestep) 187 | 188 | sei(); // enable interrupts 189 | nextLoop = micros() + LPPERIOD; // Set the loop timer variable for the next loop interval. 190 | } 191 | 192 | 193 | 194 | 195 | // ****************************************************************** 196 | // Main loop 197 | // ****************************************************************** 198 | void loop(){ 199 | digitalWriteFast(PIN_LED, HIGH); 200 | 201 | gridVolt.publish(); 202 | vBatt.publish(); 203 | iBatt.publish(); 204 | vPot.publish(); 205 | acOutput.publish(); 206 | 207 | mgain = vPot.average; // read amplitude control gain setting from potmeter. 208 | // Note: amplitude setting is updated with the frequency of the main loop (slow)! 209 | 210 | Serial.print(gridVolt.rmsVal, 0); // print the RMS input voltage 211 | Serial.print(", "); 212 | Serial.print(acOutput.rmsVal2, 0); // print the RMS output voltage 213 | Serial.print(", "); 214 | Serial.print(acOutput.rmsVal1, 2); // print the RMS output current 215 | Serial.print(", "); 216 | Serial.print(acOutput.apparentPwr, 0); // print power output VA's 217 | Serial.print(", "); 218 | Serial.print(acOutput.realPwr, 0); // print power output Watts 219 | Serial.print(", "); 220 | Serial.print(vBatt.average, 1); 221 | Serial.print(", "); 222 | Serial.println(iBatt.average, 1); 223 | 224 | digitalWriteFast(PIN_LED, LOW); 225 | 226 | while(nextLoop > micros()) {;} // wait until the end of the time interval 227 | nextLoop += LPPERIOD; // set next loop time at current time + LOOP_PERIOD 228 | } 229 | 230 | 231 | 232 | 233 | /* ****************************************************************** 234 | * ADC ISR. ADC is triggered by Timer1. 235 | * *******************************************************************/ 236 | ISR(ADC_vect){ 237 | digitalWriteFast(PIN_DEBUG, HIGH); 238 | // read the current ADC input channel 239 | adcVal=ADCL; // store low byte 240 | adcVal+=ADCH<<8; // store high byte 241 | switch (adcMuxIdx) { 242 | case 0: 243 | //time slot for sampling the grid voltage 244 | gridVolt.update(adcVal); 245 | break; 246 | 247 | case 1: 248 | //time slot for sampling the inverter current 249 | acOutput.update1(adcVal); 250 | break; 251 | 252 | case 2: 253 | //time slot for sampling the inverter voltage 254 | acOutput.update2(adcVal); 255 | break; 256 | 257 | case 3: 258 | // time slot for sampling the battery current 259 | iBatt.update(adcVal); 260 | break; 261 | 262 | case 4: 263 | // time slot for sampling the battery voltage 264 | vBatt.update(adcVal); 265 | break; 266 | 267 | case 5: 268 | // optional time slot 269 | vPot.update(adcVal); 270 | break; 271 | 272 | // default: 273 | } 274 | adcMuxIdx++; 275 | if (adcMuxIdx > 5){ 276 | adcMuxIdx = 0; 277 | } 278 | ADMUX = (ADMUX & B11110000) | adcMuxIdx; // set the ADC-MUX channel for the next call 279 | digitalWriteFast(PIN_DEBUG, LOW); 280 | } 281 | 282 | 283 | 284 | 285 | 286 | /* ****************************************************************** 287 | * Timer1 ISR running at 6000Hz 288 | *********************************************************************/ 289 | ISR(TIMER1_OVF_vect) { 290 | // complementary sin waves drive both legs in H-bridge. High-side and low-side are PWM-switched. AHI=5V and BHI=5V. 291 | // (see HIP4082 application note; LF switched inverter ALI//BHI (pin4,2) and AHI//BLI (7,3) ) 292 | 293 | #ifdef UNIPOL 294 | outputWave.osgMaSlUpdate2(0, 0); // generate signed reference sin wave with DDS. 295 | amplitude = (float)outputWave.rcos * mgain; 296 | pdac_out = (int)amplitude + 0x1FF; //make unsigned, 10 bit range 297 | ndac_out = (~pdac_out) & 0x3FF; //invert for n-channel. 298 | pdac_out += ICR1_OFFSET; // add offset to center between the BOTTOM to TOP value range of the timer. 299 | ndac_out += ICR1_OFFSET; 300 | // write to PWM output registers A&B (10bit). 301 | OCR1AH = pdac_out>>8; //MSB 302 | OCR1AL = pdac_out; //LSB 303 | //inverted output channel (dead-time correction inside the H-bridge driver HIP4082): 304 | OCR1BH = ndac_out>>8; //MSB 305 | OCR1BL = ndac_out; //LSB 306 | #endif 307 | 308 | // complementary gate drives in both legs of the H-bridge. AHI=5V and BHI=5V. 309 | //dac_out += 0x1FF; 310 | #ifdef BIPOL 311 | outputWave.osgMaSlUpdate2(0, 0); // generate the reference sin wave with DDS. 312 | amplitude = (float)outputWave.rcos * mgain; 313 | dac_out = (int)amplitude + 0x1FF; 314 | dac_out += ICR1_OFFSET; 315 | OCR1AH = dac_out >> 8; // top 8 bits 316 | OCR1AL = dac_out; //bottom 8 bits 317 | OCR1BH = OCR1AH; //Inverted output with the inverting output compare setting above. 318 | OCR1BL = OCR1AL; 319 | #endif 320 | 321 | // LF+PWM dive. Not optimal yet... Reference wave should be half wave with 10bit or more amplitude range. 322 | #ifdef HYBRID 323 | outputWave.osgMaSlUpdate2(0, 0); // generate the reference sin wave with DDS. 324 | amplitude = (float)outputWave.rcos * mgain; 325 | dac_out = (int)amplitude; 326 | if (dac_out >= 0) { 327 | digitalWriteFast(PIN_H_AHI, LOW); // write magnitude data to PWM output registers A&B (10bit). 328 | digitalWriteFast(PIN_H_BHI, HIGH); 329 | //dac_out = dac_out<<1; //scaling incorrect - this should be fixed by lookup table in PowerSys lib... 330 | //dac_out += ICR1_OFFSET; //? 331 | OCR1AH = dac_out>>8; // top 8 bits 332 | OCR1AL = dac_out; // bottom 8 bits 333 | } 334 | else { 335 | digitalWriteFast(PIN_H_BHI, LOW); 336 | digitalWriteFast(PIN_H_AHI, HIGH); 337 | dac_out = -dac_out; // + ICR1_OFFSET; //? 338 | //dac_out = (-dac_out)<<1; //times 2 339 | OCR1BH = dac_out>>8; // top 8 bits 340 | OCR1BL = dac_out; // bottom 8 bits 341 | } 342 | #endif 343 | } 344 | -------------------------------------------------------------------------------- /sketches/Inverter1b/Inverter1b.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Inverter1b.ino 3 | * Purpose: openMicroInverter example project. This sketch establishes a voltage-mode inverter without output voltage control (open loop). 4 | * It uses the Dual Channel H-bridge Motor Shield (8A/22V) from Elecrow. This sketch has been adapted from example Inverter1.ino version 1.2.1. 5 | * Version: 1.0.0 6 | * Release date: 22-06-2021 7 | * 8 | * Last update: - 9 | * 10 | * URL: https://github.com/MartinStokroos/openMicroInverter 11 | * 12 | * License: MIT License 13 | * 14 | * Copyright (c) M.Stokroos 2021 15 | * 16 | */ 17 | 18 | #include // library for high performance digital reads and writes by jrraines 19 | // see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267553811/0 20 | // and http://code.google.com/p/digitalwritefast/ 21 | 22 | #include // https://github.com/MartinStokroos/TrueRMS 23 | #include // https://github.com/MartinStokroos/openMicroInverter 24 | 25 | // H-bridge switching mode: 26 | #define UNIPOL // unipolar switching - Complementary sin waves drive L+R legs of the H-bridge. 27 | //#define BIPOL // bipolar switching - Complementary gate drive applied to both legs of the H-bridge. 28 | //#define HYBRID // bipolar switching - Bottom FET's of the H-bridge are LF switched, top FET's are PWM driven. 29 | 30 | #define LPPERIOD 1000000 // main loop period time in us. In this case 1s. 31 | #define RMSWINDOW 20 // RMS window, number of samples used for the RMS calculation. 32 | 33 | #define PIN_LED 13 // LED 34 | #define PIN_H_P_1 9 // Timer1 OCR1A 10-bit PWM 35 | #define PIN_H_P_2 10 // Timer1 OCR1B 10-bit PWM 36 | #define PIN_H_1A 4 37 | #define PIN_H_1B 5 38 | #define PIN_H_2A 7 39 | #define PIN_H_2B 8 40 | #define PIN_H_EN 6 41 | #define PIN_DEBUG 3 // debugging output pin 42 | 43 | //scaling calibration 44 | const float gridVoltRange = 660.0; //Vp-p full scale. 45 | const float outputVoltRange = 660.0; //Vp-p full scale. 46 | const float outputCurrRange = 4.5; //Ap-p full scale. 47 | const float vBattRange = 5.00; //Vbatt scaled max, not scaled correctly yet. 48 | const float iBattRange = 5.00; //Ibatt scaled max, not scaled correctly yet. 49 | const float vPotRange = 1.00; //Vpotmeter scaled max, used for amplitude control of the output wave. 50 | 51 | // ADC vars 52 | volatile int adcVal; 53 | volatile int adcMuxIdx = 0; // multiplexer index 54 | 55 | // PWM DAC 56 | float mgain = 1.0; 57 | float amplitude; 58 | unsigned int ndac_out; // DAC magnitude value 59 | unsigned int pdac_out; 60 | int dac_out; 61 | 62 | // inverter 63 | const float TD = 1/6000.0; //time step for f=6000 Hz 64 | const float f0 = 50.0; // output frequency in Hz 65 | 66 | // define instances for ac/dc voltage, current and power measurements and wave generation 67 | Rms2 gridVolt; 68 | Power2 acOutput; 69 | Average vBatt; 70 | Average iBatt; 71 | Average vPot; 72 | PowerControl outputWave; 73 | 74 | unsigned long nextLoop; 75 | 76 | 77 | 78 | // ****************************************************************** 79 | // Setup 80 | // ****************************************************************** 81 | void setup(){ 82 | cli(); // enable interrupts 83 | 84 | // initialize serial communications: 85 | Serial.begin(115200); 86 | pinMode(PIN_LED, OUTPUT); 87 | pinMode(PIN_H_P_1, OUTPUT); 88 | pinMode(PIN_H_P_2, OUTPUT); 89 | pinMode(PIN_H_1A, OUTPUT); 90 | pinMode(PIN_H_1B, OUTPUT); 91 | pinMode(PIN_H_2A, OUTPUT); 92 | pinMode(PIN_H_2B, OUTPUT); 93 | pinMode(PIN_H_EN, OUTPUT); 94 | pinMode(PIN_DEBUG, OUTPUT); 95 | 96 | // initialize ADC for continuous sampling mode 97 | DIDR0 = 0x3F; // digital inputs disabled for ADC0D to ADC5D 98 | bitSet(ADMUX, REFS0); // Select Vcc=5V as the ADC reference voltage 99 | bitClear(ADMUX, REFS1); 100 | bitClear(ADMUX, MUX0); // selecting ADC CH# 0 101 | bitClear(ADMUX, MUX1); 102 | bitClear(ADMUX, MUX2); 103 | bitClear(ADMUX, MUX3); 104 | bitSet(ADCSRA, ADEN); // AD-converter enabled 105 | bitSet(ADCSRA, ADATE); // auto-trigger enabled 106 | bitSet(ADCSRA, ADIE); // ADC interrupt enabled 107 | 108 | bitClear(ADCSRA, ADPS0); // ADC clock prescaler set to 64 (250kHz) 109 | bitSet(ADCSRA, ADPS1); 110 | bitSet(ADCSRA, ADPS2); 111 | 112 | bitClear(ADCSRB, ACME); // Analog Comparator (ADC)Multiplexer enable OFF 113 | bitClear(ADCSRB, ADTS0); // triggered by Timer/Counter1 Overflow 114 | bitSet(ADCSRB, ADTS1); 115 | bitSet(ADCSRB, ADTS2); 116 | bitSet(ADCSRA, ADSC); // start conversion 117 | 118 | /* TIMER1 configured for phase and frequency correct PWM-mode 8, top=ICR1 */ 119 | // prescaler = 1: 120 | bitSet(TCCR1B, CS10); 121 | bitClear(TCCR1B, CS11); 122 | bitClear(TCCR1B, CS12); 123 | // mode 8: 124 | bitClear(TCCR1A, WGM10); 125 | bitClear(TCCR1A, WGM11); 126 | bitClear(TCCR1B, WGM12); 127 | bitSet(TCCR1B, WGM13); 128 | // top value. f_TIM1 = fclk/(2*N*TOP) 129 | ICR1 = 0x0536; //0x0535, f=6kHz, min 0x03FF; 130 | 131 | #ifdef UNIPOL 132 | #define ICR1_OFFSET 0x09B; 133 | digitalWriteFast(PIN_H_1A, HIGH); //XFMR between M1_A and M2_A. Tie M1_A and M1_B together. Also tie M2_A and M2_B together. 134 | digitalWriteFast(PIN_H_1B, HIGH); 135 | digitalWriteFast(PIN_H_2A, HIGH); 136 | digitalWriteFast(PIN_H_2B, HIGH); 137 | bitClear(TCCR1A, COM1A0); // Compare Match PWM 10 138 | bitSet(TCCR1A, COM1A1); 139 | bitClear(TCCR1A, COM1B0); // Compare Match PWM 9 140 | bitSet(TCCR1A, COM1B1); 141 | #endif 142 | 143 | #ifdef BIPOL 144 | #define ICR1_OFFSET 0x09B; 145 | digitalWriteFast(PIN_H_1A, HIGH); //XFMR between M1_A and M2_A. Tie M1_A and M1_B together. Also tie M2_A and M2_B together. 146 | digitalWriteFast(PIN_H_1B, HIGH); 147 | digitalWriteFast(PIN_H_2A, HIGH); 148 | digitalWriteFast(PIN_H_2B, HIGH); 149 | bitClear(TCCR1A, COM1A0); // Compare Match PWM 10 150 | bitSet(TCCR1A, COM1A1); 151 | bitSet(TCCR1A, COM1B0); // Compare Match PWM9, inverted 152 | bitSet(TCCR1A, COM1B1); 153 | #endif 154 | 155 | #ifdef HYBRID 156 | #define ICR1_OFFSET 0x09B; 157 | digitalWriteFast(PIN_H_1A, HIGH); 158 | digitalWriteFast(PIN_H_1B, LOW); 159 | digitalWriteFast(PIN_H_2A, HIGH); 160 | digitalWriteFast(PIN_H_2B, LOW); 161 | bitSet(TCCR1A, COM1A0); // Compare Match PWM 10 162 | bitSet(TCCR1A, COM1A1); 163 | bitSet(TCCR1A, COM1B0); // Compare Match PWM 9 164 | bitSet(TCCR1A, COM1B1); 165 | #endif 166 | 167 | // enable timer compare interrupt 168 | bitSet(TIMSK1, TOIE1); // enable Timer1 Interrupt 169 | 170 | gridVolt.begin(gridVoltRange, RMSWINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 171 | acOutput.begin(outputCurrRange, outputVoltRange, RMSWINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 172 | vBatt.begin(vBattRange, RMSWINDOW, ADC_10BIT, CNT_SCAN); 173 | iBatt.begin(iBattRange, RMSWINDOW, ADC_10BIT, CNT_SCAN); 174 | vPot.begin(vPotRange, 4, ADC_10BIT, CNT_SCAN); 175 | 176 | gridVolt.start(); 177 | acOutput.start(); 178 | vBatt.start(); 179 | iBatt.start(); 180 | vPot.start(); 181 | outputWave.osgBegin(f0, TD); // initilize the DDS (frequency, timestep) 182 | 183 | sei(); // enable interrupts 184 | nextLoop = micros() + LPPERIOD; // Set the loop timer variable for the next loop interval. 185 | 186 | digitalWriteFast(PIN_H_EN, HIGH); //enable H-bridge 187 | } 188 | 189 | 190 | 191 | 192 | // ****************************************************************** 193 | // Main loop 194 | // ****************************************************************** 195 | void loop(){ 196 | digitalWriteFast(PIN_LED, HIGH); 197 | 198 | gridVolt.publish(); 199 | vBatt.publish(); 200 | iBatt.publish(); 201 | vPot.publish(); 202 | acOutput.publish(); 203 | 204 | mgain = vPot.average; // read amplitude control gain setting from potmeter. 205 | // Note: amplitude setting is updated with the frequency of the main loop (slow)! 206 | 207 | Serial.print(gridVolt.rmsVal, 0); // print the RMS input voltage 208 | Serial.print(", "); 209 | Serial.print(acOutput.rmsVal2, 0); // print the RMS output voltage 210 | Serial.print(", "); 211 | Serial.print(acOutput.rmsVal1, 2); // print the RMS output current 212 | Serial.print(", "); 213 | Serial.print(acOutput.apparentPwr, 0); // print power output VA's 214 | Serial.print(", "); 215 | Serial.print(acOutput.realPwr, 0); // print power output Watts 216 | Serial.print(", "); 217 | Serial.print(vBatt.average, 1); 218 | Serial.print(", "); 219 | Serial.println(iBatt.average, 1); 220 | 221 | digitalWriteFast(PIN_LED, LOW); 222 | 223 | while(nextLoop > micros()) {;} // wait until the end of the time interval 224 | nextLoop += LPPERIOD; // set next loop time at current time + LOOP_PERIOD 225 | } 226 | 227 | 228 | 229 | 230 | /* ****************************************************************** 231 | * ADC ISR. ADC is triggered by Timer1. 232 | * *******************************************************************/ 233 | ISR(ADC_vect){ 234 | digitalWriteFast(PIN_DEBUG, HIGH); 235 | // read the current ADC input channel 236 | adcVal=ADCL; // store low byte 237 | adcVal+=ADCH<<8; // store high byte 238 | switch (adcMuxIdx) { 239 | case 0: 240 | //time slot for sampling the grid voltage 241 | gridVolt.update(adcVal); 242 | break; 243 | 244 | case 1: 245 | //time slot for sampling the inverter current 246 | acOutput.update1(adcVal); 247 | break; 248 | 249 | case 2: 250 | //time slot for sampling the inverter voltage 251 | acOutput.update2(adcVal); 252 | break; 253 | 254 | case 3: 255 | // time slot for sampling the battery current 256 | iBatt.update(adcVal); 257 | break; 258 | 259 | case 4: 260 | // time slot for sampling the battery voltage 261 | vBatt.update(adcVal); 262 | break; 263 | 264 | case 5: 265 | // optional time slot 266 | vPot.update(adcVal); 267 | break; 268 | 269 | // default: 270 | } 271 | adcMuxIdx++; 272 | if (adcMuxIdx > 5){ 273 | adcMuxIdx = 0; 274 | } 275 | ADMUX = (ADMUX & B11110000) | adcMuxIdx; // set the ADC-MUX channel for the next call 276 | digitalWriteFast(PIN_DEBUG, LOW); 277 | } 278 | 279 | 280 | 281 | 282 | 283 | /* ****************************************************************** 284 | * Timer1 ISR running at 6000Hz 285 | *********************************************************************/ 286 | ISR(TIMER1_OVF_vect) { 287 | 288 | #ifdef UNIPOL 289 | // Complementary sin waves drive L+R legs of the H-bridge. 290 | outputWave.osgMaSlUpdate2(0, 0); // generate signed reference wave with DDS. 291 | amplitude = (float)outputWave.rcos * mgain; 292 | pdac_out = (int)amplitude + 0x1FF; //make unsigned, 10 bit range 293 | ndac_out = (~pdac_out) & 0x3FF; //invert for n-channel. 294 | pdac_out += ICR1_OFFSET; // add offset to center between the BOTTOM to TOP value range of the timer. 295 | ndac_out += ICR1_OFFSET; 296 | // write to PWM output registers A&B (10bit). 297 | OCR1AH = pdac_out>>8; //MSB 298 | OCR1AL = pdac_out; //LSB 299 | // Inverted output channel 300 | OCR1BH = ndac_out>>8; //MSB 301 | OCR1BL = ndac_out; //LSB 302 | #endif 303 | 304 | #ifdef BIPOL 305 | // Complementary gate drive applied to both legs of the H-bridge. 306 | outputWave.osgMaSlUpdate2(0, 0); // generate the reference wave with DDS. 307 | amplitude = (float)outputWave.rcos * mgain; 308 | dac_out = (int)amplitude + 0x1FF; 309 | dac_out += ICR1_OFFSET; 310 | OCR1AH = dac_out >> 8; // top 8 bits 311 | OCR1AL = dac_out; //bottom 8 bits 312 | OCR1BH = OCR1AH; //Inverted output with the inverting output compare setting above. 313 | OCR1BL = OCR1AL; 314 | #endif 315 | 316 | #ifdef HYBRID 317 | // LF+PWM dive. Not optimal yet... Reference wave should be half wave with 10bit or more amplitude range. 318 | outputWave.osgMaSlUpdate2(0, 0); // generate the reference wave with DDS. 319 | amplitude = (float)outputWave.rcos * mgain; 320 | dac_out = (int)amplitude; 321 | if (dac_out >= 0) { 322 | //dac_out = dac_out + 0x1FF; //? 323 | digitalWriteFast(PIN_H_2A, LOW); 324 | digitalWriteFast(PIN_H_2B, LOW); 325 | digitalWriteFast(PIN_H_1A, HIGH); 326 | digitalWriteFast(PIN_H_1B, HIGH); 327 | //dac_out = dac_out<<1; //scaling incorrect - this should be fixed by lookup table in PowerSys lib... 328 | //dac_out += ICR1_OFFSET; //? 329 | OCR1AH = dac_out>>8; // top 8 bits 330 | OCR1AL = dac_out; // bottom 8 bits 331 | } 332 | else { 333 | digitalWriteFast(PIN_H_1A, LOW); 334 | digitalWriteFast(PIN_H_1B, LOW); 335 | digitalWriteFast(PIN_H_2A, HIGH); 336 | digitalWriteFast(PIN_H_2B, HIGH); 337 | dac_out = -dac_out; // + ICR1_OFFSET; //? 338 | //dac_out = (-dac_out)<<1; //times 2 339 | OCR1BH = dac_out>>8; // top 8 bits 340 | OCR1BL = dac_out; // bottom 8 bits 341 | } 342 | #endif 343 | } 344 | -------------------------------------------------------------------------------- /sketches/Inverter2/Inverter2.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Inverter2.ino 3 | * Purpose: openMicroInverter example project. 4 | * 5 | * This sketch establishes a voltage-mode inverter without output voltage control (open loop). 6 | * It synchronizes the output wave to the grid voltage. Do not connect the inverter output in parallel with 7 | * the grid with this example! There is no current control yet. 8 | * 9 | * Version: 1.0.1 10 | * Release date: 28-10-2020 11 | * Last update:01-12-2020 12 | * 13 | * Changes in 1.0.1: Compatibility with PowerSys lib 1.1.1 14 | * 15 | * URL: https://github.com/MartinStokroos/openMicroInverter 16 | * 17 | * License: MIT License 18 | * 19 | * Copyright (c) M.Stokroos 2019 20 | * 21 | * 22 | * 23 | * This sketch has been tested with the openMicroInverter_dev hardware. 24 | * 25 | */ 26 | 27 | #include // library for high performance digital reads and writes by jrraines 28 | // see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267553811/0 29 | // and http://code.google.com/p/digitalwritefast/ 30 | 31 | #include // https://github.com/MartinStokroos/TrueRMS 32 | #include // https://github.com/MartinStokroos/openMicroInverter 33 | #include // https://github.com/MartinStokroos/fastCORDIC 34 | 35 | // H-bridge switching mode: 36 | #define UNIPOL // unipolar switching 37 | //#define BIPOL // bipolar switching 38 | //#define HYBRID // bipolar switching, bottom H-bridge=LF. LF+PWM dive. Not working correctly yet... 39 | 40 | #define LPPERIOD 10000 // main loop period time in us. In this case 100Hz. 41 | #define RMSWINDOW 40 // RMS window, number of samples used for the RMS calculation. 42 | #define PHINC 143166L // phase increment for +0.5Hz 43 | #define GRID_UNDERVOLT 500 // mains under voltage detection threshold value (CORDIC amplitude, not RMS!) 44 | 45 | #define PIN_LED 13 // PLL locking status indicator LED 46 | #define PIN_H_PWMA 9 // Timer1 OCR1A 10-bit PWM 47 | #define PIN_H_PWMB 10 // Timer1 OCR1B 10-bit PWM 48 | #define PIN_H_AHI 3 // H-bridge control pin 49 | #define PIN_H_BHI 11 // H-bridge control pin 50 | #define PIN_H_DIS 8 // enable inverter 51 | #define PIN_GRID_RELAY 2 // output relay 52 | #define PIN_DEBUG 4 // debugging output pin 53 | //#define PIN_ANCREF 6 // AN comparator reference input 54 | //#define PIN_ANCIN 7 // AN comparator input for ZCD 55 | 56 | // input scaling calibration 57 | const float gridVoltRange = 660.0; // Vp-p full scale 58 | const float outputVoltRange = 660.0; // Vp-p full scale 59 | const float outputCurrRange = 4.5; // Ap-p full scale 60 | const float vBattRange = 5.00; // Vbatt max, not scaled yet 61 | const float iBattRange = 5.00; // Ibatt, not scaled yet 62 | const float potmeterRange = 1024; // debug potmeter for phase setting range. Increase or decrease the range here. 63 | 64 | // ADC vars 65 | volatile int adcVal; 66 | volatile int adcMuxIdx = 0; // multiplexer index 67 | volatile int vGridIqIdx = 0; 68 | volatile int refIqsIdx = 0; 69 | volatile int refInstVal; 70 | 71 | // PWM DAC 72 | unsigned int ndac_out; // DAC magnitude value 73 | unsigned int pdac_out; 74 | int dac_out; 75 | 76 | // DDS 77 | const float TD = 1/6000.0; //time step for f=6000 Hz 78 | const float f0 = 50.0; // output frequency in Hz 79 | const float f_min = 49.8; //minimal output frequency in Hz. 80 | long phaseIncrement; 81 | 82 | // PLL vars 83 | volatile int U0, U1, U2, U3; //IQ sampling vars 84 | volatile int V0, V1, V2, V3; 85 | volatile int M0, M1, M2, M3; //IQ sampling vars 86 | volatile int N0, N1, N2, N3; 87 | int XG, YG, XR, YR; 88 | unsigned int gridCordicPhase, prevGridCordicPhase; 89 | unsigned int cordicAmplitude; 90 | unsigned int refCordicPhase, prevRefCordicPhase; 91 | int deltaGridPhase, deltaRefPhase; 92 | int extendedGridPhase, extendedRefPhase; 93 | int rateError, phaseError; 94 | long deltaPhase; 95 | unsigned long phaseOffset = 265289728; //phase offset between rfbk and rsin 96 | cordic10 gridCordic; 97 | cordic10 refCordic; 98 | bool mains_present; 99 | unsigned char pll_lock_cnt=0; 100 | bool pll_locked; 101 | 102 | // create instances for ac/dc voltage, current and power metering and DDS 103 | Rms2 gridVolt; 104 | Power2 outputMeasurements; 105 | //Average vBatt; 106 | //Average iBatt; 107 | Average potmeter; //debug control potmeter 108 | PowerControl outputWave; 109 | volatile boolean inv_enable = true; 110 | volatile boolean grid_conn = false; 111 | 112 | unsigned long nextLoop; 113 | int taskIdx=0; 114 | 115 | //function prototypes 116 | void io_update(void); 117 | 118 | 119 | 120 | // ****************************************************************** 121 | // Setup 122 | // ****************************************************************** 123 | void setup(){ 124 | cli(); // enable interrupts 125 | 126 | // initialize serial communications: 127 | Serial.begin(115200); 128 | pinMode(PIN_LED, OUTPUT); 129 | pinMode(PIN_H_PWMA, OUTPUT); 130 | pinMode(PIN_H_PWMB, OUTPUT); 131 | pinMode(PIN_H_AHI, OUTPUT); 132 | pinMode(PIN_H_BHI, OUTPUT); 133 | pinMode(PIN_GRID_RELAY, OUTPUT); 134 | pinMode(PIN_H_DIS, OUTPUT); 135 | pinMode(PIN_DEBUG, OUTPUT); 136 | 137 | // initialize ADC for continuous sampling mode 138 | DIDR0 = 0x3F; // digital inputs disabled for ADC0D to ADC5D 139 | bitSet(ADMUX, REFS0); // Select Vcc=5V as the ADC reference voltage 140 | bitClear(ADMUX, REFS1); 141 | bitClear(ADMUX, MUX0); // selecting ADC CH# 0 142 | bitClear(ADMUX, MUX1); 143 | bitClear(ADMUX, MUX2); 144 | bitClear(ADMUX, MUX3); 145 | bitSet(ADCSRA, ADEN); // AD-converter enabled 146 | bitSet(ADCSRA, ADATE); // auto-trigger enabled 147 | bitSet(ADCSRA, ADIE); // ADC interrupt enabled 148 | 149 | bitClear(ADCSRA, ADPS0); // ADC clock prescaler set to 64 (250kHz) 150 | bitSet(ADCSRA, ADPS1); 151 | bitSet(ADCSRA, ADPS2); 152 | 153 | bitClear(ADCSRB, ACME); // Analog Comparator (ADC)Multiplexer enable OFF 154 | bitClear(ADCSRB, ADTS0); // triggered by Timer/Counter1 Overflow 155 | bitSet(ADCSRB, ADTS1); 156 | bitSet(ADCSRB, ADTS2); 157 | bitSet(ADCSRA, ADSC); // start conversion 158 | 159 | /* TIMER1 configured for phase and frequency correct PWM-mode 8, top=ICR1 */ 160 | // prescaler = 1: 161 | bitSet(TCCR1B, CS10); 162 | bitClear(TCCR1B, CS11); 163 | bitClear(TCCR1B, CS12); 164 | // mode 8: 165 | bitClear(TCCR1A, WGM10); 166 | bitClear(TCCR1A, WGM11); 167 | bitClear(TCCR1B, WGM12); 168 | bitSet(TCCR1B, WGM13); 169 | // top value. f_TIM1 = fclk/(2*N*TOP) 170 | ICR1 = 0x0535; //0x0536, f=6kHz, min 0x03FF; 171 | 172 | #ifdef UNIPOL 173 | #define ICR1_OFFSET 0x09B; 174 | digitalWriteFast(PIN_H_AHI, HIGH); 175 | digitalWriteFast(PIN_H_BHI, HIGH); 176 | bitClear(TCCR1A, COM1A0); // Compare Match PWM 10 177 | bitSet(TCCR1A, COM1A1); 178 | bitClear(TCCR1A, COM1B0); // Compare Match PWM 9 179 | bitSet(TCCR1A, COM1B1); 180 | #endif 181 | 182 | #ifdef BIPOL 183 | #define ICR1_OFFSET 0x09B; 184 | digitalWriteFast(PIN_H_AHI, HIGH); 185 | digitalWriteFast(PIN_H_BHI, HIGH); 186 | bitClear(TCCR1A, COM1A0); // Compare Match PWM 10 187 | bitSet(TCCR1A, COM1A1); 188 | bitSet(TCCR1A, COM1B0); // Compare Match PWM9, inverted 189 | bitSet(TCCR1A, COM1B1); 190 | #endif 191 | 192 | #ifdef HYBRID 193 | #define ICR1_OFFSET 0x09B; 194 | digitalWriteFast(PIN_H_AHI, LOW); 195 | digitalWriteFast(PIN_H_BHI, LOW); 196 | bitSet(TCCR1A, COM1A0); // Compare Match PWM 10 197 | bitSet(TCCR1A, COM1A1); 198 | bitSet(TCCR1A, COM1B0); // Compare Match PWM 9 199 | bitSet(TCCR1A, COM1B1); 200 | #endif 201 | 202 | // enable timer compare interrupt 203 | bitSet(TIMSK1, TOIE1); // enable Timer1 Interrupt 204 | 205 | gridVolt.begin(gridVoltRange, RMSWINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 206 | outputMeasurements.begin(outputCurrRange, outputVoltRange, RMSWINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 207 | //vBatt.begin(vBattRange, RMSWINDOW, ADC_10BIT, CNT_SCAN); 208 | //iBatt.begin(iBattRange, RMSWINDOW, ADC_10BIT, CNT_SCAN); 209 | potmeter.begin(potmeterRange, RMSWINDOW, ADC_10BIT, CNT_SCAN); 210 | gridVolt.start(); 211 | outputMeasurements.start(); 212 | //vBatt.start(); 213 | //iBatt.start(); 214 | potmeter.start(); 215 | 216 | outputWave.osgBegin(f_min, TD); // initilize the DDS (frequency, startphase, timestep) 217 | 218 | Serial.println("grid_phase inverter_phase"); //Arduino plotter legend. For this experiment only phase information output is printed. 219 | 220 | sei(); // enable interrupts 221 | nextLoop = micros() + LPPERIOD; // Set the loop timer variable for the next loop interval. 222 | } 223 | 224 | 225 | 226 | 227 | // ****************************************************************** 228 | // Main loop 229 | // ****************************************************************** 230 | void loop(){ 231 | //digitalWriteFast(PIN_DEBUG, HIGH); 232 | 233 | gridVolt.publish(); //publish results at the loop-rate 234 | outputMeasurements.publish(); 235 | //vBatt.publish(); 236 | //iBatt.publish(); 237 | potmeter.publish(); 238 | 239 | phaseOffset = potmeter.average; 240 | phaseOffset = phaseOffset<<20; 241 | 242 | switch(taskIdx){ //100Hz/5=20Hz 243 | case 0: 244 | XG = U0+U1+U2+U3; // down sample the grid voltage 245 | YG = V0+V1+V2+V3; 246 | XR = M0+M1+M2+M3; // down sample the reference wave 247 | YR = N0+N1+N2+N3; 248 | taskIdx++; 249 | break; 250 | case 1: 251 | //digitalWriteFast(PIN_DEBUG1, HIGH); 252 | gridCordic.atan2sqrt(XG, YG); 253 | //digitalWriteFast(PIN_DEBUG1, LOW); 254 | gridCordicPhase = gridCordic.angle; 255 | cordicAmplitude = gridCordic.radius; 256 | //OCR0B = gridCordicPhase; // debug pwm output pin5 257 | taskIdx++; 258 | break; 259 | case 2: 260 | refCordic.atan2sqrt(XR, YR); 261 | refCordicPhase = refCordic.angle; 262 | taskIdx++; 263 | break; 264 | case 3: 265 | deltaGridPhase = gridCordicPhase - prevGridCordicPhase; 266 | prevGridCordicPhase = gridCordicPhase; 267 | extendedGridPhase += deltaGridPhase; 268 | deltaRefPhase = refCordicPhase - prevRefCordicPhase; 269 | prevRefCordicPhase = refCordicPhase; 270 | extendedRefPhase += deltaRefPhase; 271 | taskIdx++; 272 | break; 273 | case 4: //pll-control (when grid is available) 274 | //rateError = deltaRefPhase - deltaGridPhase; 275 | phaseError = refCordicPhase - gridCordicPhase; 276 | deltaPhase = extendedRefPhase - extendedGridPhase; //for absolute phase control 277 | if(cordicAmplitude >= GRID_UNDERVOLT){ //controller on, above minimum grid voltage 278 | mains_present = true; 279 | if (deltaPhase >= 2000) {deltaPhase = 2000;} // clamp the integral to limit max frequency droop 280 | if (deltaPhase <= -2000) {deltaPhase = -2000;} 281 | //phaseIncrement = PHINC + 1024*round(potmeter.average - 512); // open loop manual control of output phase 282 | phaseIncrement = PHINC + 32*deltaPhase; // closed loop 283 | } 284 | else { 285 | phaseIncrement = PHINC; //increment for default 49.8Hz+0.2Hz=50.0Hz 286 | mains_present = false; 287 | } 288 | if( (phaseError > -2048)&&(phaseError < 2048) ) { pll_locked = true; } 289 | else { pll_locked = false; } 290 | 291 | Serial.print(gridCordicPhase); 292 | Serial.print(" "); 293 | Serial.println(refCordicPhase); 294 | 295 | taskIdx = 0; 296 | break; 297 | } 298 | 299 | //Serial.print(round(gridVolt.rmsVal)); 300 | //Serial.print(", "); 301 | //Serial.print(round(outputMeasurements.rmsVal2)); // print the RMS output voltage 302 | //Serial.print(", "); 303 | //Serial.print(outputMeasurements.rmsVal1, 1); // print the RMS output current 304 | //Serial.print(", "); 305 | //Serial.print(round(outputMeasurements.apparentPwr)); // print power output VA's 306 | //Serial.print(", "); 307 | //Serial.print(round(outputMeasurements.realPwr)); // print power output Watts 308 | //Serial.print(", "); 309 | //Serial.print(vBatt.average, 1); 310 | //Serial.print(", "); 311 | //Serial.print(iBatt.average, 1); 312 | //Serial.println(); 313 | 314 | // update IO-pin status 315 | io_update(); 316 | 317 | //digitalWriteFast(PIN_DEBUG, LOW); 318 | 319 | while(nextLoop > micros()) {;} // wait until the end of the time interval 320 | nextLoop += LPPERIOD; // set next loop time at current time + LOOP_PERIOD 321 | } 322 | 323 | 324 | 325 | 326 | 327 | 328 | // ****************************************************************** 329 | // Update digital-IO's by direct write (fast!) 330 | // ****************************************************************** 331 | void io_update(void) { 332 | if(inv_enable) {digitalWriteFast(PIN_H_DIS, LOW);} 333 | else {digitalWriteFast(PIN_H_DIS, HIGH);} 334 | 335 | if(grid_conn) {digitalWriteFast(PIN_GRID_RELAY, HIGH);} 336 | else {digitalWriteFast(PIN_GRID_RELAY, LOW);} 337 | 338 | if (pll_locked) {digitalWriteFast(PIN_LED, HIGH);} 339 | else {digitalWriteFast(PIN_LED, LOW);} 340 | } // end of io_update 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | /* ****************************************************************** 349 | * ADC ISR. ADC is triggered by Timer1. 350 | * *******************************************************************/ 351 | ISR(ADC_vect){ 352 | digitalWriteFast(PIN_DEBUG, HIGH); 353 | // read the current ADC input channel 354 | adcVal=ADCL; // store low byte 355 | adcVal+=ADCH<<8; // store high byte 356 | 357 | switch (adcMuxIdx) { 358 | case 0: 359 | //time slot for sampling the grid voltage 360 | gridVolt.update(adcVal); 361 | refInstVal = outputWave.rfbk; // sample the reference wave and control the inverter output phase with the potmeter, or.. (under case 2:) 362 | break; 363 | 364 | case 1: 365 | //time slot for sampling the inverter current 366 | outputMeasurements.update1(adcVal); 367 | break; 368 | 369 | case 2: 370 | //time slot for sampling the inverter voltage 371 | outputMeasurements.update2(adcVal); 372 | //refInstVal = outputMeasurements.instVal2; // sample the inverter output voltage. Inverter output locks to the grid voltage. 373 | break; 374 | 375 | case 3: 376 | // time slot for sampling the battery current 377 | //iBatt.update(adcVal); 378 | 379 | // Do do the grid voltage IQ-down sampling here to spread the computing burden: 380 | // multiply and sum samples with sequence 1 0 -1 0 for I channel 381 | // multiply and sum samples with sequence 0 1 0 -1 for Q channel 382 | if (vGridIqIdx == 0){ 383 | U3=U2; U2=U1; U1=U0; U0=gridVolt.instVal; 384 | V3=V2; V2=V1; V1=V0; V0=0; 385 | } 386 | if (vGridIqIdx == 5){ 387 | U3=U2; U2=U1; U1=U0; U0=0; 388 | V3=V2; V2=V1; V1=V0; V0=gridVolt.instVal; 389 | } 390 | if (vGridIqIdx == 10){ 391 | U3=U2; U2=U1; U1=U0; U0=-gridVolt.instVal; 392 | V3=V2; V2=V1; V1=V0; V0=0; 393 | } 394 | if (vGridIqIdx == 15){ 395 | U3=U2; U2=U1; U1=U0; U0=0; 396 | V3=V2; V2=V1; V1=V0; V0=-gridVolt.instVal; 397 | } 398 | vGridIqIdx++; 399 | if(vGridIqIdx == 20) { vGridIqIdx = 0; } 400 | break; 401 | 402 | case 4: 403 | // time slot for sampling the battery voltage 404 | //vBatt.update(adcVal); 405 | break; 406 | 407 | case 5: 408 | // sample the potentiometer voltage 409 | potmeter.update(adcVal); // sample the debug potmeter voltage 410 | 411 | // Do do the grid voltage IQ-down sampling here to spread the computing burden: 412 | // multiply and sum samples with sequence 1 0 -1 0 for I channel 413 | // multiply and sum samples with sequence 0 1 0 -1 for Q channel 414 | if (refIqsIdx == 0) { 415 | M3=M2; M2=M1; M1=M0; M0=refInstVal; 416 | N3=N2; N2=N1; N1=N0; N0=0; 417 | } 418 | if (refIqsIdx == 5) { 419 | M3=M2; M2=M1; M1=M0; M0=0; 420 | N3=N2; N2=N1; N1=N0; N0=refInstVal; 421 | } 422 | if (refIqsIdx == 10) { 423 | M3=M2; M2=M1; M1=M0; M0=-refInstVal; 424 | N3=N2; N2=N1; N1=N0; N0=0; 425 | } 426 | if (refIqsIdx == 15) { 427 | M3=M2; M2=M1; M1=M0; M0=0; 428 | N3=N2; N2=N1; N1=N0; N0=-refInstVal; 429 | } 430 | refIqsIdx++; 431 | if(refIqsIdx == 20) { 432 | refIqsIdx = 0; 433 | } 434 | break; 435 | // default: 436 | } 437 | adcMuxIdx++; 438 | if (adcMuxIdx > 5){ 439 | adcMuxIdx = 0; 440 | } 441 | ADMUX = (ADMUX & B11110000) | adcMuxIdx; // set the ADC-MUX channel for the next call 442 | digitalWriteFast(PIN_DEBUG, LOW); 443 | } 444 | 445 | 446 | 447 | 448 | 449 | /* ****************************************************************** 450 | * Timer1 ISR running at 6000Hz 451 | *********************************************************************/ 452 | ISR(TIMER1_OVF_vect) { 453 | // generate the reference sin wave with DDS. 454 | // the phaseOffset should be frequency dependent otherwise the phase between grid and the reference 455 | // will deviate for frequencies different from 50Hz. 456 | 457 | #ifdef UNIPOL 458 | // complementary sin waves drive both legs in H-bridge. High-side and low-side are PWM-switched. AHI=5V and BHI=5V. 459 | // (see HIP4082 application note; LF switched inverter ALI//BHI (pin4,2) and AHI//BLI (7,3) ) 460 | outputWave.osgMaSlUpdate1(phaseIncrement, phaseOffset); 461 | pdac_out = outputWave.rcos; 462 | ndac_out = (~pdac_out) & 0x3FF; //invert for n-channel. 463 | pdac_out += ICR1_OFFSET; // add offset to center between the BOTTOM to TOP value range of the timer. 464 | ndac_out += ICR1_OFFSET; 465 | // write to PWM output registers A&B (10bit). 466 | OCR1AH = pdac_out>>8; //MSB 467 | OCR1AL = pdac_out; //LSB 468 | //inverted output channel (dead-time correction is inside the H-bridge driver HIP4082): 469 | OCR1BH = ndac_out>>8; //MSB 470 | OCR1BL = ndac_out; //LSB 471 | #endif 472 | 473 | #ifdef BIPOL 474 | outputWave.osgMaSlUpdate1(phaseIncrement, phaseOffset); 475 | dac_out = outputWave.rcos; 476 | // complementary gate drives in both legs of the H-bridge. AHI=5V and BHI=5V. 477 | //dac_out += 0x1FF; 478 | dac_out += ICR1_OFFSET; 479 | OCR1AH = dac_out >> 8; // top 8 bits 480 | OCR1AL = dac_out; //bottom 8 bits 481 | OCR1BH = OCR1AH; //Signal inverted with the output compare setting above. 482 | OCR1BL = OCR1AL; 483 | #endif 484 | 485 | #ifdef HYBRID 486 | outputWave.osgMaSlUpdate2(phaseIncrement, phaseOffset); 487 | dac_out = outputWave.rcos; 488 | // write magnitude data to PWM output registers A&B (10bit). 489 | if (dac_out >= 0) { 490 | digitalWriteFast(PIN_H_AHI, LOW); 491 | digitalWriteFast(PIN_H_BHI, HIGH); 492 | dac_out = dac_out<<1; //times 2 493 | OCR1AH = dac_out>>8; // top 8 bits 494 | OCR1AL = dac_out; // bottom 8 bits 495 | } 496 | else { 497 | digitalWriteFast(PIN_H_BHI, LOW); 498 | digitalWriteFast(PIN_H_AHI, HIGH); 499 | dac_out = (-dac_out)<<1; //times 2 500 | OCR1BH = dac_out>>8; // top 8 bits 501 | OCR1BL = dac_out; // bottom 8 bits 502 | } 503 | #endif 504 | } 505 | -------------------------------------------------------------------------------- /sketches/Inverter3/Inverter3.ino: -------------------------------------------------------------------------------- 1 | #include "Arduino.h" 2 | /* 3 | * File: Inverter3.ino 4 | * Purpose: openMicroInverter example project. 5 | * 6 | * This sketch establishes a voltage-mode inverter without output voltage control (open loop). 7 | * It synchronizes the output wave to the grid voltage. Do not connect the inverter output in parallel with 8 | * the grid with this example! There is no current control yet. 9 | * 10 | * Version: 1.0.1 11 | * Release date: 30-10-2020 12 | * Last update: 01-12-2020 13 | * 14 | * URL: https://github.com/MartinStokroos/openMicroInverter 15 | * 16 | * License: MIT License 17 | * 18 | * Copyright (c) M.Stokroos 2019 19 | * 20 | * 21 | * 22 | * This sketch has been tested with the openMicroInverter_dev hardware. 23 | * 24 | */ 25 | 26 | #include // library for high performance digital reads and writes by jrraines 27 | // see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267553811/0 28 | // and http://code.google.com/p/digitalwritefast/ 29 | 30 | #include // https://github.com/MartinStokroos/TrueRMS 31 | #include // https://github.com/MartinStokroos/openMicroInverter 32 | #include // https://github.com/MartinStokroos/fastCORDIC 33 | 34 | // H-bridge switching mode: 35 | #define UNIPOL // unipolar switching 36 | //#define BIPOL // bipolar switching 37 | //#define HYBRID // bipolar switching, bottom H-bridge=LF. LF+PWM dive. Not working correctly yet... 38 | 39 | #define LPPERIOD 10000 // main loop period time in us. In this case 100Hz. 40 | #define RMSWINDOW 40 // RMS window, number of samples used for the RMS calculation. 41 | #define PHINC 143166L // phase increment for +0.5Hz 42 | #define GRID_UNDERVOLT 500 // mains under voltage detection threshold value (CORDIC amplitude, not RMS!) 43 | 44 | #define PIN_LED 13 // PLL locking status indicator LED 45 | #define PIN_H_PWMA 9 // Timer1 OCR1A 10-bit PWM 46 | #define PIN_H_PWMB 10 // Timer1 OCR1B 10-bit PWM 47 | #define PIN_H_AHI 3 // H-bridge control pin 48 | #define PIN_H_BHI 11 // H-bridge control pin 49 | #define PIN_H_DIS 8 // enable inverter 50 | #define PIN_GRID_RELAY 2 // output relay 51 | #define PIN_DEBUG 4 // debugging output pin 52 | //#define PIN_ANCREF 6 // AN comparator reference input 53 | //#define PIN_ANCIN 7 // AN comparator input for ZCD 54 | 55 | // input scaling calibration 56 | const float gridVoltRange = 660.0; // Vp-p full scale 57 | const float outputVoltRange = 660.0; // Vp-p full scale 58 | const float outputCurrRange = 4.5; // Ap-p full scale 59 | const float vBattRange = 5.00; // Vbatt max, not scaled yet 60 | const float iBattRange = 5.00; // Ibatt, not scaled yet 61 | const float potmeterRange = 1024; // debug potmeter for phase setting range. Increase or decrease the range here. 62 | 63 | // ADC vars 64 | volatile int adcVal; 65 | volatile int adcMuxIdx = 0; // multiplexer index 66 | volatile int vGridIqIdx = 0; 67 | volatile int refIqsIdx = 0; 68 | volatile int refInstVal; 69 | 70 | // PWM DAC 71 | unsigned int ndac_out; // DAC magnitude value 72 | unsigned int pdac_out; 73 | int dac_out; 74 | 75 | // DDS 76 | const float TD = 1/6000.0; //time step for f=6000 Hz 77 | const float f0 = 50.0; // output frequency in Hz 78 | const float f_min = 49.8; //minimal output frequency in Hz. 79 | long phaseIncrement; 80 | 81 | // PLL vars 82 | volatile int U0, U1, U2, U3; //IQ sampling vars 83 | volatile int V0, V1, V2, V3; 84 | volatile int M0, M1, M2, M3; //IQ sampling vars 85 | volatile int N0, N1, N2, N3; 86 | int XG, YG, XR, YR; 87 | unsigned int gridCordicPhase, prevGridCordicPhase; 88 | unsigned int cordicAmplitude; 89 | unsigned int refCordicPhase, prevRefCordicPhase; 90 | int deltaGridPhase, deltaRefPhase; 91 | int extendedGridPhase, extendedRefPhase; 92 | int rateError, phaseError; 93 | long deltaPhase; 94 | cordic10 gridCordic; 95 | cordic10 refCordic; 96 | bool mains_present; 97 | unsigned char pll_lock_cnt=0; 98 | bool pll_locked; 99 | 100 | // create instances for ac/dc voltage, current and power metering and DDS 101 | Rms2 gridVolt; 102 | Power2 outputMeasurements; 103 | //Average vBatt; 104 | //Average iBatt; 105 | Average potmeter; //debug control potmeter 106 | PowerControl outputWave; 107 | volatile boolean inv_enable = true; 108 | volatile boolean grid_conn = false; 109 | 110 | unsigned long nextLoop; 111 | int taskIdx=0; 112 | 113 | //function prototypes 114 | void io_update(void); 115 | 116 | 117 | 118 | // ****************************************************************** 119 | // Setup 120 | // ****************************************************************** 121 | void setup(){ 122 | cli(); // enable interrupts 123 | 124 | // initialize serial communications: 125 | Serial.begin(115200); 126 | pinMode(PIN_LED, OUTPUT); 127 | pinMode(PIN_H_PWMA, OUTPUT); 128 | pinMode(PIN_H_PWMB, OUTPUT); 129 | pinMode(PIN_H_AHI, OUTPUT); 130 | pinMode(PIN_H_BHI, OUTPUT); 131 | pinMode(PIN_GRID_RELAY, OUTPUT); 132 | pinMode(PIN_H_DIS, OUTPUT); 133 | pinMode(PIN_DEBUG, OUTPUT); 134 | 135 | // initialize ADC for continuous sampling mode 136 | DIDR0 = 0x3F; // digital inputs disabled for ADC0D to ADC5D 137 | bitSet(ADMUX, REFS0); // Select Vcc=5V as the ADC reference voltage 138 | bitClear(ADMUX, REFS1); 139 | bitClear(ADMUX, MUX0); // selecting ADC CH# 0 140 | bitClear(ADMUX, MUX1); 141 | bitClear(ADMUX, MUX2); 142 | bitClear(ADMUX, MUX3); 143 | bitSet(ADCSRA, ADEN); // AD-converter enabled 144 | bitSet(ADCSRA, ADATE); // auto-trigger enabled 145 | bitSet(ADCSRA, ADIE); // ADC interrupt enabled 146 | 147 | bitClear(ADCSRA, ADPS0); // ADC clock prescaler set to 64 (250kHz) 148 | bitSet(ADCSRA, ADPS1); 149 | bitSet(ADCSRA, ADPS2); 150 | 151 | bitClear(ADCSRB, ACME); // Analog Comparator (ADC)Multiplexer enable OFF 152 | bitClear(ADCSRB, ADTS0); // triggered by Timer/Counter1 Overflow 153 | bitSet(ADCSRB, ADTS1); 154 | bitSet(ADCSRB, ADTS2); 155 | bitSet(ADCSRA, ADSC); // start conversion 156 | 157 | /* TIMER1 configured for phase and frequency correct PWM-mode 8, top=ICR1 */ 158 | // prescaler = 1: 159 | bitSet(TCCR1B, CS10); 160 | bitClear(TCCR1B, CS11); 161 | bitClear(TCCR1B, CS12); 162 | // mode 8: 163 | bitClear(TCCR1A, WGM10); 164 | bitClear(TCCR1A, WGM11); 165 | bitClear(TCCR1B, WGM12); 166 | bitSet(TCCR1B, WGM13); 167 | // top value. f_TIM1 = fclk/(2*N*TOP) 168 | ICR1 = 0x0535; //0x0536, f=6kHz, min 0x03FF; 169 | 170 | #ifdef UNIPOL 171 | #define ICR1_OFFSET 0x09B; 172 | digitalWriteFast(PIN_H_AHI, HIGH); 173 | digitalWriteFast(PIN_H_BHI, HIGH); 174 | bitClear(TCCR1A, COM1A0); // Compare Match PWM 10 175 | bitSet(TCCR1A, COM1A1); 176 | bitClear(TCCR1A, COM1B0); // Compare Match PWM 9 177 | bitSet(TCCR1A, COM1B1); 178 | #endif 179 | 180 | #ifdef BIPOL 181 | #define ICR1_OFFSET 0x09B; 182 | digitalWriteFast(PIN_H_AHI, HIGH); 183 | digitalWriteFast(PIN_H_BHI, HIGH); 184 | bitClear(TCCR1A, COM1A0); // Compare Match PWM 10 185 | bitSet(TCCR1A, COM1A1); 186 | bitSet(TCCR1A, COM1B0); // Compare Match PWM9, inverted 187 | bitSet(TCCR1A, COM1B1); 188 | #endif 189 | 190 | #ifdef HYBRID 191 | #define ICR1_OFFSET 0x09B; 192 | digitalWriteFast(PIN_H_AHI, LOW); 193 | digitalWriteFast(PIN_H_BHI, LOW); 194 | bitSet(TCCR1A, COM1A0); // Compare Match PWM 10 195 | bitSet(TCCR1A, COM1A1); 196 | bitSet(TCCR1A, COM1B0); // Compare Match PWM 9 197 | bitSet(TCCR1A, COM1B1); 198 | #endif 199 | 200 | // enable timer compare interrupt 201 | bitSet(TIMSK1, TOIE1); // enable Timer1 Interrupt 202 | 203 | gridVolt.begin(gridVoltRange, RMSWINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 204 | outputMeasurements.begin(outputCurrRange, outputVoltRange, RMSWINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 205 | //vBatt.begin(vBattRange, RMSWINDOW, ADC_10BIT, CNT_SCAN); 206 | //iBatt.begin(iBattRange, RMSWINDOW, ADC_10BIT, CNT_SCAN); 207 | potmeter.begin(potmeterRange, RMSWINDOW, ADC_10BIT, CNT_SCAN); 208 | gridVolt.start(); 209 | outputMeasurements.start(); 210 | //vBatt.start(); 211 | //iBatt.start(); 212 | potmeter.start(); 213 | 214 | outputWave.osgBegin(f_min, TD); // initilize the DDS (frequency, startphase, timestep) 215 | 216 | Serial.println("grid_phase inverter_phase"); //Arduino plotter legend. For this experiment only phase information output is printed. 217 | 218 | sei(); // enable interrupts 219 | nextLoop = micros() + LPPERIOD; // Set the loop timer variable for the next loop interval. 220 | } 221 | 222 | 223 | 224 | 225 | // ****************************************************************** 226 | // Main loop 227 | // ****************************************************************** 228 | void loop(){ 229 | //digitalWriteFast(PIN_DEBUG, HIGH); 230 | 231 | gridVolt.publish(); //publish results at the loop-rate 232 | outputMeasurements.publish(); 233 | //vBatt.publish(); 234 | //iBatt.publish(); 235 | potmeter.publish(); 236 | //x = potmeter.average; 237 | 238 | switch(taskIdx){ //100Hz/5=20Hz 239 | case 0: 240 | XG = U0+U1+U2+U3; // down sample the grid voltage 241 | YG = V0+V1+V2+V3; 242 | XR = M0+M1+M2+M3; // down sample the reference wave 243 | YR = N0+N1+N2+N3; 244 | taskIdx++; 245 | break; 246 | case 1: 247 | //digitalWriteFast(PIN_DEBUG1, HIGH); 248 | gridCordic.atan2sqrt(XG, YG); 249 | //digitalWriteFast(PIN_DEBUG1, LOW); 250 | gridCordicPhase = gridCordic.angle; 251 | cordicAmplitude = gridCordic.radius; 252 | //OCR0B = gridCordicPhase; // debug pwm output pin5 253 | taskIdx++; 254 | break; 255 | case 2: 256 | refCordic.atan2sqrt(XR, YR); 257 | refCordicPhase = refCordic.angle; 258 | taskIdx++; 259 | break; 260 | case 3: 261 | deltaGridPhase = gridCordicPhase - prevGridCordicPhase; 262 | prevGridCordicPhase = gridCordicPhase; 263 | extendedGridPhase += deltaGridPhase; 264 | deltaRefPhase = refCordicPhase - prevRefCordicPhase; 265 | prevRefCordicPhase = refCordicPhase; 266 | extendedRefPhase += deltaRefPhase; 267 | taskIdx++; 268 | break; 269 | case 4: //PLL-control (when grid is present) 270 | //rateError = deltaRefPhase - deltaGridPhase; 271 | phaseError = refCordicPhase - gridCordicPhase; 272 | deltaPhase = extendedRefPhase - extendedGridPhase; //for absolute phase control 273 | if(cordicAmplitude >= GRID_UNDERVOLT){ //controller on, above minimum grid voltage 274 | mains_present = true; 275 | if (deltaPhase >= 2000) {deltaPhase = 2000;} // clamp the integral to limit max frequency droop 276 | if (deltaPhase <= -2000) {deltaPhase = -2000;} 277 | //phaseIncrement = PHINC + 1024*round(potmeter.average - 512); // open loop manual control of output phase 278 | phaseIncrement = PHINC + 32*deltaPhase; // closed loop 279 | } 280 | else { 281 | phaseIncrement = PHINC; //increment for default 49.8Hz+0.2Hz=50.0Hz 282 | mains_present = false; 283 | } 284 | if( (phaseError > -2048)&&(phaseError < 2048) ) { pll_locked = true; } 285 | else { pll_locked = false; } 286 | 287 | Serial.print(gridCordicPhase); 288 | Serial.print(" "); 289 | Serial.println(refCordicPhase); 290 | 291 | taskIdx = 0; 292 | break; 293 | } 294 | 295 | //Serial.print(round(gridVolt.rmsVal)); 296 | //Serial.print(", "); 297 | //Serial.print(round(outputMeasurements.rmsVal2)); // print the RMS output voltage 298 | //Serial.print(", "); 299 | //Serial.print(outputMeasurements.rmsVal1, 1); // print the RMS output current 300 | //Serial.print(", "); 301 | //Serial.print(round(outputMeasurements.apparentPwr)); // print power output VA's 302 | //Serial.print(", "); 303 | //Serial.print(round(outputMeasurements.realPwr)); // print power output Watts 304 | //Serial.print(", "); 305 | //Serial.print(vBatt.average, 1); 306 | //Serial.print(", "); 307 | //Serial.print(iBatt.average, 1); 308 | //Serial.println(); 309 | 310 | // update IO-pin status 311 | io_update(); 312 | 313 | //digitalWriteFast(PIN_DEBUG, LOW); 314 | 315 | while(nextLoop > micros()) {;} // wait until the end of the time interval 316 | nextLoop += LPPERIOD; // set next loop time at current time + LOOP_PERIOD 317 | } 318 | 319 | 320 | 321 | 322 | 323 | 324 | // ****************************************************************** 325 | // Update digital-IO's by direct write (fast!) 326 | // ****************************************************************** 327 | void io_update(void) { 328 | if(inv_enable) {digitalWriteFast(PIN_H_DIS, LOW);} 329 | else {digitalWriteFast(PIN_H_DIS, HIGH);} 330 | 331 | if(grid_conn) {digitalWriteFast(PIN_GRID_RELAY, HIGH);} 332 | else {digitalWriteFast(PIN_GRID_RELAY, LOW);} 333 | 334 | if (pll_locked) {digitalWriteFast(PIN_LED, HIGH);} 335 | else {digitalWriteFast(PIN_LED, LOW);} 336 | } // end of io_update 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | /* ****************************************************************** 345 | * ADC ISR. ADC is triggered by Timer1. 346 | * *******************************************************************/ 347 | ISR(ADC_vect){ 348 | digitalWriteFast(PIN_DEBUG, HIGH); 349 | // read the current ADC input channel 350 | adcVal=ADCL; // store low byte 351 | adcVal+=ADCH<<8; // store high byte 352 | 353 | switch (adcMuxIdx) { 354 | case 0: 355 | //time slot for sampling the grid voltage 356 | gridVolt.update(adcVal); 357 | break; 358 | 359 | case 1: 360 | //time slot for sampling the inverter current 361 | outputMeasurements.update1(adcVal); 362 | break; 363 | 364 | case 2: 365 | //time slot for sampling the inverter voltage 366 | outputMeasurements.update2(adcVal); 367 | refInstVal = outputMeasurements.instVal2; // ..sample the inverter output voltage. Inverter output locks to the grid voltage. 368 | break; 369 | 370 | case 3: 371 | // time slot for sampling the battery current 372 | //iBatt.update(adcVal); 373 | 374 | // Do do the grid voltage IQ-down sampling here to spread the computing burden: 375 | // multiply and sum samples with sequence 1 0 -1 0 for I channel 376 | // multiply and sum samples with sequence 0 1 0 -1 for Q channel 377 | if (vGridIqIdx == 0){ 378 | U3=U2; U2=U1; U1=U0; U0=gridVolt.instVal; 379 | V3=V2; V2=V1; V1=V0; V0=0; 380 | } 381 | if (vGridIqIdx == 5){ 382 | U3=U2; U2=U1; U1=U0; U0=0; 383 | V3=V2; V2=V1; V1=V0; V0=gridVolt.instVal; 384 | } 385 | if (vGridIqIdx == 10){ 386 | U3=U2; U2=U1; U1=U0; U0=-gridVolt.instVal; 387 | V3=V2; V2=V1; V1=V0; V0=0; 388 | } 389 | if (vGridIqIdx == 15){ 390 | U3=U2; U2=U1; U1=U0; U0=0; 391 | V3=V2; V2=V1; V1=V0; V0=-gridVolt.instVal; 392 | } 393 | vGridIqIdx++; 394 | if(vGridIqIdx == 20) { vGridIqIdx = 0; } 395 | break; 396 | 397 | case 4: 398 | // time slot for sampling the battery voltage 399 | //vBatt.update(adcVal); 400 | break; 401 | 402 | case 5: 403 | // sample the potentiometer voltage 404 | potmeter.update(adcVal); // sample the debug potmeter voltage 405 | 406 | // Do do the grid voltage IQ-down sampling here to spread the computing burden: 407 | // multiply and sum samples with sequence 1 0 -1 0 for I channel 408 | // multiply and sum samples with sequence 0 1 0 -1 for Q channel 409 | if (refIqsIdx == 0) { 410 | M3=M2; M2=M1; M1=M0; M0=refInstVal; 411 | N3=N2; N2=N1; N1=N0; N0=0; 412 | } 413 | if (refIqsIdx == 5) { 414 | M3=M2; M2=M1; M1=M0; M0=0; 415 | N3=N2; N2=N1; N1=N0; N0=refInstVal; 416 | } 417 | if (refIqsIdx == 10) { 418 | M3=M2; M2=M1; M1=M0; M0=-refInstVal; 419 | N3=N2; N2=N1; N1=N0; N0=0; 420 | } 421 | if (refIqsIdx == 15) { 422 | M3=M2; M2=M1; M1=M0; M0=0; 423 | N3=N2; N2=N1; N1=N0; N0=-refInstVal; 424 | } 425 | refIqsIdx++; 426 | if(refIqsIdx == 20) { 427 | refIqsIdx = 0; 428 | } 429 | break; 430 | // default: 431 | } 432 | adcMuxIdx++; 433 | if (adcMuxIdx > 5){ 434 | adcMuxIdx = 0; 435 | } 436 | ADMUX = (ADMUX & B11110000) | adcMuxIdx; // set the ADC-MUX channel for the next call 437 | digitalWriteFast(PIN_DEBUG, LOW); 438 | } 439 | 440 | 441 | 442 | 443 | /* ****************************************************************** 444 | * Timer1 ISR running at 6000Hz 445 | *********************************************************************/ 446 | ISR(TIMER1_OVF_vect) { 447 | // generate the reference sin wave with DDS. 448 | // the phaseOffset should be frequency dependent otherwise the phase between grid and the reference 449 | // will deviate for frequencies different from 50Hz. 450 | 451 | #ifdef UNIPOL 452 | // complementary sin waves drive both legs in H-bridge. High-side and low-side are PWM-switched. AHI=5V and BHI=5V. 453 | // (see HIP4082 application note; LF switched inverter ALI//BHI (pin4,2) and AHI//BLI (7,3) ) 454 | outputWave.osgUpdate1(phaseIncrement); 455 | pdac_out = outputWave.rcos; 456 | ndac_out = (~pdac_out) & 0x3FF; //invert for n-channel. 457 | pdac_out += ICR1_OFFSET; // add offset to center between the BOTTOM to TOP value range of the timer. 458 | ndac_out += ICR1_OFFSET; 459 | // write to PWM output registers A&B (10bit). 460 | OCR1AH = pdac_out>>8; //MSB 461 | OCR1AL = pdac_out; //LSB 462 | //inverted output channel (dead-time correction is inside the H-bridge driver HIP4082): 463 | OCR1BH = ndac_out>>8; //MSB 464 | OCR1BL = ndac_out; //LSB 465 | #endif 466 | 467 | #ifdef BIPOL 468 | outputWave.osgMaSlUpdate1(phaseIncrement, 0); 469 | dac_out = outputWave.rcos; 470 | // complementary gate drives in both legs of the H-bridge. AHI=5V and BHI=5V. 471 | //dac_out += 0x1FF; 472 | dac_out += ICR1_OFFSET; 473 | OCR1AH = dac_out >> 8; // top 8 bits 474 | OCR1AL = dac_out; //bottom 8 bits 475 | OCR1BH = OCR1AH; //Signal inverted with the output compare setting above. 476 | OCR1BL = OCR1AL; 477 | #endif 478 | 479 | #ifdef HYBRID 480 | outputWave.osgMaSlUpdate2(phaseIncrement, 0); 481 | dac_out = outputWave.rcos; 482 | // write magnitude data to PWM output registers A&B (10bit). 483 | if (dac_out >= 0) { 484 | digitalWriteFast(PIN_H_AHI, LOW); 485 | digitalWriteFast(PIN_H_BHI, HIGH); 486 | dac_out = dac_out<<1; //times 2 487 | OCR1AH = dac_out>>8; // top 8 bits 488 | OCR1AL = dac_out; // bottom 8 bits 489 | } 490 | else { 491 | digitalWriteFast(PIN_H_BHI, LOW); 492 | digitalWriteFast(PIN_H_AHI, HIGH); 493 | dac_out = (-dac_out)<<1; //times 2 494 | OCR1BH = dac_out>>8; // top 8 bits 495 | OCR1BL = dac_out; // bottom 8 bits 496 | } 497 | #endif 498 | } 499 | -------------------------------------------------------------------------------- /sketches/Metering/Metering.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * File: Metering.ino 4 | * Purpose: openMicroInverter example project demonstrating power and energy metering. 5 | * Version: 1.0.3 6 | * Date: 10-05-2020 7 | * Release date: 07-11-2019 8 | * 9 | * URL: https://github.com/MartinStokroos/openMicroInverter 10 | * 11 | * License: MIT License 12 | * 13 | * Copyright (c) M.Stokroos 2019 14 | * 15 | * 16 | * This sketch has been tested with openMicroInverter_dev hardware. 17 | */ 18 | 19 | #include // library for high performance digital reads and writes by jrraines 20 | // see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267553811/0 21 | // and http://code.google.com/p/digitalwritefast/ 22 | 23 | #include // https://github.com/MartinStokroos/TrueRMS 24 | 25 | 26 | #define PIN_LED 13 27 | #define PIN_DEBUG 4 28 | 29 | #define LPERIOD 50000 // slow control loop period in us. In this case 50ms. 30 | //#define RMS_WINDOW 20 // rms window of 20 samples, means 2 periods @50Hz 31 | #define RMS_WINDOW 40 // rms window of 40 samples, means 4 periods @50Hz 32 | //#define RMS_WINDOW 25 // rms window of 25 samples, means 3 periods @60Hz 33 | //#define RMS_WINDOW 50 // rms window of 50 samples, means 6 periods @60Hz 34 | 35 | //scaling of measured quantities 36 | const float gridVoltRange = 660.0; //Vpeak-to-peak full scale. 37 | const float voltRange = 660.0; //Vpeak-to-peak full scale. 38 | const float currRange = 4.5; //Apeak-to-peak full scale. 39 | 40 | // ADC vars 41 | volatile int adcVal; 42 | volatile int adcMuxIdx = 0; // multiplexer index 43 | 44 | 45 | // define instances of class Rms2 and Power2 46 | Rms2 gridVolt; // create instance of Rms 47 | Power2 acPower; //create instance of Power 48 | 49 | 50 | unsigned long nextLoop; 51 | unsigned char printMuxIdx=0; 52 | char rxByte; 53 | bool publish; 54 | int pubIdx=0; //counter publishing rate 55 | 56 | 57 | 58 | // ****************************************************************** 59 | // Setup 60 | // ****************************************************************** 61 | void setup(){ 62 | cli(); // disable interrupts 63 | 64 | // initialize serial communications: 65 | Serial.begin(115200); 66 | pinMode(PIN_LED, OUTPUT); 67 | pinMode(PIN_DEBUG, OUTPUT); 68 | 69 | // initialize ADC for continuous sampling mode 70 | DIDR0 = 0x3F; // digital inputs disabled for ADC0D to ADC5D 71 | bitSet(ADMUX, REFS0); // Select Vcc=5V as the ADC reference voltage 72 | bitClear(ADMUX, REFS1); 73 | bitClear(ADMUX, MUX0); // selecting ADC CH# 0 74 | bitClear(ADMUX, MUX1); 75 | bitClear(ADMUX, MUX2); 76 | bitClear(ADMUX, MUX3); 77 | bitSet(ADCSRA, ADEN); // AD-converter enabled 78 | bitSet(ADCSRA, ADATE); // auto-trigger enabled 79 | bitSet(ADCSRA, ADIE); // ADC interrupt enabled 80 | 81 | bitClear(ADCSRA, ADPS0); // ADC clock prescaler set to 64 (250kHz). We'll lose some accuracy... 82 | bitSet(ADCSRA, ADPS1); // Timer 1 triggers the ADC. When the conversion is ready, the ADC ISR is called. 83 | bitSet(ADCSRA, ADPS2); // Timer 1 ISR should be ready before the ADC is ready. 84 | 85 | bitClear(ADCSRB, ACME); // Analog Comparator (ADC)Multiplexer enable OFF 86 | bitClear(ADCSRB, ADTS0); // select trigger from timer 1 87 | bitSet(ADCSRB, ADTS1); 88 | bitSet(ADCSRB, ADTS2); 89 | bitSet(ADCSRA, ADSC); // start conversion 90 | 91 | /* TIMER1 configured for phase and frequency correct PWM (mode 8), top=ICR1 */ 92 | bitSet(TCCR1B, CS10); // prescaler=1 93 | bitClear(TCCR1B, CS11); 94 | bitClear(TCCR1B, CS12); 95 | bitClear(TCCR1A, WGM10); // mode 8 96 | bitClear(TCCR1A, WGM11); 97 | bitClear(TCCR1B, WGM12); 98 | bitSet(TCCR1B, WGM13); 99 | // top value. f=fclk/(2*N*TOP) 100 | ICR1 = 0x0535; //f=6kHz, min 0x03FF; 101 | #define ICR1_OFFSET 0x09B; 102 | 103 | // init measurements 104 | gridVolt.begin(gridVoltRange, RMS_WINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 105 | gridVolt.start(); 106 | acPower.begin(currRange, voltRange, RMS_WINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 107 | acPower.start(); 108 | 109 | // enable timer compare interrupt 110 | bitSet(TIMSK1, TOIE1); // enable Timer1 Interrupt 111 | 112 | sei(); // enable interrupts 113 | nextLoop = micros() + LPERIOD; // Set the loop timer variable. 114 | } 115 | 116 | 117 | 118 | 119 | // ****************************************************************** 120 | // Main loop 121 | // ****************************************************************** 122 | void loop(){ 123 | //digitalWriteFast(PIN_DEBUG, HIGH); // for checking slow control loop rate and to check the execution time. 124 | 125 | gridVolt.publish(); 126 | acPower.publish(); 127 | 128 | if(pubIdx <= 0) { 129 | publish=true; 130 | pubIdx=10; //print every 0.5s. 131 | } 132 | 133 | if(publish){ 134 | switch (printMuxIdx) { 135 | case 0: 136 | Serial.print(gridVolt.rmsVal, 1); // grid voltage 137 | Serial.print(", "); 138 | break; 139 | case 1: 140 | Serial.print(acPower.rmsVal2, 1); // voltage behind the grid connection relay 141 | Serial.print(", "); 142 | break; 143 | case 2: 144 | Serial.print(acPower.rmsVal1, 2); // output current 145 | Serial.print(", "); 146 | break; 147 | case 3: 148 | Serial.print(acPower.apparentPwr, 0); 149 | Serial.print(", "); 150 | break; 151 | case 4: 152 | Serial.print(acPower.realPwr, 0); 153 | Serial.print(", "); 154 | break; 155 | case 5: 156 | Serial.print(acPower.pf, 2); 157 | Serial.print(", "); 158 | break; 159 | case 6: 160 | Serial.print(acPower.energy/3600, 2); 161 | break; 162 | } 163 | if(printMuxIdx==6) { 164 | Serial.println(); 165 | printMuxIdx=0; 166 | publish=false; 167 | } 168 | else{ 169 | printMuxIdx++; 170 | } 171 | } 172 | pubIdx--; 173 | 174 | //digitalWriteFast(PIN_DEBUG, LOW); 175 | 176 | while(nextLoop > micros()) {;} // wait until the end of the time interval 177 | nextLoop += LPERIOD; // set next loop time at current time + LOOP_PERIOD 178 | } 179 | 180 | 181 | 182 | 183 | 184 | /* ****************************************************************** 185 | * ADC ISR. The ADC is triggered by Timer1. 186 | * *******************************************************************/ 187 | ISR(ADC_vect) { 188 | digitalWriteFast(PIN_DEBUG, HIGH); // checking ADC sampling frequency and the execution time. 189 | 190 | // read the current ADC input channel 191 | adcVal=ADCL; // store low byte 192 | adcVal+=ADCH<<8; // store high byte 193 | 194 | switch (adcMuxIdx) { 195 | case 0: // sample the grid voltage 196 | gridVolt.update(adcVal); 197 | break; 198 | 199 | case 1: // sample the inverter current 200 | acPower.update1(adcVal); 201 | break; 202 | 203 | case 2: // sample the inverter voltage 204 | acPower.update2(adcVal); 205 | break; 206 | 207 | case 3: 208 | // slot 3 209 | break; 210 | 211 | case 4: 212 | // slot 4 213 | break; 214 | 215 | case 5: 216 | // slot 5 217 | break; 218 | } 219 | 220 | adcMuxIdx++; 221 | if (adcMuxIdx > 5){ 222 | adcMuxIdx = 0; 223 | } 224 | ADMUX = (ADMUX & B11110000) | adcMuxIdx; // set the ADC MUX-channel for the next run. 225 | 226 | digitalWriteFast(PIN_DEBUG, LOW); //pin low 227 | } // runtime about 90us max. 228 | 229 | 230 | 231 | 232 | 233 | 234 | /* ****************************************************************** 235 | * Timer1 ISR running at 6000Hz. 236 | *********************************************************************/ 237 | ISR(TIMER1_OVF_vect) { 238 | // Empty ISR. Required here to trigger the ADC. 239 | // Important: ADC_vect ISR must be completed before the next call. 240 | } 241 | -------------------------------------------------------------------------------- /sketches/ZeroCrossingDetector/ZeroCrossingDetector.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * File: ZeroCrossingDetector.ino 3 | * Purpose: openMicroInverter example project demonstrating Zero Crossing Detection (ZCD) with the analog comparator from the ATMEGA328. 4 | * Version: 1.0.0 5 | * Date: 16-11-2019 6 | * 7 | * URL: https://github.com/MartinStokroos/openMicroInverter 8 | * 9 | * License: MIT License 10 | * 11 | * Copyright (c) M.Stokroos 2019 12 | * 13 | * This sketch has been tested with the openMicroInverter_dev hardware. 14 | * 15 | */ 16 | 17 | #include // library for high performance digital reads and writes by jrraines 18 | // see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267553811/0 19 | // and http://code.google.com/p/digitalwritefast/ 20 | 21 | #include // https://github.com/MartinStokroos/TrueRMS 22 | 23 | 24 | #define PIN_LED 13 // PLL locking status indicator LED 25 | #define PIN_ZCD_OUT 12 // ZCD output pin 26 | #define PIN_ANCREF 6 // AN comparator reference input biased on 2.5V. 27 | #define PIN_ANCIN 7 // AN comparator input for ZCD. Scaled line voltage input biased on 2.5V 28 | 29 | //#define RMS_WINDOW 20 // rms window of 20 samples, means 2 periods @50Hz 30 | #define RMS_WINDOW 40 // rms window of 40 samples, means 4 periods @50Hz 31 | //#define RMS_WINDOW 25 // rms window of 25 samples, means 3 periods @60Hz 32 | //#define RMS_WINDOW 50 // rms window of 50 samples, means 6 periods @60Hz 33 | 34 | #define ADC_DEAD_BAND 25 // margin around ADC base line to detect the polarity of the mains voltage 35 | 36 | 37 | const int gridVoltRange = 660.0; //Vpeak-to-peak full scale. 38 | Rms2 gridVolt; // create instance of Rms 39 | volatile int adcValue; 40 | volatile int adcMuxIdx = 0; // multiplexer index 41 | volatile bool sign = LOW; // sign of input wave; 0=neg, 1=pos 42 | 43 | 44 | // ****************************************************************** 45 | // Setup 46 | // ****************************************************************** 47 | void setup(){ 48 | pinMode(PIN_LED, OUTPUT); 49 | pinMode(PIN_ZCD_OUT, OUTPUT); 50 | pinMode(PIN_ANCREF, INPUT); 51 | pinMode(PIN_ANCIN, INPUT); 52 | 53 | // initialize serial communications: 54 | Serial.begin(115200); 55 | 56 | cli(); // disable interrupts 57 | // initialize ADC for continuous sampling mode 58 | DIDR0 = 0x3F; // digital inputs disabled for A0 to A5 59 | bitSet(ADMUX, REFS0); // Select Vcc=5V as the ADC reference voltage 60 | bitClear(ADMUX, REFS1); 61 | bitClear(ADMUX, MUX0); // selecting ADC CH#0 62 | bitClear(ADMUX, MUX1); 63 | bitClear(ADMUX, MUX2); 64 | bitClear(ADMUX, MUX3); 65 | bitSet(ADCSRA, ADEN); // AD-converter enabled 66 | bitSet(ADCSRA, ADATE); // auto-trigger enabled 67 | bitSet(ADCSRA, ADIE); // ADC interrupt enabled 68 | bitClear(ADCSRA, ADPS0); // ADC clock prescaler set to 64 (250kHz). We'll lose some accuracy... 69 | bitSet(ADCSRA, ADPS1); 70 | bitSet(ADCSRA, ADPS2); 71 | bitClear(ADCSRB, ACME); // Analog Comparator (ADC)Multiplexer enable OFF 72 | bitClear(ADCSRB, ADTS0); // select trigger from timer 1 73 | bitSet(ADCSRB, ADTS1); 74 | bitSet(ADCSRB, ADTS2); 75 | bitSet(ADCSRA, ADSC); // start conversion 76 | 77 | /* TIMER1 configured for phase and frequency correct PWM (mode 8), top=ICR1 */ 78 | bitSet(TCCR1B, CS10); // prescaler=1 79 | bitClear(TCCR1B, CS11); 80 | bitClear(TCCR1B, CS12); 81 | bitClear(TCCR1A, WGM10); // mode 8 82 | bitClear(TCCR1A, WGM11); 83 | bitClear(TCCR1B, WGM12); 84 | bitSet(TCCR1B, WGM13); 85 | // top value. f=fclk/(2*N*TOP) 86 | ICR1 = 0x0535; //f=6kHz, min 0x03FF; 87 | #define ICR1_OFFSET 0x09B; 88 | bitSet(TIMSK1, TOIE1); // enable Timer1 Interrupt 89 | 90 | // configure the ATmega328 analog comparator module from the ACSR register. 91 | bitClear(ACSR, ACD); // Analog Comparator: Enabled 92 | bitClear(ACSR, ACBG); // Analog Comparator Band-gap Select: AIN0 is applied to the positive input 93 | bitClear(ACSR, ACO); // Analog Comparator Output: Off 94 | bitSet(ACSR, ACI); // Analog Comparator Interrupt Flag: Clear Pending Interrupt 95 | bitSet(ACSR, ACIE); // Analog Comparator Interrupt: Enabled 96 | bitClear(ACSR, ACIC); // Analog Comparator Input Capture: Disabled 97 | bitClear(ACSR, ACIS0); // Analog Comparator Interrupt Mode: Comparator Interrupt on output toggle 98 | bitClear(ACSR, ACIS1); 99 | sei(); // enable interrupts 100 | 101 | // init RMS measurement 102 | gridVolt.begin(gridVoltRange, RMS_WINDOW, ADC_10BIT, BLR_ON, CNT_SCAN); 103 | gridVolt.start(); 104 | } 105 | 106 | 107 | 108 | 109 | 110 | // ****************************************************************** 111 | // Main loop 112 | // ****************************************************************** 113 | void loop() { 114 | digitalWriteFast(PIN_LED, HIGH); 115 | gridVolt.publish(); 116 | Serial.println(gridVolt.rmsVal, 1); // print the RMS grid voltage 117 | delay(500); 118 | digitalWriteFast(PIN_LED, LOW); 119 | delay(500); 120 | } 121 | 122 | 123 | 124 | 125 | 126 | /* ****************************************************************** 127 | * Analog comparator ISR 128 | * Interrupts each time that the comparator output toggles. 129 | * *******************************************************************/ 130 | ISR(ANALOG_COMP_vect) { 131 | if (sign){ // positive to negative edge 132 | digitalWriteFast(PIN_ZCD_OUT, LOW); // zcd out low 133 | } 134 | if (!sign){ // negative to positive edge 135 | digitalWriteFast(PIN_ZCD_OUT, HIGH); // zcd out high 136 | } 137 | } 138 | 139 | 140 | 141 | 142 | /* ****************************************************************** 143 | * ADC ISR. The ADC is triggered by Timer1. 144 | * *******************************************************************/ 145 | ISR(ADC_vect){ 146 | // read the current ADC-input channel 147 | adcValue=ADCL; // store low byte 148 | adcValue+=ADCH<<8; // store high byte 149 | 150 | switch (adcMuxIdx) { 151 | case 0: // proces the grid voltage sample 152 | gridVolt.update(adcValue); 153 | if (gridVolt.instVal >= ADC_DEAD_BAND) { 154 | sign = true; 155 | } 156 | else if (gridVolt.instVal <= -ADC_DEAD_BAND) { 157 | sign = false; 158 | } 159 | break; 160 | 161 | case 1: // process the next sample... 162 | break; 163 | 164 | case 2: 165 | break; 166 | 167 | case 3: 168 | break; 169 | 170 | case 4: 171 | break; 172 | 173 | case 5: 174 | break; 175 | 176 | } 177 | adcMuxIdx++; 178 | if (adcMuxIdx > 5){ 179 | adcMuxIdx = 0; 180 | } 181 | ADMUX = (ADMUX & B11110000) | adcMuxIdx; //set the ADC MUX-channel for the next run. 182 | } 183 | 184 | 185 | 186 | /* ****************************************************************** 187 | * Timer1 ISR running at 6000Hz. 188 | *********************************************************************/ 189 | ISR(TIMER1_OVF_vect) { 190 | // Empty ISR. Only required here to trigger the ADC. 191 | // Important: The ADC_vect ISR must be completed before the next call. 192 | } 193 | --------------------------------------------------------------------------------