This exercise is intended to help students to understand how to scan the magnetic anomaly from three magnetic disks using a MATLAB/LEGO MINDSTORMS 2D scanner.
- Build a 2D scanner on rails with an iPhone with MATLAB Mobile installed to read the vector xyz magnetometer data.
- Use the scanner to perform xy measurements of the magnetic anomaly caused by three 10 mm x 6 mm thick Y10 ferrite magnet disks with support up to 0.114 kg pull per pack of 20 magnets.
- Create a MATLAB script to run the 2D scanner. Use the WiFi network to send the data from the iPhone to the computer.
- Display the the 2D data graphically and discuss the results with respect to the location and strength of the magnet disks.
Solution
- First you have to build the 2D scanner according to the LEGO building instructions. The building instructions are in an LXF file which can be opened with the free LEGO Digital Designer software, which is available for Computers running macOS or Windows. After launching the software you can use the view menue to switch from the construction mode to the building instructions mode.
- Your MATLAB script creates connections to the motors and the touch sensor, moves the 2D scanner in small steps and measures the xyz magnetic field using the iPhone. Using the MATLAB function imagesc we display the data in a pseudocolor plot. Unfortunately the iPhone sensor creates jumps (see image below) that need to be corrected.
LEGO building instructions and MATLAB script to run the experiment
Exercise_2D_Scanner_iPhone_Magnetic_Sensor the building instructions, the MATLAB script and example data file. The LXF file contains the building instructions to be used with the free LEGO Digital Designer software available for macOS and Windows.