Potentiometer doesn't work with 12v

Hello
I'm currently working on a project where I want to be able to control a fan and display the speed with help of three LEDs.
For the fan control I'm using a LM317 voltage regulator and some capacitors, and for controlling the LEDs I'm using a ATTINY85. I wrote a simple sketch to the ATTINY85 that would turn on the LEDs depending on the speed.
To check if it's working I plugged in the potentiometer to a arduino uno and observed the readings.
When I powered the circuit with 5 volts (from the arduino) the readings were fine and consistent, it worked liked i wanted to. But when I powered it with 12 volts via an AC adapter the values weren't consistent anymore.
How can I solve this?

EDIT:
Uploaded image, this is the wiring when I was testing the potentiometer.

philip474:
. But when I powered it with 12 volts via an AC adapter the values weren't consistent anymore.

Without seeing a clear diagram of ll your connections how can we know what might be the problem?

I hope you are not feeding 12v to an Arduino I/O pin.

...R

A proper circuit diagram might help. But if you are trying to run an ATTINY85 (max. voltage 5.5V) on 12V it's not difficult to guess why it may not be working.

Steve

The ATTINY85 is not plugged in (yet), this is only to test the potentiometer. It was plugged in to the arduino uno and the 12v power source was plugged in to the powerbus (to the left). I'll draw a schematic and upload it.

Image from Original Post so we don't have to download it. See this Image Guide

You need to produce a proper schematic - it is much too easy to confuse connections in a picture like that, And the business of drawing the schematic can often bring problems to the surface.

...R

Some wall adapter output a regulated DC voltage. Some put the AC voltage through a rectifier and call it DC, even though it has a lot of ripple on it.

Some wall adapters have very poor regulation at low current.