Hello, I am looking for a program to monitor 4 servomotors by a detector ultrasonic HC-SR04 (external power supply). The movement of each servo is different.
I am totally beginner.
Thank you to all
Hello, I am looking for a program to monitor 4 servomotors by a detector ultrasonic HC-SR04 (external power supply). The movement of each servo is different.
I am totally beginner.
Thank you to all
Can you elaborate on what your trying to do
You have an ultrasonic range finder (HC-SR04) but is this mounted on a servo or monitoring the servos, or are the servos driving a mobile platform and your using the HC-SR04 for collision avoidance or is this something completely different
Please provide a diagram and more detailed description
Thanks
Thank you very much for your request.
I want to make a montage with 4 servo motors, an ultrasonic sensor HC-SR04, an Arduino UNO, a power supply (battery)
When a person approaches 50 cm from the detector, I wish that the servos are turned on; when she leaves the servos stop.
The movement of the servo must be independent of each other. (the sensor is monitoring the servos)
Le 6 oct. 2014 à 16:35, peteroakes <messages@element14.com> a écrit :
element14
servomotor (arduino)
réponse de Peter Oakes dans Arduino - Afficher la discussion complète
Can you elaborate on what your trying to do
You have an ultrasonic range finder (HC-SR04) but is this mounted on a servo or monitoring the servos, or are the servos driving a mobile platform and your using the HC-SR04 for collision avoidance or is this something completely different
Please provide a diagram and more detailed description
Thanks
Répondre à ce message en répondant à cet e-mail, ou voir le message sur element14
Commencer une nouvelle conversation dans Arduino sur element14
**************************Disclaimer**************************
The contents of this e-mail and any file transmitted with it are confidential and intended solely for the individual or entity to whom they are addressed. The content may also contain legal, professional or other privileged information. If you received this e-mail in error, please destroy it immediately. You should not copy or use it for any purpose nor disclose its contents to any other person. The views stated herein do not necessarily represent the view of the Company.
Please ensure you have adequate virus protection before you open or detach any documents from this transmission. The Company does not accept any liability for viruses.
Premier Farnell plc
150 Armley Road
Leeds
LS12 2QQ
Telephone +44 (0) 870 129 8608
Fax +44 (0) 870 129 8610
Registered in England
Company Number 876412
Registered Office: Farnell House, Forge Lane, Leeds LS12 2NE
Do you mean that the servos turn on and off based on the servo? If so then this is quite simple to do, please clarify if this is what you meant.
You only mention one sensor but you have it monitoring for someone within 50cm and also monitoring the servos, are you using 2 sensors ?
or is the sensor monitoring for people close to it, If detected it starts the servos (4 with their own actions), but if the person / object moves out of range of the sensor the servos will stop what ever there doing and wait for a new presence to be detected by the sensor
the servos turn on and off based on the HC-SR04 Ultrasonic Sensor
Le 6 oct. 2014 à 18:47, kidiccurus <messages@element14.com> a écrit :
voir le message sur element14
the ultrasonic sensor (and servos) are attached to the wall. when a person approaches 50 cm or less, servos start in march.
Yes, the sensor is monitoring for people close to it, If detected it starts the servos (4 with their own actions), but if the person moves out of range of the sensor the servos will stop what ever there doing and wait for a new presence to be detected by the sensor.
Le 6 oct. 2014 à 20:54, peteroakes <messages@element14.com> a écrit :
You only mention one sensor but you have it monitoring for someone within 50cm and also monitoring the servos, are you using 2 sensors ?
or is the sensor monitoring for people close to it, If detected it starts the servos (4 with their own actions), but if the person / object moves out of range of the sensor the servos will stop what ever there doing and wait for a new presence to be detected by the sensor
#define echoPin 12
#define trigPin 13
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
start:
long duration, distance;
digitalWrite(trigPin, LOW); // Added this line
delayMicroseconds(2); // Added this line
digitalWrite(trigPin, HIGH);
// delayMicroseconds(1000); - Removed this line
delayMicroseconds(10); // Added this line
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance < 4) { // Change value 4 to change trigger distance
goto start;
}
if (distance >= 200 || distance <= 0){
Serial.println("Out of range");
}
else {
Serial.print(distance);
Serial.println(" cm");
}
delay(100);
// Put your code from the void loop here
}
The above code might work for you. It is an adapted version of something I found on an instruct able. Read the comments for where to change the distance (I left it at default). There is also a place for you to put your code. Here you can put the contents of the void loop section of your code. Please bear in mind that it will check for a person every time it loops and in doing so way interrupt either part way through your programming or after the person leaves. It will also create a short delay after each check, but this can be removed by commenting out the delay line at the bottom of the code. The code will also send data down a serial connection at 9600 baud as to the distance being measured for debugging. Finally the wiring is as follows: echo to pin 12 trig to pin 13 gnd to gnd and vcc to 5v. If you need more help then post.
Thousand thank you Kidiccurus.
But where the lines which controls the movement servo for each?
Le 7 oct. 2014 à 20:55, kidiccurus <messages@element14.com> a écrit :
element14
servomotor (arduino)
réponse de Samuel Doye dans Arduino - Afficher la discussion complète
The above code might work for you. It is an adapted version of something I found on an instruct able. Read the comments for where to change the distance (I left it at default). There is also a place for you to put your code. Here you can put the contents of the void loop section of your code. Please bear in mind that it will check for a person every time it loops and in doing so way interrupt either part way through your programming or after the person leaves. It will also create a short delay after each check, but this can be removed by commenting out the delay line at the bottom of the code. The code will also send data down a serial connection at 9600 baud as to the distance being measured for debugging. Finally the wiring is as follows: echo to pin 12 trig to pin 13 gnd to gnd and vcc to 5v. If you need more help then post.
Répondre à ce message en répondant à cet e-mail, ou voir le message sur element14
Commencer une nouvelle conversation dans Arduino sur element14
**************************Disclaimer**************************
The contents of this e-mail and any file transmitted with it are confidential and intended solely for the individual or entity to whom they are addressed. The content may also contain legal, professional or other privileged information. If you received this e-mail in error, please destroy it immediately. You should not copy or use it for any purpose nor disclose its contents to any other person. The views stated herein do not necessarily represent the view of the Company.
Please ensure you have adequate virus protection before you open or detach any documents from this transmission. The Company does not accept any liability for viruses.
Premier Farnell plc
150 Armley Road
Leeds
LS12 2QQ
Telephone +44 (0) 870 129 8608
Fax +44 (0) 870 129 8610
Registered in England
Company Number 876412
Registered Office: Farnell House, Forge Lane, Leeds LS12 2NE
I did not know where and when you wanted the servos to move. If you give me a list of positions in degrees and times for each servo then I will code it in for you, or if you have existing code I can modify it for you. The only thing to note is that it should start and end in the same place. Also what servos are you using, in case I need to look up a data sheet.