Go Down

Topic: Doubt-Ultrasonic sensor (Read 2344 times) previous topic - next topic


The problem is that the SRF05 have 4 exits: 5V, GRN, 2 to digital pins.

I don't know hot to conect my sensors so that they have same number of exits.

The only thing I could do is that it have 3 exits, making that:

That was my problem, how to do my sensors have 4 exits or how can I adapt the code for 3 exits?

Thanks you so much!

One more thing: sorry for my very bad English and for my electronic knowledge  XD

Yours sincerely,



Two things:

1) What sensor (who makes it, model, etc) are you using that has three output pins (what I presume when mean "exits")?
2) What code are you trying to adapt (please post)?

With this information, we can probably help you better...

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.


Thank you for your reply :)

1- Yes, I mean output... (my English XD  )

The sensors are, more or less:

The project I'm following: http://luckylarry.co.uk/arduino-projects/arduino-a-basic-theremin/

The code:

Code: [Select]
// written at: luckylarry.co.uk
// very easy Theremin
// setup pins and variables for SRF05 sonar device
int echoPin = 2;                                // SRF05 echo pin (digital 2)
int initPin = 3;                                // SRF05 trigger pin (digital 3)
int speakerPin = 6;                             // Speaker pin
unsigned long pulseTime = 0;                    // stores the pulse in Micro Seconds
unsigned long distance = 0;                     // variable for storing the distance (cm) we'll use distance as a switch for the speaker
unsigned long soundDelay = 0;                   // variable for storing the deay needed for the pitch
void setup() {
  pinMode(speakerPin, OUTPUT);                  // sets pin 6 as output
  pinMode(initPin, OUTPUT);                     // set init pin 3 as output
  pinMode(echoPin, INPUT);                      // set echo pin 2 as input
// execute
void loop() {
  digitalWrite(initPin, HIGH);                  // send 10 microsecond pulse
  delayMicroseconds(10);                        // wait 10 microseconds before turning off
  digitalWrite(initPin, LOW);                   // stop sending the pulse
  pulseTime = pulseIn(echoPin, HIGH);           // Look for a return pulse, it should be high as the pulse goes low-high-low
  distance = pulseTime/58;                      // convert the pulse into distance (cm)
  soundDelay = pulseTime/3;                     // alter this variable to alter the pitch of the sound emitted
  // make the sound.
  // check the distance, if over 30cm make no sound
  if (distance < 30) {
  digitalWrite(speakerPin, HIGH);
  digitalWrite(speakerPin, LOW);

Sorry, I've just post it into Spanish forum, but, when I was translating, I forgot put the pictures.


"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


The sensors (image) you've posted are of the raw ultrasonic transmitter and receiver transducers; an ultrasonic sensor (like the SRF05) consists of more than just those two parts - there are extra parts like amplifiers and such to drive the transducers. So tell us: Are you attempting to use "bare" sensors components, or do you have a complete ultrasonic module like the SRF05 (just one with three pins versus four)?

If the former, then you'll have a lot of extra work to do to get them to work (you can't just "hook them up" - there's a bunch of external circuitry involved); if the latter, then telling us what sensor module you have will be helpful.

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.


Thanks you so much! I'm really pleased :)

If that sensors are not valid, I'll try to look for another way to complete the project:

I was thinking about a IR led and and IR receiver (like that: http://es.farnell.com/vishay/tsop4838/ir-receiver-38khz/dp/4913190)

Could it work?

Can I build the theremin such as this one with my IR led and IR receiver?: http://mechomaniac.com/SimpleArduinoTheremin

Thanks you again ;)

Go Up