Monitorizarea online wireless a puterii produse de o turbina VAWT se poate realiza cu doar 5$ !
Sunt necesare doar o placa de dezvoltare cu WEMOS D1 MINI ~2.6 $ si un senzor de curent INA 219 ~1.7$.
Daca se inlocuieste rezistenta 0.1 ohm de pe senzorul INA219 cu o rezistenta de 0.01 ohm, 10W se pot masura curenti de pana la 32A cu o rezolutie de 8mA.
Codul necesar :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
#include <DHT.h> #include <Wire.h> #include <Adafruit_INA219.h> #include <ESP8266WiFi.h> #include "ThingSpeak.h" int AC = 0; int lastAC = 0; int turatie = 0; unsigned long myChannelNumber = 22793; const char * myWriteAPIKey = "cheie"; const char* ssid = "HUAWEI-SQ77"; const char* password = "parola"; #define DHTPIN D4 #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE); WiFiClient client; Adafruit_INA219 ina219; void setup() { Serial.begin(115200); delay(10); dht.begin(); WiFi.begin(ssid, password); Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(5000); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); ina219.begin(); Serial.println("Measuring voltage and current with INA219 ..."); ThingSpeak.begin(client); Serial.println("ThingSpeak connected"); } void loop() { float t = dht.readTemperature(); float h = dht.readHumidity(); delay(5); if (isnan(h) || isnan(t)) { Serial.println("Failed to read from DHT sensor!"); return; } float shuntvoltage = 0; float busvoltage = 0; float current_mA = 0; float loadvoltage = 0; float power = 0; float turatiei = 0; float current_A = 0; for(int i=0;i<2500;i++) { shuntvoltage = shuntvoltage + ina219.getShuntVoltage_mV(); busvoltage = busvoltage + ina219.getBusVoltage_V(); current_mA = current_mA + ina219.getCurrent_mA(); AC = digitalRead(5); // Se contorizeaza trecerea prin "0" if ((AC == LOW) && (AC != lastAC )) { turatiei++; } lastAC= digitalRead(5); delay(5); } turatie=turatiei*60/8/15; shuntvoltage = shuntvoltage/2500; busvoltage = busvoltage/2500; loadvoltage = busvoltage + (shuntvoltage / 1000); current_A = current_mA/2500/1000; power = loadvoltage * current_A; Serial.print("Bus Voltage: "); Serial.print(busvoltage); Serial.println(" V"); Serial.print("Shunt Voltage: "); Serial.print(shuntvoltage); Serial.println(" mV"); Serial.print("Load Voltage: "); Serial.print(loadvoltage); Serial.println(" V"); Serial.print("Current: "); Serial.print(current_A); Serial.println(" A"); Serial.print("Power: "); Serial.print(power); Serial.println(" W"); Serial.println(""); Serial.print("Temperature: "); Serial.print(t); Serial.print(" degrees Celsius Humidity: "); Serial.print(h); Serial.println(""); ThingSpeak.setField(1,loadvoltage); ThingSpeak.setField(2,current_A); ThingSpeak.setField(3,power); ThingSpeak.setField(4,turatie); ThingSpeak.setField(5,t); ThingSpeak.setField(6,h); ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey); Serial.println("Send to ThingSpeak"); } |
Contine suplimentar cod pentru integrarea unui senzor de temperatura / umiditate DH11 si pentru determinarea turatiei.