Skip to content

Analog Hall Sensor Wireling Tutorial

analog hall sensor product photo

This Wireling lets you measure the intensity of magnetic fields via the A1454 Linear Hall Effect Sensor. This particular version of the A1454 is intended to be used with ferrite type magnets.

Read more about the differences in common magnets.

Technical Details

Allegro A1454 Hall Sensor Specs (Analog)

  • 2 factory programmed sensitivity options: 2 LSB/G (for fields up to ±1000 G) and 4 LSB/G (±500 G)
  • Temperature-stable sensitivity for NdFeB and ferrite magnets
  • I²C interface for easy integration with support for up to 127 unique addresses
  • EEPROM stores factory-programmed settings and up to 16 bytes of user information (programmable through the I²C interface)
  • Micro-power sleep mode through I²C command for minimizing power in battery-operated applications
  • Precise recoverability after temperature cycling
  • Wide ambient temperature range: –40°C to 125°C
  • 12-bit ADC with 10-bit ENOB (Effective Number of Bits)
  • Operating Voltage: 2.65V - 3.5V
  • Operating Current: 5mA (max)

Power Requirements

  • Voltage: 3.0V - 5.5V 

Pins Used

  • A5/SCL - I²C Serial Clock line
  • A4/SDA - I²C Serial Data line

Dimensions

  • 10mm x 10mm (.394 inches x .394 inches)
  • Max Height (from the lower bottom of Wireling to upper top Wireling Connector): 4.60mm (0.18 inches)
  • Weight: 1 gram (.04 ounces)

Background

  • The A1454 will be able to pick up readings from magnets or metals containing Ferrite or Neodymium. The Wikipedia articles may sound confusing, but basically any magnet that goes on your fridge or other things made of neodymium, like headphones or DC electric motors will give a reading.
  • Hall Sensors are commonly used in projects needing switches, like a home security system that has attachments on doors and windows that detects when a magnet is moved away (like when a door opens).
  • A Hall effect sensor can operate as an electronic switch, which can be cheaper and more reliable than a mechanical switch.
  • Linear Hall Effect Sensors, like the A1454 in this tutorial, can measure a wide range of magnetic fields rather than a digital hall sensor like the TCS40DLR Discrete Hall Switch that solely measures whether there is a magnet or not (You may notice that the A1454 gives readings from a range of 0-4096)

Materials

Hardware

Required Software


Hardware Assembly

Plug your Wireling into the port you plan on using! The default in the included program is port 0.

If you want to use a different port, you just need to change the port value in the program mentioned later.


Programming

Install the necessary Python package:

pip3 install tinycircuits_a1454

Then you can download (above under Software) the Analog Hall Effect Sensor Wireling Python example:

a1454-example.py
# A1454 Analog Hall Effect Sensor Example
# Prints the magnetic field in Millitesla, and temperature in Celsius
# Written by: Laverena Wienclaw for TinyCircuits

import tinycircuits_wireling
import tinycircuits_a1454
import time

# Enable power to pi hat and wirelings
wireling = tinycircuits_wireling.Wireling()
wireling.selectPort(0) # Select port (0-3) labeled on the Pi Hat

# Sensor init
a1454 = tinycircuits_a1454.A1454()

while True:
    print("Mag: {} mT\nTemp: {} degC".format(a1454.readMag(), a1454.readTemp()))
    time.sleep(1)


Run Program

Navigate in the terminal to the directory with the file parent to the examples folder.

python3 a1454-example.py

Once the program is running, you should see magnetic field readings in Millitesla, and temperature output in Celsius:

Mag: 0.2 mT
Temp: 28.5 degC
Mag: -0.05 mT
Temp: 28.5 degC
Mag: -43.8 mT
Temp: 28.5 degC
Mag: -49.05 mT
Temp: 28.5 degC
Mag: -51.2 mT
Temp: 28.75 degC
Mag: 0.0 mT
Temp: 28.875 degC

Results will print every second. Move different magnets close to the sensor to get a better understanding of their magnetic fields!


Contact Us

If you have any questions or feedback, feel free to email us at info@tinycircuits.com or make a post on the forum.

Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it!

Thanks for making with us!


Downloads