Ultrasonic sensor responds correct only when powered via USB

I have a very simple application with ultrasonic sensor. Don’t remember the sensor brand, but I bought it from eBay for one EURO or something like that. My board is Arduino Nano.

Project is a plain distance meter, sensor is installed in the front bumber of my BMW. Based on the distance to the object I’m blinking a led faster od slower. When distance is more that 60cm, then do nothing. Just like normal PDC in the rear bumber. I can slowly get the car to get closer to the wall etc and then stop just in time.

The system is working great, the measured distance is within ±2cm of the real distance, so its accuracy is well enough for me. Since my car has auto transmission, I take input from the brake pedal, the measuring is done only when the brake is pressed. There is a 5V voltage regulator installed between 12v and Arduino, it is also working OK, input is 5V. I’ve tested this and everything is just fine. I’ve debugged the short program and it is working correctly. Also the sensor pull-down resistor is working as it should.

BUT, this happens only when the Arduino is connected to my PC via USB and also powered that way. When I disconnect my PC, the measuring does not work any more. Pressing the brake will lead the led to blink although there are no objects even near. At close range the blinking is working ok. I don’t want the led to blink when there is no object within the 60cm range.

I had the Arduino powered with the 12V from the car. Today I made a similar 5V voltage regulator to power the Arduino too, but it had no effect, the led is blinking even it should not.

I’m not an expert in electronics, but what makes the difference here? Why the sensor gives those mysterious less-than-60cm values when working “stand-alone” and why it is working ok when connected to PC? What can I do?

:o :o :o

OK. Seems that I have a unique problem without any existing or commonly known hints etc. I will quit my project and buy a cheap Chinese parking radar and try to survive with it.

I've had similar problems with those using a 4MHz xtal. (there are several types out there)

Any solution found?

..not for the 4MHz variant. (usb power only)