Powering the arduino using PC and a DC supply

I'm working on a project where i use three ultrasonic sensors. The issue is when i connected the PC usb cable and power up the arduino everything works fine.

But when I power the Arduino using a DC supply it gives false readings.

What can be the issue.How can I overcome it. I'm using a 12V 2A, DC supply. also tried with another 12V DC supply same false results.

Sounds like a GND [edit - language] f...-up. How is everything connected? What kind of sensors? Schematics etc :)

No special circuitry, direct connections. Only modification I made was, connecting the Ultrasonic sensors (HC-SR04) to a dot board and using it as a hat for the arduino board added LEDs to detect the status. If there is a GND issue, How does the circuit even work.

Maybe because you rely on the path of the USB connection. We don't know because you did not post any schematic ;) And the circuitry may not be spacial, that does not mean it can't be wrong ;) And it does not work correct so it probably is.

@Rest, sorry, forgot Americans read this as well...

septillion: Maybe because you rely on the path of the USB connection. We don't know because you did not post any schematic ;) And the circuitry may not be spacial, that does not mean it can't be wrong ;) And it does not work correct so it probably is.

@Rest, sorry, forgot Americans read this as well...

Not just Americans. :) I'm in the land of Oz, and I'd like to see the schematic too. Edit: Oz=Australia :D

Thank you all for trying to help, but as i mentioned it was a issue with the power supplies i used, With several tests on noise filtering on power supplies and changing several of them i was able to find a suitable one.

Andre_Leonardo: With several tests on noise filtering on power supplies and changing several of them i was able to find a suitable one.

That's why you were asked to show the schematic - so we could see what you were using for decoupling/filtering. Chances are that the original 2A supply would have been fine with the right capacitors in the right places. Instead, you chose the hard way.

ah no, power supply was directly connected to the Arduino board power jack, only the sensors were connected via using the hat i made, and the sensors were powered through the Arduino pins.