BYKE SHIELD (WIFI ENABLED)

148

1

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...

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).

EARLIER I HAD PREPARED SIMILAR GADGET WHICH WAS USING IR REMOTE FOR LOCKING / UNLOCKING THE GADGET.

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 BYKE SHIELD. I have used WEMOS D1 MINI 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(Wemos 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 may be unintentional but if the touch/teases continues then there must be something wrong and the gadget should warn us using its wifi connection directly on our app. 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.

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

Lets start,

Supplies:

Here is what you need to Blynk

A Smartphone • Android OS version 4.2+• iOS version 9+Blynk doesn't run on Windows Phones, Blackberries and other dead platforms. Sorry.You can also run Blynk on emulators

IoT Hardware Blynk can run on over 400 hardware modules. The most popular are: • ESP8266 • ESP32• NodeMCU• I HAVE USED WEMOS D1 MINI .Full list of supported hardware -->

Internet Connection To connect your hardware to the Internet, you can choose almost any module either built-in, or external shields Supported connectivity • WiFi• Ethernet• Cellular (GSM, 2G(MOST PROBABLY EXTINCT TECH IN PUBLIC DOMAIN), 3G, 4G, LTE)• Serial• USB via your PC• Bluetooth (BETA)

Step 1: PREPARE THE APP!!! (THE BLYNK APPLICATION)

FIRST THE BLYNK APP SHOULD BE INSTALLED

1

Create New Account in Blynk app

Account is needed to save your projects and provide access from any smartphone you have.☝️Use a valid email address as it will be later used often

2

Create New Project • Create New Project and choose the hardware you use.• If you can't find the hardware you use – select Generic Board• Choose what type of connectivity you use? • Choose Dark or Light UI interface

3

Get Auth Token Check your inbox to see if you get an email from Blynk with the Auth Token. You will need it later

CHECK OUT THE ABOVE VIDEO FOR MAKING THE APP IN DETAILED.

Step 2: Gather Your Materials!!!!!

The materials required are :

1.WEMOS D1 MINI(any wifi board (NodeMCU) can work but due to small size factor I have used WEMOS)

2. Shock sensor

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

4. Rechargeable batteries

5. Charge controller circuit/ power bank will do

6. Mounting screws

7. Aluminum strip

8. Duct tap

9. 4 ohms 5 watt speaker

10. Amplifier circuit(5volts)

12. Wire connector

13. Dc barrel jack for charging

14. Dc jack adaptor (5 volts 1 amp)

Step 3: CONNECTIONS AND SETUP

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

D4 ---->>>>>>>>>>> BUZZER (+)

PIN D2 ----->>>>>>>>>>> TRANSISTOR PIN2

OTHER CONNECTIONS

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

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

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

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

CIRCUIT OUT+ ----->>> 5V(WEMOS)

VCC CIRCUIT OUT- ----->>> GND(WEMOS)

Step 4: CODE DESIGN

#include 
#define BLYNK_PRINT Serial
#include 
#include 
BlynkTimer timer;
int LEDPIN = D3;
int flag2;
 int flag1 ;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "2a15716717a44ca7bffde37131e53de6";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = " REPLACE WITH YOUR WIFI CONNECTION NAME";
char pass[] = " ENTER CONNECTION PASSCODE";
bool locked = true;
void MAIN() {
  Blynk.syncVirtual(V2);
  if (flag2 == 1) {
      
      digitalWrite(D1, HIGH);
      long measurement = TP_init();
   
      
      delay(10 );
      Serial.println("measurment = ");
      
    if (measurement > 100) {
      Serial.println(measurement );
      digitalWrite(D4, HIGH);
      for (int k = 3000; k < 4000; k = k + 200)
      {
        tone(D4, k, 300);
        delay(70);
      }
        delay(1000);
        digitalWrite(D4, LOW);
       measurement == 0;
         delay(7000);
      long measurement = TP_init();
      delay(10);
      Serial.println(measurement);
      if (measurement > 25) {
          Serial.println(measurement);
          
          Blynk.notify( "ALERT: SOMEONE HAS MOVED ME");
          
          FORLOOPER();
                              
   
               }                            
              }
             }
}
void FORLOOPER(){
for (int p = 0; p < 120; p++)
               {
	Serial.println("iNSIDE P lOOP");
                for (int j = 3000 ; j < 5000 ; j = j + 200)
                    {  Serial.println("iNSIDE j lOOP");
                     tone(D4, j, 400);
                     delay(70);
                      
                    
                       ;   
                      delay(100);
                      
                     }
                      delay(100);
           
          if(flag1==1){p=120;}
            
               }
}
long TP_init() {
  delay(10);
  long measurement = pulseIn(D0,LOW); //wait for the pin to get HIGH and returns measurement
  return measurement;
}
void setup()
{
  // Debug console
  pinMode(D0,INPUT); pinMode(LEDPIN,INPUT);
  Serial.begin(9600);
timer.setInterval(16000L,MAIN);
  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
}
BLYNK_WRITE(V5){
 
  
  flag1=param.asInt();
 
  }
  BLYNK_WRITE(V2){
 
  
  flag2=param.asInt();
 
  }
 BLYNK_WRITE(V6){
   
 if( String("Start") == param.asStr())  {
 digitalWrite(D4,LOW); 
  Blynk.virtualWrite(V6,"I AM FINE"); 
 
  }else{Blynk.virtualWrite(V6,"I AM NOT  FINE");  }}
 
void loop()
{
  MAIN();
  Blynk.run();
}

Step 5: HOW THIS CODE FUNCTIONS

First it initiates the wifi router connection with itself (Wemos d1 mini)by entering the password provided in the code.

Then initiates the measurement variables defined and other output pins and input pins.

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 an app created in STEP 3 controlled by pressing a designated button . But this will only reset the alarm, a designated button as (MAIN) is required to be pressed to switch off the alarm.

This app will SEND notifications as"ALERT: SOMEONE MOVED ME"in the mobile. We have to set a notification tune by going into the notification settings .This will help the user to know when the MTB was moved ,as Blynk server keep a data of notifications and other controls.So ,one can go and check the dataloggers provided by the blynk server.

SO, HOW TO USE THIS APP AND SECURITY GADGET ANYWHERE IN THE WORLD?

JUST START YOUR MOBILE HOTSPOT AND CHANGE THE NAME OF YOUR HOTSPOT AND PASSCODE ACCORDING TO THE CREDENTIALS ENTERED IN THE CODE . WEMOS WILL AUTOMATICALLY PAIR WITH YOUR HOTSPOT IN 15 SECONDS.........

Step 6: PRODUCT ASSEMBLY

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 holes 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 7: FINAL GADGET LOOKS LIKE THIS

THE FINAL GADGET AFTER ASSEMBLY

BYKE SHIELD (WIFI ENABLED)

HOPE YOU ENJOYED IT!!

THANKS FOR READING/VIEWING.

BE SAFE.BE SECURE.

GO ON RIDING.

P.S :YOU CAN ALSO VISIT MY INSTRUCTABLE (ARDU-BYKE SHIELD)WHICH USES IR REMOTE FOR CONTROL (AND ENTERING PASSCODE ALSO).

Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Pets Challenge

      Pets Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    2 Discussions

    0
    None
    joynjoy

    10 days ago

    Nice gadget.