I wan to control servo motor to move to certain angle after inductive sensor detect metal...
example when my inductive sensor detect metal my servo motor will turn into 90 degree...can anyone help me with the coding?
Can you read anything from the inductive sensor? A link to the sensor would be useful.
Can you tell when the sensor is detecting the material of interest?
Can you rotate the servo?
inductive sensor can detect metal only.Its one of the proximity sensor.
Inductive sensor will detect metal when its near,depend on ur type of inductive sensor it can be detect at range 10mm or 3mm and so much more.
My servo can rotate to 180 degree.
inductive sensor can detect metal only.Its one of the proximity sensor.
Inductive sensor will detect metal when its near,depend on ur type of inductive sensor it can be detect at range 10mm or 3mm and so much more.
So, since you won't tell us exactly (by posting a link) what kind of sensor you have, I'll assume that you are reading data from the sensor, and that you can tell the difference between a reading with metal near and one with no metal near the sensor.
In that case, a simple if statement (or maybe a slightly more complex one) that tests if the value is below (or above) a threshold (or in some range) is all that is needed to execute the code to make the servo move.
I wan to control servo motor to move to certain angle after inductive sensor detect metal...
Simple event based servo control.
//zoomkat servo button test 7-30-2011
#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
Servo servo1;
void setup()
{
pinMode(button1, INPUT);
servo1.attach(7);
digitalWrite(4, HIGH); //enable pullups to make pin high
}
void loop()
{
press1 = digitalRead(button1);
if (press1 == LOW)
{
servo1.write(160);
}
else {
servo1.write(20);
}
}
10mm Rectangular Inductive Sensor
Inductive proximity sensors are noncontact proximity devices that applied to detect metal objects. FSNS10 inductive sensor is among the most common inductive sensor in rectangular shape. It offers 10mm sensing range with its compact size with NPN output signal to connect to any type of microcontroller.
Advantages of inductive proximity sensors include insensitivity to water, oil, dirt, non-metallic particles, target color, or target surface finish, and the ability to withstand high shock and vibration environments.
Specification:
Brand: F&C, Taiwan
Rectangular type
Sensing range: 10mm
Operating voltage: DC12-24V
Output signal: NPN
Size: 25mm x 39mm x 25mm
this is detail about my sensor...
can pls tell me how to make it operate with servo motor?
i wan it to work like this,when my sensor detect object my motor will turn into 90 degree but when there is no object my motor will turn back into 0 degree
can pls tell me how to make it operate with servo motor?
You will need to figure out how to interface the device with the arduino such that the device inputs something usable by the arduino. Once you get that done, the servo part should be fairly easy.