Nano - USB power (priority) and 3 AA batteries

I would like to have my project run off of battery power (3 AA), but when the user plugs in the USB, I want it to automatically switch to USB power, not the batteries. Looking for help on the best way to set this up and what components I may need to allow it. I understand that I'll be working with 4.5v on the batteries and the nano is suppose to switch to the highest voltage source, but it seems it continues to pull full amps from the batteries when the usb is plugged in (usb diode pulling too much). I need the voltage to stay above 4.2v.

Which "Nano"? There are several.

How do you connect the battery?

You should take into account the typical discharge curves for AA batteries (here alkaline):

coppertop_aa_cc_discharge

The latest Nano v3. I'll try to get the usb-c one if that matters. I'm hooking up the batteries to the +5v pin. I should note that I don't have room for a forth battery, but not sure that would change the problem.

I don't think that connection will work. If the battery voltage is lower than about 4.7V, the USB will be driving current through the batteries (i.e. "charging"), via the "autoselect" Schottky diode.

You need to either provide regulated voltage higher than about 4.8V to the 5V pin or add a blocking diode to the battery connection.

Yes, I was planning to add a Schottky diode to the battery as well to prevent USB feeding it. However, when the USB is connected, it's still pulling power from the batteries as that voltage is higher than the USB.

it's still pulling power from the batteries as that voltage is higher than the USB

I don't believe that. Please describe in sufficient detail how you measured the battery voltage, the USB voltage, the "power draw" from the batteries, and state the values you obtained.

Using a Klein Tools USB digital meter to see the power draw from the usb and used a variable power supply to simulate the batteries also displaying the power draw. If I recall, the power supply needed to get down to around 4.2V before we saw the amps drop and switch to USB.

Sorry, that makes no sense at all.

Good luck with your project.

I will take a SWAG: You are going to have to add something to control the battery voltage, as it decreases as the battery energy is used up. Also note this will also cause problems with the stability and repeatability of the A/D if using one. Now adding a diode will cause your "4.2V" to go to about 4.9V. Posting a schematic not a frizzy picture wouold help a lot and get us to a more definitive answer.