I must have a case of bad Google-fu today, since I was completely convinced that this should be a common subject. I even seem to recall having read something about this in the past. No luck today, though..

Here goes:

The country house got some new electric radiators, and they're half-fancy. Not the oil-filled variants from 20-10 years back but modern filament-to-air with a fast(ish) switching on and off (on the order of many seconds seconds to minutes). A faint(ish) red LED indicates the state of the regulation. Two 1 cm high green 7-segments displays the set temperature. Red LED is 0.5 cm to the left of left 7-segment.

I'd like to detect/monitor/log the LED state.

What would be your suggestions for a detector that can be temporarily mounted on the outside of the radiator?

I'll work out the mechanics but it'll probably be something that just hangs over the top of the radiator holding the detector in front of the LED. Intention is NOT to have it permanently attached and logging, but rather temporary for a few days during different temperature/weather conditions.

If your suggested detector has some special requirements on how it is connected to an AVR, or some special circuitry is required then please tell/hint about that too.

I'm looking for the least ambitious detector/solution. Digital would be best, but analogue not rejected if it has to come to that. (The idea of placing a camera over the whole display and hiring Cliff to code for the image analysis/processing has crossed my mind, but been rejected. ;-)

The complete gadget will probably be battery-powered. I might pull out a dusty USBstick (i.e. AT90USB1287) to do the job. Or I might go for radio/wireless and use e.g. a Raven. I reckon I will need to sample the LED on the order of one timer per second to get a reasonable accuracy. The resolution of the saved data (i.e. how often do I actually want to save) might be on the order of 5 to 15 minutes.

I'll spend some time with the bio-optics and carbon-based neck-mounted computer tonight to get a better grip on the approximate frequency of the regulation. Yeah, I know it won't be a fixed frequency, but I'd like to get a grip on how fast it switches on and off under reasonably normal circumstances. Just to get a better grip on what sampling and logging frequency makes sense.

I'll work all that out eventually, but I'd like suggestions on the detector.

