Cov txheej txheem:

Digital Voltmeter Nrog CloudX: 6 Kauj Ruam
Digital Voltmeter Nrog CloudX: 6 Kauj Ruam

Video: Digital Voltmeter Nrog CloudX: 6 Kauj Ruam

Video: Digital Voltmeter Nrog CloudX: 6 Kauj Ruam
Video: Introduction to Digital Voltmeters - Analog and Digital Instruments 2024, Hlis ntuj nqeg
Anonim
Digital Voltmeter Nrog CloudX
Digital Voltmeter Nrog CloudX

Cov roj teeb muab daim ntawv dawb huv ntawm DC (ncaj qha tam sim no) lub zog thaum ua haujlwm hauv Circuit Court. Lawv cov suab nrov qis ib txwm ua rau lawv haum zoo rau qee qhov kev nkag tau yooj yim heev. Txawm li cas los xij, nyob rau qee lub sijhawm uas lawv qhov ntsuas hluav taws xob qis qis dua qee qhov chaw pib, cov khoom siv hluav taws xob - (uas lawv xav tau rau lub zog), yuav nkag mus rau hauv tus cwj pwm tsis zoo; tshwj xeeb tshaj yog thaum lawv tsis tsim los daws qhov ntawd.

Vim li no, muaj qhov xav tau los saib xyuas lub roj teeb theem tas li txhawm rau coj qhia peb kom raug thaum lub sijhawm yuav tsum tau hloov tag nrho, lossis them nyiaj - hauv rooj plaub ntawm lub roj teeb rov tuaj. Yog li ntawd, hauv DIY no (Ua Rau Koj Tus Kheej), peb yuav tsim lub ntsuas hluav taws xob hluav taws xob yooj yim siv lub CloudX – siv 7Segment ua peb cov khoom.

Kauj Ruam 1: Yuav Tsum Tau Kho Vajtse

CloudX Microcontroller Module

CloudX USB

SoftCard

7Segment Zaub

Resistors

Lub Hwj Huam Fais Fab

Cov qhob cij

Jumper (Txuas) Cov Xov Tooj

Kauj Ruam 2: CloudX M633 Microcontroller

CloudX M633 Microcontroller
CloudX M633 Microcontroller

CloudX Microcontroller Module

CloudX module yog cov cuab yeej tsim khoom siv hluav taws xob uas tso cai rau koj kom yooj yim dua thiab yooj yim txoj hauv kev cuam tshuam nrog lub ntiaj teb lub cev los ntawm kev yooj yim microcontroller board. Tag nrho lub platform yog ua raws qhov qhib-qhov kev suav lub cev. Nws qhov yooj yim ntawm IDE (Kev Txhim Kho Ib Cheeb Tsam Ib puag ncig) tiag tiag ua rau nws haum zoo rau cov pib, tseem tab tom khaws lub luag haujlwm txaus kom tso cai rau cov neeg siv kawg kawg siv lawv txoj hauv kev. Hauv cov txiv ntoo-lub plhaub, CloudX muab rau cov txheej txheem yooj yim dua ntawm kev tuav lub microcontroller -by abstracting tam sim ntawd ib txwm ua cov ntsiab lus nyuaj cuam tshuam nrog nws; thaum tib lub sijhawm muab cov neeg siv-kev paub nplua nuj heev. Nws pom cov ntawv thov dav thoob plaws lub rooj tsavxwm: cov tsev kawm ntawv, yog cov cuab yeej Kawm Ntawv Zoo; cov khoom lag luam thiab cov lag luam; thiab raws li cov cuab yeej siv tau zoo hauv txhais tes ntawm tus nyiam ua haujlwm.

Kauj Ruam 3: Pin Txuas

Tus Pin Txuas
Tus Pin Txuas

Tus lej 7-ntu: A, B, C, D, E, F, G, 1, 2 thiab 3 txuas nrog CloudX-MCU tus pin 1, tus pin 2, tus pin 3, tus pin 4, tus pin 5, tus pin 6, tus pin 7, tus pin 8, tus pin 9, pin 10 thiab pin 11 feem.

Kauj Ruam 4: Daim duab Circuit Court

Daim duab Circuit Court
Daim duab Circuit Court

Lub microcontroller module, ua nyob rau theem nruab nrab ntawm no, tuaj yeem ua haujlwm ntawm:

tog twg los ntawm Vin thiab Gnd cov ntsiab lus (piv txwv li txuas lawv mus rau koj lub zog sab nrauv-khoom-chav tsev +ve thiab –ve cov dav sib xws) ntawm pawg thawj coj saib;

lossis dhau ntawm koj li CloudX USB softcard module

. Ntau dua, raws li tuaj yeem pom tau yooj yim los ntawm daim duab hluav taws xob saum toj no, cov roj teeb hluav taws xob nkag tau cuam tshuam nrog MCU (microcontroller) module xws li –point ntawm qhov faib hluav taws xob faib network (tsim los ntawm thiab) txuas nrog A0 ntawm MCU tus pin.

thiab raug xaiv raws li txoj hauv kev xws li:

txwv tus nqi tam sim no uas ntws los ntawm lub network;

txwv nyob hauv thaj tsam nyab xeeb ntawm (0 - 5) V rau MCU.

Siv cov mis: VOUT = (R2/(R1+R2)) * VIN; thiab tuaj yeem ntsuas tau yooj yim.

Voutmax = 5V

thiab rau txoj haujlwm no, peb xaiv: Vinmax = 50V;

5 = (R2/(R1+R2)) * 50 R1 = 45/5 * R2 Noj R2 = 10kΩ piv txwv; R1 = 45/5 * 10 = 90kΩ

