Closed OLLYDOTDEV closed 4 years ago
The obvious choices for me to use for an is a TCRT5000 based sensor or LM393 IR sensor
[TCRT5000 based sensor] [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
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.
The value 1020 is the same as saying 5v Here is what I it looks like when zooming in on that 5 volts
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.
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
(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
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
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
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.
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 I added pins for it to be connected via a ribbon cable
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
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