Got the new sensor today. Everything works perfectly!
Thanks again.
Not Telling
cellicott hasn't added any friends yet.
11 August 2014 - 06:35 PM
Got the new sensor today. Everything works perfectly!
Thanks again.
07 August 2014 - 09:48 PM
Yes, that would be fine. Thanks, Nate. Hopefully things will work out this time.
07 August 2014 - 08:53 PM
I've narrowed it down to one wire; the red jumper wire. Very odd. When this wire is in play, nothing works. When it's connecting Vcc to the power rail, the serial monitor records distances at around -470, which we established. However that's not the odd part. When plugged into the ground side, the serial monitor records distances at around positive 470. In addition to that, the recordings are marked at a much shorter delay than the code states. It seems as though the wire has a life of its own.
All wires going into the sensor are hookup wires now, and it starts up recording 0cm. At this point I replaced all of the hookup up wires with their original one by one, assuming their was another faulty wire. Every time I did this it recorded it's -400 business. Then I thought maybe it was a combination of wires, so I replaced the only jumper wire left with another hookup wire, clicked serial monitor, and instead of seeing 0s as previously, it was the -470 thing again.
This seems to be something more than just the sensor acting up...
Tried hooking the sensor on to another Arduino, using this code:
#define trigPin 8
#define echoPin 9
void setup()
{
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop()
{
int duration, distance;
digitalWrite(trigPin, HIGH);
delayMicroseconds(1000);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) /29;
Serial.print(distance);
Serial.print(" cm");
delay(500);
}
and this electrical setup:

Despite what the image looks like, the yellow wire on the right is plugged into power.
Got the same -400 results.
07 August 2014 - 06:08 PM
Tried the code, same results. Multimeter was dead so I tried replacing the Vcc and Ground wires, pulled up the serial monitor and there definitely was something wrong with the wires. All results read 0cm, and didn't respond to anything waving in front of them. Not sure if this is a good thing or a bad thing, but it seems like progress. I messed around with the trig and echo wires, nothing happened.
Batteries are brand new anyway, but I replaced them anyway. Shouldn't this not make a difference when using the computer as a power source?
Looks like we may need to move on to step 8, unless there's something I missed.

Find content