Photo below shows display. Window is just below 40 mm wide. (As an internationally standardized item of size-comparison I've included a small PCB with a 12-pin 100 mil connector.) Red LED appears brighter in photo than in real life.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here.

No guarantees, but if we don't report problems they won't get much of a chance to be fixed! Details/discussions at link given just above.

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

You may be able to use a red LED as a light sensor! Grab one out of the junk box and connect a voltmeter to it and hold it in front of the LED to monitor and see what voltage you get, or better use an o-scope.

Jim

Mission: Improving the readiness of hams world wide : flinthillsradioinc.com

@Jay: Didn't plan to pop the casing but mount something on the outside in front of the LED.

Yes, I was considering some kind of photodiode or similar, but I'm completely ignorant re those. Should I look for some specific type, or filter on some specific parameter?

From a web-search I find that red light has a wavelength of 622 to 780 nm. The local gadget shop has what they call a "photo transistor" specified at 940 nm, which I understand as being infra-red. LEDs are rather monochrome, aren't they? So a visible RED wont emit in the IR spectrum? And what's this "photo transistor" that only has two legs (i.e. like a diode)?

I told'ya. I'm completely ignorant re photodiodes and such!

Sideshow: Yes 20 is a degree or so on the low side. 22 or 23 is just fine. You just put on clothes.

Anything above 23 is luxury, which is accomplished by lighting a fire which can push temperature to above 25 easily. Sleeping is comfortable at 19 or 20.

The parents of my ex kept above 25 degrees - awake or sleeping. Visiting was a guarantee for sleepless nights..

I don't like being cold, but heat that can not be escaped is far worse - pure torture. Besides, my theory is that a lower temperature is one recipe for a lower body weight, i.e. less belly fat. Draft is different thing, and that's a PITA.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here.

No guarantees, but if we don't report problems they won't get much of a chance to be fixed! Details/discussions at link given just above.

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Instead of using an LED as a photodiode, you can use it as a capacitor with light-dependent leakage properties. Basically, reverse-bias the diode to charge the junction capacitance, then let it float and time how long it takes to fall below a preset threshold. You can do this with the inherent VIL threshold of an AVR's I/O pin, or with an AC or ADC pin. The more light falling on the detector, the greater the leakage and the faster the junction charge falls away.

There are a few Arduino-based projects out there using this principle. You might have better luck that using it as a photodiode, since the LED you're trying to measure is so dim you might have trouble distinguishing between the photovoltage of a dark vs lit target.

I'm looking for the least ambitious detector/solution. Digital would be best, but analogue not rejected if it has to come to that. (The idea of placing a camera over the whole display and hiring Cliff to code for the image analysis/processing has crossed my mind, but been rejected. ;-)

My first thought is to use a "poor man's" "camera" -- a color detection chip.

We've used the Taos (now part of ams) http://ams.com/eng/Products/Ligh... in a couple apps. One of them was to eliminate human intervention in a board-test routine. (apparently it was too difficult for the operator to press a PC keyboard key to answer the question "Is the green LED on?") That used fiber light pipes, but in your case I think just a tube or similar to limit field-of-view somewhat would work.

A current app being developed uses R-G-B-C (clear) readings on a fluid illuminated with "white" LEDs to get a color reading. Pretty cool, and works well.

Lessee--they used to have single-color models...I don't see them now.

I use the "frequency" output, and count with an AVR Tn pin, timer-as-counter. There are other interfaces.

The detector LED is not specific for the stated wavelength, that's just the max sensitivity wavelength. This is a typical response curve:

So, the IR detector can detect any visible light, in particular red at 70-80% of maximum efficiency. For this reason they are often protected by dark filters that let pass only IR light, so be sure to get unfiltered photodiodes if you decide to go that route.

Sorry, no Butterfly locatable ATM. It's somewhere but it's been close to ten years since..

I am encouraged by the graph ElTangas posted and might pick up that phototransistor from the local gadget shop. It's data sheet has a similar graph. Sheet attached.

joeymorin wrote:

Basically, reverse-bias the diode to charge the junction capacitance, then let it float and time how long it takes to fall below a preset threshold. You can do this with the inherent VIL threshold of an AVR's I/O pin, or with an AC or ADC pin.

It happens occasionally that I talk here about programming with beginners - either on the subject of coding in general or re a specific language or technique - and get responses that shows that they perceive me as being an alien with a message that can not be interpreted. I always try to be humble and remind myself that I often feel the same when it comes to analogue electronics. I will need to read the above quote a few dozen times and do my searches, and then see what I can make of it.

Attachment(s):

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here.

No guarantees, but if we don't report problems they won't get much of a chance to be fixed! Details/discussions at link given just above.

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

You read the junction of the two resistors, and the light changes the resistance of the photocell / photo diode / photo transistor.

Change the resistance of one of the two resistors and the output voltage changes.

So, this is typically an analog output device, which you would feed to an ADC input.

The value of the fixed resistor in series takes some testing and experimenting.

The photo sensor might have a couple of Meg ohm resistance in the dark, and a few K ohms when lit up, for example.

You might just try the system with a 100 K ohm resistor and see what the output voltages are, in the dark, and in the light, (led on).

You can increase or decrease the fixed resistor to move the output voltages up and down the scale.

Typical opto-isolators, similar to the above, are designed to output a high or a low output voltage, and can feed a digital input.

Your setup would best be read by the ADC, (without a lot of specific tweaking, otherwise).

You might, if you got lucky, be able to feed the signal into the Analog Comparator.

That, however, would take a lot of careful testing to account for the presence or absence of background lighting, and the value of the fixed resistor, and the delta voltage (with or without the LED being on), making the output voltage swing back and forth across the A.C.'s switching threshold.

Finally, the tricky part of this setup:

The background lighting in the room!

You will likely have to use black electrical tape to mask off the heater's display and shield your sensor from any room light.

Even the ambient light shining into the heater's display, and reflecting internally, can mess up your data readings...

The issue is that you will have a rather small delta voltage based upon the LED being on or off.

The sensor, however, will also detect the presence of sunlight through a window, and the other electrical lamps in the room.

Put an O'scope probe on the output signal and you can see the "flicker" with 2 x Mains frequency from the lights, which the human eye (generally) can't see.

You need to minimize that Mains signal and maximize the red LED's signal.

The entire output voltage will shift up and down as the background lighting in the room changes.

Hence the goal of masking off the background ambient light.

So, two components, analog wise, can't get much simpler than that.

But in fact the signal isn't clean, so some testing and tweaking will be needed.

Suddenly putting a thermistor on the heater itself, or a current monitor on the Mains power cord, or using Lee's suggested smart sensor, suddenly have merit.

Do you have a cheap O'scope, ($15 USD, Bangggod Electronics...), so "see" the output voltage of your sensor setup?

JC

Edit:

Note that the Photo Diode is "reverse biased" compared to hooking up a normal LED when one is using the LED in the normal manner, to make light.

Should I interpret the quote above as in some way being in the "time domain"?

Yes.

Here's an excerpt from the code at the page I linked to in #6:

This example circuit uses a single LED as a photodiode in *photoconductive* mode to sample the ambient light level and then glow at an appropriate brightness. It is tragically flawed by a slow refresh rate in the dark, but nonetheless it shows how to sense light.
//
// This example shows one way of using an LED as a light sensor.
// You will need to wire up your components as such:
//
// + digital2
// |
// <
// > 100 ohm resistor
// <
// |
// | LED Cathode (LED_N_SIDE, normally (-))
// |
// -----
// / \ LED, maybe a 5mm, clear plastic is good
// -----
// |
// | LED Anode (LED_P_SIDE, normally (+))
// |
// + digital3
//
// What we are going to do is apply a positive voltage at digital2 and
// connect digital3 to GND. This is backwards for the LED, current will
// not flow and light will not come out, but we will charge up the
// capacitance of the LED junction and the Arduino pin.
//
// Then we are going to disconnect the output HIGH drivers from
// digital2 (making it now a high-impedance INPUT) and count how
// long it takes the stored charge at digital2 to bleed off through
// the LED to GND at digital3. The brighter the light, the faster it will
// bleed away to digital3 (GND), thereby causing the INPUT reading
// at digital2 to change from HIGH to LOW.
//
// Then just to be perverse we will display the brightness back on the
// same LED by turning it on for a millisecond. This happens more often
// with brighter lighting, so the LED is dim in a dim room and brighter
// in a bright room. Quite nice.
//
// (Though a nice idea, this implementation is flawed because the refresh
// rate gets too long in the dark and it flickers disturbingly.)

So, were you to use this approach, you would start by determining how long that interval is when the target LED is lit, and then again when the target LED is not lit. The difference is likely to be significant. It's entirely possible that it will take several seconds when the target LED is not lit. You don't need to wait that long between readings, though. I would expect it to take only a few dozen ms when the target LED is lit. Say it's 50 ms. Then after 200 ms if the reading hasn't fallen from high to low, you can assume that the target LED is not lit, and then initiate another cycle. In this way, you can get at least 5 readings per second.

Clear as mud? ;-)

A CdS sensor might also work nicely. You'll need to find one that's sensitive enough to detect your dim LED, but most CdS cells are sensitive between 400 and 700 nm (red LEDs are typically 620-645 or so). However the Cd content makes these hard to get in Europe, IIUC.

I suggested the time-domain LED-as-light-sensor approach because you can build this with parts on hand, and code is already available. It is really just as simple as wiring a junk-bin LED directly to two I/O pins on an AVR. No other components. Although I expect you'll need a red or IR LED. I don't know if the 'photoconductive' properties of green or higher-wavelength LEDs will make them sensitive to red light. Worth a try.

"Experience is what enables you to recognise a mistake the second time you make it."

Even the ambient light shining into the heater's display, and reflecting internally, can mess up your data readings...

While (IME with the TAOS devices) indeed some care needs to be taken in the physical design to "point" at the desired light source (if direct sunlight from a window above the radiator, unshielded, would obviously negate the readings), a bit of experimentation with the actual [probably red channel in this case, or its relative value from other channels] readings when on/off and with/without limiting tubes lead to thought processes like "when I point the sensor at the target from distances between a couple cm to a few more cm, I get red readings of 100 to 300 when the light is on. When it is off, the readings are much lower. Using a flashlight for ambient light pollution I indeed get high red readings even when the LED is off, but get higher C readings as well. Even with light pollution, a rise of 50+ in red is seen when on versus off".

So a hypotheses based on heuristic approach, then tested and verified. I'm guessing that a small piece of toilet paper tube will shield to the target area and also provide an appropriate spacing.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

One of the factors that make it great is that it is basically a mini-color spectrum analyzer.

You can get a reading on the Red signal intensity and on the overall signal intensity and then make some decisions on the presence or absence of the Red LED's signal.

As one is provided with both the Red and the overall lighting signal level that decision process is easier, and one can use a mix of relative and absolute signal strength information.

With a broad spectrum light sensor you don't get the two data points, so no relative signal strength info is available, (i.e. no "How much of this light energy is Red compared to the overall light energy?"), and one doesn't get any data on Red light alone, one just gets broadband signal intensity.

With the broad spectrum light sensor, also, the small delta voltage difference from the LED turning on and off is going to ride up and down the larger voltage scale dependent upon the background lighting. Turning on and off a light in the room will, I think, significantly alter the "operating point" of the output, and of course add Mains optical (light "flicker"), noise.

So, at the end of the day, I think this is a great academic discussion and project, that isn't as simple as it at first appears, but if I really just wanted the data I'd tape a DS18B20 digital temp sensor or a thermistor (with a 10K resistor) on the heater and move on with data logging and analysis part of the project. As the heater is inside, the ambient temperature range is pretty narrow, and when the heater is on it will get hot to the touch. That is a huge signal difference to monitor for a state change, and all of the signal to noise distractors from the optical approach vanish.

Likewise, the power cord is accessible. Perhaps 10 A on and < 1/4 A current flow when off? So a clamp on current sense coil again gives one easy to process data, although one might wish to put some analog circuitry between the coil and the micro.

Although I suspect detecting a faint red LED, through a Plexiglas shield, with a varying digital display adjacent to it, and a widely varying background ambient light level, and Mains optical noise flicker, is still easier than detecting GPS signals, I'd go for the easier approach.

Johan clearly has the software ability to write a great signal detection and analysis program.

I posted this circuit in another thread but couldnt find it. This just needs an LED and an op amp and a couple of passives. Just about any op amp will work, I think. I used 5 volts on a single voltage op amp. If you use a clear LED it will detect all wavelengths shorter than the emitted wavelength. If you use an LED that has a colored lens, the lens will act as a filter and then the photometer will only respond to a narrow band of wavelengths around the emitted wavelength. You could hook the output to an ADC pin if you wanted to measure brightness.