0% found this document useful (0 votes)
19 views10 pages

LAMPIRAN

The document contains code for two Arduino projects: 1. A massage device program that sets the timer, controls motors and displays status on an LCD screen. 2. A compression device program that reads temperature sensors, controls heaters to maintain a set temperature, and uses a buzzer to signal when the cycle is complete. It also includes a circuit diagram for a massage device that uses a 7805 voltage regulator, transistor switches to control motors, and a relay to switch polarity for forward/reverse rotation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views10 pages

LAMPIRAN

The document contains code for two Arduino projects: 1. A massage device program that sets the timer, controls motors and displays status on an LCD screen. 2. A compression device program that reads temperature sensors, controls heaters to maintain a set temperature, and uses a buzzer to signal when the cycle is complete. It also includes a circuit diagram for a massage device that uses a 7805 voltage regulator, transistor switches to control motors, and a relay to switch polarity for forward/reverse rotation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

LAMPIRAN

1. Listing Program Keseluruhan Alat Pemijat


#include<Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3,POSITIVE);
int motor1 = 2;
int limit1 =3;
int limit2 =4;
int putar_kanan1 =1;
int putar_kiri1 =1;
int putar_kanan2 = 1;
int putar_kiri2 = 1;
int a=1;
int b=1;
int c=1;
int d=1;
int e=1;
int f=1;
int g=1;
int relay1=5;
int relay2=10;
int limit3=11;
int limit4=12;
int motor2=13;
int waktu=0;
int waktu1=0;
int waktu2=0;
int mode1=6;
int mode2=7;
int menit=0;
int detik=59;
int star=0;
int durasi=0;
int mulai = 8;
int jalan=-1;
int belakang =9;

58
59

int belakang =9;


void setup() {
pinMode(motor1, OUTPUT);
pinMode(motor2, OUTPUT);
pinMode(relay1,OUTPUT);
pinMode(relay2,OUTPUT);
pinMode(belakang,OUTPUT);
pinMode(limit1, INPUT);
pinMode(limit2, INPUT);
pinMode(limit3, INPUT);
pinMode(limit4, INPUT);
pinMode(mode1, INPUT);
pinMode(mode2, INPUT);
pinMode(mulai, INPUT);
lcd.begin(16,4);
lcd.setCursor(3,2);
lcd.print("BRA TERAPI");
delay (2000);
lcd.clear();
Serial.begin(9600);
}
void loop() {
jalan=-1;
digitalWrite(belakang, LOW);
lcd.clear();
lcd.setCursor(2,1);
lcd.print("SETING WAKTU");
lcd.setCursor(4,2);
lcd.print(waktu);
lcd.print(" MENIT");

waktu1 = digitalRead (mode1);


if (waktu1 != e){
if (waktu1 == LOW){
waktu =15;
}
e=waktu1;}
waktu2 = digitalRead (mode2);
60

if (waktu2 != c){
if (waktu2 == LOW){
waktu =20;
}
c=waktu2;}
star = digitalRead (mulai);
if (star != d){
if (star == LOW){
jalan = waktu - 1;
}
d=star;
lcd.clear();
lcd.setCursor(2,1);
lcd.print("SEDANG TERAPI");
lcd.setCursor(3,2);
lcd.print(waktu);
lcd.print(":");
lcd.print("00");
lcd.print(" MENIT");
}
while(jalan>=0){
digitalWrite(belakang, HIGH);
waktu=0;
durasi = durasi +1;
if (durasi ==7){
durasi =0;
lcd.clear();
lcd.setCursor(2,1);
lcd.print("SEDANG TERAPI");
lcd.setCursor(5,2);
lcd.print(":");
if (jalan>=10){
lcd.setCursor(3,2);
lcd.print(jalan);
}
if (jalan<=9){
lcd.setCursor(3,2);
61

lcd.print(detik);
lcd.print(" MENIT");
}
detik --;
}
if (detik<=-1){
jalan=jalan-1;
detik = 59;
}
putar_kanan1 = digitalRead (limit1);
if (putar_kanan1 != a){
if (putar_kanan1 == LOW){
digitalWrite(relay1, HIGH);
}
}
a=putar_kanan1;
putar_kiri1 = digitalRead (limit2);
if (putar_kiri1 != b){
if (putar_kiri1 == LOW){
digitalWrite(relay1, LOW);
}
}
b=putar_kiri1;
putar_kanan2 = digitalRead (limit3);
if (putar_kanan2 != f){
if (putar_kanan2 == LOW){
digitalWrite(relay2, HIGH);
}
}
f=putar_kanan2;
putar_kiri2 = digitalRead (limit4);
if (putar_kiri2 != g){
if (putar_kiri2 == LOW){
digitalWrite(relay2, LOW);
}
}
g=putar_kiri2;

digitalWrite(motor1, HIGH);

digitalWrite(motor2, HIGH);
62

delay(32);
digitalWrite(motor1, LOW);
digitalWrite(motor2, LOW);
delay(100);
digitalWrite(motor1, LOW);
digitalWrite(motor2, HIGH);
delayMicroseconds(3500);
}
delay (100);
}

