LDR vs Digipot for NTC "simulation" - Page 1
Forum section: electronics / beginners

author: cyrix2000
author_rank: Contributor
timestamp: October 28, 2022, 05:59:41 pm
content: Hi,I'm trying to replace the NTC outside temperature sensor of my central heating system with a "simulated" NTC, which I can control from a Raspberry Pi (that's the only way to interfere with the modulation of my boiler, as it is quite "dumb").The question is now, what is the best way to do that? As far as I can see the way the boiler controller reads in the NTC is by impressing a certain current and read back the voltage over the NTC and look up the associated temperature.I'm thinking about either using a DigiPot controlled via I2C to simulate the resistance of the NTC or alternatively using a LDR with PWM controlled LED. I'm wondering what is more accurate? Or do you have a totally different (but better) idea to solve this task?

author: ledtester
author_rank: Super Contributor
timestamp: October 28, 2022, 06:10:29 pm
content: I don't think you need such fine-grained control.The boiler uses the NTC to read the outside temperature, but usually this temp is just compared with the thermostat setting to determine if the boiler should run or not. So you only need to switch between two resistances -- one for "temp outside is hot, do not run the boiler" and another for "temp outside is cold, turn boiler on". You could probably just use a relay.

author: cyrix2000
author_rank: Contributor
timestamp: October 28, 2022, 06:18:10 pm
content: Hi,my boiler is using a modulation curve based on the outside temperature (e.g. the water will be heated to 30C if the outside temp is 15C but 70C if the outside temp is -10C, see attached diagram). This helps saving energy, as the heating system isn't "overshooting" so much when trying to reach a certain inside temperature. So it is necessary to hit at least a +/- 2C accuracy for the simulated sensor I would say.

author: ledtester
author_rank: Super Contributor
timestamp: October 28, 2022, 06:38:45 pm
content: Ok, I see the problem now.Just a month ago there was huge thread on the topic of creating a digital adjustable resistor:https://www.eevblog.com/forum/beginners/digital-adjustable-resistor/I think the best approach is to have a bunch of resistors in series controlled by relays -- like what you see in this post:https://www.eevblog.com/forum/beginners/digital-adjustable-resistor/msg4439026/#msg4439026but with relays switching in/out the resistors instead of MOSFETs.Also consider using latching relays so your boiler doesn't go haywire if the RPi loses power or crashes.

author: Kleinstein
author_rank: Super Contributor
timestamp: October 28, 2022, 07:07:07 pm
content: An LDR with LED would have the advantag of isolation. However the LDRs are also somewhat temperature dependent. This is especilly the case for low light of the dark case, probabyl less when stronger illuminated.A digital pot only works OK when inside the supply of the pot chip. The choices for more than 5V supply are somewhat limited. Usually the available resistor values are also more on the high side. So it depends on the resistance range if this is practical.One may also get away with a DAC and adding some voltage to a resistor.

author: Gyro
author_rank: Super Contributor
timestamp: October 28, 2022, 08:18:02 pm
content: A FET output optocoupler? Something like the old On-Semi The H11F3M. These can operate as effectively a variable resistance output. Adding a second one with the LEDs in series would allow reasonably accurate resistance feedback.Maybe the same idea would work with couple of LED - LDR pairs for temperature compensation.

author: Benta
author_rank: Super Contributor
timestamp: October 28, 2022, 08:50:27 pm
content: Quote from: Gyro on October 28, 2022, 08:18:02 pmThat's technically a really nice idea, I like it. But I'm not sure that they are still available.

author: cyrix2000
author_rank: Contributor
timestamp: October 28, 2022, 08:55:57 pm
content: Thanks for the feedbackWhat speaks against Digipots? They seem to be quite inaccurate?

author: Gyro
author_rank: Super Contributor
timestamp: October 28, 2022, 09:11:49 pm
content: Quote from: Benta on October 28, 2022, 08:50:27 pmApparently they are, RS and Farnell still have them in stock. Depending on NTC resistance, there's a choice of H11F1M, H11F2M or H11F3M.

author: Gyro
author_rank: Super Contributor
timestamp: October 28, 2022, 09:29:38 pm
content: Quote from: cyrix2000 on October 28, 2022, 08:55:57 pmA Digipot isn't isolated, so you need to know the voltage applied to the NTC and whether it is ground referenced - it needs to be compatible with the supply and ground of your Pi / Digipot.

author: Benta
author_rank: Super Contributor
timestamp: October 28, 2022, 09:30:39 pm
content: Quote from: cyrix2000 on October 28, 2022, 08:55:57 pmThe problem is, that they're not floating (as a simple NTC is). They need a power supply, and the signal voltage levels cannot go outside the supply voltage range.Do you really mean "inaccurate?"

author: cyrix2000
author_rank: Contributor
timestamp: October 28, 2022, 09:39:37 pm
content: I mean if I'm looking into the datasheets for Digipots they have quite high tolerances (+/-20%) for the resistance. The NTC I need to replace is a 12k (@25C) so I'd need a resistive range of ~4k to 100k Ohms.But the H11F3M looks quite promising. I'll have a closer look at this one.

author: Gyro
author_rank: Super Contributor
timestamp: October 28, 2022, 09:45:16 pm
content: If the minimum resistance is 4k then the H11F3M is fine. The difference between variants is the minimum resistance they can achieve (200 - 470R). The H11F3M is the highest at 470R and so the cheapest - still 10 times better than you need.

