App note: Magnetometer placement in mobile devices

an_kionix_AN042

App note from Kionix about magnetometer integration challenges from the mobile equipment point of view, and gives guidelines for the mounting position of the magnetic sensor. Link here (PDF)

Electronic devices contain many parts which can affect a magnetic sensor. When deciding the mounting position, it is necessary to consider the types of materials and the amount of current carried in proximity of the magnetic sensor. Accuracy of an electronic compass depends upon getting clean geomagnetic data from the magnetic sensor output without errors caused by other magnetic elements. These errors need to be canceled by calibration or correction.

App note: Magnetometer placement in mobile devices

an_kionix_an042

Correct magnetometer placement app note from Kionix. Link here (PDF)

Electronic devices contain many parts which can affect a magnetic sensor. When deciding the mounting position, it is necessary to consider the types of materials and the amount of current carried in proximity of the magnetic sensor.

Accuracy of an electronic compass depends upon getting clean geomagnetic data from the magnetic sensor output without errors caused by other magnetic elements. These errors need to be canceled by calibration or correction. This document explains magnetometer integration challenges from the mobile equipment point of view, and gives guidelines for the mounting position of the magnetic sensor.

Automatic Resistance: Resistors Controlled by the Environment

Resistors are one of the fundamental components used in electronic circuits. They do one thing: resist the flow of electrical current. There is more than one way to skin a cat, and there is more than one way for a resistor to work. In previous articles I talked about fixed value resistors as well as variable resistors.

There is one other major group of variable resistors which I didn’t get into: resistors which change value without human intervention. These change by environmental means: temperature, voltage, light, magnetic fields and physical strain. They’re commonly used for automation and without them our lives would be very different.

Thermistors

Thermistor
Thermistor, By Ansgar Hellwig [CC BY-SA 2.0 DE], via Wikimedia Commons
As you can probably tell from part of the name, thermal, meaning “of or relating to heat”, these are resistors whose resistance changes with temperature. While that’s true of all resistors, with thermistors the change is larger and desired.

They come in two types:

  • NTC, or Negative Temperature Coefficient thermistors, where as the temperature increases their resistance decreases, and
  • PTC, or Positive Temperature Coefficient thermistors, where as the temperature increases their resistance increases.

Many Hackaday readers might be familiar with NTC thermistors in 3D printers where they’re used to measure the temperature of the hot end of the extruder. If your printer has a heated bed it is likely also monitored by an NTC.

And there are many more applications where they’re used for measuring temperature such as in digital thermometers, toasters, coffee makers, freezers, and so on.

But in addition to measuring temperature, NTC thermistors are also used for limiting current. As inrush current limiters they limit any rush of high current when a device is first turned on. Basically when the device is turned on, the thermistor is still relatively cool and so acts as a high resistance, limiting the current. Over time, as more current flows through the thermistor, its temperature increases and so its resistance decreases. That allows more current to flow through it, which is fine since the initial rush of high current is finished by that time.

My only experience with NTC thermistors was to play around with one that was part of an automotive sensor. The sensor was to be screwed into the engine compartment possibly for measuring the coolant or oil temperature. Of course this doesn’t measure the temperature directly. Instead a voltage is applied across it. As the temperature changes, the resistance changes and so does the voltage. The vehicle’s computer then uses a table or formula to map that voltage to a temperature.

Automotive temperature sensor_thermistor Thermistor graph

I couldn’t find the datasheet for the automotive part and didn’t know the relationship between the thermistor’s temperature and resistance so I put it in a pot of water on the stove. As I slowly brought the water to a boil I measured the water temperature and the thermistor’s resistance, obtaining the chart shown here.

Positive Temperature Coefficient (PTC) thermistors, whose resistance increases as temperature increases, also have their uses.

One example is as a replacement for a fuse. As the current in a circuit increases, the temperature of the thermistor increases due to normal resistive heating. This heat is lost to the surroundings. But if the current is higher than it should be then at some point it will heat up faster than it can lose that heat. At that point the resistance will increase, limiting the current.

With the advent of flat panel displays there are fewer and fewer CRT displays around but some readers will remember that PTC thermistors were used in the display’s degaussing coil circuits. The degaussing coil would need to be energized briefly and turned off gradually. The current through the coil would create the needed magnetic field for degaussing, and the current would also heat up the thermistor. As it did, the thermistor’s resistance would increase in the desired gradual manner, reducing the current through the coil until the circuit shut off.

Varistor

Varistor
Varistor, By Michael Schmid [CC BY-SA 3.0], via Wikimedia Commons, and voltage-current graph
The name varistor doesn’t help much as the name’s origin comes from “varying resistor”, which is a description of all the parts covered in this article and the others in the series. A varistor’s resistance varies according to the voltage, so maybe remembering that it starts with a ‘V’ helps. In a varistor the higher the voltage, the higher the resistance, and the direction of the current doesn’t matter. It’s also much like a diode in that up to a certain minimum voltage it’s off and then turns on (see the voltage-current graph).

Most applications for varistors are in surge protection, protecting circuits from mains transients, inductive loads and from lightning. They’re usually placed across the circuit to be protected so that should the voltage rise high enough across it, the varistor will conduct and act as a short for the current, instead of the current going through the circuit.

