Alternative to Arduino when using photoresistor

Thread Starter

Saatvik Sehgal

Joined Apr 3, 2019
2
Is there an IC that I can use instead of an arduino or attiny to compare a reading from a photoresitor to a threshold value (eg 2.4v). If the reading is above 2.4v it should turn the transistor on and if it is below turn the transistor off.
 

danadak

Joined Mar 10, 2018
4,057
Comparator with onboard reference -

http://www.ti.com/product/TLV3011

When photoresistor triggers comparator is there a minimum time you
want comparator to stay triggered if light level falls back below its trigger
point ?

Do you need circuit to not generate false trigger while circuit is being
powered up ?

The above would be why you might want to reconsider using ATTINY.....


Regards, Dana.
 
Last edited:

Thread Starter

Saatvik Sehgal

Joined Apr 3, 2019
2
Comparator with onboard reference -

http://www.ti.com/product/TLV3011

When photoresistor triggers comparator is there a minimum time you
want comparator to stay triggered if light level falls back below its trigger
point ?

Do you need circuit to not generate false trigger while circuit is being
powered up ?

The above would be why you might want to reconsider using ATTINY.....


Regards, Dana.
Thank you for the reply. I think I will need a negative comparator. I havent thought about those questions until now. I would want it to stay on for 5 minutes after detecting darkness. It is okay if it false triggers on power up.
 

be80be

Joined Jul 5, 2008
2,070
Comparator 1
555. 1
Resistor 5
Caps 1
Photoresistor 1
9 parts

Uc any 6 pin job with adc some can use pullup with adc
So just a photoresistor and cap. Little code and your done
 

danadak

Joined Mar 10, 2018
4,057
For future designs look into mBlock, pretty easy to do. 6'th grade kids
across US doing robot work with it. Consider this for future designs.

mBlock and then program ATTINY -

upload_2019-8-16_17-53-58.png

You drag and drop blocks vertical window 2, into window 3, config block, and then
tell tool to upload. The tool generates the Arduino code in right hand window from
your block configurations, and does the upload. Arduino Nano board would work
well here, thats < $ 2.

If you wanted to use ATTINY then you use a Nano or Uno board as a programmer.
A few more steps to do the programming to get that done. Fairly straightforward.


mBlock is free.

In my example coding you might want to add hysteresis in coding to handle
short transient light level changes that "hang" around the trigger V you decide
on. Like cloud movement. Just a thought....


Regards, Dana.
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
If you use ATTINY this is what it would look like.

If your load operates off 5V and takes < 20 mA or so you
can drop using the transistor and its R from base to ground.
ATTINY would then directly drive load.

upload_2019-8-16_18-37-10.png

Regards, Dana.
 
Last edited:

crutschow

Joined Mar 14, 2008
31,110
Okay, here's my part's list to do the job, not including the photo resistor circuit:
5 Resistors
1 Capacitor
1 LM393 dual comparator IC
No programer

Exact configuration depend upon the polarity of the photo resistor signal.
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
If external transistor not needed -

upload_2019-8-16_20-33-54.png

Timing accuracy 2% over T and V.

V measurement accuracy set by Vdd supply accuracy you put on ATTINY power pin.

I will post project if you would like to use my coding. Or just copy
my arrangement of blocks.


Regards, Dana.
 
Last edited:
Top