Scary Trick Using Arduino-LDR-BlueAct App
by maysaraabdullah in Circuits > Mobile
3865 Views, 25 Favorites, 0 Comments
Scary Trick Using Arduino-LDR-BlueAct App


With a small funny trick start joking with your friends at bored nights & make many tricks using a thing that we all have which is smartphones or tablets ... here i found an app on PlayStore that can help in these tricks and here is a tutorial for the app ...
An app that play/stop any sound track on your smartphone without using any shield.
You will find the circuit and code which is easy to do , you have to make the 4 wires and 2 components simple circuit then you have to install the Arduino code to your Arduino board.
Needed time : 15 minutes
Difficulty: easy
Setting Your BlueAct App:



Watch BlueAct tutorial in the above video or follow the three steps below to set your app for this trick:
1- connect the bluetooth module to your circuit and "Pair" it with your smartphone or tablet .
2- Add an action on BlueAct app such as play a soundtrack , vibrate , send sms , make a special schedule to do some actions on a specific time , read the device accelerometer , and much more.
3- program your microcontroller to send the data you selected on BlueAct app through your bluetooth module.
Circuit Connection
.jpg)

you just have to connect the bluetooth module such as (HC-06 , HC05) with your Arduino circuit as you have seen the above schematic photo.
The simple circuit connections are as follow:
Bluetooth Module------->Arduino :
-TX-->RX
-RX-->TX
-VCC-->5 volts
-GND-->GND
LDR & 10k ohm Resistor-------> Arduino:
-LDR-->1'st pin to "5 volts" , 2'nd pin to "A0" of Arduino (Whatever the LDR polarity)
-10K ohm Resistor-->1'st pin to "GND" , 2'nd pin to "A0" of Arduino (Whatever the Resistor polarity)
Then upload the next code to Arduino:
// Pins
int sensorPin = 0;
// Variables
//these flags to send only just one time the command see below
int flagOff=0;
int flagOn =0;
int treshold=150; //treshold for the light intensity.Change it as you need
void setup() { // Start Serial
//Serial.begin(19200);//change this value according to your Blutoth module baudrate
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(sensorPin);// Read the sensor pin
// If light level is low is detected, send command to play Sound
if (sensorValue < treshold && flagOff==0){
Serial.write("low");
flagOff=1;
flagOn=0;
} // If light level is low is detected, send command to stop Sound
if (sensorValue > treshold && flagOn==0){
Serial.write("high");
flagOn=1;
flagOff=0;
}
}