Kauj Ruam 5: Lub hauv paus ntsiab lus ntawm Kev Ua Haujlwm

Thaum ntsuas qhov ntsuas hluav taws xob tau nyeem los ntawm VOUT taw tes ntawm qhov faib hluav taws xob network, cov ntaub ntawv tau ua tiav ntxiv hauv MCU txhawm rau ntsuas mus rau qhov kawg qhov tseeb uas qhia hauv ntu ntu. Nws (cov txheej txheem tsim) yog qhov tsis siv tus lej zauv ntsiab lus tso rau hauv, hauv qhov ntawd nws (tus lej cim zauv) tau hloov pauv txoj haujlwm ntawm lub vijtsam-chav nws tus kheej raws li qhov ntab tus nqi hais tawm ntawm txhua lub ntsiab lus hauv lub sijhawm. Tom qab ntawd, tag nrho kho vajtse 7-Segment display unit tau txuas nrog hauv hom sib txawv. Nws yog qhov kev npaj tshwj xeeb uas yog tib lub tsheb npav cov ntaub ntawv (8-cov ntaub ntawv pins) los ntawm MCU txau peb qhov haujlwm 7-ntu nyob hauv chav tso saib. Kev xa cov qauv ntaub ntawv mus rau txhua qhov ntawm cov khoom siv tau ua tiav los ntawm cov txheej txheem hu ua Scanning. Luam theej duab yog txheej txheem cuam tshuam nrog xa cov ntaub ntawv hla mus rau txhua qhov kev tiv thaiv 7-ntu; thiab ua kom zoo (piv txwv li hloov pauv) lawv ua tiav sai raws li lawv cov ntaub ntawv ntsig txog. Tus nqi hais txog txhua tus ntawm lawv tau ua tiav xws li nws ua tiav hauv kev dag ntxias tib neeg lub zeem muag kom ntseeg tias txhua tus ntawm lawv (ntu ntu) tau qhib (hais daws) tib lub sijhawm. Nws (scanning) yooj yim, siv tau, siv qhov tshwm sim hu ua Persistence Of Vision.

Kauj Ruam 6: Txoj Haujlwm Software

#suav nrog

#suav nrog

#suav nrog

#define segment1 pin9

#define segment2 tus pin 10

#define segment3 tus pin 11

ntab batt_voltage;

int decimalPoint, sib ntaus;

/*arrays uas khaws ntu-qauv rau txhua tus lej muab*/

char CCathodeDisp = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F};

char CAnodeDisp = {0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90};

int disp0, faib 1, faib 2;

tso saib () {

unsigned char kuv;

yog (decimalPoint <10) {

disp0 = (int) batt_voltage /100; // nqa MSD (Tus lej tseem ceeb tshaj)

// yog qhov hnyav tshaj plaws

/* nqa tus lej tom ntej uas hnyav dua; thiab lwm yam */

disp1 = ((int) batt_voltage % 100)/10;

disp2 = ((int) batt_voltage % 10);

}

lwm tus {

disp0 = (int) batt_voltage /1000;

disp1 = ((int) batt_voltage % 1000)/100;

disp2 = ((int) batt_voltage % 100)/10;

}

/*Cov qauv tau nchuav rau tso saib; thiab 0x80 tus cim ntxiv tus lej zauv

yog tias qhov xwm txheej cuam tshuam muaj tseeb*/

rau (kuv = 0; kuv <50; kuv ++) {

pin 9 = pin10 = pin11 = HIGH;

yog (decimalPoint <10)

portWrite (1, CCathodeDisp [disp0] | 0x80);

lwm qhov chaw PortWrite (1, CCathodeDisp [disp0]);

ntu 1 = QIB;

ntu 2 = HIGH;

ntu 3 = HIGH;

delayMs (5);

pin 9 = pin10 = pin11 = HIGH;

yog ((decimalPoint> = 10) && (decimalPoint <100))

portWrite (1, CCathodeDisp [disp1] | 0x80);

lwm qhov chaw PortWrite (1, CCathodeDisp [disp1]);

ntu 1 = HIGH;

ntu 2 = QIB;

ntu 3 = HIGH;

delayMs (5);

pin 9 = pin10 = pin11 = HIGH;

yog (decimalPoint> = 100)

portWrite (1, CCathodeDisp [disp2] | 0x80);

lwm qhov chaw PortWrite (1, CCathodeDisp [disp2]);

ntu 1 = HIGH;

ntu 2 = HIGH;

ntu 3 = QIB;

delayMs (5);

}

}

teeb tsa () {// teeb tsa ntawm no

AnalogSetting (); // analog chaw nres nkoj initialized

portMode (1, NTAWV); // Pins 1 txog rau 8 teeb tsa raws li cov pins tso tawm

/ * scan pins teeb tsa raws li cov pins tso tawm */

pin9Mode = OUTPUT;

pin10Mode = OUTPUT;

pin11Mode = OUTPUT;

portWrite (1, QAB);

pin 9 = pin10 = pin11 = HIGH; // scan pins (uas nquag-qis)

// raug xiam oob qhab thaum pib

loop () {// Program ntawm no

batt_voltage = analogRead (A0); // siv tus nqi ntsuas

batt_voltage = ((batt_voltage * 5000) / 1024); // hloov dua siab tshiab rau 5Vin

batt_voltage = (batt_voltage * 50)/5000; // hloov dua siab tshiab rau 50Vin

decimalPoint = batt_voltage; // cim qhov twg tus lej lej zauv tshwm hauv

// tus nqi qub ua ntej cov ntaub ntawv siv

zaub ();

}

}

Pom zoo: