Portable EMG Data Logger

From Embedded Nirvana

Jump to: navigation, search

This wiki page is for updating the project status of the Portable EMG Data Logger.


Raw Idea

The idea is to come up with a open hardware and open software based Portable EMG Data Logger targeted for Medical Use. It will be based on ARM and will be built using open technologies.

It would be somewhat like this :

  EMG Sensor ----> MCU & Peripherals ----> Analytics To SmartPhone/Tablet/PC/Mac          

Raw Idea.

Block Diagram

This is very generic block diagram based on the raw idea. It would change as the project and the idea develops.

Block Diagram.

Micro Controller & Development/Evaluation Board

Toolchain For STM32F4DISCOVERY

Note : Before setting up toolchain, it is recommended to update the system.

Summor ARM Toolchain is being used, to set up toolchain , follow these :

1) Make a directory for downloading the sources :

  $ mkdir ~/stm32f4discovery
  $ cd ~/stm32f4discovery

2) Fetch the summon arm toolchain :

  $ git clone https://github.com/esden/summon-arm-toolchain.git
  $ cd summon-arm-toolchain
  $ ./summon-arm-toolchain 

Executing ./summon-arm-toolchain will start the configuration.

If everything goes well then the toolchain will configured and you can check the ~/sat folder in home which will contain :

  arm-none-eabi  bin  include  lib  libexec share

~/sat/bin contains the ELF executable which are the used to compile the code written for the application.

To confirm that your toolchain is configured apart from above said ~/sat folder your script should give this as the output on the terminal before ending :

       BUILD   lib/stm32/f1
      make[1]: Nothing to be done for `all'.
       BUILD   lib/stm32/f2
      make[1]: Nothing to be done for `all'.
       BUILD   lib/stm32/f4
      make[1]: Nothing to be done for `all'.
       BUILD   lib/lpc13xx
      make[1]: Nothing to be done for `all'.
       BUILD   lib/lpc17xx
      make[1]: Nothing to be done for `all'.
       BUILD   lib/lm3s
      make[1]: Nothing to be done for `all'.
       INSTALL headers
       INSTALL libs
       INSTALL ldscripts
       INSTALL scripts
      Cleaning up libopencm3-3596075ee0f189f8a95090c4fb5522844255a029

Possible Errors While Configuring Toolchain :

  • If after executing the ./summon-arm-toolchain the script isn't able to fetch the NEWLIB then do following :
  1) Download the NEWLIB tar in the sources and save it in sources directory :
  2) Open : $vi summon-arm-toolchain and comment the 321 line. 

This will skip NEWLIB fetching using the script, though the installation will be done by the script only by using the source you downloaded in step 1.

Now execute :


  • After resolving above error possibility is that one can get following error :
   checking for objdir... .libs
   checking for the correct version of gmp.h... yes
   checking for the correct version of mpfr.h... no
   configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
   Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
   their locations.  Source code for these libraries can be found at
   their respective hosting sites as well as at
   ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
   http://gcc.gnu.org/install/prerequisites.html for additional info.  If
   you obtained GMP, MPFR and/or MPC from a vendor distribution package,
   make sure that you have installed both the libraries and the header
   files.  They may be located in separate packages.

To get rid of this, do following assuming you are in summon-arm-toolchain directory  :

   1) Download these packages from here : http://www.multiprecision.org/index.php?prog=mpc&page=download 
   2) cd gcc-linaro-4.5-2011.02-0/ 
   3) tar -jxf ../mpfr-3.1.0.tar.bz2 
   4) mv -v mpfr-3.1.0 mpfr
   5) tar -jxf ../gmp-5.0.2.tar.bz2
   6) mv -v gmp-5.0.2 gmp
   7) tar -zxf ../mpc-0.9.tar.gz
   8) mv -v mpc-0.9 mpc

Now execute the script :

  • This error can also occur during the configuration :
   checking for creal in -lm... yes
   checking for __gmpz_init in -lgmp... yes
   checking for MPFR... no
   configure: error: libmpfr not found or uses a different ABI.
   make[1]: *** [configure-mpc] Error 1
   make[1]: Leaving directory 
    `/home/chetanpatil/LM3S9B96/stm32f4discovery_root/esden-summon-arm-   toolchain-5f14832/build'
   make: *** [all] Error 2

Do following :

   1) sudo yum install ncurses-devel
   2) sudo yum install mpfr-devel

Then run the script again:


Code Repository And Bug Reporting

The code is hosted on github

Please report all your bug on github itself.

How Data Will Be Viewed On SmartPhone/Tablets/PC/Mac ?

We are planning to make use of GNU Health. GNU Health is a free Health and Hospital Information System with the following functionality :

  • Electronic Medical Record (EMR)
  • Hospital Information System (HIS)
  • Health Information System

We would be opting for such solution instead of building one from scratch.

Time Line

This project came alive on 8th Feb 2012

Part Description Status Duration
Signal Conditioning To capture the low signals from EMG sensor by providing a gain before giving it to the Micro controllers ADC pins. PCB for same is ready. Testing is being conducted. 1st March 2012 - Present
Micro-Controller & Target This will be used to control the activities to get desired output. STM32F4DISCOVERY will be used to develop the application. It has ARM Cortex M4F. Details from vendors is being gathered. 20th April 2012 - 5th May 2012
Toolchain To compile code in order to run on the target, we need to set up the toolchain. Summon ARM Toolchain for STM32F4DISCOVERY has been configured. 5th May 2012 - 19th May 2012
Evaluation Board To built a prototype the evaluation STM32F4DISCOVERY board will be used. Will be delivered soon. 20th May 2012 - 30th May 2012
Git Hub Repository is needed to push all the code of the project. Up and running on Git Hub,check link above 26th May 2012
Sample Programs To test STM32F4DISCOVERY sample application program has to be done. Work has started. 30th May 2012 - 7th June 2012
Modular Programming Module wise programming in order to create proper application. From capturing the data till storing or displaying the data in proper manner. In Progress 7th June 2012

Note : Strike out means that part is accomplished.


Note : Under Development

GDB related code:GNU Public licence (GPL)

Rest of the code (like device driver, utilities, etc):Apache 2.0

Hardware Files : Creative Commons Attribution Share-Alike license CC


Chetanpatil 23:45, 30 September 2012 (CDT)

Personal tools