What's new
  • Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as: All that and more! Registration is quick, simple and absolutely free. Join our community today!

Help Arduino project, please help.

Sacerex12

Addict
Established
Joined
Sep 14, 2017
Messages
323
Reaction score
42
00.PNG 00.PNG 01.PNG Hello, I'm trying to do a project about Automatic Room Light Controller with this guide You must register or login to view this.

However, hindi po ako makahanap na same IR sensor module used in the first project and planning to use another kind of IR sensor. Will it still work if I use the same code provided by the first project?

Below is the code and I've attached the photo for the IR sensors. Yung 00 po yung ginamit sa link tapos pampalit ko po ung 01.
Code:
#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);

#define in 14
#define out 19
#define relay 2

int count=0;

void IN()
{
    count++;
    lcd.clear();
    lcd.print("Person In Room:");
    lcd.setCursor(0,1);
    lcd.print(count);
    delay(1000);
}

void OUT()
{
  count--;
    lcd.clear();
    lcd.print("Person In Room:");
    lcd.setCursor(0,1);
    lcd.print(count);
    delay(1000);
}

void setup()
{
  lcd.begin(16,2);
  lcd.print("Visitor Counter");
  delay(2000);
  pinMode(in, INPUT);
  pinMode(out, INPUT);
  pinMode(relay, OUTPUT);
  lcd.clear();
  lcd.print("Person In Room:");
  lcd.setCursor(0,1);
  lcd.print(count);
}

void loop()
{
 
  if(digitalRead(in))
  IN();
  if(digitalRead(out))
  OUT();
 
  if(count<=0)
  {
    lcd.clear();
    digitalWrite(relay, LOW);
    lcd.clear();
    lcd.print("Nobody In Room");
    lcd.setCursor(0,1);
    lcd.print("Light Is Off");
    delay(200);
  }
 
  else
    digitalWrite(relay, HIGH);
 
}
Thank you.
 

HwarangLee

Enthusiast
Kung iibahin mo yung infrared. Try mo iresearch kung anu anu yung babaguhin na values or kung may babaguhin man
Another,
baka recommended lang yung ginamit dun sa example, try mo iapply kung gagana


Pero mas recommended na hanapin mo yung ginamit na IR hahahahaha
 

Sacerex12

Addict
Kung iibahin mo yung infrared. Try mo iresearch kung anu anu yung babaguhin na values or kung may babaguhin man
Another,
baka recommended lang yung ginamit dun sa example, try mo iapply kung gagana


Pero mas recommended na hanapin mo yung ginamit na IR hahahahaha
So far, wala po ako makita na same dun sa example eh haha kaya nagbabakasakali sa alternative. Sana gumana naman haha
 

pixkit

Addict
What is the other IR sensor that you are using? How's it different with the one from the original guide?

As long as you know when your IR sensor is in HIGH or LOW mode, you should be able to copy the idea from the original guide. I wrote "copy the idea" and NOT copy the code in verbatim (big difference).

In fact you should be able to do this with any sensor (not only IR sensor) that can detect a HIGH and LOW voltage (close and open circuit), for example those magnetic door switches.
 

Sacerex12

Addict
What is the other IR sensor that you are using? How's it different with the one from the original guide?

As long as you know when your IR sensor is in HIGH or LOW mode, you should be able to copy the idea from the original guide. I wrote "copy the idea" and NOT copy the code in verbatim (big difference).

In fact you should be able to do this with any sensor (not only IR sensor) that can detect a HIGH and LOW voltage (close and open circuit), for example those magnetic door switches.
The blue one with the white background, sir. From the original guide, it uses LM358 while the one I plan on using uses LM393. But I'm not sure on how it differs, especially how it could affect or not the project.

Also, I'm slow on the part of coding/programming, that's why I'm seeking for some help or guidance.
 

pixkit

Addict
Your follow-up doesn't make sense. LM358 and LM393 are NOT IR SENSORS.

I suggest you Google first what they are and read the docs about them. Check their data sheets if you want detail info about them. Google "LM358 datasheet" and "LM393 datasheet"

They are definitely not IR sensors.

Asking how to use "IR sensor" vs "asking how to use LM393 on a guide that's based on LM358" is a different kind of beasts. Your question should be is how to use "IR sensor MODULE that's based on LM 393". Your best bet is to read the datasheet for this "module". Play around with it (I hope you know some basic IOT and electronics).

Make that work first. Once you know how that module works. Then start learning how to program.

Or probably you can start with learning how to program yet. They can be started independently. Since you don't know both and you admit you're slow on both, take your time. Focus on one thing first.

There is NO QUICK solution. Sorry.
 
Top