Pages: [1]   Go Down
Author Topic: Doubt-Ultrasonic sensor  (Read 1073 times)
0 Members and 1 Guest are viewing this topic.
Spain
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-lol


Yours sincerely,


Antonio
Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 5592
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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...

smiley
Logged

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

Spain
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your reply smiley

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

The sensors are, more or less:




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




The code:


Code:
// 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
//setup
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);
  delayMicroseconds(soundDelay);
  digitalWrite(speakerPin, LOW);
  delayMicroseconds(soundDelay);
  }
}


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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26480
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.robotstorehk.com/sensors/doc/srf05tech.pdf
Logged

"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.

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 5592
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

smiley
Logged

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

Spain
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks you so much! I'm really pleased smiley

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 smiley-wink
Logged

Pages: [1]   Go Up
Jump to: