Resistance Measuring

Hi, I am using an atmega328, and i'm trying to measure the resistance of a resistor. The only issue is that the circuit i'm trying to measure is 12V. My supply is a regulated 12V DC supply. I was wondering what is the best way to do this.

I've already managed to measure the resistance accurately of a 5V circuit using the atmega using this circuit. Would it be possible to make this circuit work for 12V?

sorry my english isn't great.

Sorry for the double post, but I should add that the reading doesn't have to be accurate, only consistent.

Yes, it's possible. But, you need an [u]over-voltage protection circuit[/u] so you don't fry your Arduino. And of course, you have to adjust the calculations accordingly.

And if you the ADC reads 1023, you've maxed-out the ADC and you'll need to change the known-resistor value to bring the voltage down.

Now... The Arduino has a regulated 5V supply, so why use 12V? Normally when you read resistance (with a multimeter) you turn power-off in the circuit under test, so the only voltage & current is coming from the meter. Any voltage in the circuit will foul-up the resistance reading. And in a circuit, the meter reads the resistance of the resistor and any parallel resistances so you may not read the true resistance of the resistor unless you remove it from the circuit.

I went with 12V as the circuit i'll be measuring will be well over 100m of cable.

The circuit i'll be measuring gets it's power from my circuit and is dedicated just for resistors.

It's for a fire alarm, when a smoke detector goes into alarm it redirects the current through a resistor.

Here is a schematic to demonstrate how it'll work.

As you can see the NC contact of the relay just passes the current on to the next device, if there is no smoke detected, the current will go through the EOL resistor and the atmega will read that as there being no fire.

However if a smoke detector detects smoke, the relay will flick over to NO and the current will be redirected to that resistor, the atmega will read the new resistance and trip an alarm.

Your mistake is thinking you want measure resistance. You cannot do that directly with an Arduino, you can only measure voltage up 5 volts (or what's on the VREF pin). So, to measure 12 volts, you need a voltage divider. Google "voltage divider"for your solution.

Using that circuit I linked you can get a reading in ohms using a calculation.

Ripmax:
Using that circuit I linked you can get a reading in ohms using a calculation.

Really? What would that calculation be and where and how is the Arduino connected in that schematic? I certainly don't see it...

The circuitbasics one, not the image I uploaded.

this

Of the five resistors in your circuit, which one is the "known" resistor? And the values of the others?

The known resistor will be on the same PCB as the Atmega, it is 1kΩ.

My mistake for not making that very clear, apologies.

Attached is an updated schematic.

All the resistors to the right of the known resistors are the "unknown" resistors.

Please understand that you DO NOT need to use 12 volts due to the wire length but I think being a non-English speaker is the root problem here... And if you do this incorrectly, you will destroy your Arduino with 12 volts on an input pin so you have been warned! Please test your circuit before connecting the Arduino.

The circuit is really not the correct way to detect closed relays - but you asked so here you go:

Make the the EOL resistor 20k ohm. The 4 detector resistors can be 10k ohm each.

The voltage will go up for each relay that is turned on.

Again, this is a poor design but it should work, in theory.

Thanks for the help, however I think i'll just stick with 5 volts.

The idea was that each detector has a different resistor on it, that way I can tell exactly which detector was triggered.