Membuat Alat Pijat / Terapi Elektrik (Elektronik MASSAGE)
Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang berbasis arduino yang berguna untuk terapi atau pijat dengan menggunakan manset, jadi alat ini bisa dipasangkan sampai 3 manset di bagian tubuh lalu akan melakukan pompa dan setelah tekanan tercapai akan keep angin dulu selama 15 detik lalu mengeluarkan angin selama 45 detik dan akan berulang seperti itu seterusnya sampai 1 jam. untuk sensor yang dipakai bisa menggunakan MPX5050GP atau MPX4115VC6U. untuk lebih jelasnya berikut adalah skema dan programnya.
a. Skema
b. Komponen Penyusun
c. Program Arduino IDE
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <AFMotor.h>
#include <DS3231.h>
LiquidCrystal_I2C lcd(0x27, 16,2);
AF_DCMotor motor1(1); //pompa
AF_DCMotor motor2(2); //solenoid buang angin
AF_DCMotor motor3(3); //solenoid ke manset
int buzzer = 9;
int btset = A1;
int btup = A2;
int btdown = A3;
int btok = 10;
int menit = 59;
int detik = 60;
int pilihan;
int btsetx;
int btupx;
int btdownx;
int btokx;
int waktu = 60;
int dataadc;
int mmhg;
int presure = 20;
//SOLENOID ON ITU UDARA MENGALIR
//SOLENOID OFF ITU UDARA STOP
DS3231 rtc(SDA, SCL);
Time t;
void setup() {
lcd.clear();
lcd.begin();
lcd.noCursor();
Serial.begin(9600);
motor1.setSpeed(255);
//motor1.run(RELEASE);
motor2.setSpeed(255);
//solout.run(RELEASE);
motor3.setSpeed(255);
//solman.run(RELEASE);
pinMode(buzzer,OUTPUT);
pinMode(btset,INPUT_PULLUP);
pinMode(btup,INPUT_PULLUP);
pinMode(btdown,INPUT_PULLUP);
pinMode(btok,INPUT_PULLUP);
rtc.begin();
//rtc.setDOW(FRIDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(0, 0, 0); // Set the time to 12:00:00 (24hr format)
//rtc.setDate(13, 5, 2022); // Set the date to January 1st, 2014
}
void loop() {
motor2.run(FORWARD);
motor3.run(FORWARD);
btsetx = digitalRead(btset);
btokx = digitalRead(btok);
lcd.setCursor(0,0);
lcd.print("P/W= ");
lcd.print(presure);
lcd.print("/");
lcd.print(waktu);
lcd.print(" ");
lcd.setCursor(15,0);
lcd.print(pilihan);
lcd.setCursor(0,1);
lcd.print("TEKAN MULAI ");
if(btsetx == 0){
delay(1000);
lcd.clear();
settekanan();
lcd.clear();
delay(1000);
setwaktu();
lcd.clear();
delay(1000);
}
if(btokx == 0){
delay(1000);
lcd.clear();
rtc.setTime(0, 0, 0); //set timer
t.sec = 0;
mulai();
}
delay(100);
}
void settekanan(){
btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);
lcd.setCursor(0,0);
lcd.print("Setting Presure ");
lcd.setCursor(0,1);
lcd.print(presure);
lcd.print(" ");
if(btupx == 0){
delay(200);
presure = presure + 10;
}
if(btdownx == 0){
delay(200);
presure = presure - 10;
}
if(btokx == 0){
delay(200);
lcd.clear();
if(presure == 20){
pilihan = 0;
}
if(presure == 30){
pilihan = 1;
}
if(presure == 40){
pilihan = 2;
}
if(presure == 50){
pilihan = 3;
}
if(presure == 60){
pilihan = 4;
}
return;
}
if(presure < 20){
presure = 20;
}
if(presure > 60){
presure = 60;
}
settekanan();
}
void setwaktu(){
btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);
lcd.setCursor(0,0);
lcd.print("Setting waktu ");
lcd.setCursor(0,1);
lcd.print(waktu);
lcd.print(" ");
if(btokx == 0){
delay(200);
lcd.clear();
btokx = 1;
return;
}
setwaktu();
}
void mulai(){
t = rtc.getTime();
//pompa manset
motor1.run(FORWARD);
motor2.run(RELEASE);
motor3.run(FORWARD);
dataadc = analogRead(A0);
mmhg = (dataadc - 46.222) / 3.2;
lcd.setCursor(0,0);
lcd.print("P/M/W=");
lcd.print(mmhg);
lcd.print("/");
lcd.print(presure);
lcd.print("/");
lcd.print(waktu);
lcd.setCursor(0,1);
lcd.print(t.hour);
lcd.print(":");
lcd.print(t.min);
lcd.print(":");
lcd.print(t.sec);
lcd.print(" ");
lcd.setCursor(9,1);
lcd.print(" ");
if(t.hour == 1){
lcd.clear();
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
return;
}
if((pilihan == 0)&&(mmhg >= 26)){
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
digitalWrite(buzzer,HIGH); //bunyi
delay(5000);
digitalWrite(buzzer,LOW); //off
lcd.clear();
return;
}
if((pilihan == 1)&&(mmhg >= 39)){
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
digitalWrite(buzzer,HIGH); //bunyi
delay(5000);
digitalWrite(buzzer,LOW); //off
lcd.clear();
return;
}
if((pilihan == 2)&&(mmhg >= 52)){
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
digitalWrite(buzzer,HIGH); //bunyi
delay(5000);
digitalWrite(buzzer,LOW); //off
lcd.clear();
return;
}
if((pilihan == 3)&&(mmhg >= 65)){
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
digitalWrite(buzzer,HIGH); //bunyi
delay(5000);
digitalWrite(buzzer,LOW); //off
lcd.clear();
return;
}
if((pilihan == 4)&&(mmhg >= 78)){
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
digitalWrite(buzzer,HIGH); //bunyi
delay(5000);
digitalWrite(buzzer,LOW); //off
lcd.clear();
return;
}
if(mmhg >= presure){
//presure stay
lcd.setCursor(9,1);
lcd.print("INFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
delay(15000);
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor2.run(FORWARD);
delay(45000);
}
mulai();
}
#include <LiquidCrystal_I2C.h>
#include <AFMotor.h>
#include <DS3231.h>
LiquidCrystal_I2C lcd(0x27, 16,2);
AF_DCMotor motor1(1); //pompa
AF_DCMotor motor2(2); //solenoid buang angin
AF_DCMotor motor3(3); //solenoid ke manset
int buzzer = 9;
int btset = A1;
int btup = A2;
int btdown = A3;
int btok = 10;
int menit = 59;
int detik = 60;
int pilihan;
int btsetx;
int btupx;
int btdownx;
int btokx;
int waktu = 60;
int dataadc;
int mmhg;
int presure = 20;
//SOLENOID ON ITU UDARA MENGALIR
//SOLENOID OFF ITU UDARA STOP
DS3231 rtc(SDA, SCL);
Time t;
void setup() {
lcd.clear();
lcd.begin();
lcd.noCursor();
Serial.begin(9600);
motor1.setSpeed(255);
//motor1.run(RELEASE);
motor2.setSpeed(255);
//solout.run(RELEASE);
motor3.setSpeed(255);
//solman.run(RELEASE);
pinMode(buzzer,OUTPUT);
pinMode(btset,INPUT_PULLUP);
pinMode(btup,INPUT_PULLUP);
pinMode(btdown,INPUT_PULLUP);
pinMode(btok,INPUT_PULLUP);
rtc.begin();
//rtc.setDOW(FRIDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(0, 0, 0); // Set the time to 12:00:00 (24hr format)
//rtc.setDate(13, 5, 2022); // Set the date to January 1st, 2014
}
void loop() {
motor2.run(FORWARD);
motor3.run(FORWARD);
btsetx = digitalRead(btset);
btokx = digitalRead(btok);
lcd.setCursor(0,0);
lcd.print("P/W= ");
lcd.print(presure);
lcd.print("/");
lcd.print(waktu);
lcd.print(" ");
lcd.setCursor(15,0);
lcd.print(pilihan);
lcd.setCursor(0,1);
lcd.print("TEKAN MULAI ");
if(btsetx == 0){
delay(1000);
lcd.clear();
settekanan();
lcd.clear();
delay(1000);
setwaktu();
lcd.clear();
delay(1000);
}
if(btokx == 0){
delay(1000);
lcd.clear();
rtc.setTime(0, 0, 0); //set timer
t.sec = 0;
mulai();
}
delay(100);
}
void settekanan(){
btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);
lcd.setCursor(0,0);
lcd.print("Setting Presure ");
lcd.setCursor(0,1);
lcd.print(presure);
lcd.print(" ");
if(btupx == 0){
delay(200);
presure = presure + 10;
}
if(btdownx == 0){
delay(200);
presure = presure - 10;
}
if(btokx == 0){
delay(200);
lcd.clear();
if(presure == 20){
pilihan = 0;
}
if(presure == 30){
pilihan = 1;
}
if(presure == 40){
pilihan = 2;
}
if(presure == 50){
pilihan = 3;
}
if(presure == 60){
pilihan = 4;
}
return;
}
if(presure < 20){
presure = 20;
}
if(presure > 60){
presure = 60;
}
settekanan();
}
void setwaktu(){
btsetx = digitalRead(btset);
btupx = digitalRead(btup);
btdownx = digitalRead(btdown);
btokx = digitalRead(btok);
lcd.setCursor(0,0);
lcd.print("Setting waktu ");
lcd.setCursor(0,1);
lcd.print(waktu);
lcd.print(" ");
if(btokx == 0){
delay(200);
lcd.clear();
btokx = 1;
return;
}
setwaktu();
}
void mulai(){
t = rtc.getTime();
//pompa manset
motor1.run(FORWARD);
motor2.run(RELEASE);
motor3.run(FORWARD);
dataadc = analogRead(A0);
mmhg = (dataadc - 46.222) / 3.2;
lcd.setCursor(0,0);
lcd.print("P/M/W=");
lcd.print(mmhg);
lcd.print("/");
lcd.print(presure);
lcd.print("/");
lcd.print(waktu);
lcd.setCursor(0,1);
lcd.print(t.hour);
lcd.print(":");
lcd.print(t.min);
lcd.print(":");
lcd.print(t.sec);
lcd.print(" ");
lcd.setCursor(9,1);
lcd.print(" ");
if(t.hour == 1){
lcd.clear();
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
return;
}
if((pilihan == 0)&&(mmhg >= 26)){
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
digitalWrite(buzzer,HIGH); //bunyi
delay(5000);
digitalWrite(buzzer,LOW); //off
lcd.clear();
return;
}
if((pilihan == 1)&&(mmhg >= 39)){
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
digitalWrite(buzzer,HIGH); //bunyi
delay(5000);
digitalWrite(buzzer,LOW); //off
lcd.clear();
return;
}
if((pilihan == 2)&&(mmhg >= 52)){
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
digitalWrite(buzzer,HIGH); //bunyi
delay(5000);
digitalWrite(buzzer,LOW); //off
lcd.clear();
return;
}
if((pilihan == 3)&&(mmhg >= 65)){
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
digitalWrite(buzzer,HIGH); //bunyi
delay(5000);
digitalWrite(buzzer,LOW); //off
lcd.clear();
return;
}
if((pilihan == 4)&&(mmhg >= 78)){
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
digitalWrite(buzzer,HIGH); //bunyi
delay(5000);
digitalWrite(buzzer,LOW); //off
lcd.clear();
return;
}
if(mmhg >= presure){
//presure stay
lcd.setCursor(9,1);
lcd.print("INFLASI");
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(FORWARD);
delay(15000);
lcd.setCursor(9,1);
lcd.print("DEFLASI");
motor2.run(FORWARD);
delay(45000);
}
mulai();
}
d. VIDEO HASILNYA
No comments:
Post a Comment