PDA

View Full Version : Light Sensor & LCD :: Code & Schematic



munim
- 11th December 2006, 16:14
Dear All,

My problem is really simple for you guys but not for me as I am a beginner.

My problem is:

I have a light sensor (works as a resistor), a PIC16F84A microcontroller, and LCD like the two of these...

--
| |
--
| |
-- .

If the light in the room increased the value in the LCDs also increases (limit is 0 ~ 99) and vise versa for decrement.

I want a schematic and picbasic code ...

Can anyone help me in this respect?

Thanks in advance,
Munim

mister_e
- 11th December 2006, 17:27
It's certainely not something i would do with a F84. There's no ADC, no PWM module etc etc.

If it was for me, i would choose a better one, 16F88, 16F648,16f676, 16f684 etc etc.

But begin by understanding some part of your stuff first. You need to multiplex your displays (7 segments), see this one
http://www.picbasic.co.uk/forum/showthread.php?t=5297

Have a look in the PBP manual for ADCIN (what you need to read your ambient light) AND HPWM (what you need to play with your display brightness)

Try something, block by block... and then if there's anything that doesn't work, post your code and schematic here.

Have fun!

SOMRU
- 11th December 2006, 20:07
Are We Looking At A Light Meter, I Suspect.

I have To Agree With Mister_e I'd Use A Pic With Adc

Perhaps Like A 16f818 - 16f87x, K.I.S.S. METHOD,

NO OFFENCE INTENDED.

mister_e
- 11th December 2006, 21:39
Or skip the ADC/PWM/PIC stuff but doing it in hardware.... ICL 7106 and pals, TC820cpl... no PIC at all !

Buy a 5$ multimeter and hack it

List is endless :D

Acetronics2
- 12th December 2006, 08:27
Hi, Steve

As a 0-100 scale is expected, ... RCTime function could do it.

Buuuut, the problem is light scale ... it's a logarithmic scale !!!

Sooo.... the input scale must be 0 - 10 000 !!! ( which is the A/D to use, Then ???? )

I think a design around a CA3089 ( or with log response: FM IF systems w/signal stenght indicator make good sonometers ...) could do it easily.

here, a modular 3 1/2 digit std voltmeter could be enough ... as the CA3161/3162 are ... out of my purse !!!

Alain

mister_e
- 12th December 2006, 14:51
log scale? Could be. Use a VCA (SSM2164 & pals), set a fix voltage at the input, place the LDR at the voltage control... now it's close to be LOG scaled :D

OR Lookup tables OR some maths Or maybe there's some Log LDR?... I don't know and we don't have many parameter of this project so... HeeeeHaaa let's shed some tons of different ways :D