author: cyrix2000
author_rank: Contributor
timestamp: October 28, 2022, 09:53:30 pm
content: Yes, I meant 4k to 100k, that is well within the specs of the H11F3M.Looking at the attached circuit diagram, I assume I would connect it via Vin to the NTC input of my boiler controller and use the If inputs connected to a PWM out of the RPi (via a resistor to protect the LED)? Or do I need an analogue signal/filter the PWM out? (sorry I'm quite a Newbie in circuit design...)

author: Gyro
author_rank: Super Contributor
timestamp: October 28, 2022, 10:04:10 pm
content: You just need to connect the output pins directly to the NTC input (either polarity, it's bidirectional). I think you would need to analogue filter your PWM output. Looking at the resistance vs input current curve in the datasheet, I think the LED would need less than a couple of mA to reach down to 4k.

author: Sauli
author_rank: Contributor
timestamp: October 29, 2022, 12:17:37 pm
content: I seriously doubt that you can make the H11F3M work with the accuracy you desire. It is highly unlinear and also sensitive to temperature variation. At least you should accurately control the led current, not just the voltage of the led + current limit resistor. Also you should calibrate the resulting resistance at several led currents and hope that aging does not change the calibration. Personally I would seriously consider using a digital pot instead, powered from the same source as the NTC is.

author: cyrix2000
author_rank: Contributor
timestamp: October 29, 2022, 12:57:55 pm
content: I guess I'll give both options a go and see which one works more reliably... components aren't too expensive, so worth playing around a bit :-)Regarding DigiPots: any suggestions for the best type to use? Better 2x 100k in series or one 200k?

author: Gyro
author_rank: Super Contributor
timestamp: October 29, 2022, 01:50:39 pm
content: Quote from: Sauli on October 29, 2022, 12:17:37 pmFor all we know, the boiler might be using a capacitive dropper, non isolated power supply. Just a note of caution.I agree on the linearity, that's why I suggested using twoof them[Ed: H11F3Ms], with LEDs in series and one providing resistance feedback. Yes the PWM would need to be matched to resistance levels... which would also need to be matched to the existing NTC thermistor resistance, mapped at different temperatures.

author: sokoloff
author_rank: Super Contributor
timestamp: October 29, 2022, 02:24:10 pm
content: Depending on what you’re trying to accomplish, I’d also consider a simple relay to bias the existing NTC’s resistance (an added series resistor that you short out with a relay to lower the flow temp when the relay is on or a parallel resistance to be switched in to lower the flow temp.)That, coupled with picking what is currently the “wrong” reset curve might get you close (and if the tweak is small, would also still work as stock when the RPi is not functioning).I’m just about to install a non-stock (but probably the same performance) NTC for my own boiler this weekend. I characterized the boiler this week (resistance vs what boiler thinks the outdoor temp is) and found 6-for-$7 NTCs (10K/B3950) instead of the $150 Bosch part. I think they’ll work, but I’ll know in a few hours.

author: sokoloff
author_rank: Super Contributor
timestamp: October 29, 2022, 02:27:17 pm
content: You could combine those ideas as well: get a different value NTC that’s biased one way and use resistors and relay to pull the curve as you need to.

author: cyrix2000
author_rank: Contributor
timestamp: October 29, 2022, 02:30:02 pm
content: Maybe a bit more about the "why" I'm trying to do this: My Boiler is sitting in the south facing side of the house and the temperature sensor should be mounted in the north. I want to avoid adding a new wire through the whole building, so instead of using the "real" NTC I want to connect the simulated one controlled by temperature data from my own weather station. So in general I don't really need to change the temperature curves of the boiler, I just need to find a way to feed in the outside temperature. If the boiler was supporting Opentherm (or ebus, etc.) that would be easy, but as it is a quite "dumb" older system, I need to go this rather convoluted way...

author: sokoloff
author_rank: Super Contributor
timestamp: October 29, 2022, 02:33:26 pm
content: For that, I bet that mounting it in a white enclosure mostly in the shade on the south side (or just around a nearby east or west corner) would work perfectly fine for that application and be <2% of the work.Just tweak the water curves by a couple degrees if you have to (pick a different emitter tech's curve or use the custom curve and offset the left and right sidedown(edit) up a degree or two).Hell, even just mounting it on the south side (so long as it's in the shade) and tweaking nothing I bet would work OK. If (and only if) that doesn't work, then you could add tweaking resistor (in your case, you'd want to add a small series resistor (maybe 2.2K or so) and see if that worked to bump the flow a couple degrees). Only if all that fails would I go to anything active. (KISS. Make sure you'll have heat if the WiFi is out or the SD card gets corrupted, etc.)

author: Terry Bites
author_rank: Super Contributor
timestamp: October 29, 2022, 09:33:53 pm
content: Isnt that just a LUT and a DAC. You can measure and store or calculate the LUT.

author: cyrix2000
author_rank: Contributor
timestamp: October 29, 2022, 10:54:02 pm
content: I don't think it works with just a voltage out as the boiler PCB is forcing a fixed current output (at least that is how it was explained to me) and then measuring the voltage over the NTC. The DAC wouldn't be able to sink this current I guess?