ir sensor as a detector alarm

Just purchased a 2PCS Digital 38KHz Infrared IR Sensor Transmitter Kit for Arduino and would like some help on how I am going to interface it with the arduino and the code . I was able to send a signal but the buzzer would not come on.

Thank :)

First rule is provide enough information to enable us to know what you have done.

A program and wiring diagram would help.


Transmitter? Presumably there's a receiver too?

This is the sensor I connected the data pins and gave it supply and a signal is send from the photo diode when passing the receiver an led on the receiver go high to tell you it revieved a signal (it is build in)

Now I need some help to with the coding to make a buzzer go high when the receiver receives a signal from the photo diode

Well the receiver has a data pin: presumably that goes high when it receives a signal?

So just connect that to an Arduino i/o pin and read it with digitalRead. If it's high, make another pin go high for your buzzer.

(Or if the receiver's logic is inverted, look for a low on its data pin and turn your buzzer on then)

I am making this code but still is not working

int LED = 47; // IR Led on this pin int dtect = 49 ;

void setup(){ pinMode(LED, OUTPUT); pinMode(dtect, INPUT); digitalWrite(LED, HIGH); }

void loop(){

irsensor(); }

void irsensor() {

if (digitalRead(dtect) == HIGH) { digitalWrite(Buzzer,HIGH); }

Well no, it won't compile will it? You have a pin named Buzzer here...


... but you didn't declare a variable called Buzzer and assign it a pin number..