Introduction: Android Wi-fi Disabler With Arduino Distance Sensor
Another quick project!
I was doing a part in my bigger project and came across a part, where I was in need to shut down my phone's wifi via Bluetooth form an Arduino. It was ment as a "safety" trigger that acts as when the hand is above the sensor the wifi on the phone is enabled, but when the hand is removed, the wifi shuts down.
So I called my friend that built the andoid app.
This instructable can be referred as an upgrade to my tutorial on Bluetooth and Ultrasonic sensor so make sure you watch that first if you don't know how they work (https://www.instructables.com/id/Arduino-Bluetooth-and-Ultrasonic-sensor-TUTORIAL/).
Step 1: Components
These are the components that you will need to make this project:
-Arduino / compatable Micro controller
- HC-SR04 ultrasonic distance sensor
- HC-06 Bluetooth module or any compatable UART bluetooth module
- Android device
Step 2: HARDWARE CONNECTION
The picture shows up the hardware connection.
The first one shows up the connection normally, for the BT module to be connected to hardware serial pins RX(0), TX(1). Be sure to disconnect the BT module from these pins before uploading the code to the arduino, as the program will be wanting to upload to the BT module, which is impossible.
The second one shows the connection for Software Serial which is a library, that uses 2 other pins of the arduino for RX and TX and creates virtual/software serial pins. That way you don't need to disconnect the BT module while uploading. This is a great way to do projects as you build and debug your code you don't need to disconnect and reconnect the parts at every upload.
Below are the 2 codes for each purpuse.
Step 3: Android App
The app is very simple and available on the playstore!
You just simply type in the name of the BT module that you have paired befor either with the code 1234 pr 0000. If you have HC-06, than that will most likely be it's name like in my case. The app also runs in the background, so you can do other things and diconnect the wifi.
So just put in it's name and hit that RUN button and it will connect to the module and wait for pulses.
To shut the app down all you need to do is click the STOP button or just remove it from the tasks.
Thank you for watching my quick instructable. The use of it can be somekind situational but you can proceed from this point on and build something amazing and I'll see you next time.