Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IR Sensor #14

Closed
OLLYDOTDEV opened this issue Jun 11, 2020 · 3 comments
Closed

IR Sensor #14

OLLYDOTDEV opened this issue Jun 11, 2020 · 3 comments
Labels
Projects
Milestone

Comments

@OLLYDOTDEV
Copy link
Owner

From an engineering view
This will be using the main sensor as a tripwire and well to detect movent within a room
So it will trigger the alert system protecting the private information

@OLLYDOTDEV OLLYDOTDEV added ROM'S Remote Observation Monitor System 2.5 labels Jun 11, 2020
@OLLYDOTDEV OLLYDOTDEV added this to the Sprint 1 milestone Jun 11, 2020
@OLLYDOTDEV OLLYDOTDEV added this to Back Log in Birdseye Jun 11, 2020
@OLLYDOTDEV OLLYDOTDEV removed this from the Sprint 1 milestone Jun 13, 2020
@OLLYDOTDEV OLLYDOTDEV moved this from Back Log to Backlog (Sorted by priority) in Birdseye Jun 22, 2020
@OLLYDOTDEV OLLYDOTDEV moved this from Backlog (Sorted by priority) to Sprint Backlog in Birdseye Jun 23, 2020
@OLLYDOTDEV OLLYDOTDEV added this to the Sprint 3 milestone Jun 24, 2020
@OLLYDOTDEV
Copy link
Owner Author

The obvious choices for me to use for an is a TCRT5000 based sensor or LM393 IR sensor

ezgif com-webp-to-png
[TCRT5000 based sensor]
ezgif com-webp-to-png
[LM393 based]

I happen to already have a hand full of both of these
tonight I will test what sensor will be better suited to this project as then I will have access to the hardware

@OLLYDOTDEV
Copy link
Owner Author

OLLYDOTDEV commented Jun 25, 2020

There is one major difference between both of these sensors it is that the LM393 based sensor happens to also be capable of an analog output signal that when with the sensitivity of the receiving diode is controlled by the potentiometer, in this case, I am able to get the IR sensor at having a max trigger range of a roundabout 0 to 12 cm see here (video) for demo

whereas the TCRT5000 based sensor would still work the purpose of the sensor of detecting if a door had opened/closed but with a smaller max and would in turn decrease some of the situations that ROMS could be useful in. demo (video)

The videos in the paragraphs above this will give you a quick idea of what is happening with the sensors and the prototype/test setup I am using. In short to recap I am using the LM393 IR based sensor over the TCRT5000 based IR sensor due to the fact that it uses an LM393 (low voltage comparator) combined with a potentiometer (variable resistor) that allows to fine turn the output of the IR sensor.
As a start, I pulled together some code that will read the value of the A0 pin

int IRSensor = A0; // connect ir sensor to arduino pin 2
void setup() 
{
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Native USB only
  }
  pinMode (IRSensor, INPUT); // sensor pin INPUT
}
void loop()
{
   Serial.println(analogRead (IRSensor));
 delay(100);
}

So as for a start, it showed a value of about 1020.
image

The value 1020 is the same as saying 5v
Here is what I it looks like when zooming in on that 5 volts
image

It can be seen that there is a value inconsistency of +-1
this should be kept in mind for later when making this more accurate.

image
There is what happens when I trigger the IR sensor by putting an object in front of it right now it has a max distance of 3cm so any time you put an object within the max distance it will trigger as seen in the image above.

This is great but I want to see If it is possible to get more performance out of my hardware, in this case, to increase the max distance from 3cm to some great value. There is only one thing I am able to change on the PCB

image
(credit for image goes to henrysbench)
Potentiometer so happened to control the distance that the LM393 IR sensor activates

so for trying out all the values that this
there a small handful with some interesting properties

First is with the potentiometer all the way anticlockwise I get a pretty much-fixed output of 1020
image

the next is when the comparator is a value so low that the led turn on (this LED indicates whether the digital 1 or 0) so with all the online tutorials using a digital read this is as far they would be able to see as past this point but I have opted to use an analog read meaning that this LED is deceptive in reality should be ignored. there for this will work as a ADC

image
here is the potentiometer to fully to the clockwise direction which is supposed to be most sensitive but this is not so.
as much as it is at the increased it is from the base distance in fact in yields a total of about 7 cm. But the one hindering of this is the fact that if we look very closely at the points (see image below) some of the value that is that should be set as the value (triggered value) jump up to a rest value (see red circle) and if all that I was just checking if the code great or less then a 37.6 then there could be some false activations but this is not the worst part if you look at the green circle then we can see that it drop below the threshold for the low value and this is where the issue appears as this would trigger a false positive and inturn and trigger the system. This I important to be noted for #12 so that this can be prevented in the master version of this code

85720980-0869cf80-b745-11ea-81b4-c0379c421b71

image

but there is the most interesting thing is when I orientate the potentiometer so it is not quite a digital one but almost it spazzes out. frantically jumps between the 1000 value and the 500 value but is still able to drop the value below 50 thus giving me values that I can work with when programming in #12
so I was like this is odd so I did some more testing of the distance it had increased to a massive 32cm activation distance, that is over 10 times total improvement.

having this great range significantly opens up more possibilities for different mounting positions and locations for keeping an eye on entry/exit doors.

@OLLYDOTDEV OLLYDOTDEV mentioned this issue Jun 25, 2020
@OLLYDOTDEV
Copy link
Owner Author

This is sensor will be mounted on #20 rather than directly to the ROMS PCB this will be done via in internal headers
All that is need to hook up of the IR sensor is rather easy as it only uses three pins

VCC = 5V POWER
GND = Gound
OUT = Data out

the data out is that we care most about as this is what gives us the sensor data values
image
I added pins for it to be connected via a ribbon cable

image
the header pin for IR_OUT goes to Arduino pin A3 (hardware PC3)
I picked A3 as it is an analog pin rather than digital pins. the advantage of using an analog pin is coved in this comment

GITadded header pins for IR Sensor

see #12 for the full programming development

Birdseye automation moved this from Sprint Backlog to Completed In Sprint Jun 29, 2020
@OLLYDOTDEV OLLYDOTDEV moved this from Completed In Sprint to Archive in Birdseye Jul 26, 2020
Birdseye automation moved this from Archive to Completed In Sprint Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Birdseye
  
Completed In Sprint
Development

No branches or pull requests

1 participant