AngleCraft — AS5600 Magnetic Rotary Encoder
About this project
AngleCraft connects an ESP32 to an AS5600 contactless magnetic rotary encoder using raw I2C register reads — no library. A diametrically magnetised neodymium disc magnet rotates above the AS5600 die; the sensor's two orthogonal Hall-effect bridges continuously measure the horizontal magnetic field vector, and an on-chip CORDIC processor computes the arctangent to produce a 12-bit angle value (0 to 4095 = 0° to 360°, resolution 0.0879°). On each 100 ms read cycle the firmware reads the filtered ANGLE register (0x0E-0x0F), masks to 12 bits, converts to degrees, and also reads the 1-byte STATUS register (0x0B), 1-byte AGC register (0x1A), and 12-bit MAGNITUDE register (0x1B-0x1C). Angular velocity in RPM is derived from the delta between consecutive raw readings with explicit wraparound handling at the 4095/0 boundary — when the magnet crosses the zero position, the apparent large step is recognised as a small forward increment. An IIR low-pass filter smooths the RPM trace. An SSD1306 OLED on the shared I2C bus shows angle, RPM, AGC quality, and magnet status in real time. The ESP32's Wi-Fi AP at 192.168.4.1 serves an interactive dashboard with a 200×200 canvas analog gauge (needle rotating to live angle), large angle and RPM readouts, an AGC quality bar, and magnet-status badges.
What you get
- Complete, commented source code
- Full components list with quantities
- Pin-by-pin wiring guide and connection table
- Step-by-step upload and testing guide
- Project report (.docx, IEEE style)
- Presentation slides (.pptx)