Problem With Analog Inputs when Arduino is Externally Powered

Hello, I have been doing some prototyping with Arduino Nano. The goal is to read an analog voltage and if that reading is less than or equal to 2V I would like to turn on LED. I am reading the analog input from a power source that I am varying from 0-5V across a 1kOhm resistor. I was able to successfully do this when I power the Arduino from the USB 2.0 port. However, when I try to power it with a 5V regulated source, from a 12V to 5V Linear regulator(L7805), the readings are not correct as the LED powers on when the Analog input is less than or equal to 1V. I noticed that when I bypass the regulator and power with the 12V source all is well. I have attached some tinkerCad images of the when it is working via the USB Power. The only difference when it does not work is that I am powering the Arduino via the Vin and GND pins from the L7805 Vout and GND pins. I am using a 12V battery and an Arduino Nano but couldn't include that. Any help is appreciated.

int controlPin = 3;
int sensorPin = A2;
float sensorValue = 0.0;
float voltageValue;
void setup() {
  // put your setup code here, to run once:
  //Serial.begin(9600);
  pinMode(controlPin, OUTPUT);
  pinMode(sensorPin, INPUT); 

}

void loop() {
  // put your main code here, to run repeatedly:
  sensorValue = analogRead(sensorPin);
  voltageValue = (5.0 / 1023.0) * sensorValue;
  //Serial.println(voltageValue);
  delay(500);


  if (voltageValue < 2.0) {
    digitalWrite(controlPin, 1);
  }
  else  {
    digitalWrite(controlPin, 0);
  }

}

Is this only in simulation, or a real circuit?

The Vin pin needs 7 to 9V.

5V will not work on Vin.

Thank you. I never powered an Arduino externally and since the USB operates at 5V. I assumed 5V would be sufficient. The data sheet clearly states other wise. Much appreciated.

5V is sufficient - placed at the 5V pin (terminal).