Useful Arduino project for car .

I write this post for second time with the idea to do my project.
With risk to not accomplish my project, i will start to work on it with your help and support
and i will begin with simple parts.
Aim 1: SMS Control on all components connected to the arduino.
Task 1: Activate PIR sensor and Piezo
Task 2: Activate microphone to record on SD module
Problem 1:
How to fit this code:
to this:
Problem 2: How to program this SD module with this microphone
http://img.td-imgs.com/images/42/45/254245_1531733_ECT-254245.jpg
https://www.sparkfun.com/products/8635?utm_source=NewProdClick&utm_medium=HomePage&utm_campaign=TopRight
Am using this power supply:
http://i.ebayimg.com/00/s/NzY4WDEwMjQ=/z/uFUAAOSwd4tUH~ah/$_35.JPG
Arduino Uno
GPS/GPRS/GSM Module V3.0
P.S. Sorry if this post is stupid and am asking elementary things
I will be glad and realy happy if you help to one newbie
With risk to not accomplish my project, i will start to work on it with your help and support

Aim 1: SMS Control on all components connected to the arduino.
Task 1: Activate PIR sensor and Piezo
Task 2: Activate microphone to record on SD module
Problem 1:
How to fit this code:
Code: Select all
int pirPin = 2; //digital 2
int pinSpeaker = 10;
void setup(){
Serial.begin(9600);
pinMode(pirPin, INPUT);
pinMode(pinSpeaker, OUTPUT);
}
void loop(){
int pirVal = digitalRead(pirPin);
if(pirVal == LOW){ //was motion detected
Serial.println("Motion Detected");
playTone(300, 160);
delay(2000);
}
}
void playTone(long duration, int freq) {
duration *= 1000;
int period = (1.0 / freq) * 1000000;
long elapsed_time = 0;
while (elapsed_time < duration) {
digitalWrite(pinSpeaker,HIGH);
delayMicroseconds(period / 2);
digitalWrite(pinSpeaker, LOW);
delayMicroseconds(period / 2);
elapsed_time += (period);
}
}
to this:
Code: Select all
// Product name: GPS/GPRS/GSM Module V3.0
// # Product SKU : TEL0051
// # Description:
// # The sketch for controling the GSM/GPRS/GPS module via SMS.
// # Steps:
// # 1. Turn the S1 switch to the Prog(right side)
// # 2. Turn the S2 switch to the USB side(left side)
// # 3. Set the UART select switch to middle one.
// # 4. Upload the sketch to the Arduino board(Make sure turn off other Serial monitor )
// # 5. Turn the S1 switch to the comm(left side)
// # 6. Turn the S2 switch to the Arduino(right side)
// # 7. RST the board until the START led is on(make sure you have >6V power supply)
// # 8. Plug the long side of LED into pin 13 and short side into GND
// # 9. Start sending "LH" and "LL" to your board to turn LED on and off.
/*
* created: 2013-11-14
* by: Grey
* Version: 0.3
* Attention: if you send the wrong SMS command to the module, just need to press RST.
* This version can't watch the module status via the serial monitor, it only display the Arduino command.
* If you want to watch the status,use the SoftwareSerial or the board with another serial port plese.
*/
byte gsmDriverPin[3] = {
3,4,5};//The default digital driver pins for the GSM and GPS mode
//If you want to change the digital driver pins
//or you have a conflict with D3~D5 on Arduino board,
//you can remove the J10~J12 jumpers to reconnect other driver pins for the module!
int ledpin = 13;
char inchar;
void setup()
{
//Init the driver pins for GSM function
for(int i = 0 ; i < 3; i++){
pinMode(gsmDriverPin[i],OUTPUT);
}
pinMode(ledpin,OUTPUT);
Serial.begin(9600); //set the baud rate
digitalWrite(5,HIGH); //Output GSM Timing
delay(1500);
digitalWrite(5,LOW);
digitalWrite(3,LOW); //Enable the GSM mode
digitalWrite(4,HIGH); //Disable the GPS mode
delay(2000);
delay(5000); //call ready
delay(5000);
Serial.println("AT+CMGD=1,4"); //Delete all SMS in box
}
void loop()
{
if(Serial.available()>0)
{
inchar=Serial.read();
if(inchar=='T')
{
delay(10);
inchar=Serial.read();
if (inchar=='I') //When the GSM module get the message, it will display the sign '+CMTI "SM", 1' in the serial port
{
delay(10);
Serial.println("AT+CMGR=1"); //When Arduino read the sign, send the "read" AT command to the module
delay(10);
}
}
else if (inchar=='L')
{
delay(10);
inchar=Serial.read();
if (inchar=='H') //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
{
delay(10);
digitalWrite(ledpin,HIGH); //Turn on led
delay(50);
Serial.println("AT+CMGD=1,4"); //Delete all message
delay(500);
}
if (inchar=='L') //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
{
delay(10);
digitalWrite(ledpin,LOW); //Turn off led
delay(50);
Serial.println("AT+CMGD=1,4"); //Delete all message
delay(500);
}
}
}
}
Problem 2: How to program this SD module with this microphone
http://img.td-imgs.com/images/42/45/254245_1531733_ECT-254245.jpg
https://www.sparkfun.com/products/8635?utm_source=NewProdClick&utm_medium=HomePage&utm_campaign=TopRight
Am using this power supply:
http://i.ebayimg.com/00/s/NzY4WDEwMjQ=/z/uFUAAOSwd4tUH~ah/$_35.JPG
Arduino Uno
GPS/GPRS/GSM Module V3.0
P.S. Sorry if this post is stupid and am asking elementary things
I will be glad and realy happy if you help to one newbie

2015-02-27 00:41:47 hi DonPesho,
cool project! and how is it going these days?
first, I add the two codes together like bellow, not sure if it's what you want:
second,i suggest you could learn how to record on SD card , we have a product may help
https://www.dfrobot.com/wiki/index.php?title=SD_Module_(SKU:_DFR0071)
Good luck!
Leff
cool project! and how is it going these days?
first, I add the two codes together like bellow, not sure if it's what you want:
Code: Select all
// Product name: GPS/GPRS/GSM Module V3.0
// # Product SKU : TEL0051
// # Description:
// # The sketch for controling the GSM/GPRS/GPS module via SMS.
// # Steps:
// # 1. Turn the S1 switch to the Prog(right side)
// # 2. Turn the S2 switch to the USB side(left side)
// # 3. Set the UART select switch to middle one.
// # 4. Upload the sketch to the Arduino board(Make sure turn off other Serial monitor )
// # 5. Turn the S1 switch to the comm(left side)
// # 6. Turn the S2 switch to the Arduino(right side)
// # 7. RST the board until the START led is on(make sure you have >6V power supply)
// # 8. Plug the long side of LED into pin 13 and short side into GND
// # 9. Start sending "LH" and "LL" to your board to turn LED on and off.
/*
* created: 2013-11-14
* by: Grey
* Version: 0.3
* Attention: if you send the wrong SMS command to the module, just need to press RST.
* This version can't watch the module status via the serial monitor, it only display the Arduino command.
* If you want to watch the status,use the SoftwareSerial or the board with another serial port plese.
*/
byte gsmDriverPin[3] = {
3,4,5};//The default digital driver pins for the GSM and GPS mode
//If you want to change the digital driver pins
//or you have a conflict with D3~D5 on Arduino board,
//you can remove the J10~J12 jumpers to reconnect other driver pins for the module!
int ledpin = 13;
char inchar;
int pirPin = 2; //digital 2
int pinSpeaker = 10;
void setup()
{
//Init the driver pins for GSM function
for(int i = 0 ; i < 3; i++){
pinMode(gsmDriverPin[i],OUTPUT);
}
pinMode(pirPin, INPUT);
pinMode(pinSpeaker, OUTPUT);
pinMode(ledpin,OUTPUT);
Serial.begin(9600); //set the baud rate
digitalWrite(5,HIGH); //Output GSM Timing
delay(1500);
digitalWrite(5,LOW);
digitalWrite(3,LOW); //Enable the GSM mode
digitalWrite(4,HIGH); //Disable the GPS mode
delay(2000);
delay(5000); //call ready
delay(5000);
Serial.println("AT+CMGD=1,4"); //Delete all SMS in box
}
void loop()
{
int pirVal = digitalRead(pirPin);
if(pirVal == LOW){ //was motion detected
Serial.println("Motion Detected");
playTone(300, 160);
delay(2000);
}
if(Serial.available()>0)
{
inchar=Serial.read();
if(inchar=='T')
{
delay(10);
inchar=Serial.read();
if (inchar=='I') //When the GSM module get the message, it will display the sign '+CMTI "SM", 1' in the serial port
{
delay(10);
Serial.println("AT+CMGR=1"); //When Arduino read the sign, send the "read" AT command to the module
delay(10);
}
}
else if (inchar=='L')
{
delay(10);
inchar=Serial.read();
if (inchar=='H') //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
{
delay(10);
digitalWrite(ledpin,HIGH); //Turn on led
delay(50);
Serial.println("AT+CMGD=1,4"); //Delete all message
delay(500);
}
if (inchar=='L') //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
{
delay(10);
digitalWrite(ledpin,LOW); //Turn off led
delay(50);
Serial.println("AT+CMGD=1,4"); //Delete all message
delay(500);
}
}
}
}
void playTone(long duration, int freq) {
duration *= 1000;
int period = (1.0 / freq) * 1000000;
long elapsed_time = 0;
while (elapsed_time < duration) {
digitalWrite(pinSpeaker,HIGH);
delayMicroseconds(period / 2);
digitalWrite(pinSpeaker, LOW);
delayMicroseconds(period / 2);
elapsed_time += (period);
}
}
second,i suggest you could learn how to record on SD card , we have a product may help
https://www.dfrobot.com/wiki/index.php?title=SD_Module_(SKU:_DFR0071)
Good luck!
