Mbed Magnet Location Classification System

Project Members

Tanmay Bangalore, Blake Bergquist, Ye Tian, and Zhenxuan Zhang

Introduction

This Wiki page shows you how to build a magnet location detection system described in [1] using the mbed platform. This system can potentially be used as a tongue-computer-interface device to help people with severe disabilities in their daily life. While the Tongue Drive System in [1] sends raw data to the PC for signal processing, this system performs the location classification algorithm in the microcontroller. Also, we utilize accelerometer data to cancel the Earth’s magnetic field to increase the accuracy of the system when in motion. We have implemented an RPC communication protocol over serial between Mbed and a C# based GUI. In the future, we will build a BLE based wireless Mbed solution to communicate with a smartphone platform.

/media/uploads/jazhang/system_overview.png

Hardware Requirements

Software Requirements

  • Windows 7 and above
  • Visual Studio 2012 and above
  • Access to Internet to download source code and compile mbed code

Wiring info

Mbed pinMicroSDLSM303D1LSM303D2LSM303D3LSM303D4Description
GNDGNDGNDGNDGNDGND
VOUTVCCVINVINVINVIN3.3V regulated voltage out from mbed
p5DImbed SPI MOSI
p6DOmbed SPI MISO
p7SCKmbed SPI SCK
p10CS
p11SDASDASDASDAmbed SPI MOSI
p12SDOSDOSDOSDOmbed SPI MISO
p13SCLSCLSCLSCLmbed SPI SCK
p14CS
p15CS
p16CS
p17CS

Information

We discovered during testing that the SD card cannot share the same SPI bus as the LSM303D chips.

Source Code

C# GUI source code and executable
mbed binary file

Import programECE4180_final_project_serial

the rpc serial interface part of the project

Technical Detail - GUI

A customized C# based GUI is developed to control the magnet location classification system from PC.

A RPC Serial library from mbed is used to communicate with PC. The library can be found here:

Import libraryRPCInterface

No documentation found.

Examples are available at this link: /users/nambvarun/notebook/rpc-tutorial/

The C# RPC Library is also used in this project. The code can found at the following link:/media/uploads/tianyeapply/4180_final_project.7z

NOTE We have only tested Digital IO and RPC call for the C# library.

A serial callback function is used to collect responses from mbed. The example is available here: https://msdn.microsoft.com/en-us/library/system.io.ports.serialport.datareceived(v=vs.110).aspx.

/media/uploads/jazhang/gui_flow.png

/media/uploads/jazhang/gui.png

GUI Instruction

  • Serial Port: Showing all available Serial Ports.
  • Connect: Connect to the selected Serial Port.
  • emf: Collect the external magnetic field data. Please make sure that no magnet is close to the system.
  • Number of Points: The number of data points collected at each label.
  • Number of Labels: The number of labels for this training session.
  • Repeat Times: The number of repetitions for each labeled trial.
  • Reset: Clean all train data in mbed.
  • Confirmation: Request mbed to start collecting training data.
  • Train: When all data is collected, start training process.
  • Update frequency: Setting how often the program will update the position info. Default is 1 second.
  • Start: Request the location of the magnet.
  • Magnet Location: Output screen that indicate the location of the next labeled training data set.
  • Current Magnet Location: Showing the predicted location of magnet based of training data.
  • Debug info: Show all return message from mbed.

First time user's guide

  1. Connect to Serial Port
  2. Collect EMF Data
  3. Reset Train Data
  4. Training
    • Input training arguments
      • Input Number of Points per Label
      • Input Number of Labels
      • Input Repeat Times
    • Move magnet to the location shown in Magnet Location and collect train data
    • Click Train button when all the points data have been successfully collected
  5. Test
    • Set frequency and start test.
    • Moving magnet. Its current location is shown in the Current Magnet Location text box.

Note

The program will collect x points at each Label 0, 1, 2.....y. It will repeat z times. So the program will collect x*y*z points in total.

Technical Detail - mbed

Mbed will take the RPC call from C# and implement appropriate functions. /media/uploads/jazhang/data_flow.png

Technical Detail - Magnet Location Classification Algorithm

Please see details in the following link: Magnet Location Classification Algorithm using Support Vector Machines

Technical Detail - Data Acquisition

Please see details in the following link: LSM303D Library

Demo

Future Work

  • Add BLE based wireless communication between mbed to a smart phone
  • Select Suitable mbed solution and peripheral hardwares
  • Customize PCB design
  • Clinical Trial

References

[1] Z. Zhang, S. Ostadabbas, M.N. Sahadat, N. Sebkhi, D. Wu, A.J. Butler, and M. Ghovanloo, "Enhancements of a tongue-operated robotic rehabilitation system," Proc. IEEE Biomedical Circuits and Systems Conf. , pp. 25-28, Oct. 2015.
DOI: 10.1109/BioCAS.2015.7348284.


Please log in to post comments.