linear Hall sensor/How it works/05. VCC sets the zero and the scale
How it works · 05 of 9

VCC sets the zero and the scale

The output is ratiometric: the resting level is half of VCC and the sensitivity scales with it, 3.25 mV per gauss at 5 V and about 2.1 at 3.3 V. A strong field takes the output to about 0.8 of VCC, so from a 5 V supply it reaches about 4 V. VCC goes to your board's logic voltage: 3V3 on an ESP32, ESP32-S3 or Pico, 5V on an Uno.

The supply is the ruler

The chip's output is ratiometric: everything about it is a share of VCC. The resting level is half of VCC, and the millivolts per gauss scale with it. The data sheet's curves give about 2.1 mV per gauss at 3.3 V against 3.25 at 5 V, and 3.25 × 3.3 ÷ 5 = 2.15 agrees.

VCC sets the zero and the scale
Your board
VCC wired to
Field at the chip0 G
Rest
1.65 V
mV per gauss
2.1
SIGNAL now
1.65 V
Pin takes
3.6 V
Right. The chip rests at half of VCC, 1.65 V, and moves about 2.1 mV per gauss. The ESP32-S3's ADC has its own reference, so a sagging 3V3 moves the zero and the ADC does not follow: measure the zero when the sketch starts.

Pick your board, where VCC goes, and a field. On an Uno with VCC on 5V the ADC measures against the same 5 V, so a supply that sags by a tenth of a volt moves the chip's zero and the ADC's scale together, and the reading barely changes. An ESP32 measures against a reference inside the chip, and a sagging 3V3 moves the zero on its own. That is one more reason the sketches measure the zero when they start.

The ceiling is the danger

The sheet gives the output as 1 V to 4 V across its range at 5 V. It does not give the limits at 3.3 V; scaled with the supply they would be about 0.7 to 2.6 V, which suits a 3.3 V pin with room to spare.

From a 5 V supply, the resting 2.5 V looks harmless on an ESP32 or a Pico, and it is. Then a magnet comes close, the output heads for 4 V, and the pin gets more than the 3.6 V it tolerates. So VCC goes to your board's logic voltage: 3V3 on an ESP32, an ESP32-S3 or a Pico, 5V on an Uno. 3V3 on an Uno works, but it gives away resolution and the supply no longer cancels.

When it does not work

It works on 5V with my ESP32. Why change it?

Because it works until a magnet comes close. At rest the output is 2.5 V, which the pin takes. With a strong field it heads toward 4 V, over the 3.6 V an ESP32 pin tolerates. Move VCC to 3V3; the chip is specified down to 3 V.

The reading drifts when I switch from USB to a battery.

The zero is half of VCC, so a different supply moves it. On an Uno the ADC measures against the same 5 V and the change mostly cancels; on an ESP32 it does not. Press reset after changing the supply, so the sketch measures its zero again.

Is 3.3 V enough for the chip?

Yes. The data sheet runs it from 3 to 12 V, so 3.3 V is inside the range with 0.3 V to spare. The sensitivity falls with the supply, to about 2.1 mV per gauss, and an ESP32's finer ADC more than makes that up.

Where this goes next

Three wires, and a sketch that measures its zero before it measures anything else.

The first reading →

Edit this page — content/books/linear-hall-sensor/vcc-sets-the-zero-and-the-scale.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

Linear Hall Effect Sensor

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →