Skip to content

ironsheep/P2-Magnetic-Imaging-Tile

Repository files navigation

P2 Magnetic Imaging Tile

Project Maintenance

License: MIT

A Propeller 2 (P2) implementation for interfacing with the SparkFun Magnetic Imaging Tile V3, providing real-time magnetic field visualization and high-speed data acquisition. I'm using the project as my playground, having CLAUDE implement all of the code itself.

NOTE: I'm using this project as a means to dial in the types of information available for download from our P2 Knowledge Base. In doing so i'm continually improving the CLAUDE ability to generate working P2 code in both pasm and spin

Overview

The SparkFun Magnetic Imaging Tile V3 is an 8×8 array of Hall effect sensors capable of visualizing magnetic fields in real-time. This project creates a complete P2-based interface system with two primary objectives:

Primary Purpose: Create a low-hardware-cost magnetic field visualizer using minimal components (P2 + magnetic tile + OLED display)

Secondary Purpose: Determine the maximum achievable frame rate using Propeller 2 hardware with this sensor configuration

Hardware Components

Primary Components

Quick Reference

HDMI Connection (Pin Group 0: P0-P7)

PSRAM Connection (P2 Edge 32MB - DIRB Pins 8-23 → P40-P55)

Pin Range Function Description
P40-P55 Data Bus 16-bit PSRAM data (DIRB bits 8-23 + 32 = P40-P55)
P56 CK PSRAM Clock
P57 CS PSRAM Chip Select

Note: PSRAM driver uses DIRB register for data pins. The bit pattern $00FF_FF00 (bits 8-23) maps to physical pins P40-P55 (add 32 to DIRB bit numbers to get physical pin numbers).

Magnetic Tile Connection (Pin Group 8: P8-P15)

Pin Function Wire Color LA Ch Color Description
P8 (+0) CS VIOLET 00 0-0 YELLOW AD7940 Chip Select
P9 (+1) CCLK WHITE 05 1-1 BROWN Counter Clock (sensor mux)
P10 (+2) MISO BLUE 01 0-1 GREEN AD7940 Data Input
P11 (+3) CLRb GRAY 04 1-0 GRAY Counter Clear (sensor mux)
P12 (+4) SCLK GREEN 02 0-2 BLUE AD7940 SPI Clock
P14 (+6) AOUT YELLOW Analog Input (optional)
GND Ground BLACK Ground connection
3.3V VCC RED Power supply

OLED Display Connection (Pin Group 16: P16-P23)

Pin Function Wire Color LA Ch Color Description
P16 (+0) DIN BLUE 04 2-0 GRAY SPI data output (MOSI)
P18 (+2) CLK YELLOW 05 2-1 BROWN SPI clock (SCLK)
P20 (+4) CS ORANGE 06 2-2 RED Chip Select (active low)
P22 (+6) DC DK GREEN 07 2-3 ORANGE Data/Command select
P23 (+7) RST WHITE 03 1-3 ORANGE Reset (active low)
GND Ground BLACK Ground connection
3.3V VCC RED Power supply

For detailed hardware specifications, see:

Features

Data Acquisition

  • Low-Cost Design: Minimal hardware components for cost-effective implementation
  • Dual ADC Support: P2 internal ADC and external AD7940 14-bit ADC for performance comparison
  • Maximum Frame Rate Testing: Benchmark P2 performance limits with this sensor configuration
  • Frame Buffering: Extensive buffering using P2's 512KB Hub RAM

Visualization

  • Primary Display: 128×128 OLED (SPI) for compact real-time visualization
  • Secondary Display: HDMI output for expanded visualization
  • Debug Logging: Serial output for driver verification and troubleshooting
  • Dual Sensitivity: Normal and 10× amplified displays
  • Color Mapping: Bipolar visualization (red for negative, green for positive fields)
  • Background Calibration: Adaptive baseline correction for improved accuracy

Communication

  • SPI Interface: Direct hardware connection for sensor data and display output
  • Control Interface: TBD - possibly debug console for device control
  • Live Display: Real-time magnetic field visualization without external commands

Operational Modes

Initial Implementation: Live continuous scanning with real-time OLED display

Mode Description Frame Rate
Live Scan Continuous real-time magnetic field visualization Limited by display refresh
High-Speed Maximum speed capture and display Up to 2000 Hz
Debug Single sensor diagnostic via debug console Variable

Note: Command interface for mode switching is under development

Data Format

Frame Structure

Each frame contains 64 sensor readings arranged as an 8×8 grid, processed internally and displayed directly on the OLED screen:

[0,0] [0,1] [0,2] [0,3] [0,4] [0,5] [0,6] [0,7]
[1,0] [1,1] [1,2] [1,3] [1,4] [1,5] [1,6] [1,7]
...
[7,0] [7,1] [7,2] [7,3] [7,4] [7,5] [7,6] [7,7]
  • 64 sensor values per frame
  • Real-time color mapping for OLED display
  • Internal processing without external data output

Project Status

Current Phase: Documentation and Planning

This project is currently in the initial development phase. Comprehensive documentation has been created based on the Arduino reference implementation:

  • ✅ Hardware interface specifications
  • ✅ Communication protocol definition
  • ✅ System architecture design
  • ⏳ P2 source code implementation
  • ⏳ VGA/HDMI display system
  • ⏳ Testing and validation

Documentation

Detailed technical documentation is available in the DOCs/ directory:

Hardware Specifications

Reference Implementation

Technical Datasheets

Applications

Scientific Research

  • Real-time magnetic field visualization
  • Motor and transformer analysis
  • Permanent magnet characterization
  • Electromagnetic interference detection

Educational Use

  • Physics demonstrations
  • STEM outreach activities
  • Interactive magnetic field exploration
  • Engineering design validation

Industrial Applications

  • Quality control testing
  • Magnetic component inspection
  • Research and development tools
  • Prototype validation

Development Requirements

Hardware

Software Tools

  • Propeller 2 development environment
  • PNut or FlexProp compiler
  • Serial terminal application
  • Debug console for development and diagnostics

Getting Started

  1. Hardware Setup: Connect the magnetic imaging tile to P2 using the pinout above
  2. Display Setup: Connect 128×128 OLED display via SPI for primary visualization
  3. Compile Code: Use PNut or FlexProp to compile the P2 source code (when available)
  4. Load Program: Upload the compiled binary to P2
  5. Operation: Device will automatically start live scanning and display magnetic fields
  6. Optional: Connect HDMI display for secondary visualization

Contributing

This is an open-source project under the MIT License. Contributions are welcome for:

  • P2 source code implementation
  • Performance optimization
  • Feature enhancements
  • Documentation improvements
  • Testing and validation

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Contact

Project Maintainer: Stephen M Moraco Organization: Iron Sheep Productions LLC

For questions, issues, or contributions, please use the project's issue tracking system.


If you like my work and/or this has helped you in some way then feel free to help me out for a couple of ☕'s or 🍕 slices or support my work by contributing at Patreon!

coffee    -OR-    PatreonPatreon.com/IronSheep


About

Instantly see, capture, and analyze magnetic fields in real-time with this high-speed, 64-pixel magnetic imaging board.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Contributors