Varistor protected circuit Lightning arresters

My own experience with varistors comes from my time as a solar contractor. We’d attach lightning arresters to various components of the solar system: two arresters for the inverter, where one set of wires ran outdoors to a generator and another set went out to the loads in the cottage, and one arrester for the charge controller where wires ran out to the solar panels. These are all wire runs where voltage can be induced to damaging levels by nearby lightning.

Each of these lightning arresters contains a Metal Oxide Varistor (MOV). The varistor is connected between the wires and ground. As long as the voltage is low enough then current doesn’t conduct. But when lightning strikes somewhere nearby, the voltage on the wires rises and reaches a point where the varistor conducts to ground (e.g. 385 volts). This prevents the voltage from rising further. As long as the solar component is able to handle that voltage then it’s protected. With some standards, the solar component is designed to handle up to 2300 volts where these wires are connected.

Photoresistor/LDR

Photoresistor
Photoresistor

A photoresistor’s resistance decreases as light intensity increases. You may also see it referred to as an LDR (Light Dependent Resistor). Its resistance in the dark can be in the megaohms but with the correct wavelengths and sufficient intensity of light, it can be just a few ohms.

Photoresistors aren’t good for detecting rapid changes in light intensity. In going from complete darkness to light, there can be as much as a 10 millisecond delay before the resistance decreases fully. And when going from light to complete darkness the resistance can take as much as 1 second to increase to the megaohm range. However, there are applications where this delay is desireable such as with audio compression. Here an LED or electroluminescent panel is used to control the resistance of the photoresistor and affect the audio signal gain. Doing so is said to sound smoother by softening the attack and release than doing so without a photoresistor.

Another typical application is for a light sensor to detect if a night light should be turned on.

Laser communicator to photoresistor circuit
Laser communicator to photoresistor circuit

In my case I made a laser communicator that used an audio signal to modulate the output of a dollar store toy laser. I then shined that now fluctuating laser beam onto a distant photoresistor. The photoresistor was part of a circuit that fed an amplifier and the result was the audio signal transmitted by light and reproduced on the amplifier’s speaker. This violated what I mentioned above about not using them for rapid changes in light intensity, but it worked well enough as a fun experiment.

Magneto Resistive Sensor

Magneto resistive sensor (KMT32B) from Digikey
Magneto resistive sensor (KMT32B) from Digikey

The resistance of a magneto resistor can be used to detect the position, orientation and strength of a magnetic field. It uses the magnetoresistance effect. The anisotropic magnetoresistance (AMR) effect, discovered in the 1800s is sensitive to the magnetic field strength and the angle between an electric current and the magnetic field. There are other, more recently discovered effects but most conventional resistors use the AMR effect. Magneto resistive sensors that are built around these resistors are available from Digikey and Mouser among others.

I haven’t used magneto resistive sensors myself but one common application is as wheel speed sensors in automobiles. Others are magnetometry, various sensors for angle, rotation and linear positions, and for detecting vehicles on the road.

There is a lot of interesting potential applications for these sensors. At the 2013 Open Hardware Summit a 1-DOF haptick feedback kit called Hapkit was demonstrated by a group from Stanford. They used a magneto resistive sensor to detect a pendulum’s position. That position is then used by a microcontroller to power a motor to make moving the pendulum by hand feel like you’re moving a spring or click wheel.

Strain Gauges

 Strain gauge interior
Strain gauge interior, [CC BY-SA 2.5], via Wikimedia Commons
A strain gauge is an electrical conductor that changes resistance as it’s stretched or compressed, but without breaking, buckling or otherwise permanently deforming it. To get a large enough effect to make a useful change in resistance, the conductor is usually laid out in a zigzag or serpentine pattern with the long ends oriented in the direction of the expected strain.

The change in resistance is very small and so to aid measurement the strain gauge is incorporated in a Wheatstone bridge. A full article could be written about strain gauges and their use in Wheatstone bridges so here’s just a brief overview.

The Wheatstone bridge consists of two voltage dividers, R1 and R2 being one of them, and R3 and R4 being the other one. The input voltage, called the excitation voltage (VEx), is across the outside of the bridge, and the resulting output voltage (Vo) is taken from the centers of the two voltage dividers.

Wheatstone bridge and voltage output formula
Wheatstone bridge and voltage output formula

The voltage output, Vo, can be calculated using the formula shown. If the ratio R1/R2 is equal to the ratio R4/R3 then calculating Vo you’ll find you get 0 volts. But if one of the resistors is replaced with a strain gauge then when it’s strained, Vo will become non-zero. Further formulas can be used to convert this to a value in a unit actually called ‘strain’.

Multiple strain gauges can also be used to further amplify the values and to compensate for temperature.

Strain gauges are found in load cells and pressure sensors, both often incorporated in Wheatstone bridges. The ones in pressure sensors are usually made with silicon, polysilicon, metal film, thick film or bonded foil.

Conclusion

And that concludes this series on resistors. The other two articles are on fixed value resistors and on variable resistors that are manipulated by human intervention. Check them out if you missed them. And let us know in the comments of any resistors that we missed along the way or of anything you’d like to add.


Filed under: Featured, Interest, Original Art