resistance measurement of multiple Heating elements with multiplexing

Hello, I have done a Lot of research and I have Lost faith in a current project maybe You could give me some hints to what I AM doing wrong. Please.

The proyect consist in the following, i have an array of 10 Heating elements which i need to heat to some calculated and around 3 grades centígrades of precision temperature with a PID algorithm. ( I can't use thermistor, thermocoupler or anyother temperature sensor due to the small diameter of My Heating elements.

I plan on giving it power with pwm and a N channel logic MOSFET, so far so good with that part.

I plan on measuring the resistance of the Heating elements as i heat them and using their temperature coefficient of resistance as the temperature goes up to extrapolate the temperature, however i don't know how to do this exactly, cause I have to measure the resistance while the circuit is working, at a precision of around 0.01 ohms, ( i don't care about accuracy) i just want precisión and repeatability, cause i only care about the diferrential between the temperatures i Will be working.

i though of using some voltage divider with the Heating elements and as they are 10, using an analog multiplexer to only use one voltage divider at the output of the mux and then folowed by a op amp buffer followed by an ampliffication stage (i have done the math already) to increase resolution to get the 0.01 omhs precisión i need.

I know i can't use the voltage divider while the circuit is powered on so i plan on turning off the Heating some microseconds, take the measuremts of the Heating elements while the power is off and then the pid gets the data and then power on the circuit again, but how do i do this? How do I switch from reading resistance to power the circuit withouth interfering with each other or destroying the sensing part of the circuit.

Also the multiplexer has some internal resistance and when the resistance of the Heating elements goes in the input to the output of the mux it has added resistance that Will alter the result of the conversion of the voltage divider, thus rendering the sensor measuremts of resistance useless. I wouldnt care of this added resistance if it were constant or stable, as i don't care about accuracy, but i do care about precisión and repeatability,.

Sorry i wrote this much but i really need some advice, because i have thought of everything and I am not very Smart, so if You guys could come with a better solution please.

Maybe it is confusing if You need me to write an schematic i would do it.

The usual way of calculating resistance is to measure the current through the resistor and the voltage drop across the resistor while the circuit is energized. No need for switching. If mains voltages are involved then things get more complicated, but it's still doable.

Indeed, current sensor in series with the heating elements should give you the resistance of those elements.

Just make sure your supply current is properly regulated; if not you have to separately measure the actual value of that.

Thanks for the answers, but I have a question, since i Will be powering the Heating elements with a variable voltage source through pwm, how can i get a precise measure of the current change? Because if the current changes in My circuit because of the voltage change and the temperature change, this method doednt work at all I Guess. Also I Will have 10 Heating elements or more, reading the current of all of them is practical?

If you use a single microcontroller, your minimum allowable pulse width will be 220 microseconds as the C and V measurements have to be done sequentially and each takes about 110 microseconds.

With multiple heating elements and the shortest possible pulse widths you'll need to stagger each of the PWM clocks by at least 220 microseconds so that only one element is active at a time.

CondeVampa:
since i Will be powering the Heating elements with a variable voltage source through pwm...

PWM is NOT a varying voltage.
It's the FULL voltage for a varying amount of TIME.
Just measure in that 'on' time.
Leo..

Wawa:
PWM is NOT a varying voltage.
It's the FULL voltage for a varying amount of TIME.
Just measure in that 'on' time.
Leo..

how do i measure on the on time? Also the circuit that i al proposing is feasible or not?

mikb55:
If you use a single microcontroller, your minimum allowable pulse width will be 220 microseconds as the C and V measurements have to be done sequentially and each takes about 110 microseconds.

With multiple heating elements and the shortest possible pulse widths you'll need to stagger each of the PWM clocks by at least 220 microseconds so that only one element is active at a time.

i don't quite understand this concept allthough i already thought of only powering one at a time so fast that it looks like all of them are being powered in real time

Also i can't use shunt resistors for current measuremnt because i Will need to buy at least 10 of them and they are Big and costly, i need to do the circuit in little space, because it is portable, also more information:

The Heating elements are nickel-200 with a 0.2ohms resistance at ambient temperature and a increment of 0.0067 ohm per grade centígrades, i want to heat them to 130 grades centígrades using a 3.7V lipo battery to power them.

CondeVampa:
how do i measure on the on time? Also the circuit that i al proposing is feasible or not?

You KNOW when the element is on, because the code you write does that.
So you know when to measure.
You have choosen a 'difficult' project. Maybe you don't have the skills yet for this.

Not sure if you should use default PWM.
Maybe you can just turn the element on/off for a certain amount of time.
That time (milliseconds) depends on how fast the element heats up and cools down.

A shunt can be a few centimeters of wire or circuitboard trace, since you're dealing with ~20Amp.
I calculate 3.35% change per degree C from your numbers. Seems high.

Shouldn't you be testing with ONE, before expanding to TEN.
Leo.

Wawa:
You KNOW when the element is on, because the code you write does that.
So you know when to measure.
You have choosen a 'difficult' project. Maybe you don't have the skills yet for this.

Not sure if you should use default PWM.
Maybe you can just turn the element on/off for a certain amount of time.
That time (milliseconds) depends on how fast the element heats up and cools down.

A shunt can be a few centimeters of wire or circuitboard trace, since you're dealing with ~20Amp.
I calculate 3.35% change per degree C from your numbers. Seems high.

Shouldn't you be testing with ONE, before expanding to TEN.
Leo.

It seens like You don't understand quite well My question, if iam using pwm i can't know the on time of the dutycycle but i can obviusly know the on time of the pwm, but that doesnt work for me knowing that, but the idea of only turning on and off the signal withouth pwm is a good idea Indeed, the problem is that it Will be lees accurate the temperature control because i want to heat to 120 celcius at about 4 to 5 seconds

You can know when the PWM is on by reading the pin state: a digitalRead() on an output pin returns the current state of that pin. For good measures, you should read the pin state, do the analogRead(), and read the pin state again to confirm it didn't go low while you were taking the reading. That chance is high as the HIGH time of the pin is just about 1 ms or 0.5 ms depending on which pin you use (two PWM pins are at ~980 Hz, four at ~490 Hz), and an analogRead() takes just over 0.1 ms.
A simpler way is to use slow PWM. It's a heater, so it reacts slowly. Big heaters may use duty cycles of seconds or even minutes; for your small and (for a heater) fast reacting one maybe use 1-10 Hz. That's so slow it can easily be done in software, and you just take your analogRead() based on the PWM.
Finally you can just take a number of analog reads. Take like 10 in succession and you have read for over 1 ms, that coves a complete cycle of a PWM signal. Take the highest reading, you probably have 2-3 of the same readings in that time.
As you're using a battery, you must compensate for actual voltage. So you must measure the battery voltage: connect the battery through a 1:3.3 voltage divider (10k:3k3) to bring down the voltage to no more than about 1V. That 1V is as you must read the voltage using the internal reference voltage, or you NEVER get useful readings.
To measure the actual current, consider using one of the INA current sensors. It's I2C so getting 10 of them connected is tricky. If you use a piece of circuit board trace to measure the current you will have to amplify the voltage, it's too low to measure properly. You will want to get the output for the maximum current to be about 1V for maximum resolution.
Not easy, indeed. Lots of tricky bits in the sensing, the 20A currents involved... good luck!

wvmarle:
To measure the actual current, consider using one of the INA current sensors.

+1
An INA219 or other family member could measure current high-side, and also measure battery voltage.
The project consists of several different elements that you must master first before bringing it all together.
Leo..

