Analog Knob Converter


This program reads an analog value on adc1 and outputs a porportional probability on po. During the adc conversion pwr is pulled low to to power a potentiometer dividing vcc as input.

	     ATtiny45
	      --v--			 100k
    rst pb5 -|     |- vcc ------------\/\/\/\/---+
     pi pb3 -|     |- pb2 sck adc1 ------^       |
     po pb4 -|     |- pb1 miso pwr --------------+
	gnd -|     |- pb0 mosi scope
	      -----
	       8MHz

http:files/DownloadParts/adc-pot.asm


The part uses the Tiny45's built-in analog to digital converter. As the voltage at adc1 ranges from 0 to vcc, the output at po varies porportionately.

Here is a circuit that balances a CdS photo-resister against a fixed (22k) resister. It doesn't reach the full range of possible values, but it does seem to be useful for detecting room illumination, shadows, and even reflections from leds at short range.

	     ATtiny45
	      --v--			 22k
    rst pb5 -|     |- vcc ------------\/\/\/\/---+
     pi pb3 -|     |- pb2 sck adc1 --------------+
     po pb4 -|     |- pb1 miso pwr --[photo res]-+
	gnd -|     |- pb0 mosi scope
	      -----
	       8MHz


Try using a 100k pot instead of the fixed resistor. As I've played with CdS cells more I've found the adjustability handy. See VideoFeedback.

 

Last edited December 24, 2006
Return to WelcomeVisitors