2. Listing Program Keseluruhan Alat Kompres


#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS1 10
#define ONE_WIRE_BUS2 9

OneWire oneWire1(ONE_WIRE_BUS1);
OneWire oneWire2(ONE_WIRE_BUS2);

DallasTemperature sensorSuhu1(&oneWire1);
DallasTemperature sensorSuhu2(&oneWire2);

float suhuSekarang1;
float suhuSekarang2;
float seting = 57.00;
int heater1 = 6;
int heater2 = 5;
int waktu = -1;
unsigned long timer;
unsigned long durasi;
const unsigned long setting = 900000;
int star = 1;
int buzzer = 3;
int mulai;
int selesai= 0;
int bunyi = 0;
63

void setup(void)
{
Serial.begin(9600);
sensorSuhu1.begin();
sensorSuhu2.begin();
pinMode(heater1, OUTPUT);
pinMode(heater2, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(star, INPUT);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(100);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(100);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
}
void loop(void)
{
durasi = millis();
waktu = -1;
suhuSekarang1 = ambilSuhu1();
if (suhuSekarang1 <= seting){
digitalWrite(heater1, HIGH);
}
else{
digitalWrite(heater1, LOW);
}
suhuSekarang2 = ambilSuhu2();
if (suhuSekarang2 <= seting){
digitalWrite(heater2, HIGH);
}
else{
digitalWrite(heater2, LOW);
}
64

delay(100);
mulai = digitalRead(star);
if (mulai == LOW){
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(100);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(100);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
waktu = 1;
timer = durasi;
}
while (waktu >= 0){
durasi = millis();
if ((durasi - timer)>=setting){
selesai = 1;
}
while (selesai == 1){
digitalWrite(heater1, LOW);
digitalWrite(heater2, LOW);
bunyi = 0;
if (bunyi <= 1){
for (int fadeValue = 225 ; fadeValue >= 50; fadeValue -= 1)
{
analogWrite(buzzer, fadeValue);
delay(5);
}
for (int fadeValue = 225 ; fadeValue >= 50; fadeValue -= 1)
{
analogWrite(buzzer, fadeValue);

delay(5);

}
65

for (int fadeValue = 225 ; fadeValue >= 50; fadeValue -= 1)


{
analogWrite(buzzer, fadeValue);
delay(5);
}
for (int fadeValue = 225 ; fadeValue >= 0; fadeValue -= 1)
{
analogWrite(buzzer, fadeValue);
delay(5);
}
}
bunyi ++;
}
suhuSekarang1 = ambilSuhu1();
if (suhuSekarang1 <= seting){
digitalWrite(heater1, HIGH);
}
else{
digitalWrite(heater1, LOW);
}
suhuSekarang2 = ambilSuhu2();
if (suhuSekarang2 <= seting){
digitalWrite(heater2, HIGH);
}
else{
digitalWrite(heater2, LOW);
}
delay(80);
}}
float ambilSuhu1()
{
sensorSuhu1.requestTemperatures();
float suhu1 = sensorSuhu1.getTempCByIndex(0);
return suhu1; }
float ambilSuhu2()
{
sensorSuhu2.requestTemperatures();
float suhu2 = sensorSuhu2.getTempCByIndex(0);
return suhu2; }
66

3. Rangkaian Keseluruhan Alat Pijat

U1
7805 +5v
SW1
Q1
1 3 TIP3055
VI VO
SW-SPST

GND
+5v C5 C4

2
22pF 22pF RL1
B1 C1 X1 RLY-DPCO
12V 2200u C2 C3
220u 1nF

CRYSTAL

R9 Q2

2
1
BD139
+5v 2,2k

U2 J1
motor1
2 14
PD0/RXD/PCINT16 PB0/ICP1/CLKO/PCINT0
3 15
R1 4
PD1/TXD/PCINT17 PB1/OC1A/PCINT1
16
PD2/INT0/PCINT18 PB2/SS/OC1B/PCINT2
5 17
330 PD3/INT1/OC2B/PCINT19 PB3/MOSI/OC2A/PCINT3
6
PD4/T0/XCK/PCINT20 PB4/MISO/PCINT4
18
R10 Q3
11 19 BD139
PD5/T1/OC0B/PCINT21 PB5/SCK/PCINT5
12 9
R2 13
PD6/AIN0/OC0A/PCINT22 PB6/TOSC1/XTAL1/PCINT6
10
2,2k
PD7/AIN1/PCINT23 PB7/TOSC2/XTAL2/PCINT7 +5v
330
21 23
AREF PC0/ADC0/PCINT8 +5v
20 24
R3 AVCC PC1/ADC1/PCINT9
25
PC2/ADC2/PCINT10 J4
26
330 PC3/ADC3/PCINT11
27 1
PC4/ADC4/SDA/PCINT12
R4 28 2
PC5/ADC5/SCL/PCINT13
1 3
PC6/RESET/PCINT14
330 4
ATMEGA328P
R5 lcd RL2
RLY-DPCO
330 +5v

R6
330 RL3
R7
R11 Q4

2
1
330 BD139
330
R8
Q6 J2
330 motor2
RLY-DPCO

J3 R13
1
2 330 R12 Q5
BD139
motor3 BD139 330
67

4. Rangkaian Keseluruhan Alat Kompres


U5
3
VCC
2 24.0
DQ
1
GND
DS18B20

U4
3
VCC
2 27.0
DQ
1
GND
R1
R5 R6 DS18B20
330 7,8k 7,8k
U1
2 14
PD0/RXD/PCINT16 PB0/ICP1/CLKO/PCINT0
3 15
PD1/TXD/PCINT17 PB1/OC1A/PCINT1
BUZ1 4 16
PD2/INT0/PCINT18 PB2/SS/OC1B/PCINT2 C2
5 17
PD3/INT1/OC2B/PCINT19 PB3/MOSI/OC2A/PCINT3
6 18
PD4/T0/XCK/PCINT20 PB4/MISO/PCINT4
11 19
PD5/T1/OC0B/PCINT21 PB5/SCK/PCINT5
12 9 22pF
BUZZER PD6/AIN0/OC0A/PCINT22 PB6/TOSC1/XTAL1/PCINT6
13
PD7/AIN1/PCINT23 PB7/TOSC2/XTAL2/PCINT7
10 X1
R3 21 23
CRYSTAL
C1
AREF PC0/ADC0/PCINT8
20 24
330 AVCC PC1/ADC1/PCINT9
25
PC2/ADC2/PCINT10
26 22pF
PC3/ADC3/PCINT11
27
PC4/ADC4/SDA/PCINT12
Q1 PC5/ADC5/SCL/PCINT13
28 R2
BD139 1
PC6/RESET/PCINT14
2

10k
ATMEGA328P

U2 R4 Q2
OV1 SSR BD139

1
OVEN 330

U3
SSR
4

OV2
OVEN
Heater

6
T

Heater

V1
VSINE V2
VSINE
T

You might also like