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
358
Reaction
40
00.PNG 00.PNG 01.PNG Hello, I'm trying to do a project about Automatic Room Light Controller with this guide You do not have permission to view the full content of this post. Log in or register now.

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.
 
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
 
Comment

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
 
Comment

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.
 
Comment

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.
 
Comment

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.
 
Comment

paopaozalez

Enthusiast
Okay according sa question mo na ichechange mo ung IR, oks naman un.. What you will do is CHECK how does the first IR and second IR work ( specially how does those sensors detect changes, pag same ba or hindi..) siguro u can address this via reading how does ir work.. kasi ang alam ko it detects changes and reflects this thru voltages( so un ung manipulation na need mo icheck IF those 2 IRs work the same..
Actually if pareho ung pinheads ng ipapalit mong IR, u can test it nman.. trial and error method.. if it doesnt work the same wit thr used ir module sa project, then un na startmo na sya gawin as ug sinabi ko sa top..
 
Comment

Like us on facebook

Online statistics

Members online
1,382
Guests online
1,076
Total visitors
2,458

Forum statistics

Threads
883,700
Messages
15,627,274
Members
1,410,698
Top