OLLYDOTDEV / Project-Birdseye-DTX-2020

The initial plan is to create a device that is made for the sole purpose of a Preemptive Security system for People who work with Confidential/Private Information and need to work on potentially more public places where one cant Guarantee fully secure/discrete room. My Approach to solving this is with a wireless computing node That Takes Sensor data from a variety of senses. Then the Data from the Senses is taken then and processed to determine whether there is a security breach if so then it will Relay that info over to the Raspberry Pi W that then Emulates an HID (Human interface device) Using the P4wnP1_aloa made by mame82 to Execute a custom user-defined action that will be set via Apache server hosted of the Raspberry Pi W Communicating From a web interface back to the purchase server utilizing Ajax
GNU General Public License v3.0
3 stars 1 forks source link

IR Sensor #14

Closed OLLYDOTDEV closed 4 years ago

OLLYDOTDEV commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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