-
1(These steps are from version 1 , My project is updated at PROJECT LOGS) Circuit Diagram - Descriptions.
The bracelet has 3 operating modes: Battery charging mode, Finger vibration mode, Sound mode.
- "Button" is used to turn the device on or off by pressing and holding for 3 seconds. Or to switch between two modes, finger vibration mode or sound mode.
- Pc817 has function to close circuit to A2 pin measure battery voltage.
- Relay has a function to turn on / off the power from the battery with charging feet and Arduino.
-
2Make circles from the plastic pipe
water plastic pipe ∅21mm and ∅48
And it fit the size of my hand
-
3Make a box containing the circuit
I cut a lot of small plastic sheets, to fit into the box shape, then use plastic glue to connect them
Now try wearing it on your hand. Looks pretty okay
Use plastic glue to connect them.
-
4Load the program for the Arduino pro mini.
//tác giả: Đỗ Xuân Tiến #include <EEPROM.h> const int trig = 8; //chân trig của HC-SR04 const int echo = 7; //chân echo của HC-SR04 byte ngon_tay_cai_6 = 6; //ngón tay cái - thumb //byte middle_finger = 5; //ngón tay giữa byte ngon_tay_ut_3 = 3; //ngón tay út - little finger byte relay_A0 = A0; //relay 3v3a byte button_A3 = A3; //button byte coi_chip_10 = 10; //buzzer byte led_11 = 11; //led byte opto_volt_pin_12 = 12; //opto pc817 byte do_volt_out_A1 = A1; //Check whether the charger is charging or not byte do_volt_pin_A2 = A2; //Measure the battery voltage byte rung_cai = 0; byte rung_ut = 0; byte rung_cai_1 = 0; byte rung_cai_2 = 0; byte rung_ut_1 = 0; byte rung_ut_2 = 0; byte che_do_rung = 0; byte khong_lap = 0; byte sau_tha_nut = 0; byte loa1 = 0; byte loa2 = 0; byte den1 = 0; byte den2 = 0; byte tat = 0; //biến giúp khi rút sạc thì tắt - Turn off the power when not charging int dovolt_out = 0; float volt_out = 0; unsigned long pe_rung = 0; unsigned long pe_rung_cai_1 = 0; unsigned long pe_rung_cai_2 = 0; unsigned long pe_rung_ut_1 = 0; unsigned long pe_rung_ut_2 = 0; unsigned long pe_loa1 = 0; unsigned long pe_loa2 = 0; unsigned long pe_nhanli = 0; unsigned long pe11 = 0; unsigned long pe12 = 0; int GT_button = 0; int GT_button_000 = 0; int time_x = 0; void tien_sacpin (unsigned long giay) { unsigned long peham_sac = millis(); while((millis() - peham_sac <= giay) && (volt_out >= 3.5)){ //đo volt ngoài dovolt_out = analogRead(do_volt_out_A1); volt_out = dovolt_out / 1023.0 * 5.0; //nháy đèn if((den1 == 0) && (millis() - pe12 >= 150)){pe11 = millis(); digitalWrite(led_11,HIGH); den1 = 1; den2 = 0;} if((den2 == 0) && (millis() - pe11 >= 150)){pe12 = millis(); digitalWrite(led_11,LOW); den2 = 1; den1 = 0; } } } void setup() { pinMode(relay_A0,OUTPUT); digitalWrite(relay_A0,HIGH); //Serial.begin(9600); // giao tiếp Serial với baudrate 9600 pinMode(trig,OUTPUT); // chân trig sẽ phát tín hiệu pinMode(coi_chip_10,OUTPUT); pinMode(ngon_tay_cai_6,OUTPUT); pinMode(ngon_tay_ut_3,OUTPUT); pinMode(opto_volt_pin_12,OUTPUT); pinMode(led_11,OUTPUT); pinMode(echo,INPUT); // chân echo sẽ nhận tín hiệu pinMode(button_A3,INPUT); pinMode(do_volt_out_A1,INPUT); pinMode(do_volt_pin_A2,INPUT); delay(6000); che_do_rung = EEPROM.read(6); delay(200); if((che_do_rung != 1) && (che_do_rung != 0)){delay(1000); EEPROM.write(6, 0); delay(1000); che_do_rung = EEPROM.read(6);} //quan trọng, chỉ dùng 1 lần - Only run once } void loop() { //đo volt ngoài - Check whether the charger is charging or not dovolt_out = analogRead(do_volt_out_A1); volt_out = dovolt_out / 1023.0 * 5.0; //Serial.println(volt_out); //chế độ sạc pin - Battery charging mode if(volt_out >= 3.5){tat = 1;} //biến giúp khi rút sạc thì tắt - "tat = 1: Turn off the power when not charging" while((volt_out >= 3.5) or (tat == 1)){ digitalWrite(coi_chip_10,LOW); analogWrite(ngon_tay_cai_6,0); analogWrite(ngon_tay_ut_3,0); //đo volt ngoài - Check whether the charger is charging or not dovolt_out = analogRead(do_volt_out_A1); volt_out = dovolt_out / 1023.0 * 5.0; digitalWrite(led_11,LOW); digitalWrite(relay_A0,LOW); digitalWrite(opto_volt_pin_12,HIGH); delay(3500); //đo volt pin - Measure the battery voltage int dovolt_pin = analogRead(do_volt_pin_A2); float volt_pin = dovolt_pin / 1023.0 * 5.0; //Serial.println("pin_1"); //Serial.println(volt_pin); //Serial.println("pin_2"); if(volt_pin <= 4.9){digitalWrite(relay_A0,HIGH); tien_sacpin(60000);} else{digitalWrite(led_11,HIGH); delay(500);} } digitalWrite(relay_A0,HIGH); digitalWrite(opto_volt_pin_12,LOW); if((den1 == 0) && (millis() - pe12 >= 1500)){pe11 = millis(); digitalWrite(led_11,HIGH); den1 = 1; den2 = 0;} if((den2 == 0) && (millis() - pe11 >= 1500)){pe12 = millis(); digitalWrite(led_11,LOW); den2 = 1; den1 = 0; } //chế độ không sạc pin - No battery charging mode if(volt_out < 3.5){ //nhấn lỳ 3s để tắt - Hold down for 3 seconds to turn off GT_button = digitalRead(button_A3); if (GT_button != GT_button_000) { GT_button_000 = GT_button; pe_nhanli = millis(); } if ((GT_button == 1) && (millis() - pe_nhanli > 3000)){digitalWrite(coi_chip_10,HIGH); digitalWrite(led_11,HIGH); analogWrite(ngon_tay_cai_6,100); analogWrite(ngon_tay_ut_3,100); delay(500); digitalWrite(coi_chip_10,LOW); delay(5000); digitalWrite(relay_A0,LOW); delay(5000);} //nhấn nhanh để chuyển đỗi gữa loa và rung, Đọc trạng thái button để bật loa hoặc bật rung - Quick click to switch speakers and vibrate GT_button = digitalRead(button_A3); if((GT_button == 1) && (khong_lap == 0)){ khong_lap = 1; sau_tha_nut = 1; } if((GT_button == 0) && (sau_tha_nut == 1)){sau_tha_nut = 0; khong_lap = 0; che_do_rung = EEPROM.read(6);delay(10); if(che_do_rung == 1){delay(300); EEPROM.write(6, 0); delay(300);} else{delay(300); EEPROM.write(6, 1); delay(300); } che_do_rung = EEPROM.read(6); } unsigned long thoi_gian = 0; // biến đo thời gian - Time variable int khoang_cach; // biến lưu khoảng cách - Distance variable /* Phát xung từ chân trig */ delay(50); //delay tránh nhiễu sóng siêu âm digitalWrite(trig,0); // tắt chân trig delayMicroseconds(2); digitalWrite(trig,1); // phát xung từ chân trig delayMicroseconds(5); // xung có độ dài 5 microSeconds digitalWrite(trig,0); // tắt chân trig /* Tính toán thời gian */ thoi_gian = pulseIn(echo,HIGH); // Tính khoảng cách đến vật. khoang_cach = int(thoi_gian/2/29.412); //Serial.print(khoang_cach); //Serial.println("cm"); if(khoang_cach <= 130) {rung_cai = 1; rung_ut = 0; pe_rung = millis();} if((khoang_cach > 130) && (khoang_cach <= 280)){rung_cai = 0; rung_ut = 1; pe_rung = millis();} else{if(millis() - pe_rung >= 1000){rung_cai = 0; rung_ut = 0;}} //chế độ rung ngón tay - finger vibration mode if(che_do_rung == 0){ if(millis() - pe_loa1 >= 50){digitalWrite(coi_chip_10,LOW);} // rung nhẹ ngón tay cái - Motor vibration on the thumb if(rung_cai == 1){if((rung_cai_1 == 0) && (millis() - pe_rung_cai_2 >= 100)){pe_rung_cai_1 = millis();analogWrite(ngon_tay_cai_6,150); rung_cai_1 = 1; rung_cai_2 = 0;} //rung có nhịp if((rung_cai_2 == 0) && (millis() - pe_rung_cai_1 >= 300)){pe_rung_cai_2 = millis();analogWrite(ngon_tay_cai_6,0); rung_cai_2 = 1; rung_cai_1 = 0; }} else{analogWrite(ngon_tay_cai_6,0);} // rung nhẹ ngón tay út - Vibration motor on the little finger if(rung_ut == 1){if((rung_ut_1 == 0) && (millis() - pe_rung_ut_2 >= 100)){pe_rung_ut_1 = millis();analogWrite(ngon_tay_ut_3,150); rung_ut_1 = 1; rung_ut_2 = 0;} //rung có nhịp - Vibration motor feel comfortable if((rung_ut_2 == 0) && (millis() - pe_rung_ut_1 >= 300)){pe_rung_ut_2 = millis();analogWrite(ngon_tay_ut_3,0); rung_ut_2 = 1; rung_ut_1 = 0; }} else{analogWrite(ngon_tay_ut_3,0);} } //chế độ phát loa, nháy loa nhanh dần khi khoảng cách giảm dần - Sound mode else{ analogWrite(ngon_tay_cai_6,0); analogWrite(ngon_tay_ut_3,0); if(khoang_cach <= 300){ time_x = (2 * khoang_cach) + (khoang_cach / 2); if((loa1 == 0) && (millis() - pe_loa2 >= time_x)){pe_loa1 = millis();digitalWrite(coi_chip_10,HIGH); loa1 = 1; loa2 = 0;} if((loa2 == 0) && (millis() - pe_loa1 >= 50)) {pe_loa2 = millis();digitalWrite(coi_chip_10,LOW); loa2 = 1; loa1 = 0; } } else{if(millis() - pe_loa1 >= 30){digitalWrite(coi_chip_10,LOW);}} //nháy loa nhanh khi khoảng cách đến vật khoảng 1m //if(rung_cai == 1){ if((loa1 == 0) && (millis() - pe_loa2 >= 60)){pe_loa1 = millis();digitalWrite(coi_chip_10,HIGH); loa1 = 1; loa2 = 0;} // if((loa2 == 0) && (millis() - pe_loa1 >= 60)){pe_loa2 = millis();digitalWrite(coi_chip_10,LOW); loa2 = 1; loa1 = 0; }} //nháy loa chậm khi khoảng cách đến vật từ 1m đến 2.8m //if(rung_ut == 1) { if((loa1 == 0) && (millis() - pe_loa2 >= 500)){pe_loa1 = millis();digitalWrite(coi_chip_10,HIGH); loa1 = 1; loa2 = 0;} // if((loa2 == 0) && (millis() - pe_loa1 >= 80)){pe_loa2 = millis();digitalWrite(coi_chip_10,LOW); loa2 = 1; loa1 = 0; }} // //if((rung_cai == 0) && (rung_ut == 0)){if(millis() - pe_loa1 >= 60){digitalWrite(coi_chip_10,LOW);}} } } }
-
5Electric assembly
I solder the tin between two Arduino circuits with hc-sr04 through their GND pin. As in the picture, red circle. The circuit will be fixed firmly !
Try putting it in the box, there's still a good gap for the rest.
Use glue to bond vibrating motor with small ring.
Vibrator Motor can be purchased at the telephone repair shop.
After the electrical part is completed.
I use 2 screws for the bottom of the box.
Thank you!!!
-
6The bracelet is fabric-covered and adjustable in size
I use elastic fabric to wrap the bracelet. Can take advantage of the socks.
The bracelet adjustable to fit more people's hands. The strap taken from a broken helmet.
Can wear medium with the hands of more people.
Thank you!!!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.