Cov txheej txheem:

Arduino Wattmeter - Voltage, Tam sim no thiab Kev Siv Hluav Taws Xob: 3 Cov Kauj Ruam
Arduino Wattmeter - Voltage, Tam sim no thiab Kev Siv Hluav Taws Xob: 3 Cov Kauj Ruam

Video: Arduino Wattmeter - Voltage, Tam sim no thiab Kev Siv Hluav Taws Xob: 3 Cov Kauj Ruam

Video: Arduino Wattmeter - Voltage, Tam sim no thiab Kev Siv Hluav Taws Xob: 3 Cov Kauj Ruam
Video: Voltage Sensor 0-25v,Arduino Voltage monitoring,calculation & how to modify for reading high voltage 2024, Hlis ntuj nqeg
Anonim
Arduino Wattmeter - Voltage, Tam sim no thiab Kev Siv Hluav Taws Xob
Arduino Wattmeter - Voltage, Tam sim no thiab Kev Siv Hluav Taws Xob

Ib lub cuab yeej tuaj yeem siv los ntsuas lub zog siv. Lub voj voog no tseem tuaj yeem ua raws li Voltmeter thiab Ammeter los ntsuas qhov hluav taws xob thiab tam sim no.

Khoom siv

Kho vajtse Cheebtsam

Arduino Ib

LCD 16 X 2

LM 358 Op-Amp

7805 Tus tswj hwm Volage

Potentiometer 10k ohm

0.1f ua

Kev tiv thaiv 10k ohm

Resistor, 20 kohm

Resistor 2.21k ohm

Resistor, 0.22 hli

Ntsuas load

Txuas xov hlau

Cheeb Tsam Software:

Arduino IDE Cov

Kauj Ruam 1: Ua haujlwm ntawm Arduino Wattmeter

Ua haujlwm ntawm Arduino Wattmeter
Ua haujlwm ntawm Arduino Wattmeter

Tsim koj tus kheej lub ntsuas tsis yog tsuas yog txo tus nqi ntawm kev sim tab sis tseem muab chav rau peb los pab txhawb cov txheej txheem ntsuas.

Ua hauj lwm:

Los ntawm qhov ntsuas qhov ntsuas, muaj ob ntu uas ntseeg tau rau ntsuas qhov ntsuas hluav taws xob thiab tam sim no. Txog kev ntsuas qhov hluav taws xob, qhov hluav taws xob faib hluav taws xob tau ua tiav siv 10KΩ thiab 2.2KΩ Resistor.

Nrog kev pab los ntawm cov tshuaj tiv thaiv no, koj tuaj yeem ntsuas qhov hluav taws xob tau yooj yim txog 24V. Cov resistors no tseem txhawb peb hauv kev ntsuas qhov voltage mus rau 0V - 5V, uas yog qhov ib txwm muaj uas Arduino ua haujlwm.

Txhawm rau ntsuas qhov tam sim no, peb yuav tsum hloov qhov txiaj ntsig tam sim no rau qhov ntsuas qhov ntsuas hluav taws xob. Raws li Ohm Txoj Cai, qhov hluav taws xob poob thoob plaws lub nra yog sib piv rau qhov tam sim no.

Yog li ntawd, me me shunt resistor tau npaj nrog kev hwm rau lub nra. Los ntawm kev kwv yees qhov hluav taws xob hla tus tiv thaiv no, peb tuaj yeem suav qhov tam sim no. Peb tau siv LM358 Op-Amp hauv Tsis-Hloov Hloov Amplifier Hom los ua kom muaj nuj nqis muab rau Arduino.

Lub network faib hluav taws xob rau kev tawm tswv yim suav nrog a20KΩ Resistor thiab 1KΩ Resistor. Cov resistors no muab qhov nce ntawm kwv yees li 21.

Kawm paub ntau ntxiv txog IoT Course uas yuav pab koj txhim kho Kev Kho Mob Tshwj Xeeb IoT.

Kauj ruam 2: Khiav Code

#suav nrog

int Nyeem_Voltage = A1;

int Nyeem_Current = A0;

const int rs = 2, en = 4, d4 = 9, d5 = 10, d6 = 11, d7 = 12;

LiquidCrystal lcd (rs, en, d4, d5, d6, d7);

ntab Voltage = 0.0;

Ntab Tam sim no = 0.0;

Lub zog ntab = 0.0;

void teeb tsa ()

{

lcd.begin (16, 2);

Serial.begin (9600);

lcd.print ("Arduino");

lcd.setCursor (0, 1);

lcd.print ("Wattmeter");

ncua (2000);

lcd.clear ();

}

void lub voj ()

{

Voltage = analogRead (Nyeem_Voltage);

Tam sim no = analogRead (Nyeem_Current);

Voltage = Voltage * (5.0/1023.0) * 6.46;

Tam sim no = Tam sim no * (5.0/1023.0) * 0.239;

Serial.println (Voltage); Serial.println (Tam sim no);

Fais fab = Voltage * Tam sim no;

Serial.println (Hwj chim);

lcd.setCursor (0, 0);

lcd.print ("V =");

lcd.print (Voltage);

lcd.print ("");

lcd.print ("Kuv =");

lcd.print (Tam sim no);

lcd.setCursor (0, 1);

lcd.print ("P =");

lcd.print (Hwj chim);

ncua (1000);

}

Pom zoo: