Light Dependent Resistor (LDR) and LED lighting

Garahbara

New Member
Hi all,

Trust someone here can help with a simple solution to my problem. I haven't needed any support or assistancve with Picaxe for more than 10 years.

I use Picaxe processors to provide signal control on my model railway. Have done for years with no problems.

A LDR (Light Dependant Resistor) is placed between the rails and I detect a drop in the returned value to indicate a train has passed over it. No problems with incandecant train rtoom lighting. (Halogen floodlights).

I have replaced to room lighting with LED floodlights. Consequence is, that the signalling does not work anymore.

I've determined that the LED floodlights "strobe", and I've checked the spec of the LDRs and they have a response time of about 25 millseconds. So I believe my problem to be the LDRs are now returning eratic and widely varying values to the Picaxe processor when I "sample" the LDR value, causing havoc with the Picaxe logic.

Firstly, would I be right in my diganosis here?

Secondly, how can I "smooth" the current passing through the LDRs to get a stable reading of the ambient light, or shaded light emitted by the LED floodlights? Some sort of capacitor "in series" or across the LDR maybe???

I'm not about to pull apart an entrie signalling system to use Infrared detection instead. (15 sets of signals and Pixace processors, and programming)

These are the lights I am using (20 of them) from here

Looking forward to, and upfront thanks for any assistanvce that can be provided.

TOOT! Garahbara model railway
 

Attachments

premelec

Senior Member
Your simplest solution would likely be to put a capacitor across the voltage coming from the LDR circuit so it does not respond as fast. That should work if the problem is indeed from the light strobing... You could also modify the lights to run on DC current - a more complicated route ;-0
 

erco

Senior Member
A cap sounds like a good simple solution as a voltage divider filter. Is your LDR in series with a fixed resistor? I'd start with an electrolytic cap ~100uF-470uF in parallel with your LDR. Watch the polarity.
 

jscottb

Active member
I'm assuming you have a partnered resistor creating a voltage divider to measure from. What size resistor do you use as the partner? You may be able to change that value to adjust the gain of the LDR. I would make a testbed with a PICAXE reading the LDR and play with that value to find one suitable.
 

inglewoodpete

Senior Member
Like most things, LED lights (lamps) are made as cheaply as possible. They are likely to be pulsing at mains frequency (half-wave rectified power) or twice mains frequency (full wave rectified). The half-wave powered LEDs will be the most problematic, due to the long "off" period when the power source is effectively off.

Full-wave lighting with LEDs or fluorescents are likely to be "saved" by the persistence of the phosphors used to get the white light. As many of us would know, even fluorescent lights pulse at twice mains frequency but, because they operate for the full power cycle and they use long persistence phosphors, they never actually "turn off" completely until well after power is removed.

With LEDs, power to them is cut when the power source drops below their forward switching voltage. Initially you may think this is only around 3 or 3.5 volts but lamp manufacturers tend to place many LEDs in series, so they do not start to conduct (and emit light) until the mains sine wave voltage reaches many tens of volts. This higher 'on' threshold voltage, combined with the shape of the driving sine-wave will extend the "off" period of the pulsing LEDs.
 

Garahbara

New Member
OK guys. Thanks for you responses so far. Much appreciated.

Inglewood Pete, I think you comprehensive defined exactly what my problem is. Now to easily fix it. The halogen floodlight was using 2500W of power. Costing me a motza. That's why I replaced with LEDs.

It appears the LDR is connected with one side to the -ve bus on the veroboard I used. There is a resistor between the otherside of the LDR and the Picaxe pin. Couldn't easily tell you what value, however it is different from all the others resistors connected as "pull down" resistors. It is green. The boards are buried up under the tain layout and very awkward to examine closely. I'd say the value of the resistor is the recommended value for use with LDRs on the LDR pin I defined.

These things have run for years, and the code I used is buried on a laptop I haven't cranked up for a similar amount of time.

I do remember I set the LDR values 0 - 256 to give a good range.

On startup, I test the LDR value and set that as "ambient" light. Then anything less than 50% of that means a train has gone over the LDR. This mechanism allows me to run in low light levels (simulated evening) and still detect a train, rather than use a fixed value to test as "less than" beause the low "ambient" light level might already be below that arbitrary 'fixed" value. When the LDR returns to "ambient" value it means the entire train has gone past.

Given all this, will a capacitor put in the LDR line (and where) or accross the LDR fix my problem? Erco, you suggest an electrolytic cap ~100uF-470uF. Is this still the case?

Thanks again for any assistance you can provide.

TOOT!
 

premelec

Senior Member
Without knowing your specific resistances and LDRs it's hard to give more specific suggestions than erco has... perhaps only 10uF would do directly on READADC pin to V-... life is empirical - give it a try.
 

Garahbara

New Member
OK guys. Hopefully I've got something that will assist with a correct capacitor, and where to place it, if indeed that will fix my problem.

I've attached a pic of the veroboard circuit. I've followed through the power bus on it. and the connections to the LDR (blue and white wires at the top) are indicated. I'm not good at determining resistor value, and have highlighted and attached a close up of the resistor in question. It appears to be a 100K ohm resistor. The resistor is across the +ve bus and the LDR pin.

I've also attached a close up of the resistor, and a pic of the LDRs I'm using.

Hope this helps in refining what I need to do.

Thanks again so much for your advice and guidance.

TOOT!
 

Attachments

AllyCat

Senior Member
Hi,

Yes, the colour bands tell us that it's either 24 ohms, +/-1% or 100k ohms,+/- 2%, so we can assume 100k, particularly as all the other resistors have been neatly assembled with the bands reading Left to Right. ;)

Unfortunately, that's rather higher than might be expected and the LDR will almost certainly have a lower value (at least when the light level is high). LDRs can go above 1 Mohm at low light levels, but down to "hundreds" of ohms at high (daylight) levels. LED lamps are typically 5 times more efficient than incandescents, so your 20 x 50w floodlights might be twice as intense as your original 2500 watts. They won't "look" twice as bright, but that's what the LDRs may detect; not difficult to fix by a physical or electronic method (which we can discuss if necessary) but something you should be aware of.

I assume that the LDRs might fall to a few kohms, but it would help if you could measure it; e.g. measure the voltages across the LDR, the 100k resistor and the supply rail (any two of the three will do) in the brightest conditions, so we can do the calculations. Then we need to calculate the optimum "time constant", which is the product of the effective resistance and the (parallel) capacitance. The longest time constant that can be tolerated is the time that it takes for the train (or maybe a carriage/wagon) to pass over the LDR, I'll guess at 1 second. If the resistance is as high as 100k (i.e. at low light levels) then 10uF might be as high as you can go (i.e. 100k x 10u = 1000m = 1 second). Conversely, if the (LDR) resistance is 1k at high brightness, then the time constant would become 10ms which might be just about sufficient to filter a "break" in the light from the lamp(s) of perhaps 5 ms.

Yes, there is free software available to use the "soundcard" (microphone or line input) of most PCs as a "scope", but I wouldn't really trust it (or the PCs hardware) at 50 Hz, which is lower than needed for most "audio" these days. IMHO what would be more useful is if you can "look inside" one of the floodlights, because we can't guess at the "technology" that's been used. An "advantage" of some of the cheap Chinese stuff is that it's not fully sealed or encapsulated, so can be "opened up" quite easily (there appear to be hex-head screws on the front?).

"Raw" white LED chips have a voltage drop of about 3 volts and it looks as if those floodlights might have 50 x "1watt" chips (but those might each contain multiple components). They will very probably be connected (partially) in series, but I would hope with at worst 2 strings of 25 LEDs having opposite polarities (for the two phases of the mains), and preferably 10 strings of 5 (with a forward drop of 15 volts or more). A problem with series strings is that if one chip fails, then the whole row becomes dead, but I didn't see the ebay listing say anything about the predicted MTBF (Mean Time Between Failure). :)

However, the main question is how is the "low voltage" for the LEDs obtained from the mains? Many of the more recent "Compact Fluorescent" lamps rectified the mains to dc and then employed a high frequency converter / transformer to drive the tube. Thus, I had expected/hoped that LED lamps might work in a similar way (the "dimmable" lamps do of course use low frequency PWM). But I did dismantle one (lower power) LED lamp that simply used a series capacitor, which as IWP suggested above will lead to significant "gaps" in the light output. I suspect that the floodlights you have may use that method, and there's not really any simple way that they could be "improved". If they did use their own (step-down) dc-dc converter, then you might be able to feed them with "better" dc, but generating1,000 watts of clean (i.e. ripple-free) dc is not trivial.

Therefore, you may well need to "fix" the PICaxe / LDR circuit itself, which does require some knowledge of the worst amount of ripple / gaps in the light level. It would be nice to have a 'scope, but if necessary it might be possible to lash up a very simple light detector using (any) PICaxe with a tight SERTXD loop driving the Editor terminal, to a file and a spreadsheet (graph).

Cheers, Alan.
 

Garahbara

New Member
Alan,
Thanks for your comprehenisive and prompt reply. Much appreciated. I'm an electronics numpty, so it will take me a while to digest all that. No probs with programming the thing, as that is my background. There's some pretty wizzy code in there to control the signals, even if I do say so my self! :geek: o_O. To the extent all the signal Picaxe processors are all linked together and communcate with each other. Different pulse lengths on one of the pins sends the current signals' status (red, yellow or green) to the prior signal on a single wire "comms bus". Signal A is switched to "red" as the train crosses the LDR, however the prior signal (signal B) cannot turn yellow until the entire train has passed Signal A. SIgnal B tests the "pulse length" sent from signal A, and won't turn "yellow" until the entire train has passed Signal A, and so on and so on back down the line. If Signal B is at "yellow", then Signal C can turn "green". All sending different "pulse lengths" back down the line, setting prior signals appropriately. Anyway, nuff of that.

I know the resistor is 100K ohm, as I have "spares" in an envelope with 100K ohm written on the envelope. See? Told you I'm a numpty with these things!

I will do some measuring. I only have a basic multimeter to work with. I think I understand some of the values and measurements you are after that will help with the capacitor specs.

1. Measure the "ambient light" (under the LED floodlights) resitance of an unconnected LDR. Both ambient light and "shaded" (covered by train carriage).
2. Also measure the voltage across the "green" resistor on the vero-board. Again, LED floodlights, both ambient and covered by train carriage. (I think that is what you are asking me to do). ie. put my multimeter probes either side of the "green" resistor and test the DC voltage??? Should my multimeter register half what the voltage was under incandecent lights (due to LED strobing), then this will be OK as the "ambient light" logic I have in the code will cater for this. I store the "ambient light" LDR value on power up, and test for 50% of this to detect a train passing over the LDR.

Now for the "time constant". I think I know what you mean here. A bit convoluted, but please bear with me here.

On development of the system, I was getting "false positives" that the entire train had cleared the signal. The light on the LDR between the gaps between each carriage raised the LDR level to the point where it thought the train had fully passed. So I delay, and test again (twice more) to ensure it wasn't a "false positive" that the train had passed. So I need 3 "ambient light levels" in a row, (test 500 ms apart) to confirm the train has fully passed.

By the "time constant" I think you mean the capacitor will "smooth" the LDR voltage over a rolling period of, say, 1 second as you indicated. Have I worded this right? So I think 1.5 seconds for a "time constant" would be great. That's if I've understood your explantion of "time constant" correctly. Have I got this right? If what I think you are saying, then my "false positive" coding (due to the LDR reacting very quickly due to the gaps between the carriages) could be a thing of the past, even under incandecent light. So if under the LED floodlights, the capacitor "smooths" to half what the Incandececant lights give, (due to peaks and troughs of the strobing LEDs) Then that will be OK as the"ambient light" logic (described above) will cater for that. I think my cheap multimeter will show a "smoothed" voltage across the "green" resistor, and that I'd need a decent oscilloscope to show the full peaks and troughs of the voltage across that resistor with the LDR under the LED floodlights.

Now, that was a long post to read. Trust I've communicated it all OK. Can you confirm I'm on the right page? I'll get those values and get back to you. If I'm way off the mark, please let me know. Again, I'm an electronics numpty.

Assistance much appreciated, as I was at a complete loss as to what I could do about it all.

TOOT!
 

AllyCat

Senior Member
Hi,

In principle, a multimeter measurement to find a "ballpark figure" for just the lowest resistance of the LDR (i.e. at the highest light level that will be encountered) is all that we need, but additional measurements "under" the train and at "dusk" light levels, etc. may be helpful. I only suggested measuring directly on the PICaxe pins because I didn't know to what extent the LDRs might be "hidden" in the track, behind a filter or smaller hole, etc., (so that it receives less light). And of course, reading the voltage that the PICaxe actually "sees" removes a lot of uncertainty.

Mathematically, the Time Constant is simply the product of a resistance and a capacitance. In practical/electronic terms, a "source" resistance and a "load" capacitor can be formed into a low-pass filter. Then, if a "step voltage" is applied to the input (e.g. if the free end of the resistor is suddenly moved from 0 volts to 5 volts), the voltage on the capacitor will rise to about 63% of the "final" voltage (e.g. 3.15v) after one time constant (it's not a linear rise because the current falls as the capacitor voltage gets closer to the target voltage). As your program is detecting a 50% change, I'd try to keep the "ripple" below about 30%, which is why I suggested a target of 5ms, with a TC of 10ms. In this case the "filter" is simply formed by the parallel connection of the LDR and 100k (between the ADC pin and supply / ground) and an (additional) capacitor between the ADC input and ground. The "step" is in the resistance of the LDR, which changes the "aiming" voltage on the ADC input.

In practice, it's more complicated than a simple voltage "step"; the LDR itself has a Slower response (i.e. another Time Constant) and the variation of light from the floodlights (during a mains cycle) might be quite complex. Also, the values may alter with the intensity of the light, which is why I'm only considering ballpark figures with plenty of safety margins. The "source" resistance is the parallel connection of the 100k and the LDR, which will be close to 100k at low light levels (where the LDR resistance might be "negligibly high"), but at high light levels the (lower) LDR resistance will dominate. Thus the Time Constant won't actually be a "constant".
_____

You probably don't need even a "half-decent" 'scope to analyse the light variation adequately, something like the following should be good enough:
Code:
#picaxe 08m2     ; Or any other
#no_data
#terminal 19200
pause 2000
setfreq m16
do
for bptr = 28 to 127
   readadc  c.1,@bptr    ; c.1 is connected to the "mid point" of the 100k and LDR (across supply to ground)
next
for bptr = 28 to 127
  sertxd(#@bptr," ")     ; Or a different ASCII separator depending on the spreadsheet/software
next
pause 10000
loop
Copy the data received by the (PE5/6) Terminal Emulator into a file or clipboard and paste into Excel (or whatever you have) and select a (line) graph. That should give 100 points spaced around 0.5 - 1ms apart, which should give a few cycles of the mains frequency.

I could write a lot more, but let's keep it simple for now. Just ask if you need any more detail.

Cheers, Alan.
 

Garahbara

New Member
Alan (AllyCat),
I've got some measurements for you. Those things are very awkward to get at under the train layout!😠
However, using the LED floodlights, my multimeter gave me the following readings. I tested 3 of the signal boards. They varied a little depending on their poximity to the lights. (the lights are mounted about 3 metres up the side walls.

The LDRs are not "hidden" in the track. They have the full LDR surface exposed at the level of the track sleepers.

Stand alone LDR:
Ambient light (LED Floodlights) - 13K ohms
Covered by carraige - 200K ohms

Measuring the DC voltage across the "green" resistor.
Ambient light 3.0V DC to 3.9V DC
Covered by carriage bogie - .9V DC to 1.8 V DC
Covered by middle of carriage 1.4 V DC to 2.2 V DC

I would assume my multimeter is smoothing out the peaks and troughs of the real voltages here caused by the LED floodlight strobing. I do not know the sampling time or sample period of my multimeter, other than the multimeter was moderately priced (on the cheap side). It is a digital display multimeter, rather than analogue (needle and scale).

I also tested with "covered by bogie" because the wheel bogies are much closer to the ground underneath them, and surrounded by the wheels, of course, affecting the light getting to the LDR.

Is the measured voltage in direct proportion to the LDR pin value returned? (I think I set the LDR pin to return 0 - 256 steps when sampled in the code)

I do not know what the LDR resistance and voltages would be under the incandecant halogen lighting I used to have. The code won't tell me the actual values I test for either, as I use a "logical" value of the ambient light, stored in a variable at processor startup. I'm not testing for "hard coded" values returned on the LDR pin.

I'm also still trying to digest what you have said.

I think I understand the code and "terminal emulator" bit, and what it is trying to achieve/show. But I don't have a spare board, or processor setup to do that, and I'd have to build it. No probs with the Excel bit, and what it will show.

I'm still grappling with the "time constant" thing. I did check the specs of the LDRs and it appears they have a response time of ~25ms or less. So if the LED Floods lights are strobing at 50hz (240 V 50 hz mains supply), the LDR's resistance is going to fluctuate wildy. Pity there isn't an LDR with a greater response time, say 100 - 200ms. (high latency, or rise and decay time, I think the term is). Would that solve my problem? I've tried to find some with no luck.

If I understand correctly, the "time constant" would be affected by the capacitor specs, as the 100k resistor part of the equation is fixed. Given a 50hz strobe of the LED lights, and 25ms response time of the LDR, the "step voltage" on the LDR pin would rise and fall around up to 50 times per second. (every 20 - 25 ms).
Now, if it takes "1 time constant" to raise the capacitor voltge to 63% when the "step voltage" is raised, is at also implied the capacitor voltage will drop/drain/decay in "1 time constant" when the "step voltage" is reduced or removed? Given this, (if it is correct, and not a load of waffle!!) Would not a "time constant" of, say, 100ms be better? I"m not looking for it to be responsive down the the millisecond. Responsive to about 0.5 seconds would be fine.

Anyway, all this is a learning process, which I enjoy. I trust I'm picking all this up correctly.

Again, much appreciated for your assistance. I owe you a few pints of you're ever down my part of the world.

Alan.
 
Last edited:

inglewoodpete

Senior Member
EEEK Same thing, from Australia. What a rip off! 12.99 (UK pounds) is about $24 AUS. And they want $39.95 AUS? 🤪😲
Actually being able to see what is happening in many circuits makes even a basic oscilloscope extremely valuable. I don't think you'll regret buying one.

Sounds pretty cheap if you want a solution to your problem. You could waste many hours guessing and experimenting around a solution.
 

eclectic

Moderator
Or ....


and £8.50 Airmail.

Just my opinion.

e
 

AllyCat

Senior Member
Hi,

Yes, those measurements look quite useful and suggest that the modifications shouldn't be as "difficult" as I feared they might be. But first to answer a couple of your questions: Yes, the ADC input is basically linear (and "ratiometric" with the supply rail, to use a technical term). Using READADC (i.e. 256 steps) and a 5 volt supply rail will make each step about 20 mV, and if the LDR is 100k (equal to the resistor) then the input will be 2.5 volts giving an ADC value around 128. But neither the LDR (resistance) nor the potential divider (series connection of LDR and 100k) will give a "linear" response. The sensitivity will be greatest when the LDR ~= 100k and then falls when either resistance gets significantly greater than the other. However, the human sense of "brightness" is also logarithmic (and of course doesn't detect rapid changes) which is why we do need to make some measurements. Also, I think you are likely to be "disappointed" if relying on the "lag" of phosphors or LDR resistance; I believe these observations tend to be subjective over a large dynamic range and not just the tens of % that the PICaxe code is likely to need.

Yes, the time constant will also behave in the same way for a falling step, but don't get too tied up with the time constant, it's just a way to get a ballpark indication of the overall behaviour. A filter capacitor of 100nF, 10uF or 470uF are all "plausible" values to use on an ADC input pin, but it is looking as if 10uF may be "about right". It's important to note that the time constant changes with the light level, because the LDR resistance is changing. The calculation for connecting resistors in parallel is more complex than for series, so you may need to take my approximations on trust, but if the LDR is 200k (covered by a carriage), then the combined "source" resistance is ~67k and the time constant with 10 uF = 670 ms. If the LDR is 13k (ambient light) then the parallel resistance becomes about 12k and the time constant 120ms. But what about "covered by a carriage at simulated dusk"?

IMHO an oscilloscope is not essential to solve this problem, but the Australian price of the PCB Scope is not unreasonable. The 13 UKPounds price is before 20% VAT (sales tax) and Rev Ed add quite a lot for UK shipping (but they do offer a First Class service), which pushes the price to almost 20 UKP. It's strength is that it has two channels and a weakness that it needs to connect to a PC, but I won't say more as we discussed it in some detail last month . I think the "PICAXE Ocilloscope" linked by Eclectic is its forerunner with rather similar performance (but perhaps less refined).

Now a rather surprising addendum: After I posted on Sunday, i took another look at your ebay link for the floodlights and noticed that there appeared to be many sellers of the same device, mainly at similar prices. But one was only $9 until you noticed the "catch" that shipping was around $20 - because it was "from London to Australia". You may be aware that's where I live, so I pasted the description into ebay.UK and sure enough the same listing was there, with the equivalent UK price (5 UKP) and Free shipping! Now I don't have a football pitch to illuminate (or a miniature railway) but a security light is always useful and I have an investigative mind, so I ordered one on Sunday evening.

Some of the Chinese "UK Stock" and particularly "posted from UK".ebay items are actually packed in China, bulk-shipped (airmail) into the UK and then posted there. It's quite an efficient operation and the item may be received within a couple of weeks, but this seller was predicting delivery by next Thursday. I took that with a pinch of salt, but it was actually delivered this morning, less than two days after ordering! Unfortunately, I can't put it on my "test bench" for a few days, but as expected I was able to run out the dozen or so posidrive screws and look inside. I'd expected to at least identify the type of capacitor(s) used, but there are none , except possibly the blue disc at top right (which might be RF interference suppression or some form of surge limiter). There doesn't appear to be anything that could "filter" the ripple over a complete mains cycle. Here's the inside

:Floodlight=reduced.jpg

The little black blob (with 4 leads) at the top right is almost certainly a bridge rectifier, so at least it should be radiating light at 100 Hz and I hope the cylinder below it is a fuse or perhaps a surge limiter, but otherwise there's nothing except the three little 8-pin ICs at the left-hand edge (the adjacent SMD resistors are 6 ohms). The ICs are actually marked "CD1000A" for which there appears to be an 88 page "User Manual" on the web, but you have to "register" with a Credit Card number to download it, and the "Index" doesn't look like an IC data sheet anyway, so that's a step too far for me at the moment. The next thing to determine will be how many LEDs are connected in series; it might be possible to follow the tracks on the PCB or I may need to probe it with a multimeter (Ohms range). Note the "floating" earth cable, which might have been trapped under the front panel, but I don't think so. In due course I'll reassemble it and see if I can determine the "what, how and why" of the LED's light output.

So perhaps I'll have some more information in a few days time. ;)

Cheers, Alan..
 

Garahbara

New Member
Or ....


and £8.50 Airmail.

Just my opinion.

e
Mr Eclectic,

Thanks for that. I've had a look, and the data sheet doesn't tell me much. The download link for the software for this one also gives me a 404 not found. https://picaxe.com/downloads/kit120.zip I'd also need to source a power supply, and a Picaxe programming cable. All I have is my old homemade serial port Picaxe programming cable. (I have since acquired a USB/serial port cable, for use with the model railway DCC Controller.) FOr the other oscilliscope, I have a few spare USB - Micro USB cables that I could use, and the power source comes via USB.

However, I note it looks like it has the 2 channels as bayonet plugs, which are standard (from what I can find out) oscilloscope probes. Not sure how you would connect the probes to the other one yet.

Any comments?
 
Last edited:

AllyCat

Senior Member
Hi again,

The "bayonet" plugs are called BNC (which often used be called "BL**dy Nasty Connectors", rather unfairly). They're often used for "video", so try adding CCTV in your search terms. For example I found THIS which shows the 4 types, but you won't need 10 ! There are also adapters available between "BNC" and "RCA" plugs (aka "Phono").

The original DPScopes, used BNCs, but the PCB-Scope was really intended to plug into a "solderless breadboard" to make direct wire connections (and save some money). Certainly a BNC connector is more useful if you have (and want to use) a "10 Times probe" (or better, switchable 1x / 10x probes).

Cheers, Alan.

PS: You do NOT want the type with a "Balun" (transformer) which would short-circuit the dc signals. The "cheap" versions just link the corresponding "pins" and "screens" together. (edited again because Editing often "breaks" the previous Hot links).
 
Last edited:

Garahbara

New Member
Hi,

Yes, those measurements look quite useful and suggest that the modifications shouldn't be as "difficult" as I feared they might be.
.
.
.
.
.
. Note the "floating" earth cable, which might have been trapped under the front panel, but I don't think so. In due course I'll reassemble it and see if I can determine the "what, how and why" of the LED's light output.

So perhaps I'll have some more information in a few days time. ;)

Cheers, Alan..
Alan (AllyCat)

An interesting read. Be interested in what you find out about the insides of the LED lights. I'm the sort who just has to know "how things work" too.

Any solid ideas on what spec capacitor I need yet?

I will get one of those oscilloscopes, preferably https://www.wiltronics.com.au/product/8564/picpcb-scope-oscilloscope/ as it's local, and I won't have the hassles of shipping from the UK, and getting it through import as they'll hold it until the GST (our VAT) is paid etc etc etc. If it was on Ebay, Ebay sorts that all out for you, and adds the payable GST into the costs.

I'm not sure how you would attach the probes from ebay here to all those pins or where. The user manual here isn't much help. Then there's which is which and what version/download of the Windows software to run it!!! (dead download links).

Life wasn't meant to be easy.

TOOT!
 

Jim-TX

New Member
Hi,

...

I'd expected to at least identify the type of capacitor(s) used, but there are none , except possibly the blue disc at top right (which might be RF interference suppression or some form of surge limiter). There doesn't appear to be anything that could "filter" the ripple over a complete mains cycle.
The blue leaded part is most likely a Transorb or Varistor - for AC line protection, as you have indicated.

The little black blob (with 4 leads) at the top right is almost certainly a bridge rectifier, so at least it should be radiating light at 100 Hz and I hope the cylinder below it is a fuse or perhaps a surge limiter, but otherwise there's nothing except the three little 8-pin ICs at the left-hand edge (the adjacent SMD resistors are 6 ohms). The ICs are actually marked "CD1000A" for which there appears to be an 88 page "User Manual" on the web, but you have to "register" with a Credit Card number to download it, and the "Index" doesn't look like an IC data sheet anyway, so that's a step too far for me at the moment. The next thing to determine will be how many LEDs are connected in series; it might be possible to follow the tracks on the PCB or I may need to probe it with a multimeter (Ohms range). Note the "floating" earth cable, which might have been trapped under the front panel, but I don't think so. In due course I'll reassemble it and see if I can determine the "what, how and why" of the LED's light output.

So perhaps I'll have some more information in a few days time. ;)

Cheers, Alan..
I'm not sure what the three IC-looking parts are, but my guess is that the LEDs are connected in series. White LEDs have a voltage drop of around 3.5 volts. This number varies depending on the manufacturer, but it is a good starting point for estimating numbers.

50 * 3.5 = 175 volts. When you full-wave rectify the 120VAC, you get around 170VDC.
You will notice in the part number on the PC Board the first characters are 50W - I am guessing that means that the LED light consumes about 50 Watts. If that is true, then each LED is being driven at 1-Watt. (By their size, they look to be 1/2-Watt LEDs - so they are probably being overdriven and are going to get very warm when lit.)

With that in mind, I am thinking that the whole string of LEDs is running at about 285mA. The large tubular-looking device on the AC input may be a resistor (MELF), or it may be the little square SMT device next to the 4-pin regulator. In either case, I'm thinking that one of these will measure about 12 to 20 ohms - give or take. (It's most likely the MELF resistor)

Light output from this thing is probably going to be around 3750 - 4000 Lumens. Not bad, but don't look at it when you plug it in.

The PCB is probably an Aluminum-core PCB, which means that the routing is on the top-side, as the aluminum-core is considered the bottom-side. Any 'trace following' will be done by looking at the top side - easy peasy.

Again, I do not know what the three devices on the left are for. I might venture a guess that they are some sort of constant-current regulators, but that negates all of the above dialog.

This whole LED light is Chinese-made, and they are going to make it as cheap as possible.

All of the above is back-of-the-envelope numbers and a first-time look at something. It's probably all wrong, but looking at something remotely is always difficult.

Keep us posted on what you learn.
 

Garahbara

New Member
OK guys, I think I've done my homework on the PICpcb scope THIS ONE

I'll need some connectors BNC Female Connectors and connect two of them. One to CH1/GND and another to CH2/GND ensuring correct polarity. They should just screw onto the pins??

NOTE: I'm yet to work out what TRG/GND and 1, 2, 3 & 4 pins are for. (see attached pic)

And get a set of probes to connect to the BNC female connectors. BNC PROBES HERE

Now for the PC/Windows software. From http://dpscope.freevar.com/downloads_ii.html ??? It seems that "one size fits all" these DPscopes we've discussed. with this software??

I have spare USB/Micro USB cables to connect to the laptop.

Do I get top marks for my homework? :geek: 👍

Thanks for any advice. Much appreciated.

TOOT!
 

Attachments

lbenson

Senior Member
With this DPScope, you don't need BNC connectors. You can use female to female Dupont cables if you have a breadboard to plug into or a header pin on what you are trying to test, or you can wire up mini grabbers. The BNC connectors are overkill for most of what you want to do with this scope.
 

Garahbara

New Member
With this DPScope, you don't need BNC connectors. You can use female to female Dupont cables if you have a breadboard to plug into or a header pin on what you are trying to test, or you can wire up mini grabbers. The BNC connectors are overkill for most of what you want to do with this scope.
hmmmm.... OK. Do you mean some of these (male to female) and plug them straight onto the pins? Use the male end as the probe? Join them together to make a longer probe? And cut the ends off some and put on some of these?

I doubt I'd ever need the 1X 10X modes of the BNC probes....................... but ya never know!🤓
 

lbenson

Senior Member
hmmmm.... OK. Do you mean some of these (male to female) and plug them straight onto the pins? Use the male end as the probe? Join them together to make a longer probe? And cut the ends off some and put on some of these?
Right (except I prefer female to female and use a long header pin if need be) and OK for the alligator clips but I prefer these mini grabbers (both is best):
 

AllyCat

Senior Member
Hi,

.... BNC Female Connectors and connect two of them. One to CH1/GND and another to CH2/GND ensuring correct polarity. They should just screw onto the pins??

I'm yet to work out what TRG/GND and 1, 2, 3 & 4 pins are for. (see attached pic)
The pins on the header of the PCBScope are 0.1" (2.5mm) centres but the terminals on the BNC socket are 0.2" apart, so you'd probably need short wires between them. The PCBScope is so tiny and lightweight that there's the risk that the probe cables might "overwhelm" it. If I were using probes, I think I'd mount the Scope on / in a small baseboard / box (metal or plastic) with "chassis" connectors such as here, or there's a similar type from Wiltronix for $3 each, but they do need to be soldered of course.

Certainly using "full-size" probes is a slight overkill for the PCBScope, but they do have advantages; the lowest sensitivity is 2v/div so the x1 range is limited to 24 volts. The x10 range would get you to 240 volts, although that's still not enough for "mains" (line) testing which is about 350 volts peak (700v pk-pk). Unlike most 'Scopes, the PCBScope does NOT have an ac-coupling mode, so +/-24 v is an absolute limit. Another advantage of the x10 mode is that the input impedance rises form 1 Mohm to 10 Mohms. For most (low voltage/logic) purposes 1Mohm is perfectly adeaquate, but you've measured your LDR as 200k, so connecting 1 Mohm across it will slightly affect the (scale of the) measurements. You can of course use your own 9 Mohm series resistor (ideally with a small parallel capacitor) which is basically what the probe contains.

The trigger input almost gives a third channel and on a "big" Scope might also have a BNC input, so you could swap 3 probes around (two displayed and one giving a time reference). But here, like the 4 logic analyser (binary digital) inputs (1, 2 , 3, and 4) you'd probably just use 6 "flying wires" (5 inputs + Earth) with miniature crocodile clip or hook connectors as discussed above.

Cheers, Alan.
 

lbenson

Senior Member
Good start. Personally I'd prefer the mini-grabbers to the full-sized ones: https://www.ebay.com.au/itm/1x-Multimeter-SMD-IC-SOIC-Mini-Test-Clip-Hook-Grabber-Jumper-Quality-Pr-E9J5/193017948817

A set of the alligator clip wires is always handy.

And break-apart long pin headers: https://www.ebay.com/itm/10PCS-Single-Row-1-40-40Pin-2-54mm-1X40-19mm-Height-Long-Breakable-Pin-Header-S9/402343986858

With these you can turn a F-F dupont wire into an F-M or an M-M. After you break one off you may need to slide the little black plastic piece to the center.

5" Stainless Steel Straight Hemostat Forceps is always useful for plugging header pins/wires into a breadboard.
 

Garahbara

New Member
Thanks for the advice, Ibensen. Appreciated.

I'll wait for it all to turn up, and see how it goes putting it all together, and getting it to work with the software. I'm going to need it to get this LED Floodllight problem properly solved.

I also ordered bits and pieces I need for my next project. It's going to use the PICAXE-40X2 because I'll need that many pins. 12 ADC inputs, and I intend to use the LDRs again, so I have to get this problem solved first.

It's going to be a level crossing with lights, boom gates and bell sound module. Something like **this** but just one road, with three bi-directional tracks. :cool:

A quick question, if I may.

Can I run a 5 V Servo direct from the Picaxe pins to raise and lower the gates? Servo such as **this** ? Or should I run the servo via a 5V relay such as **this**?

Glad to take any advice I can get. 🤓
 

lbenson

Senior Member
That servo and heftier ones can be run directly from the picaxe pins, since the picaxe is really only supplying a signal. If the servo (some other one) is really hefty, you may need to run it off of a separate power supply so the current draw doesn't pull down the voltage and reset the picaxe, but the servo could still be run directly off of the picaxe.
 

lbenson

Senior Member
It's going to be a level crossing with lights, boom gates and bell sound module. Something like **this** but just one road, with three bi-directional tracks.
Nifty. If your signals are just on/off except for the servo (identical signal 2 times for the crossing gates), you could (probably) do with a 14M and an MCP23017 I2C I/O expander or two. But the 40X2 is a great chip. How many I/Os do you need?
 

Garahbara

New Member
That servo and heftier ones can be run directly from the picaxe pins, since the picaxe is really only supplying a signal. If the servo (some other one) is really hefty, you may need to run it off of a separate power supply so the current draw doesn't pull down the voltage and reset the picaxe, but the servo could still be run directly off of the picaxe.
Thanks for that. I'll be running a few of thos servos. To drive multiple boom gates up and down. How many of those could I run off one set of pins? But a relay wouldn't hurt, would it? Also I will have to run the sound module off a relay. It is 9V - 14V DC. **here**
 

Garahbara

New Member
Nifty. If your signals are just on/off except for the servo (identical signal 2 times for the crossing gates), you could (probably) do with a 14M and an MCP23017 I2C I/O expander or two. But the 40X2 is a great chip. How many I/Os do you need?
I need 4 separate sensors (LDRs) per track, times 3 tracks. 12 sensors in all. (I think that measn 12 ADC inputs) One on approach to detect the train (from either direction), then one to detect the train has fully passed the crossing (from either direction) and for 3 tracks. The logic will be complex, if it's to mange multiple trains in multiple directions that may be passing through at the same time.

It's fine, if just one track. Turn it all on when the train triggers the "approach" and turn it all off when the train has "gone past". However, should a train approach on track 2, from the opposite direction, and triggers the approach BEFORE the train on track 1 has "gone past", I can't turn it all off, until the train on track 2 has "gone past" as well. Introduce a third track, and this concept can get quite complex.

Then there's two pins for the flashing lights (left & right alternate flashing), and a pin to drive the sound module.
 
Top