Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LDR, photodiode or?

Status
Not open for further replies.

MrDEB

Well-Known Member
working on Christmas 2020 project and trying to decide what to use for detecting "dark'"
project entails a Christmas star that is placed on top of Christmas tree, powered by coin cell battery or 5v USB walwart.
leaning towards the wall-wart idea so battery would no need to be replaced.
project utilizes an 18f43k22 to control the 35 LEDs.
the light sensor will turn on the LEDs when it gets dark and runs for predetermined amount of time ( thinking 6 hours) thus a long delay is programmed in the pic.
the light sensing circuitry to be connect to an ADC port.
looking at different light sensor ideas using photo diode, photo transistor or even an LDR. All basically the same but trying to utilize the KISS method.
any ideas on which sensor type to utilize?
 
An ADC typically requires a source impedance <10k, which makes interfacing to an LDR easiest and least interference-prone, in my opinion.
 
I agree with alec_t

LDR and suitable resistor is the simplest option and the easiest to understand.
 
Likewise, it's crazy to consider anything else. You don't even need to use an analogue input, you can use a simple capacitor charging technique on any normal I/O pin, as in my joystick tutorial - and easily achieve more than 8 bit resolution.
 
I think Mr Deb should use PIC analogue input (or possibly comparator) for measuring LDR/resistor potential divider voltage.

Not nearly as clever as capacitor charge timing, but simpler to understand for a beginner.
 
You might consider something like the Everlight ALS-PDIC243-3B (datasheet). It will have more uniform and predictable results than random photocell, and its response to tailored to match the human eye – IR is filtered out.

At LCSC, the qty 10 price is 20 cents each, or 42 cents each at Mouser.

The circuit is pretty simple.

SmartSelect_20200803-114512_Drive.jpg
 
Last edited:
I clicked on the data sheet that Jon posted but it is a relay, not a LDR
it happens
 
Sorry. Link fixed. But to be fair, the part number was there – you could have found it with the tiniest bit of effort.

Screenshot_20200803-123224_Firefox.jpg
 
I was wrong in thinking you posted the correct link.
been searching for inexpensive wall warts but everything is $6+
These Christmas stars are Christmas presents for friends and family so cost is a big issue. Need to $hip these stars to Florida and California so my cost has exploded not to mention if going with a wal wart then a voltage regulator will be needed so cost = ++
Going with battery power only with LDR
need to research PWM further.
onward with design
 
Any USB wall wart will power a USB Arduino which will easily make your project possible.

Mike.
 
First ebay listing. USB charger, 6 bucks. For 4. With free shipping in the US. That makes them $1.50 each. You should be able to find USB cables cheap. A full-size USB-B connector on the board will be easy to install and will take a beating and survive. Or cut the connector off and solder wires directly to the board.

Sounds like you didn't even take a look at the datasheet after I corrected the link.

Use USPS Flat Rate Priority shipping. They provide the box, so it's the easiest way to handle it.

Advice is only good if it's what you want to hear.


Screenshot_20200804-065426_Firefox.jpg
 
Seems like a good deal but, do you really think they are CE/UL listed? What is the flammability rating on that housing? How hot does it get?

I stopped buying those 4 for $x deals because I don't really want to burn someone's house down to save a buck. And, I don't send non-idiot proof devices for friends and family because I don't want them to burn their houses down even if the power supply is UL listed - especially putting something atop of a terpene-filled, dried out evergreen.
 
You're right. Usually, I buy better power supplies. For about the same price.

At thrift stores and PC recyclers, one of the greatest values are power supplies from cell phone and computer manufactures and other "wall warts" that came with consumer electronics. These power supplies were engineered for a long service life, follow good design practices and have all the ratings. For a buck or two. Some are a little more, like the mammoth X-Box power supplies, which provide 12 volts at up to 16 amps depending on the version.

While I can't state with utter confidence as some do here, the switching power supplies I have tested have a strong self-preservation instinct. As current draw approaches the and exceeds the maximum rated current draw, the output voltage rapidly falls to zero.

A very safe way to have an illuminated ornament would be to use a USB power bank. Recharge it periodically and it will work great.
 
Why not fit it with a small rechargeable battery? Solder tagged NiMh battery will trickle charge with no special circuitry. Give it a USB socket and they can charge it using their phone charger before they stick it on the tree. Battery voltage hits the PIC's supply voltage range with no regulator. Don't know how long it would light your LED's for though. You using super-low current ones?
 
I looked at flea bay and saw the ones Jon posted and yes I want them with cords plus not worry about a fire.
still contemplating what direction.
As for LEDs, using standard white and blue. only one resistor for the blue (multiplexing each LED so only one rsistor works (did similar last year and the LEDs twinkle. The white LEDs this year will be clustered in groups of 3 or 4. These will twinkle with a longer off time. Contemplating using PWM but need to breadboard and experiment with PWM.
issue with throbscottles suggestion is USB wal-wart issue plus I still need to add a voltage reg which will increase the cost slightly.
And yes I viewed and printed out the data sheet for the ALS-PDIC 243-3B AND THE PT42-21C/TR8
 
Am I right in thinking you are making these as Christmas gifts?

My point was, nearly everyone has more USB phone chargers than they know what to do with. Settle on this standard and you don't need to supply one. Phone manufacturers already make them an optional add-on.

As to voltage regulation, that PIC will run on 5.5v down to 2.3v. Unless you meant the version with an L in the name. So it would not be needed.

I think you are right to not trust off-brand chargers. But there are also reputable manufacturers cheaper than the big-name brands.
 
My present schematic has both a usb input port and a coin cell battery at present. IF I have both then maybe keep both but?
If one puts it on the top of the tree then adds the usb cord sounds good BUT if only the battery and battery goes dead then what!!
Will have a LDR so battery life should last longer plus I am planning on 500-1K resistors so drain should be pretty low..
I have some friends in town that I gave one to two years ago with a wall-wart and they put it in their kitchen as a night light so it really has some brightness to it using 250-500 ohm resistors.
LOTS to consider.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top