user56281: I need to read a potentiometer value from an ATTINY85.
I have big fat 10K POT but for this use case I need it to be very small so I used a salvaged 2.4K one, the kind that is soldered directly onto a PCB.
I am using tinkercad to prototype my project and I am facing a very weird problem. Everytime I read from the POT Pin, I get the value of 512 (using the debugger)
Here is a screenshot of my prototype:

The goal is to power the circuit and the lamp (does not matter what is there, consider it just a load) with a 9V battery, use a 5V regulator to power the ATTINY85 and use an NPN transistor to turn the lamp/load on or off.
For information, the whole regulator and transistor setup is tested and works like a charm.
Here is the code I wrote for the this case:
void setup()
{
  pinMode(PB0, INPUT);
}

int potValue = 0;

void loop()
{
  potValue = analogRead(PB0);
  delay(100);
}

Not real fancy right?
Now no matter what use for the POT, and I tried 2.4K, 10K and up to 100K, the value read by the ATTINY is always 512.
Do you see something wrong in this setup?
Could it be a bug in tinkercad? (I'd be surprised though)
I could try and share this circuit within tinkercad if someone would be willing to have a look...
EDIT: I just tried with PB2 as suggested but not the value is always 58:


user62523: Port PB0 is not an ADC (analog input) pin on the ATTiny85.
Available pins of the ATTiny85 (from the Atmel ATtiny 25, 45, 85 datasheet):
Choose PB2, PB3, PB4 or PB5 if you need an analog input.
Additional information: When built in TinkerCAD, using PB2 as an analog input does not seem to work correctly and produces a fixed value. Using PB3 did work correctly however. This might be a bug in TinkerCAD.

56281: <p>I need to read a potentiometer value from an ATTINY85.
I have big fat 10K POT but for this use case I need it to be very small so I used a salvaged 2.4K one, the kind that is soldered directly onto a PCB.</p>
<p>I am using tinkercad to prototype my project and I am facing a very weird problem. Everytime I read from the POT Pin, I get the value of 512 (using the debugger)</p>
<p>Here is a screenshot of my prototype:
<a href="https://i.stack.imgur.com/Xyzc5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xyzc5.png" alt="enter image description here" /></a></p>
<p>The goal is to power the circuit and the lamp (does not matter what is there, consider it just a load) with a 9V battery, use a 5V regulator to power the ATTINY85 and use an NPN transistor to turn the lamp/load on or off.</p>
<p>For information, the whole regulator and transistor setup is tested and works like a charm.</p>
<p>Here is the code I wrote for the this case:</p>
<pre><code>void setup()
{
  pinMode(PB0, INPUT);
}

int potValue = 0;

void loop()
{
  potValue = analogRead(PB0);
  delay(100);
}
</code></pre>
<p>Not real fancy right?
Now no matter what use for the POT, and I tried 2.4K, 10K and up to 100K, the value read by the ATTINY is always 512.</p>
<p>Do you see something wrong in this setup?
Could it be a bug in tinkercad? (I'd be surprised though)</p>
<p>I could try and share this circuit within tinkercad if someone would be willing to have a look...</p>
<p>EDIT: I just tried with PB2 as suggested but not the value is always 58:
<a href="https://i.stack.imgur.com/5DHK8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5DHK8.png" alt="enter image description here" /></a></p>
 62523: <p><a href="https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet.pdf" rel="nofollow noreferrer">Port PB0 is not an ADC (analog input) pin on the ATTiny85</a>.</p>
<p>Available pins of the ATTiny85 (from the Atmel ATtiny 25, 45, 85 datasheet):</p>
<p><a href="https://i.stack.imgur.com/ksObn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ksObn.jpg" alt="ATtinyx5 pinout" /></a>Choose PB2, PB3, PB4 or PB5 if you need an analog input.</p>
<p>Additional information: When built in TinkerCAD, using PB2 as an analog input does not seem to work correctly and produces a fixed value. Using PB3 did work correctly however. This might be a bug in TinkerCAD.</p>
