Arduino Nano with 9v power supply

Good day,

I have been working on a project where I need to measure the water levels in a tank using ultrasonic JSN-SR04T. The tank is around 14 meter away from the display unit. So my water proof ultrasonic sensor is kept inside the tank. From the ultrasonic sensor inside the tank, a pair of connection wires of 14 meter(extended) length is running all the way to the ultrasonic module from which TRIG / ECHO pins are connected to the Arduino.

Now the problem which I'm facing is that when I'm powering up the Arduino with 9v battery, readings are accurate, however when I power it up using a 9v adapter, readings are going up and down. I tried with 6v adapter as well. Result is same. Correct readings are available only when connected using a 9v 'battery'.

I'm using Arduino Nano, 16x2 LCD display, a buzzer and a JSN-SR04T waterproof ultrasonic sensor. Power adapter:9v 1A.

As this unit needs to be run 15-20 mins a day, it is preferable to use an adapter not a battery.

Any inputs?

Thanks in advance.

I find adapters to be somewhat noisy . Try a pair of 15 to 20uf capacitors with a voltage regulator .

You cannot usefully power the Arduino with a 9V supply using the "Vin" pin. The on-board regulator is capable only of supplying the ATMega chip itself; once you add another component it is not capable.

You need to supply 5 V - preferably regulated - to the 5 V pin. If you must use a 9 V battery (a carrier of six "AA" cells would be the minimum) then you need a switchmode "buck" regulator module to efficiently drop it to 5 V.

But a 5 V "phone charger" feeding the USB connector would be much more appropriate.

The lead length between Arduino and ultrasonic sensor is going to be a major problem. The two should be within a meter or two.

Trust the adapter. I have no idea of what you are doing but, IF you are using a 9v PP3 battery, its possible that it's giving you a wrong reading - consistently - and the right reading is the is the "up and down" one.

I am using a 9v PP3 Battery. And it is giving the correct reading while using the battery. Same is verified by physical measurements.

I tried two different adapters and the result is same. The reading jumps between different values. That's when I came to the conclusion that readings are wrong only while using power adapters.

Even I was concerned about the lead length between ultrasonic sensor and Arduino. However readings are accurate while it is powered by battery.

Should I power up the ultrasonic sensor module independently? If I use a 5v mobile charger adapter and power up Arduino and ultrasonic sensor module in parallel from the same adapter...will it solve the issue?

The standard way to power an Arduino is via a 9v wall wart. <<<<<Read that twice.

Phone chargers are for charging 3.7v batteries. IF you are sure it delivers 5v AND you connect Nano in the proper manner, presumably at the 5v pin, It should be fine, particularly if it a newish one, as they good for 1.5A and more these days. If it is an ancient one, good for less than 500mA, it might be best to stay away from it, but there is one thing that you can be absolutely sure of, ANYTHING is better than a PP3, and any grief or misconceptions you get from your insistence in using one is well-deserved. Usually a problem like yours is the other way round, but I submit that you have come to the wrong conclusion and, if the problem is indeed real, the solution lies somewhere else.

Phone chargers are for charging 3.7v batteries. IF you are sure it delivers 5v AND you connect Nano in the proper manner, presumably at the 5v pin,

All the ones I have (including some that are 15+ years old) are rated to produce 5V. The more modern ones have USB connectors even.

They might be rated to produce 5v but that doesn't mean you have to believe it, and people have measured them to produce 4.7v, which is not such a good start when you are having power problems with a 5v Arduino, but they will work just fine doing what they are made for - hence my comment.