Baca RPM Motor DC
Baca RPM Motor DC
Baca RPM Motor DC
com]
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:
2 Inkubatek [supported by : www.tokotronik.com]
LCD 2x16
Arduino UNO
Motor DC
Driver
Motor DC M
Optocoupler
Schematics
LCD1
VCC LM016L
+12V
RV2
DUINO1 50K
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3
4
5
6
7
8
9
10
11
12
13
14
APK-TECH | techno-apk.blogspot.com
AREF
R1
13 10k
PB5/SCK
PB4/MISO
12 Q1
RESET 11 IRF540
~PB3/MOSI/OC2A
10
~ PB2/SS/OC1B
9
~ PB1/OC1A
8
PB0/ICP1/CLKO
Q2
ATMEGA328P-PU
R2
1121
DIGITAL (~PWM)
7
INKUBATEK
ANALOG IN
PD7/AIN1 2N2222
6
A0 ~ PD6/AIN0 PIN 6 1k
PC0/ADC0 5
A1 ~ PD5/T1 PIN 5
A2
PC1/ADC1
PD4/T0/XCK
4
PIN 4 R3
PC2/ADC2 3 1k
A3 ~ PD3/INT1 +5V +5V
PC3/ADC3 2
A4 PD2/INT0
PC4/ADC4/SDA 1
A5 TX PD1/TXD
PC5/ADC5/SCL 0
RX PD0/RXD +5V
ARDUINO UNO R3 R5 U1
U2:A 33K 4 C A 1
4
3 3 2
1 E K
+5V
2 OPTOCOUPLER
R4
820
11
LM324
RV2
50K
3 Inkubatek [supported by : www.tokotronik.com]
Koneksi Optocoupler:
Pin ARDUINO Pin Optocouper
2 Output sensor
6 In Driver motor DC
8 RS
9 EN
4 Inkubatek [supported by : www.tokotronik.com]
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.h>
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(){
5 Inkubatek [supported by : www.tokotronik.com]
lcd.setCursor(0,0);
lcd.print("PWM:");
lcd.setCursor(0, 1);
lcd.print("RPM:");
delay(1000);
lcd.setCursor(4, 0);
lcd.print(pwm);
lcd.print(" ");
lcd.setCursor(4, 1);
lcd.print(rpm);
lcd.print(" ");
count = 0;
}
}
void readCount(){
count++;
}
Jalannya Alat :
LCD, menampilkan nilai PWM dan nilai RPM yang terbaca. Kecepatan motor berubah dari
lambat ke cepat berdasarkan perubahan PWM, semakin kecil nilai PWM maka semakin
cepat putaran motor. Nilai PWM dari 0 s/d 210.
PWM:160
RPM :1740
6 Inkubatek [supported by : www.tokotronik.com]