hamid159
Full Member level 3
hy guyz,i'm working on digital voltmeter and ammeter (130V and 40A,on lcd) using atmega328.
it is working well on proteus.but not worknig on verroboard,it shows the constant voltage and current i.e, 130V and 40A(max. limits).it does not detect the adc voltage.
This is my code.
- - - Updated - - -
it is also working well on arduino uno board.In above pdf file,crystal (16MHz)is missing..i've connected it with 9 and 10 pin of atmega328 with capacitors grounded
it is working well on proteus.but not worknig on verroboard,it shows the constant voltage and current i.e, 130V and 40A(max. limits).it does not detect the adc voltage.
This is my code.
Code C - [expand] 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 #include <LiquidCrystal.h> LiquidCrystal lcd(7,8,9,10,11,12); int analogInput = 0; int analogInput1 = 1; float vout = 0.0,vout1 = 0.0,vin = 0.0,vin1 = 0.0; float vinnew=0.0; float R1 = 680000.0; float R2 = 27000.0; float R3=100000.0; float R4=100000.0; float value = 0.0; float value1 = 0.0; void setup() { lcd.begin(20,4); pinMode(analogInput, INPUT); pinMode(analogInput1, INPUT); lcd.setCursor(0,2); lcd.print("voltmeter"); delay(100); } void loop() { lcd.setCursor(0,0); lcd.print(" V A"); value = analogRead(analogInput); value1 = analogRead(analogInput1); vout = (value * 5.0) / 1024.0; vin = vout / (R2/(R1+R2)); vout1 = (value1 * 5.0) / 1024.0; vin1 = vout1 / (R4/(R3+R4)); lcd.setCursor(0, 1); if (vin<0.1) { vin=0.00; } vinnew=4*vin1; if (vinnew<0.1) vinnew=0.0; lcd.print(vin); lcd.setCursor(8, 1); lcd.print(vinnew); delay(500); }
- - - Updated - - -
it is also working well on arduino uno board.In above pdf file,crystal (16MHz)is missing..i've connected it with 9 and 10 pin of atmega328 with capacitors grounded
Attachments
Last edited by a moderator: