Hi all, I am facing the below issues.
When I connected pir sensor with 9v battery, output is coming properly. Means when someone near to sensor output pin is high for 3seconds and again it is low. Checked with multimeter and led. Sensor is Working perfect.
But when I connected pir sensor with Arduino board, I am facing the issue that sensor output is toggled always (1->0->1->0 going..) actually I am connecting simcom modem also with Arduino board and tx and rx pin is connected with Arduino and simcom modem.
Onething is, if I disconnect the tx pin of Arduino then this toggle issue is not visible. Sensor output is high to low onetime when motion is detected.
And even I did not connect pir sensor output pin to Arduino but connected with multimeter. Here voltage toggles like 5volt-> 3secs->0volt->3secs keep going.
Please help to solve this issue?
Hi, @sakthivenus
Welcome to the forum.
If your input is pulled high when the PIR triggers, have you got a 10K between the Arduino input and the Arduino gnd, to keep the input at gnd when no signal is coming from the PIR?
Can you please post a circuit diagram of your project, including power supplies, use a pen(cil) and paper and show an image of it would be fine.
Thanks.. Tom...
Code.
Schematic.
Device specs.
You have provided little real information that we can use to help you.
Post your code. Read the forum guidelines to see how to properly post code and some information on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Post a schematic. Hand drawn, photographed and posted is fine. Include all components, their part numbers and/or values and power supplies. Label pins with numbers and functions.
Post technical data for the components (data sheets, manuals).
#include <SoftwareSerial.h>
int buzzer = 3;
int sensor1= 7;
int sensor2 = 8;
int led = 4;
unsigned long value = 0UL;
unsigned long maxValue = 16000000UL;
SoftwareSerial sim800Serial (10,11);
void setup()
{
pinMode(buzzer, OUTPUT);
pinMode(sensor1, INPUT);
pinMode(sensor2, INPUT);
pinMode(led, OUTPUT);
digitalWrite(buzzer,LOW);
digitalWrite(sensor1,LOW);
digitalWrite(sensor2,LOW);
digitalWrite(led,LOW);
sim800Serial.begin(9600);
Serial.begin(9600);
}
void smsFunc()
{
sim800Serial.println("AT+CMGF=1\r");
delay(1000);
sim800Serial.println("AT+CMGS="+919361558096"\r");
delay(1000);
sim800Serial.println("Someone entered in your CAR");
sim800Serial.println(0x0d);
delay(1000);
sim800Serial.println((char)26);
}
void DialFunc()
{
sim800Serial.println("ATD+919361558096;");
sim800Serial.println(0x0d);
sim800Serial.println(0x0a);
}
void StatusUpdate()
{
if((digitalRead(sensor1)==HIGH) || (digitalRead(sensor2)==HIGH))
{
digitalWrite(buzzer,HIGH);
digitalWrite(led,HIGH);
}
else
{
digitalWrite(buzzer,LOW);
digitalWrite(led,LOW);
}
}
void delayFunc(int delayCount)
{
for(int i=0;i<delayCount;i++)
{
while(value++ >= maxValue)
{
value = 0UL;
StatusUpdate();
}
StatusUpdate();
}
}
void loop()
{
if((digitalRead(sensor1)==HIGH) || (digitalRead(sensor2)==HIGH))
{
digitalWrite(buzzer,HIGH);
digitalWrite(led,HIGH);
smsFunc();
delayFunc(30); // delay in seconds approximately
DialFunc();
delayFunc(30);
}
else
{
digitalWrite(buzzer,LOW);
digitalWrite(led,LOW);
}
}
Call is activated by sim800 and no issue with gsm modem. Issue is only with pir sensor
Hi,
Thanks for the information.
To add code please click this link;
If you use a DMM and measure the volts between pin 7 or 8 and gnd, what do you see and does the fault still occur while the DMM is connected?
Did you develop your code in stages?
If so you should have some code that JUST reads the PIR output?
That is with no other hardware connected and code that ONLY reads the PIR, do you still see the output randomly toggling?
If you remove the PIR and leave the pull down resistor, does the output randomly toggle?
Thanks.. Tom...
The relay module is not shown on the schematic. How are the relay coils connected and powered?
The schematic shows the Arduino board connected to 12V. Is that into the Vin pin or power plug? Be careful when using the power plug or Vin. Powering through Vin or the power jack means that the Arduino and all peripherals that are on the 5V rail are powered by the onboard 5V regulator. The on board 5V regulator is not heat sinked so will supply limited current before it overheats and shuts down. The amount of current depends on the voltage input to Vin or the power jack. The higher the voltage the less current can by supplied. I would use a buck converter to drop the 12V to 5V and connect that to the 5V on the Arduino, bypassing the, weak, 5V regulator. Then the rated current of the DC DC converter is available on the 5V line.
The Sim card could be pulling enough current to drag the 5V low or cause the regulator to shut down and the processor to reset.
Is the processor resetting? Put a serial print in setup() that will show when the processor resets. Monitor the 5V rail to see if the supply voltage is maintained properly.
Read the forum guidelines to see how to properly post code and some information on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
You can go back and fix your original post by highlighting the code and clicking the </> in the menu bar.
If you use a DMM and measure the volts between pin 7 or 8 and gnd, what do you see and does the fault still occur while the DMM is connected?
Yes. PIR output pin is connected with gpio7 and gpio7 is pulled down with 10k. If I measured the voltage at pin7 using multimeter, 3.3v->3sec->0v->3sec->3.3v->3sec->0v...keep toggling
That is with no other hardware connected and code that ONLY reads the PIR, do you still see the output randomly toggling?
If I remove the tx pin(11 Arduino connected with sim800 rxd pin) of Arduino then pir sensor output is not toggling. PIR sensor output is working fine.
If you remove the PIR and leave the pull down resistor, does the output randomly toggle?
I removed the pir sensor output pin to the Arduino and checked with multi meter. Still toggling is happening. Even I have connected separate 9v battery for sensor supply and only pir output pin is connected with Arduino. This time also toggling issue is there.
I did not connect relay circuit but still toggle issue is observed. PIR sensor is working perfectly when sim800 is not connected with Arduino board. Means txd and rxd pins not connected with Arduino.
When these pins are connected then pir sensor gives high low high low... Toggling output continuously.
12v 1amps are connected with Arduino power plug and 5v input is taken from Arduino and given to pir sensor.
Sim800l tx and rx pin connected with Arduino cause this issue I suspect. But donot know
Is the Sim800l powered by the Arduino board 5V (regulator)?
How much current does the Sim800l pull when transmitting?
See here for the currents needed by the module.
With 12V into the power jack you can draw, maybe, 100mA before the regulator is overwhelmed and the voltage drops and the processor resets or the voltage regulator just overheats and shuts down. I suggest that you use a 12V to 5V converter (SMPS buck converter) to drop the 12V to 5V to connect to the 5V pin and supply the Arduino and sim800. That will bypass the weak 5V regulator.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.