> For the complete documentation index, see [llms.txt](https://docs.andymark.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.andymark.com/frc-electronics/can-sensors/can-magnetic-switch-am-5746.md).

# CAN Magnetic Switch (am-5788)

![AndyMark CAN Magnetic Switch (am-5788)](https://2060440806-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcQgnvayQud3Xf5sZi0wz%2Fuploads%2FlAQu48INc4jj58WzDv90%2Fcan-magnetic-switch-am-5788-product.jpg?alt=media)

The **AndyMark CAN Magnetic Switch** is a compact Hall-effect sensor that reports whether a magnet is detected without requiring mechanical contact. It is useful for homing, end-of-travel detection, latch confirmation, and other repeatable position checks.

See Specifications for electrical and mechanical details, Examples for code, and Device API for the complete library interface.

***

## At a glance

| Parameter             | Value                        |
| --------------------- | ---------------------------- |
| AndyMark part number  | am-5788                      |
| Communication         | CAN                          |
| Measurement           | Magnet detected/not detected |
| Default CAN ID        | 0                            |
| Maximum input voltage | 16 V                         |
| Connector             | Locking 4-pin JST-PA         |

## When to use this sensor

* Establish a repeatable home position without physical switch contact.
* Confirm that an elevator, arm, turret, gate, or latch reached a known position.
* Detect a magnet embedded in a moving carrier or mechanism.
* Replace a contact limit switch where wear, dust, or alignment is a concern.

## What it does not measure

The switch reports magnet detection; it does not provide distance, field strength, or angular position. Detection distance depends on the magnet, its orientation, the mounting geometry, and nearby material, so determine the working gap on the actual mechanism.

## Before installation

1. Attach an appropriate magnet securely to the moving component.
2. Mount the sensor rigidly at the desired detection point.
3. Adjust the magnet’s path and orientation until detection is repeatable across mechanism tolerance and vibration.
4. Ensure the magnet cannot strike the sensor at either travel limit.
5. Support the cable so motion or service work cannot load the connector.
6. Assign a unique CAN ID before placing multiple default-ID devices on the same bus.

## Initial checks

* Move the mechanism slowly by hand and observe the reported state.
* Test both approach directions and the full expected mechanical tolerance.
* Confirm that vibration does not cause state chatter.
* Add software debouncing or state persistence if the application requires it.
* Verify safe behavior if CAN communication is lost or the sensor does not trigger.

## Resources

* [CAN Magnetic Switch product page](https://andymark.com/products/magnetic-andymark-standard-sensors?variant=45328203350188)
* Examples
* Device API
