I'm reading some rules for a Mars-rover competition, and one of the rules says you are not allowed to use "Sensors that rely on the Earth’s magnetic field".
So my question is - do accelerometers (like this one) use the Earth's magnetic field?
No, accelerometers do not rely on the magnetic field of the Earth.
Diagrammatic explanation of how inertia is used to measure acceleration. (Source)
As detailed here (own highlighting):
Conceptually, an accelerometer behaves as a damped mass on a spring. When the accelerometer experiences an acceleration, the mass is displaced to the point that the spring is able to accelerate the mass at the same rate as the casing. The displacement is then measured to give the acceleration. Hence, they work on the principle of inertia, not magnetism.
No, accelerometers do not use any magnetic fields to make measurements, they measure the deflection of a mass, which is proportional to the acceleration received (ADXL335 datasheet).
However, as you posted a link to the ADXL345 accelerometer, it is important to note that many commercial inertial measurement units which include accelerometers such as the ADXL345, may also include a magnetometer (e.g. the 9 Degrees of Freedom - Razor IMU) for use in tracking heading. These do not however rely on the Earth's magnetic field, they will estimate strength/direction of any magnetic field.
An accelerometer measures the force on a mass that is caused by inertia or the pull of gravity. The Earths magnetic field is not associated with inertia or gravity and is not used by an accelerometer. However, for the benefit of others looking at this question, many accelerometers use magnetism. But, they generate their own magnetic field and do not rely on the Earth. The output of these accelerometers is equivalent to the magnetic force required to hold a weight in a neutral position. A change in the motion of the accelerometer, or the pull of a gravity field, will try to move the weight. The magnetic field holding the weight is increased to hold the weight in position. The amount of energy required to generate the magnetic field is the output of the accelerometer.