Step 1: Materials
Hardware:
1- Arduino board
2- 1Sheeld and Android Smartphone/Tablet
3- Ultrasonic sensor HC-SR04
4- Jumper wires (Male to Female)
Software:
1. Arduino IDE (you can download fromhttps://www.arduino.cc/en/Main/Software)
2-You need to download and place 1sheeld library and 1Sheeld app from here:-http://1sheeld.com/downloads/
3- Download Ultrasonic library fromhttps://github.com/JRodrigoTech/Ultrasonic-HC-SR04...
Step 2: Code
Download it directly from"Mom is coming" GitHub repo
or c&p
****************CODE***********************
//Connect SRF 04 to 1Sheeld like this:
//Vcc >> +5 ..... Tri >> digital pin #12 .... Echo >> digital pin #13 .... GND >> Gnd
#include <VibrationShield.h>
#define CUSTOM_SETTINGS
#define INCLUDE_TEXT_TO_SPEECH_SHIELD
#define INCLUDE_VIBRATION_SHIELD
/* Include 1Sheeld library. */
#include <OneSheeld.h>
/* This pattern waits for 1 second and vibrate for 2, 3 times. */
int pattern[6] = {1000,2000,1000,2000}; int patternSize = 6;
#include "Ultrasonic.h"
Ultrasonic ultrasonic(12,13);
int distance;
void setup()
{
/* Start communication. */
OneSheeld.begin(); }
void loop() {
distance=ultrasonic.Ranging(CM);
// I make detection distance < 50 ... but you can change it as you want From 2cm to 400 cm
if (distance < 50)
{
/* Vibrate as the first pattern once. */
Vibration.start(patternSize,pattern);
/* Wait for 3 seconds. */
OneSheeld.delay(3000);
/* Stop the vibration. */
Vibration.stop();
TextToSpeech.say("Mom is coming");
}
}
Step 3: System Diagram >> Link it up
1-Install 1sheeld app on your smart phone. (you can install it directly from Play Store).
2-Connect the 1sheeld over the arduino board.
3-Connect the Ultrasonic sensor HC-SRF 04 to 1Sheeld like this:
//Vcc >> +5 ..... Tri >> digital pin #12 .... Echo >> digital pin #13 .... GND >> Gnd
4-Download 1 sheeld library into Arduino IDE.
5-Write the code on Arduino IDE after adjusting the detection distance from 2cm to 400 cm( I make it if < 50), connect Arduino board to PC and upload the code into Arduino board.
(Hint: Take care about Upload mode and Operating mode of the 1 sheeld board also Arduino UNO working on 5V).
6-Connect 1sheeld mobile app to 1sheeld board, select the required sheelds(vibration - text to speech) from 1sheeld app, and make a test.
Schematic
Congratulations, Now you do it yourself... :)
Any comments and suggestions will be welcome.
Any comments and suggestions will be welcome.