Vin and USB weirdness

I have a DHT-22 with a Nano. I have a Buck- 12v to 5v rated to 3A providing power to the Nano-Vin and the DHT. I have the pull up resistor. I have a 12vdc-1A wall wart to the Buck.

If I plug in only the USB cable I get correct readings from the DHT.

If I plug in the 12v with the USB and press reset, I get correct readings from the DHT.

If I un-plug the USB laving just the 12v and press reset, I get the correct readings from the DHT.

If I un-plug the 12v and replug it in I get invalid readings from the DHT.

With the 12v plugged in and invalid readings, I plug in the USB and it reboots itself and I get the correct readings from the DHT.

I have tried two other Nanos same thing. It seems like there is something being set by plugging in the USB.

Could it be something with the Data Pin? The example program just shows

void setup()
{ Serial.begin(115200);
   Serial.println();
   Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)");
   dht.setup(2); // data pin 2
}

SalineSolution:
I have a DHT-22 with a Nano. I have a Buck- 12v to 5v rated to 3A providing power to the Nano-Vin and the DHT. I have the pull up resistor. I have a 12vdc-1A wall wart to the Buck.

Connect the buck converter to the 5V pin, not to Vin :

Ciao, Ale.

V-in (or RAW) is the input of the onboard 5volt regulator.
It needs a minimum of 6volt on V-in to produce a stable 5volt for the board.

If you have 5volt, connect it directly to the 5volt pin.
Leo..

Ahhh, OK, thanks guys.

"Vin" means "Volts in" only sometimes. I am sure it is the docs, but a trap for the unwary at best.

Now I have to go re-solder about 20 IoT Nodes. Good thing I hadn't made PCBs for them. :slight_smile:

SalineSolution:
I am sure it is the docs, but a trap for the unwary at best.

You say unwary, I say the inattentive. It's hard to look at any piece of spec literature without seeing the "Input Voltage (recommended) 7-12 V"

Read the datasheet, double (or triple) check everything. That's how electronics is done without
too many nasty surprizes.