Using Inductive Proximity sensors with Arduino
ฝัง
- เผยแพร่เมื่อ 24 พ.ย. 2017
- Using Inductive Proximity sensors with Arduino
Sketch
int limitSwitch = 13;
int state = LOW;
void setup() {
Serial.begin(9600);
pinMode(limitSwitch,INPUT);
}
void loop() {
int val = digitalRead(limitSwitch);
if( val != state ){
state = val;
Serial.print("Sensor value = ");
if( state == 0 )
Serial.println( "(0) Target Hit!" );
else
Serial.println( "(1) None");
}
} ::::::::::: SUPPORT CHANNEL ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Please Donate To Help Me Afford New Equipment And Software To Make My Videos More : goo.gl/1m8Dg2
Don't forget to subscribe! - วิทยาศาสตร์และเทคโนโลยี
OMG - Just what I needed and how specific and clear, Thank you so much ;-)
Thank you so much, this was just what I needed! Great video.
im wondering what the forward voltage on that optocoupler is to be able to wire 12v directly to it?
Can you help me with my DYI project flatbed screen printing. I want to use 2 pneumatic cylinder, 2 nema 23 and proximity sn04 and the sensor you used in your video. How much to pay you for the diagram and the list of materials to be used?
Parabéns pelo video!
Muito explicativo e vai me ajudar a fazer pull up na minha cnc router
Great, thanks ! Just something I noticed, if I'm not mistaken Emitter and Collector are inverted on the first slide.
Do you have modified or improved circuit of for this vedio
1. I mean instead of using 10K resistor , Can we use INTERNAL PULLUP resistor ?
2. This proximity sensor is inductive SENSOR , so do we need any DIODE in reverse direction between BLACK and BROWN wire ? Its for safety of PC817??
3. For safe operation , can we use a transistor to interface at input or output of PC817 ?
3. What is the current limit of this sensor ?
4. what is the reason to use 10K resistor as pullup ? current limit has been considered ?
I have connected only one sensor on analog pin.all other analog pins are not connected to any sensor but when I read other analog pins I get the same reading on them how I can avoid this problem.plz suggest any solution.
Thank you very much. A Liteon LTV-815 can be replaced with PC-817
The model number for your sensor ends in B. But I don't see any of those sensors on the internet that end in just B . They all seem to have a letter after the B, such as BX or B Y.
is there any better circuit then this using internal PULLUP resistor ?
Hi. Can this be used with other Type of NPN sensors like contrast sensors from SICK ?
To the point explanation thankyou very much..subscribed
Hi, great video. But just a beginner question: Do i need the optokoppler also, if i use an NPN Sensor? I mean that if i use an NPN sensor and switch the digital input of the Arduino to INPUT_PULLUP --> Can i then directly connect the black signal cable to the digital input and remove R2 (because of the internal pullup)?
did you got answer for you question ? I am thinking in same way ?
@@sanjaybatra6593hi, no i did not get an answer.
Thank you so much
Hi can I connect it direct into the arduino without resistors if I use 5V proxmity sensor?
You are awesome bro thank you so much
you should add one npn transistor, so the proximity would be active high..
Hi, please tell me, how can i use an optocoupler with mechanical limit switches.
Is there any way to make this project run as it is without using the optocoupler PC817
Voce consegue me mandar um desenho esquema para eu montar 5 fins de curso na minha máquina?
Very nice explaination 👍👍👍
What is the switching frequency of the inductive proximity sensor
What is the blue thing in your breadboard called? Is that a relay?
it is just connecting to 12v power supply it is not relay
thanks for this the best video
Hi, how can I make a servomotor rotate when I sense?
if the supply voltage is 28 volts, will the output voltage remain stable at 5 volts through this circuit?
your code works well with digital pin D5, Pin D13 may be faulty in my nano..
int limitSwitch = 5;
int state = LOW;
void setup() {
Serial.begin(9600);
pinMode(limitSwitch,INPUT);
}
void loop() {
int val = digitalRead(limitSwitch);
if( val != state ){
state = val;
Serial.print("Sensor value = ");
if( state == 0 )
Serial.println( "(0) Target Hit!" );
else
Serial.println( "(1) None");
}
}
PIN13 connects to the defined LED_BUILTIN. Voltage drop exists there.
How would I do this with a cnc shield?
Can I use 9Vin directly to the Inductive Sensor then use 7805 IC to regulate the output to 5V the connect it to the analog?
read the voltage rating of proximity sensor..normally written on its side...apply voltage accordingly to get better results.
n again thanx...!!
Thanks a lot dear.. :)
Digital pins behave strange, analog read with conditions if (val 200) {println("None");} works great, maybe my sensor or optocoupler does not give pure zero volt.
Great video!!
Can i just use a 9V battery for this?
can you help me, could do it without the foto thing?
the program didn't work in my project can u find my problem?
Is the sensor n.o pnp?
excellent vid
What Power Supply should I use?
Is a 12V and 1A Power Supply enough?
i use battery mount wich has 8x1.5volt aa batteries so its 12volts. battery mount cost like 2 euro
Here is the modified code that worked perfect for me..
int limitSwitch = A0;
int state = LOW;
int val1;
void setup() {
Serial.begin(9600);
pinMode(limitSwitch,INPUT);
}
void loop() {
int val = analogRead(limitSwitch);
if( val 200 ){
val1=HIGH;
}
if( val1 != state ){
state = val1;
Serial.print("Sensor value = ");
if( state == 0 )
Serial.println( "(0) Target Hit!" );
else
Serial.println( "(1) None");
}
}
what changes would it be?
Great Job!!
Is there a way I can make use of that sensor to measure rotary speed in rpm?
have you found the answer yet? because i need it too
Hi, cant we just use the inductive proximity sensor directly without using optocoupler?
Yes ,if proximity sensor use 5v
@@MakerTutor101 sorry for asking, why you use optocoupler in this video?
The sensor uses 12v power and output is also 12v.Your Arduino board is broken if it input get a 12v power.It is a good reason that you must use Optocoupler to prevent damage from electrical power that is more than 5v
@@MakerTutor101 thankyou for your kind response.. i see now, so you used an external battery as supply to the sensor?
@@MakerTutor101 how can we add 12v supply? using what?
good
Thanks so much
Do you have modified or improved circuit of for this vedio
1. I mean instead of using 10K resistor , Can we use INTERNAL PULLUP resistor ?
2. This proximity sensor is inductive SENSOR , so do we need any DIODE in reverse direction between BLACK and BROWN wire ? Its for safety of PC817??
3. For safe operation , can we use a transistor to interface at input or output of PC817 ?
3. What is the current limit of this sensor ?
4. what is the reason to use 10K resistor as pullup ? current limit has been considered ?
Can anyone else expert share me more information for industrial use ?
i just orden promix sensor, need read spindle motor speed, 2 time trickered spindle rod, how change code can show right spindle speed, have 2 hoöe in spindle rod, trick 2 time / rev, and speed maximum have motor 30K rpm. trick 60K time max speed. i try before use IR sensor but not working, show non accurate speed to oled display. spindle rod have ER16 key hole what sensor trick. thanks i search lot how connect prox sensor 12volt to arduino 5volt pin. but code how make read speed.
Can this use on esp32?
Yes It can use esp32
Can i use pc817c?
Yes sure or th-cam.com/video/dD4r5I7h4Xg/w-d-xo.html
my girlfriend. Capacitive sensors are based on the all or nothing principle. Are there any capacitive sensors that change the output signal (analog) according to each material detected?
I am looking for a capacitive sensor circuit diagram or PCB
I need an analog sensor, please help me
girlfriend
Use a ultrasonic sensor
What the blue like a terminal?
Yes Terminal Ground
Standard color coding for 3 wire Proximity switches is Brown=Positive (+), Black=Load, Blue=Negative (-).
@@MakerTutor101 helo what about capacitive proximity sensor, is same?
This is insanely stupid. There is /NO/ need for the optocoupler - the output of the sensor is directly compatible with the Arduino.
for max sensing distance on none ferrous metals the sensor will need more volts than Arduino can handle.
It makes no sense. The Arduino does not need to "handle" anything. With NPN-sensor, the maximum voltage on the sensor's output is the pull-up voltage on the Arduino - e.g. 3.3 or 5V. If you are using a PNP sensor and are powering it from 12V, you just put a voltage divider on the output (10K+15K resistor) and the 12V is scaled to 5V for the Arduino - You can measure 1000V with the Arduino, you just need a suitable voltage divider - simple!
Not so stupid. The sensor line is tied to the input voltage through a 10K resistor, meaning that if the sensor is energised by 12V, there is 12V going directly to the arduino pin when the sensor is INACTIVE.
The 10K resistor is external to the sensor, so just pull it up to 5V. In some cases the indicator LED is pulling up the line, but so weakly that the internal clamp diodes in the microcontroller will deal with it just fine.
The 10K resistor holds the sensor line HIGH, so when the NPN transistor activates, it pulls the sensor line LOW. If you put a voltage divider (extra resistor to ground) on the sensor line to lower it to 5V, the sensor is activated permanently. (Tested)