umbra070
Posts: 1
Joined: Tue Apr 01, 2014 6:34 pm

photo resistor.

Tue Apr 01, 2014 6:42 pm

Hello! I buy raspberry and now i have some questions:
How can i use photo resistor? he have boolean data or int?

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: photo resistor.

Wed Apr 02, 2014 2:55 pm

You need an analog-to-digital converter. A photoresistor produces an analog output, which the Pi cannot interpret. They're quite inexpensive on Ebay.

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: photo resistor.

Wed Apr 02, 2014 3:04 pm

You can charge a small capacitor through the photoresistor from a toggled GPIO output pin and cyclically time how long it takes for the centre-point voltage to fall below the voltage threshold of another GPIO pin set as input.

It's not something I've tried myself, but it's an often mentioned method for measuring electrical resistance on a Pi.
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

boyoh
Posts: 1468
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: photo resistor.

Wed Apr 02, 2014 7:48 pm

photo resistor_schem.jpg
photo resistor_schem.jpg (37.6 KiB) Viewed 1840 times
Build this circuit up on a bread board, This will help you
To understand how a Photo Resistor works
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: photo resistor.

Wed Apr 02, 2014 7:57 pm

For $2 delivered, you can have a photoresistor, temp sensor and more all connected to a ADC.

Image

http://www.ebay.com/itm/1PC-New-AD-DA-C ... 2c71d20f9d
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

Return to “Beginners”