I'm working on a boat modernization project and I'd like to replace an analog temperature gauge with an Arduino-based digital solution. The sensor in question is a single-pole thermistor with a common ground to a engine block. The thermistor's resistance range is 15 ... 1000 Ohms.
The existing analog gauge has wires for the thermistor pole and the common ground. I can measure the varying resistance between these wires with my multimeter.
My Arduino Mega 2560 has its own stable 5V power supply that is not connected to the engine block common ground. My question is, is it possible to use an Arduino to read the thermistor in a realiable and safe way? If so, how about multiple thermistors that do not share the same common ground?
If the circuits don't share the same ground then they are different circuits. If they cannot be made to share the same ground then you instead need a way that allows the different circuits to communicate, common ways to do this is to use opto isolators or relays.
I'm not sure what your point is, perhaps if you ask a different question I might be able to help. My point was to tell you something basic about electronics that you can't avoid. What do you mean by a single pole sensor? Maybe if you share some schematics it will be clear what you have.
Thanks, that's a great tutorial that explains the issue quite well.
My optimal solution would have been being able to measure the resistance between two analog pins of an Arduino.
My challenge here is that I have two (old) diesel engines with separate alternators that charge three different 12V lead-acid batteries. I need to look into this more closely and see if I can make the various parts of the system share a common ground.
It actually may be that the various electrical parts of the boat already share a common ground, or can be made to do so. I need to research this further. Thank you everyone for your help.
Not possible, it doesn't work like that. The analogue inputs measure voltage with respect to ground. The range of the voltage that can be measured is between ground and either the internal reference voltage or the supply voltage, which will be either 3V3 or 5V, depending on the microcontroller you are using. If you want to measure outside that range then you need additional circuitry to bring it into that range. The inputs cannot measure resistance but you can apply Ohms law to convert resistance into voltage and measure the voltage. In practice that means passing some current through the resistance you want to measure and measuring the resultant voltage. If you don't know Ohm law then research it because it is fundamental to electronics and you can't really understand electronic circuits if you don't know what Ohms law tells you.
If the different parts of the boat are not bonded (search for electrical bonding) then to do what you are trying to do they need to be bonded. You can't rely on chance electrical connections through metal parts of the boat. I would not expect there to be any problems with bonding the various parts.
I imagine the engine has a starter motor, when it is running it will draw a lot of current and you need to be sure that the resulting voltage drop across the conductors carrying that current does not find its way into your microcontroller because if it does then expect a puff of smoke.
Thank you, this is a clear explanation. I do know Ohms law but I do not have a lot of experience with Arduino.
There are two starter motors actually, one for each engine.
I'm aware that the voltage from the alternators and batteries is quite dirty and can spike, so I'm using some buck converters to provide a stable 5V for the Mega through the USB port.
You also have to consider that the current to the motors passes through the ground conductors, which have resistance, so voltage develops across the ground conductors meaning the ground voltage in one part of the boat could well be different to the ground voltage in another part of the boat, potentially that voltage different ends up at the micro-controller and you get smoke. You need to consider this.
But the problem is that "ground" here is the casing of the engine because we clearly assume the sensor is in fact, screwed into the engine itself.
This is not the same ground as the battery negative, nor is it the same ground as any other part of the boat because whatever connections there are - such as the ground strap from the battery to the engine - may be carrying significant current and developing a voltage across them, possibly a few Volts and possibly several Volts if there is some malfunction.
It is a vexed problem; the suggestion of connecting one analog input to the sensor and another to the ground near the sensor (that is, the engine casing, separate from any other ground connection) is actually most sensible as you then calculate the voltage difference between the two points. The only caveat is that these connections to the analog inputs must have series resistors of something like 4k7 to limit what current might flow into the Arduino if a transient occurs through the wiring and (Schottky) diodes to clamp any such current to the 5 V supply and ground.
Yes which the op said the gauge was connected to, why can't the Arduino share the same gnd, I know there are two engines, they charge 3 batteries, are the batteries sharing the same gnd?
I would assume they do if they also contribute to the starting of the engines.
Anyway, we will see what the OP finds.
Tom...
PS. Off to bed, I need my beauty sleep for work tomorrow.
I did some inspecting yesterday, and both of the engine chassis are connected with very thick cables to each other and the ground terminals of the alternators and the batteries. A few multimeter tests (with engines off) suggest that all ground contacts in various parts of the boat are connected, including the voltage source for the Arduino.
Am I wrong in assuming that buck converters offer at least some protection against voltage spikes from the 12V system? Any pointers to futher protective circuits I should use to protect the Arduino?
You are correct, but the concern @Paul_B and I have is that the ground voltage might vary in different parts of the boat. The check you need to make is to measure the voltage between the ground in one place and another place while the starter motors are cranking the engines.