18 0 742 KB
1
Inkubatek [supported by : www.tokotronik.com]
Baca RPM motor DC Sistem Kerja Alat: Baca putaran motor per menit /Rotasi Per Menit (RPM) pada motor DC. Sensor optocopler sebagai sensor pembaca jumlah putaran motor. Pada ujung as motor diberi piringan yang dilubangi sebanyak 36 lubang (code disc). Hasilnya ditampilkan pada LCD.
Kebutuhan Hardware :
Sensor optocoupler slot Code disc (penghitung jumlah putaran motor) Motor DC Driver motor DC menggunakan IRF540N (Anda juga bisa menggunakan driver yang lain misalkan L298) LCD 2x16 Modul Arduino UNO Power supply +9Volt
Optocoupler Slot Penghitung jumlah putaran (code disc)
Motor DC
Diagram Blok:
Inkubatek [supported by : www.tokotronik.com]
LCD 2x16 Arduino UNO
Motor DC Driver Motor DC
M Optocoupler
Schematics LCD1
VCC
LM016L
+12V
RV2 DUINO1
PC0/ADC0 PC1/ADC1 PC2/ADC2 PC3/ADC3 PC4/ADC4/SDA PC5/ADC5/SCL
D0 D1 D2 D3 D4 D5 D6 D7 7 8 9 10 11 12 13 14
RS RW E 4 5 6
AREF PB5/SCK PB4/MISO ~PB3/MOSI/OC2A ~ PB2/SS/OC1B ~ PB1/OC1A PB0/ICP1/CLKO
DIGITAL (~PWM)
ANALOG IN
PD7/AIN1
~ PD6/AIN0 PD5/T1 ~ PD4/T0/XCK ~ PD3/INT1 PD2/INT0 TX PD1/TXD RX PD0/RXD
R1
13 12 11 10 9 8
10k
Q1 IRF540
7 6 5 4 3 2 1 0
Q2
R2
INKUBATEK
PIN 6 PIN 5 PIN 4
2N2222 1k
R3 +5V
+5V
+5V
R5
ARDUINO UNO R3
U2:A
U1 4
C
A
1
4
33K
3 1 2
3
2 E K OPTOCOUPLER
+5V
R4 11
A0 A1 A2 A3 A4 A5
APK-TECH | techno-apk.blogspot.com
RESET
1 2 3
VSS VDD VEE
50K
1121 ATMEGA328P-PU
2
820 LM324
RV2 50K
1k
3
Inkubatek [supported by : www.tokotronik.com]
Koneksi Optocoupler: Pin ARDUINO
Pin Optocouper
2
Output sensor
Koneksi Driver motor DC: Pin Arduino
Koneksi
6
In Driver motor DC
Koneksi Arduino UNO dengan LCD: Pin ARDUINO
LCD
8
RS
9
EN
Inkubatek [supported by : www.tokotronik.com]
4
10
D4
11
D5
12
D6
13
D7
Source Code/Sketch : /************************************* * Program : Project 12. Baca RPM motor DC * Input : Sensor Optocoupler * Output : LCD 2x16, Motor DC * 125 Proyek Arduino Inkubatek * www.tokotronik.com * ***********************************/ #include LiquidCrystal lcd(8, 9, 10, 11, 12, 13); word count; word rpm; word rps; byte pwm; void setup(){ pinMode(6,OUTPUT); analogWrite(6, 255); lcd.begin(16, 2); lcd.clear(); lcd.print(" Baca RPM Motor"); lcd.setCursor(0,1); lcd.print(" DC"); delay(2000); //----------------seting interupsi 0 pinMode(2, INPUT); digitalWrite(2, HIGH); attachInterrupt(0, readCount, FALLING); delay(50); pwm=220; lcd.clear(); } void loop(){
Inkubatek [supported by : www.tokotronik.com]
5
lcd.setCursor(0,0); lcd.print("PWM:"); lcd.setCursor(0, 1); lcd.print("RPM:"); delay(1000); if(pwm == 0) pwm = 250; pwm=pwm-10; for(char i=0; i