Telechargé par massi belaidi

Arduino-with-GSM-and-PIR-Sensor-EnglishArabic

publicité
technology
workshop
craft
home
food
play
outside
costumes
Arduino with GSM and PIR Sensor (English/Arabic)
by motheeb on October 22, 2015
Table of Contents
Arduino with GSM and PIR Sensor (English/Arabic) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
Intro: Arduino with GSM and PIR Sensor (English/Arabic) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
Step 1: Required Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
Step 2: Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
Step 3: GSM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
Step 4: Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
Step 5: Explaining the code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Step 6: Controlling the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Step 7: Future projects using this lesson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
Intro: Arduino with GSM and PIR Sensor (English/Arabic)
?????? ???? ???? ?? ????????? ?????? ???
???????:
?? ?????????? ?????? ???????? ??????? ????? ???? ????? ????? ???? ?? ??????? ????? ???? ?????? ?????? ???? ??????? ????? ??? ?? ????
???? ?????? ?????? ????? ?? ?????? ??? ????? ?????? ?? ???? ?? ??????? ??? ?????? ??????
Introduction:
This lesson will allow you to use SMS to control an LED along with using Arduino to make automatic calls to your phone in case it sensed movements in your room. You
will be able to listen to the voices there and act upon emergency.
Step 1: Required Parts
???????? ?????:
· ???????
· ?????????? ???????? ?????? ???
· ?????? ???? ????
· ???? ?????
· ???? ????
· ????? ????? ?? ???????? ?????? ?? ?
· 220 ????? ?????? ? ?? ?
· ????
· ??????? ??????? ???
· 12VDC ??????? ????
· ?????????
· ?????? ????? ?????? ) ?????? ??????
Parts:
· Arduino Uno R3
· Type A to B USB
· SainSmart GSM SIM300 Module
· Sim Card
· Motion Sensor
· 2 different Color LED
· 2x 220 Ohm Resistor
· Jumper wires
· Breadboard
· 12VDC adaptor
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
· Microphone
· Speakers (Optional)
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
Step 2: Connections
????? ?????:
??????? ??????? ?? ???? ???? ? ???? ???????? ????? ???? ??? .???????? ?? ????? ????? ????? ?? ???? ?????? ?????
Connections:
Follow the attached picture connections carefully. Please verify your connections with the table below.
?????? ???? ???? ?????
Connections between Arduino and GSM Module:
GSM === Arduino
TX === PIN 3
RX === PIN 2
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
GND === GND
?????? ???? ?????:
Connections between Arduino and Motion Sensor:
Motion Sensor === Arduino
VCC === 5 V
Data === PIN 7
GND === GND
????? ???? ???????? ?????
???????? ?? ???? ????? <= ???????? ?? ???? ? ???? ??? ????
?????? ?? ????? ????? ?? : ????? ?? ?????? ????? <= ???????? ?? ?????? ?????
???????? ?? ???? ???? <= ????? ?? ?????? ?????
Connections between Arduino and LED
Pin 9/10 in Arduino => one side of the Resistor
Other side of the Resistor => Positive Side of LED (long leg)
Negative side of LED => GND in Arduino
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
Step 3: GSM Configuration
?????? ???? ???? ??? ????????? ???:
· ??????? ???? ??? ?????? ??????? ???? ????? ?? ?????? ??????
o ???? ????? ?? ????????? ?? ??????? ?? ????? ?? ?????? ???? ?????? ???
· ??????? ??? ?????? ????????? ?????? ????? ?? ????
· ??? ??? ???? ???? ? ???? ???? ????? ??? ?? ????
· ????????? ?????? ????? ?? ????
GSM Configuration:
· Please make sure the jumpers are correctly placed as attached picture
o This will allow the chip to know if it is dealing with a micro controller or PC
· Connect speakers and microphone as in picture
· Place a valid SIM card preferably no pin code.
· Connect Power adapter to GSM
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
Step 4: Programming
???????? ??? ???????? ???:
???????? ?????? ??? ????? ???? ?? ?????? ???????? ??? ???
?????? ??? ????? ?? ???????? ??? ?? ?????? ??????:
· NUM_MSGS_DELETE ??????? ????? ??? ??????? ???? ??? ????? ??? ?? ????
· CPIN[] ?? ??? ?? ????? ??????? ??? ????
· AT() ???? ?? ????? ????? ?? ???? ??? ??? ??? ???
· CALL_NUM ???? ???? ??? ?????? ???
?????? ??????? ???????? ????? ????? ?? ????? ????? ????? ???? ???? ????
1. ????? ?? ?????? ??? ??? ???? ??? ?????????:
o SEND_MSG_NUM ??????? ?????? ??? ????
o SEND_MSG_TXT ?????? ??????? ?????
2. ???????? ?????? ?? ????? ????? ??? ??? ?????? ??? ???? ?????
o send_call() ----to----> send_txt()
???????? ????? ????? ???:
??? ????? ?? ????????? ??????? ??????? ???
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
C:\Users\user\Documents\Arduino\libraries
????? ??????? ??????? 100 ??? ???? 64 ?? ???????? ??????? ?? ?????? ????? ???? ???? ??????? ????? ????????? ????? ?? ????? ??????? ???
Uploading program to Arduino:
Just download the program or copy the code into an Arduino sketch
Please go over this code check list prior to executing the code:
· NUM_MSGS_DELETE (check it’s value if the SIM is not dedicated for the project)
· CPIN[] (insert SIM PIN Code, if required )
· if PIN is required, uncomment the code in AT()
· CALL_NUM (Emergency Call Number For Motion)
There is an additional function (send_txt()) in the code for Sending SMS instead of calling you.
1. For it to work you must fill :
o SEND_MSG_NUM (Insert phone number to receive SMS MSG)
o SEND_MSG_TXT (Insert SMS text)
2. And replace send_call() with send_txt() in main loop
ADDED LIBRARY:
Download adjusted Software Serial library and place it in:
C:\Users\user\Documents\Arduino\libraries
Only internal buffer increased to 100 instead of 64 nothing more.
File Downloads
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
Code with Arabic.txt (24 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Code with Arabic.txt']
GSM_Lesson_Motheebotronic.ino (14 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'GSM_Lesson_Motheebotronic.ino']
ADJSoftwareSerial.zip (6 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'ADJSoftwareSerial.zip']
Step 5: Explaining the code
???????? ???:
?????????? ???????? ?????? ????? ?? ??? ?? ????? ?? ?? ????? ????? ???? ??? ????
??????? ??? ???? ????????? ???? ????? ?????
Explaining the code:
Almost every line inside the code has comments along with it
Please try reading all comments attached to understand the code.
?? ??? ?????:
????? ?? ??????? ???? ???????? ???? ?? ?????? ?? ?? ???? .??????? ?????? ???????? ???? ??????? ?? ?? ??? ????? .
?????? ?? ??? ????? ???
"AT" or "at"
????? ?? ???? ??? ?????? ?????? ?????.
????????? ????? ???? ?????? ?? ??? ???? ?????? ?????? ?????? ?? ?????? ??????.
AT Commands:
“AT commands are instructions used to control a modem. AT is the abbreviation of ATtention. Every command line starts with "AT" or "at". That's why modem
commands are called AT commands. Note that the starting "AT" is the prefix that informs the modem about the start of a command line.” From CodeProject.com
To know and understand each command, you can download attached PDF file.
File Downloads
list_AT_Command.pdf (2 MB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'list_AT_Command.pdf']
Step 6: Controlling the project
???????? ??????:
1. ?????? ?????? ?????? ???? ?????? ?????? ???? ???????? ?????? ???
2. ?????? ?? ???? ?? ???? ?? ???? ?? ?????? ?????? ??? ?????? ???
a. ????? ?? ???????? ?????? ??? ????? ??????? ??????? ??? ??
3. ???? ??? ????? ???????? ?? ????????? ??????? ???? ????? ????? ?????
a. ON ????? ??????
b. OFF ????? ????
Controlling the project:
1. When a continuous movement is detected by the motion sensor, you will receive a call
2. When answering your phone, you will be able to listen to the surroundings of the device.
a. This will allow you to take necessary action
3. You can also send a Text to the Arduino with:
a. ON – To turn the LED ON
b. OFF – To turn the LED OFF
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
Step 7: Future projects using this lesson
??????? ??? ???????? ???????? ??????:
· ????? ??????? ???? ???? ?? ?????? ?? ?????? ??????????? ?????? ?????? ??????? ?????? ????? ???? ??
· ?????? ????? ??????? ????? ? ????????? ?????? ??????? ??????? ??? ????? ???? ????? ???? ??
· ??????? ???????? ?? ?????? ?????
Future projects using this lesson:
· By adding a Relay, you can control any AC device like your room lights, Alarm Sound, or any 110 V or 220V Household equipment
· By adding IR transmitter, you can control your TV and A/C using your phone World Wide.
· And many more…
Related Instructables
Arduino GSM
shield by
technolando
GSM Shield
Controlling AC
appliances
Home Alarm by
benhur.goncalves through smsUsing Arduino
remotely control
fan and light by
ostin jos
GSM
CONTROLLED
GREENHOUSE
FOR RURAL
AFRICA by
kimrot
Using GSM
Mobile Phone to
Switch
Appliances by
himshekhar.das
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
TXT ME by
englishman_in_berlin
Advertisements
Comments
http://www.instructables.com/id/Arduino-with-GSM-and-PIR-Sensor-EnglishArabic/
Téléchargement