ARDU-BYKE SHIELD

253

2

About: i am a 14 year old student from India. I love everything about arduino and robotics . I have experience in solving day to day problems with the help of my coding skills and knowledge in electronics(mainly a...

ARDU-BYKE-SHIELD

Introduction

Everyone in this world wants to protect the things which they like the most or their valuable belongings. Some people like to secure their cars and some want to secure their toys. This project is one of my attempt to secure my bike(MTB).

The question: How to secure it ?

How exactly and by which means?

The questions stated above laid the foundation of my project, which ultimately led me to ARDU-BYKE SHIELD .I have used Arduino Nano for this project.This idea revolves around a small concept of shocks and vibrations.

There exist a sensor in the world known as shock sensor. This sensor senses the vibes and converts it into electrical signals and sends it to the reader(arduino nano in this case).One can do more research on this ,but that’s not the topic here.

Here we assume that if someone touches bike/safe/door , it maybe unintentional but if the touch/teases continues then there must be something wrong and the gadget should warn us. After a delay of 7 seconds,

if the gadget continues to receive vibrations, it will produce a high-pitched

alarm and warn the user at the same time.

I HAVE USED IR REMOTE HERE IN THE PROJECT ,AS IN INDIA (MAYBE IN SOME OTHER COUNTRIES ALSO) STUDENTS ARE NOT ALLOWED TO BRING MOBILES OR ANY OTHER GADGET IN THE SCHOOLS.SO IR REMOTE WILL DO.

This project is inexpensive and made using easily available materials for students to do .

Lets start,

Step 1: Gather Your Materials!

The materials required are :

1. Arduino NANO(any arduino can work but due to small size factor I have used nano)

2. Shock sensor

3. PVC pipe of 1.5 inches(diameter) length (7 inches)

and pipe caps

4. IR receiver (TSOP1738 Sensor)

5. IR remote(any will work)

6. Rechargeable batteries

7. Charge controller circuit/ power bank will do

8. Mounting screws

9. Aluminum strip

10. Duct tap

11. 4 ohms 5 watt speaker

12. Amplifier circuit(5volts)

13. Wire connector

14. Dc barrel jack for charging

15. Dc jack adaptor (5 volts 1 amp)

Step 2: Connections and Circuit Diagram

ARDUINO TO CORRESPONDING PINS

D12 ----->>>>>>>>>>> IR PIN1

D2 ----->>>>>>>>>>> SIGNAL PIN Of shock sensor

D3 ---->>>>>>>>>>> BUZZER (+)PIN

D9 ----->>>>>>>>>>> TRANSISTOR PIN2

OTHER CONNECTIONS

TSOP+ pin(3)--------->>> VCC

TSOP- pin(2) -------->>>>GND

BATT+ ----->>>>>>>>>> CHARGER VCC

BATT- ----->>>>>>>>>> CHAGER GND

SENS GND ----->>>>>>> GND

SENS GND ----->>>>>> VCC

CIRCUIT OUT+ ----->>> ICSP VCC

CIRCUIT OUT- ----->>> ICSP GND

Step 3: Code Design

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////PRIYANSHU UCHAT////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////priyanshu.uc507@gmail.com///////////////////////////////////////////////////////////
#include
String pass = "007"; //Password to unlock.set as per your wish
int chances = 3; //Chances before 1 will start to buzz continuously.
bool afterChances = true;
int BUZZER = 12;// integer for defining buzzer
int RECV_PIN = 9;// reciveing signal from pin 1 of TSOP
String btn1 = "1fe50af"; //Your button 1 IR HEX code (in lower case). eg.: ff63ad
String btn2 = "1fed827"; //Your button 2 IR HEX code (in lower case).
String btn3 = "1fef807"; //Your button 3 IR HEX code (in lower case).
String btn4 = "1fe30cf"; //Your button 4 IR HEX code (in lower case).
String btn5 = "1feb04f"; //Your button 5 IR HEX code (in lower case).
String btn6 = "1fe708f"; //Your button 6 IR HEX code (in lower case).
String btn7 = "1fe00ff"; //Your button 7 IR HEX code (in lower case).
String btn8 = "1fef00f"; //Your button 8 IR HEX code (in lower case).
String btn9 = "1fe9867"; //Your button 9 IR HEX code (in lower case).
String btn0 = "1fee01f"; //Your button 0 IR HEX code (in lower case).
String btnReset = "1fe906f"; //Your button REPEAT OR RESET BUTTON IR HEX code (in lower case).
bool locked = true;
bool shouldBeep = true;
bool unlockSound = true;
String cPass = "";
int chance = 0;
String cmp = "----PRIYANSHU UCHAT-----\n";
String str2 = "AT-----\n";
void setup() {
pinMode(9, INPUT);
pinMode(12, INPUT); //set EP input for measurment
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);//init serial 9600
Serial.print(cmp);
}
void loop() {
if (cmp.endsWith(str2) == false)
Serial.print("Error!");
else {
if (irrecv.decode(&results)) {
if (String(results.value, HEX) == btn1) {
Serial.print("1");
updatePass("1");
}
else if (String(results.value, HEX) == btn2) {
Serial.print("2");
updatePass("2");
}
else if (String(results.value, HEX) == btn3) {
Serial.print("3");
updatePass("3");
}
else if (String(results.value, HEX) == btn4) {
Serial.print("4");
updatePass("4");
}
else if (String(results.value, HEX) == btn5) {
Serial.print("5");
updatePass("5");
}
else if (String(results.value, HEX) == btn6) {
Serial.print("6");
updatePass("6");
}
else if (String(results.value, HEX) == btn7) {
Serial.print("7");
updatePass("7");
}
else if (String(results.value, HEX) == btn8) {
Serial.print("8");
updatePass("8");
}
else if (String(results.value, HEX) == btn9) {
Serial.print("9");
updatePass("9");
}
else if (String(results.value, HEX) == btn0) {
Serial.print("0");
updatePass("0");
}
else if (String(results.value, HEX) == btnReset) {
resetPass();
Serial.println("\nRESET");
}
irrecv.resume(); // Receive the next value
}
if (locked == true) {
MAIN();
}
else {
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool updatePass(String ch) {
if (locked == false)
return false;
beep();
if (updatable() == true) {
cPass += ch;
if (cPass.length() < pass.length()) {
}
else {
if (pass == cPass) {
locked = false;
chance = 0;
digitalWrite(4, LOW);
digitalWrite(2, LOW);
for (int k = 1000; k < 4000; k = k + 200)
{
tone(4, k, 300);
delay(70);
}
Serial.println("\nUNLOCKED");
if (unlockSound == true) {
beep();
}
}
else {
cPass = "";
chance += 1;
for (int k = 300; k < 1000; k = k + 100)
{
tone(4, k, 300);
delay(100);
}
Serial.println("\nWRONG PASSWORD!");
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool updatable() {
if (chance <= chances)
return true;
return afterChances;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void resetPass() {
cPass = "";
locked = true;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void beep() {
if (shouldBeep == true) {
for (int k = 0; k < 4000; k = k + 500)
{
tone(4, k, 300);
delay(70);
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////1
void MAIN() {
if (locked == true) {
digitalWrite(2, HIGH);
long measurement = TP_init();
delay(10 );
if (measurement > 100) {
Serial.println(measurement );
digitalWrite(4, HIGH);
for (int k = 3000; k < 4000; k = k + 200)
{
tone(4, k, 300);
delay(70);
}
delay(1000);
digitalWrite(4, LOW);
measurement == 0;
delay(7000);
long measurement = TP_init();
delay(10);
Serial.println(measurement);
if (measurement > 100) {
Serial.println(measurement);
for (int p = 0; p < 120; p++)
{
for (int j = 3000 ; j < 5000 ; j = j + 200)
{
tone(4, j, 400);
delay(70);
irrecv.resume();
}
delay(100);
if ((irrecv.decode(&results)) == true)
{
if (String(results.value) = btnReset)
{
Serial.println("\nRESET");
digitalWrite(4 , LOW);
digitalWrite(2, LOW);
irrecv.resume();
break;
}
}
}
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
long TP_init() {
delay(10);
long measurement = pulseIn (12, LOW);
return measurement;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Step 4: How This Code Functions?

HOW THIS CODE FUNCTIONS:

The code receives digital signals from the SHOCK Sensor. It checks the vibration values received from the sensor continuously. If it detects any vibration more than prescribed value , it will beep once (as warning considering it an unintentional touch ).

But if someone continuously try to move the VEHICLE/ DOOR/SAFE where this gadget is installed for more than prescribed time (7 seconds in the instant case ), it will sound a high-pitched alarm continuously until stopped by the user with help of IR remote control by pressing a designated button . But this will only reset the alarm, a designated passcode(through IR remote) is required to be entered to switch off the alarm.

When a number button is pressed by the user for entering the passcode, the gadget will acknowledge the same by beeping a tone. If entered passcode is correct , a confirmation long tone will be played and system will enter in unguarded mode for using the vehicle or open door or safe. If wrong passcode is entered then it will play a short tune to acknowledge the same.

Step 5: Assemble the Components

First drill a 3 holes through pipe cap ,first at center ,second at the boundaries and attach the ir receiver jack and strip as shown above.

Second, arrange all the components with the help of double sided tape as per convenience .So that fixes into the pipe properly.

third, drill some hole in the pipe(bottom side) .Here i have attached it on a bottle holder space . Do as per your requirement.

Fourth,drill some holes on other side of the pipe for speaker and some for screws attaching to the body with cap.

Fifth,now pass the strip after attaching on appropriate place and and connect with connector the speaker wires through connectors as i have done .

Now put on the screws to attach the pipe cap to the pipe body.

CRUDE MODEL SHOWN ABOVE ATTACHED ON MY MTB

NOTE: PLEASE COVER THE ALUMINIUM STRIP WITH DUCT TAPE TO AVOID CONDUCTION OF ELECTRICITY.

Step 6: ARDU-BYKE SHIELD IS NOW READY! (FINAL GADGET)

THE FINAL GADGET AFTER ASSEMBLY

ARDU-BYKE SHIELD

HOPE YOU ENJOYED IT!!

THANKS FOR READING/VIEWING.

BE SAFE.BE SECURE.

Arduino Contest 2019

Participated in the
Arduino Contest 2019

Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • 1 Hour Challenge

      1 Hour Challenge

    Discussions