wvmarle:
You can know when the PWM is on by reading the pin state: a digitalRead() on an output pin returns the current state of that pin. For good measures, you should read the pin state, do the analogRead(), and read the pin state again to confirm it didn't go low while you were taking the reading. That chance is high as the HIGH time of the pin is just about 1 ms or 0.5 ms depending on which pin you use (two PWM pins are at ~980 Hz, four at ~490 Hz), and an analogRead() takes just over 0.1 ms.
A simpler way is to use slow PWM. It's a heater, so it reacts slowly. Big heaters may use duty cycles of seconds or even minutes; for your small and (for a heater) fast reacting one maybe use 1-10 Hz. That's so slow it can easily be done in software, and you just take your analogRead() based on the PWM.
Finally you can just take a number of analog reads. Take like 10 in succession and you have read for over 1 ms, that coves a complete cycle of a PWM signal. Take the highest reading, you probably have 2-3 of the same readings in that time.
As you're using a battery, you must compensate for actual voltage. So you must measure the battery voltage: connect the battery through a 1:3.3 voltage divider (10k:3k3) to bring down the voltage to no more than about 1V. That 1V is as you must read the voltage using the internal reference voltage, or you NEVER get useful readings.
To measure the actual current, consider using one of the INA current sensors. It's I2C so getting 10 of them connected is tricky. If you use a piece of circuit board trace to measure the current you will have to amplify the voltage, it's too low to measure properly. You will want to get the output for the maximum current to be about 1V for maximum resolution.
Not easy, indeed. Lots of tricky bits in the sensing, the 20A currents involved... good luck!

Omg this are actually really good ideas, thanks You so much, really thankyu i Will try all of the things You proposed experimentally, and see what aproach serves me better.

I don't have problems amplificating the signal, cause I have experience with op amps, the idea of compensate for voltage battery is quite Nice, i was having problem with the dilema of voltage change of battery as i am drawing a Lot of power from them so maybe i could use some capacitors to buffer the voltage drop and i had to do a real time measurement as You sugested.

I AM using a 3.3v or 2.5v precision voltage reference for the ADC of the Arduino so maybe i don't have to use the internal reference of Arduino and if the resolution of the signal is a problem, i could just amplify to the required precisión i want for the ADC what You think?

I am planning in Heating the element with pid from 25 grades centígrades to 120 grades centígrades in like maximum 3 seconds, and they cannot pasa this temperature by maximum 5 to 6 grades of error, so i need pretty speed control. so i want to re-confirm that 1-10hz is enough speed for this(maybe a foulish question since i AM the one who should answer this with experimentation) . Also your aproach of reading the pin state i didnt know about that, it is genius i Will try it, also the sampling of 10 and taking the higher seems honestly like the perfect approach, a bit microseconds slower than reading the pin state but also simpler and more robust.

I think that with this information and the answer You could give me about these reasonings are enough for me to complete this project, i though i had a problem of circuit but it looks like it was a problem of software.

Also i don't care about absolute values of resistances for each Heating elements, they could be different from each other as i only care about precise measured change in the resistance, as each Heating element Will have different topography so they Will obviusly have different resistances. That problem Will be caibrated initially for each Heating element.

Also MERRY CHRISTMAS FOR ALL OF YOU GUYS.

CondeVampa:
I don't have problems amplificating the signal, cause I have experience with op amps,

Amplifying a signal of <10 mV, possibly <1 mV (as that's what you're going to do here) is not trivial.

CondeVampa:
how do i measure on the on time? Also the circuit that i al proposing is feasible or not?

Do slow PWM in software, then its easy to time the readings. Heating elements don't need kHz rates of PWM as they have thermal inertia.

MarkT:
Do slow PWM in software, then its easy to time the readings. Heating elements don't need kHz rates of PWM as they have thermal inertia. If you use PWM at 100Hz or so you have plenty of time to do what you want, analogRead() takes 0.11ms or so.

MarkT:

Sorry for My ignorante but how do i make a manual slow PWM in code?

I will assume the code would consist of a microseconds or milis counter, some kind of flag for notice the interval i want and then kind of turn un and off the MOSFET pin according to a time i Will want?

AM i correct? I would avoid the use of delay due to real time reactions that i need.

Have a look at Blink Without Delay. PWM is no more than fast blinking.