{"id":28548,"date":"2019-12-29T17:54:59","date_gmt":"2019-12-29T09:54:59","guid":{"rendered":"\/blog\/?p=28548"},"modified":"2021-07-05T15:20:07","modified_gmt":"2021-07-05T07:20:07","slug":"what-is-emg-sensor-myoware-and-how-to-use-with-arduino","status":"publish","type":"post","link":"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/","title":{"rendered":"What is EMG sensor, Myoware and How to use with Arduino?"},"content":{"rendered":"\n<p>When it comes to EMG sensor with Arduino, Myoware is the one you&#8217;ve probably only heard of. However, here at Seeed, we offer a cheaper alternative for your EMG applications!<\/p>\n\n\n\n<p>Before we introduce our EMG muscle sensor, let&#8217;s understand more about what is an EMG sensor and how it works first! <\/p>\n\n\n\n<p>This guide will cover the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>What is EMG sensor<\/li><li>How does an EMG sensor work<\/li><li>Introduction to Grove &#8211; EMG Detector, a cheaper alternative to Myoware muscle sensor<\/li><li>EMG sensor Arduino Guide and Code<\/li><li>Other biomedical sensor recommendations<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is an EMG Sensor?<\/strong><\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/what-is-emg.png\" alt=\"\" class=\"wp-image-28551\" width=\"293\" height=\"172\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/what-is-emg.png 391w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/what-is-emg-300x176.png 300w\" sizes=\"(max-width: 293px) 100vw, 293px\" \/><figcaption><a href=\"https:\/\/hackaday.io\/project\/8823\/gallery#f23e3092ae58bd3fabe3054d8b1649a1\">ref<\/a><\/figcaption><\/figure><\/div>\n\n\n\n<p>EMG Sensor, also known as electromyography sensor is one that measures small electrical signals generated by your muscles when you move them! <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>This includes lifting your arm up, clenching your fist, or even the simplest of movements like moving a finger!<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Technical details<\/strong><\/h4>\n\n\n\n<p>If you would like to further understand the technical side of things, here&#8217;s how your muscles move and its relationship with ECG: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The whole process starts off in your brain<\/li><li>Neural activity in the motor cortex (part of your brain) signals to the spinal cord <\/li><li>The signal is then conveyed to the muscle part via motor neurons<\/li><li>Motor neurons innervate the muscle directly, causing the release of Calcium ions within the muscle and ultimately creating a mechanical change <\/li><li>This mechanical change involves depolarization (change in electromechanical gradient), which is then detected by EMG for measurement<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What are the types of EMG sensors?<\/strong><\/h2>\n\n\n\n<p>Now that we&#8217;ve had a better understanding of the definition of EMG, we&#8217;ll now take a look at the two types of EMG sensors!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>sEMG sensors (surface electrodes)<\/strong><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/SeeedDocument\/Grove-EMG_Detector\/master\/img\/Grove_emg_demo_2.gif\" alt=\"\" width=\"120\" height=\"160\"\/><figcaption>SEMG sensors placed on the skin<\/figcaption><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>The &#8220;S&#8221; refers to the surface, where this type of EMG sensor takes measurements by placing surface EMG electrodes on your skin <\/li><li>Uses Non-invasive technology, making this EMG sensor type not painful<\/li><li>Commonly applicable in clinics and sports health<\/li><li>Limitations: Though is a simple and easy way of EMG measurement, it&#8217;s restricted to superficial muscles and dependent on other variables such as the weight of patients, etc.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Intramuscular EMG <\/strong><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/www.researchgate.net\/profile\/Francesca_Stival\/publication\/305378844\/figure\/fig2\/AS:384561327427585@1468697973860\/Intramuscular-EMG.png\" alt=\"\" width=\"200\" height=\"200\"\/><figcaption><a href=\"https:\/\/www.google.com\/url?sa=i&amp;source=images&amp;cd=&amp;ved=2ahUKEwiXjPCl9NTmAhVMRK0KHe1lAuQQjRx6BAgBEAQ&amp;url=https%3A%2F%2Fwww.researchgate.net%2Ffigure%2FIntramuscular-EMG_fig2_305378844&amp;psig=AOvVaw0trBG-pIJWedMaGsm9gS2D&amp;ust=1577504480179165\">ref<\/a><br><\/figcaption><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Intramuscular EMG takes measurement through an inserting a monopolar needle electrode through your skin and into the muscle tissue<\/li><li>A common way of EMG sensing<\/li><li>A perfectly safe option, though it may cause discomfort when the needle electrodes are inserted and muscle soreness afterward<\/li><li>Limitations: Possible contamination of deeper muscle recording as the needle shaft is exposed <\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How does EMG sensor work?<\/strong><\/h2>\n\n\n\n<p>Both types of EMG differs from the sensor placement, though its procedures share certain similarities. Here&#8217;s the illustration of how each EMG sensor works! <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"215\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/emg-sensor-placement-1.png\" alt=\"\" class=\"wp-image-28555\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-placement-1.png 622w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-placement-1-300x104.png 300w\" sizes=\"(max-width: 622px) 100vw, 622px\" \/><figcaption><a href=\"https:\/\/www.delsys.com\/downloads\/TECHNICALNOTE\/101-emg-sensor-placement.pdf\">1. EMG Sensor Placement<\/a><\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"366\" height=\"300\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/emg-sensor-oscilloscope-1.png\" alt=\"\" class=\"wp-image-28556\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-oscilloscope-1.png 366w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-oscilloscope-1-300x246.png 300w\" sizes=\"(max-width: 366px) 100vw, 366px\" \/><figcaption><a href=\"https:\/\/www.delsys.com\/downloads\/TECHNICALNOTE\/101-emg-sensor-placement.pdf\">2. EMG Sensor Output Display <\/a><\/figcaption><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>This is how a surface EMG sensor works:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>The process begins with EMG sensor placement; where it&#8217;s placed in the innervation zone of both tendons for better detection quality (Picture 1)<\/li><li>Electrodes begin to detect electrical activity generated by muscle movement\/contraction<\/li><li>Electrical activity detected is then displayed via the form of waves on a monitor (also known as an oscilloscope)<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How an intramuscular EMG work:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>The process begins by inserting a sterile needle (monopolar needle electrode) into the muscle itself <\/li><li>Electrodes begin to detect electrical activity generated by muscle movement\/contraction<ul><li>An audio amplifier may be attached for evaluation of appearance and sound <\/li><\/ul><\/li><li>The electrical activity from your working muscle is measured and displayed on the monitor<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p style=\"background-color:#e7fde2\" class=\"has-background\"><strong>Note: Both EMG sensing sensor procedures should end up with either normal or abnormal results:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Normal results:<\/strong><ul><li>Muscle tissue at rest should be electrically inactive with no waveforms<\/li><li>There should be varying rates and amplitudes spotted on the data when the muscle is fully contracted<\/li><\/ul><\/li><li><strong>Abnormal results:<\/strong><ul><li>Unusual data collected<\/li><li>May result from disorders of muscle, nerves, etc.<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>Overall, the stronger the muscle contraction = the higher the number of activated muscles. Hence, a higher recorded voltage amplitude.   <\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is EMG Sensor used for?<\/strong><\/h2>\n\n\n\n<p>EMG sensors are mostly used for biomedical applications that range from:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Helping doctors diagnose muscle and nerve disorders of patients for early prevention\/treatment<\/li><li>Research tool for <a href=\"https:\/\/en.wikipedia.org\/wiki\/Kinesiology\">kinesiology<\/a><\/li><li>A control signal for prosthetic devices; hands, arms, and lower limbs<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Myoware Muscle Sensor Alternative:\u00a0<a href=\"https:\/\/www.seeedstudio.com\/Grove-EMG-Detector-p-1737.html?utm_source=blog&amp;utm_medium=blog\">Grove\u00a0&#8211;\u00a0EMGDetector<\/a><\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"525\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/Grove-emg-sensor.jpg\" alt=\"\" data-id=\"28568\" data-link=\"\/blog\/?attachment_id=28568\" class=\"wp-image-28568\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/Grove-emg-sensor.jpg 700w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/Grove-emg-sensor-300x225.jpg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption>Grove &#8211; EMG Detector<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"525\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/Emg-sensor-electrodes.jpg\" alt=\"\" data-id=\"28569\" data-link=\"\/blog\/?attachment_id=28569\" class=\"wp-image-28569\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/Emg-sensor-electrodes.jpg 700w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/Emg-sensor-electrodes-300x225.jpg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption>Surface Electrodes that come with it<\/figcaption><\/figure><\/li><\/ul>\n\n\n\n<p>Now for the moment you&#8217;re waiting for, this is the Grove &#8211; EMG Detector, a cheaper alternative to Myoware muscle sensor for your EMG sensing needs!<\/p>\n\n\n\n<p>Similarly to the Myoware muscle sensor, our Grove &#8211; EMG Detector does not need an additional power supply and supports 3.3V &#8211; 5V for easy microcontroller integration!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why\u00a0you\u00a0should\u00a0buy\u00a0this\u00a0EMG\u00a0Sensor\u00a0<\/strong><\/h3>\n\n\n\n<p>Our very own EMG sensor is capable of gathering small muscle signals and processing it with 2th amplify and filter, with the output signal easily recognizable by Arduino!<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Seeed\u2019s very own\u00a0<\/strong><a href=\"https:\/\/www.seeedstudio.com\/document\/pdf\/Introduction%20to%20Grove.pdf\"><strong>Grove system<\/strong><\/a><\/h4>\n\n\n\n<p>Grove system is Seeed very own initiative, allowing for you to pair the Grove &#8211; EMG Sensor with other sensors, shields, modules through plug-and-play!<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>You still need to solder the Myoware Muscle Sensor if\u00a0you\u00a0want\u00a0to\u00a0use\u00a0it\u00a0with\u00a0Arduino<\/strong><\/li><\/ul>\n\n\n\n<p class=\"has-text-color has-vivid-red-color\"><strong>However, with this, it means no more using messy and complicated jumper wires, soldering, or debugging electronic circuits!\u00a0<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"551\" height=\"307\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/typical-myoware-circuit.png\" alt=\"\" data-id=\"28582\" data-link=\"\/blog\/?attachment_id=28582\" class=\"wp-image-28582\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/typical-myoware-circuit.png 551w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/typical-myoware-circuit-300x167.png 300w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/typical-myoware-circuit-360x200.png 360w\" sizes=\"(max-width: 551px) 100vw, 551px\" \/><figcaption>Typical Myoware Arduino Circuit<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"551\" height=\"383\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/grove-myoware-circuit.png\" alt=\"\" data-id=\"28583\" data-link=\"\/blog\/?attachment_id=28583\" class=\"wp-image-28583\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/grove-myoware-circuit.png 551w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/grove-myoware-circuit-300x209.png 300w\" sizes=\"(max-width: 551px) 100vw, 551px\" \/><figcaption>With Grove<\/figcaption><\/figure><\/li><\/ul>\n\n\n\n<p>Apart from the above reasons, the Grove &#8211; EMG Detector has the following features as well:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>3.5mm Connector<\/li><li>6 Disposable Surface Electrodes included<\/li><li>1000mm Cable Leads<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>EMG Sensor Schematic:<\/strong><\/h3>\n\n\n\n<p>To take a deeper look at the Grove &#8211; EMG detector, here&#8217;s its circuit diagram for your reference!<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"499\" height=\"378\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/image-169.png\" alt=\"\" class=\"wp-image-28570\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/image-169.png 499w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/image-169-300x227.png 300w\" sizes=\"(max-width: 499px) 100vw, 499px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>EMG Sensor Arduino Tutorial<\/strong><\/h2>\n\n\n\n<p>Need an EMG sensor Arduino code for the pairing? We got you covered with this EMG sensor Arduino tutorial!<\/p>\n\n\n\n<p>This tutorial will show you how to connect our Grove &#8211; EMG Sensor to a Seeeduino! <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Seeduino is Seeed&#8217;s very own Arduino, built with benefits over the original version<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>What do you need?<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-gallery columns-3 is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"525\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/Seeeduino-lotus.jpg\" alt=\"\" data-id=\"28571\" class=\"wp-image-28571\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/Seeeduino-lotus.jpg 700w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/Seeeduino-lotus-300x225.jpg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption><a href=\"https:\/\/www.seeedstudio.com\/Seeeduino-Lotus-V1-1-ATMega328-Board-with-Grove-Interface.html\">Seeeduino Lotus V1.1<\/a><\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"525\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/grove-led-bar.jpg\" alt=\"\" data-id=\"28573\" data-link=\"\/blog\/?attachment_id=28573\" class=\"wp-image-28573\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/grove-led-bar.jpg 700w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/grove-led-bar-300x225.jpg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption><a href=\"https:\/\/www.seeedstudio.com\/Grove-LED-Bar-v2-0.html\">Grove &#8211; LED Bar<\/a><\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"210\" height=\"157\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2019\/12\/base-shield-7.jpg\" alt=\"\" data-id=\"28574\" data-link=\"\/blog\/?attachment_id=28574\" class=\"wp-image-28574\"\/><figcaption><a href=\"https:\/\/www.seeedstudio.com\/Base-Shield-V2.html\">Grove &#8211; Base Shield<\/a><\/figcaption><\/figure><\/li><\/ul>\n\n\n\n<p style=\"background-color:#f5f5f5\" class=\"has-background\">Note: This tutorial can work without the Base Shield as well since the Seeeduino Lotus V1.1 contains grove ports. <\/p>\n\n\n\n<p style=\"background-color:#f5f5f5\" class=\"has-background\">EMG sensor raspberry pi is made possible as well since it supports other microcontroller platforms. However, users have to write their own software library as it&#8217;s not possible to provide demo code for all supported platforms<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Hardware Configuration:<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Step 1:<\/strong> Plug Grove-Base Shield to Seeeduino<\/li><li><strong>Step 2:<\/strong> Plug Grove &#8211; LED Bar to D8 port<\/li><li><strong>Step 3:<\/strong> Connect Grove &#8211; EMG Sensor to A0 port<\/li><li><strong>Step 4:<\/strong> Plug in the electrodes to Grove &#8211; EMG Sensor and place it on your muscle. Remember to keep a distance between each.<\/li><\/ul>\n\n\n\n<p><strong>It should look something like this once done:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/SeeedDocument\/Grove-EMG_Detector\/master\/img\/Emg_connect.jpg\" alt=\"\" width=\"499\" height=\"378\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Software configurations:<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Step 1: <\/strong>Copy and paste the EMG sensor Arduino code below and upload<ul><li>You may download the code in GitHub <a href=\"https:\/\/github.com\/Seeed-Studio\/Grove_EMG_detector_demo_code\/\">here<\/a>\u00a0as\u00a0well<\/li><\/ul><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Grove - EMG Sensor demo code\n\/\/ This demo will need a Grove - Led Bar to show the motion \n\/\/ Grove - EMG Sensor connect to A0\n\/\/ Grove - LED Bar connect to D8, D9\n\/\/ note: it'll take about serval seconds to detect static analog value\n\/\/ when you should hold your muscle static. You will see led bar from level 10 turn to \n\/\/ level 0, it means static analog value get ok\n\n#include &lt;LED_Bar.h>\n\nLED_Bar bar(9, 8);\n\nint max_analog_dta      = 300;              \/\/ max analog data\nint min_analog_dta      = 100;              \/\/ min analog data\nint static_analog_dta   = 0;                \/\/ static analog data\n\n\n\/\/ get analog value\nint getAnalog(int pin)\n{\n    long sum = 0;\n    \n    for(int i=0; i&lt;32; i++)\n    {\n        sum += analogRead(pin);\n    }\n    \n    int dta = sum>>5;\n    \n    max_analog_dta = dta>max_analog_dta ? dta : max_analog_dta;         \/\/ if max data\n    min_analog_dta = min_analog_dta>dta ? dta : min_analog_dta;         \/\/ if min data\n    \n    return sum>>5;\n}\n\nvoid setup()\n{\n    Serial.begin(115200);\n    \n    long sum = 0;\n\n    for(int i=0; i&lt;=10; i++)\n    {\n        for(int j=0; j&lt;100; j++)\n        {\n            sum += getAnalog(A0);\n            delay(1);\n        }\n        \n        bar.setLevel(10-i);\n    }\n    \n    sum \/= 1100;\n    \n    static_analog_dta = sum;\n\n    Serial.print(\"static_analog_dta = \");\n    Serial.println(static_analog_dta);\n}\n\nint level       = 5;\nint level_buf   = 5;\n\nvoid loop()\n{\n\n    int val = getAnalog(A0);                    \/\/ get Analog value\n    \n    int level2;\n    \n    if(val>static_analog_dta)                   \/\/ larger than static_analog_dta\n    {\n        level2 = 5 + map(val, static_analog_dta, max_analog_dta, 0, 5);\n    }\n    else \n    {\n        level2 = 5 - map(val, min_analog_dta, static_analog_dta, 0, 5);\n    }\n    \n    \/\/ to smooth the change of led bar\n    if(level2 > level)\n    {\n        level++;\n    }\n    else if(level2 &lt; level)\n    {\n        level--;\n    }\n\n    if(level != level_buf)\n    {\n        level_buf = level;\n        bar.setLevel(level);\n    }\n    \n    delay(10);\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Step 2:<\/strong> Upload the code to Seeeduino<ul><li>If you have any problems about code uploading, do refer to <a href=\"http:\/\/wiki.seeedstudio.com\/Getting_Started_with_Seeeduino\">Getting Started With Seeeduino<\/a><\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/SeeedDocument\/Grove-EMG_Detector\/master\/img\/Emg_ide.png\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Testing phase;\u00a0Before\u00a0you\u00a0start\u00a0moving!<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>When you&#8217;ve finished uploading the demo code, it&#8217;ll take about 5s to initialize, and you should keep static when it&#8217;s initializing<\/li><li>You&#8217;ll then see the LED Bar go from level 10 to level 0<\/li><li>When the LED Bar is all off, you can start moving!<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/SeeedDocument\/Grove-EMG_Detector\/master\/img\/Grove_emg_demo_2.gif\" alt=\"\" width=\"180\" height=\"240\"\/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Resources and Going Further<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Grove &#8211; EMG Sensor related Files<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/raw.githubusercontent.com\/SeeedDocument\/Grove-EMG_Detector\/master\/res\/Grove-EMG_Sensor_v1.0.zip\">Grove-EMG Sensor v1.0 Eagle File<\/a><\/li><li><a href=\"https:\/\/raw.githubusercontent.com\/SeeedDocument\/Grove-EMG_Detector\/master\/res\/Grove-EMG_Sensor_v1.1_Eagle.zip\">Grove-EMG Sensor v1.1 Eagle File<\/a><\/li><li><a href=\"https:\/\/raw.githubusercontent.com\/SeeedDocument\/Grove-EMG_Detector\/master\/res\/Grove-EMG_Sensor_v1.1_SCH.pdf\">Grove-EMG Sensor v1.1 schematic PDF<\/a><\/li><li><a href=\"https:\/\/github.com\/Seeed-Studio\/Grove_EMG_detector_demo_code\">Download Arduino Demo Code<\/a><\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>More on Biomedical Sensors:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.seeedstudio.com\/blog\/2019\/10\/14\/biomedical-sensors-types-of-sensors-and-how-it-works\/\">Other Biomedical Sensors offered at Seeed<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Summary<\/strong><\/h2>\n\n\n\n<p>That&#8217;s all for today on EMG Sensors. I hope with today\u2019s blog, you get a deeper understanding of what it is, how it works, and what it takes to build one with an Arduino!<\/p>\n\n\n\n<p>For easy EMG sensor pairing with Arduino, do consider the <a href=\"https:\/\/www.seeedstudio.com\/Grove-EMG-Detector-p-1737.html?utm_source=blog&amp;utm_medium=blog\">Grove &#8211; EMG Detector<\/a>. Start building your EMG related project today!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When it comes to EMG sensor with Arduino, Myoware is the one you&#8217;ve probably only<\/p>\n","protected":false},"author":2850,"featured_media":28587,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"iawp_total_views":0,"footnotes":""},"categories":[1],"tags":[1700,1701],"class_list":["post-28548","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","tag-biomedical-sensors","tag-emg-sensor"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is EMG sensor, Myoware and How to use with Arduino? - Latest News from Seeed Studio<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is EMG sensor, Myoware and How to use with Arduino? - Latest News from Seeed Studio\" \/>\n<meta property=\"og:description\" content=\"When it comes to EMG sensor with Arduino, Myoware is the one you&#8217;ve probably only\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/\" \/>\n<meta property=\"og:site_name\" content=\"Latest News from Seeed Studio\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-29T09:54:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-05T07:20:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png\" \/>\n\t<meta property=\"og:image:width\" content=\"683\" \/>\n\t<meta property=\"og:image:height\" content=\"391\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Shawn\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shawn\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/\",\"name\":\"What is EMG sensor, Myoware and How to use with Arduino? - Latest News from Seeed Studio\",\"isPartOf\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png\",\"datePublished\":\"2019-12-29T09:54:59+00:00\",\"dateModified\":\"2021-07-05T07:20:07+00:00\",\"author\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/c9b61b761840d544e2d830b0e3bc9fe2\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/#primaryimage\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png\",\"contentUrl\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png\",\"width\":683,\"height\":391,\"caption\":\"What is EMG sensor, Myoware and how to use it with Arduino\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.seeedstudio.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is EMG sensor, Myoware and How to use with Arduino?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#website\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/\",\"name\":\"Latest News from Seeed Studio\",\"description\":\"Emerging IoT, AI and Autonomous Applications on the Edge\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.seeedstudio.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/c9b61b761840d544e2d830b0e3bc9fe2\",\"name\":\"Shawn\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5afdc71205d9d485de69bc4b192294e3?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5afdc71205d9d485de69bc4b192294e3?s=96&r=g\",\"caption\":\"Shawn\"},\"url\":\"https:\/\/www.seeedstudio.com\/blog\/author\/shawn\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is EMG sensor, Myoware and How to use with Arduino? - Latest News from Seeed Studio","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/","og_locale":"en_US","og_type":"article","og_title":"What is EMG sensor, Myoware and How to use with Arduino? - Latest News from Seeed Studio","og_description":"When it comes to EMG sensor with Arduino, Myoware is the one you&#8217;ve probably only","og_url":"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/","og_site_name":"Latest News from Seeed Studio","article_published_time":"2019-12-29T09:54:59+00:00","article_modified_time":"2021-07-05T07:20:07+00:00","og_image":[{"width":683,"height":391,"url":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png","type":"image\/png"}],"author":"Shawn","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Shawn","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/","url":"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/","name":"What is EMG sensor, Myoware and How to use with Arduino? - Latest News from Seeed Studio","isPartOf":{"@id":"https:\/\/www.seeedstudio.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/#primaryimage"},"image":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/#primaryimage"},"thumbnailUrl":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png","datePublished":"2019-12-29T09:54:59+00:00","dateModified":"2021-07-05T07:20:07+00:00","author":{"@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/c9b61b761840d544e2d830b0e3bc9fe2"},"breadcrumb":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/#primaryimage","url":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png","contentUrl":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png","width":683,"height":391,"caption":"What is EMG sensor, Myoware and how to use it with Arduino"},{"@type":"BreadcrumbList","@id":"https:\/\/www.seeedstudio.com\/blog\/2019\/12\/29\/what-is-emg-sensor-myoware-and-how-to-use-with-arduino\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.seeedstudio.com\/blog\/"},{"@type":"ListItem","position":2,"name":"What is EMG sensor, Myoware and How to use with Arduino?"}]},{"@type":"WebSite","@id":"https:\/\/www.seeedstudio.com\/blog\/#website","url":"https:\/\/www.seeedstudio.com\/blog\/","name":"Latest News from Seeed Studio","description":"Emerging IoT, AI and Autonomous Applications on the Edge","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.seeedstudio.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/c9b61b761840d544e2d830b0e3bc9fe2","name":"Shawn","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5afdc71205d9d485de69bc4b192294e3?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5afdc71205d9d485de69bc4b192294e3?s=96&r=g","caption":"Shawn"},"url":"https:\/\/www.seeedstudio.com\/blog\/author\/shawn\/"}]}},"modified_by":"jia wei","views":119798,"featured_image_urls":{"full":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",683,391,false],"thumbnail":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover-80x80.png",80,80,true],"medium":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover-300x172.png",300,172,true],"medium_large":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",640,366,false],"large":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",640,366,false],"1536x1536":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",683,391,false],"2048x2048":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",683,391,false],"visody_icon":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",32,18,false],"magazine-7-slider-full":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",683,391,false],"magazine-7-slider-center":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",683,391,false],"magazine-7-featured":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",683,391,false],"magazine-7-medium":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",664,380,false],"magazine-7-medium-square":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2019\/12\/emg-sensor-cover.png",675,386,false]},"author_info":{"display_name":"Shawn","author_link":"https:\/\/www.seeedstudio.com\/blog\/author\/shawn\/"},"category_info":"<a href=\"https:\/\/www.seeedstudio.com\/blog\/category\/news\/\" rel=\"category tag\">News<\/a>","tag_info":"News","comment_count":"0","_links":{"self":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/28548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/users\/2850"}],"replies":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/comments?post=28548"}],"version-history":[{"count":2,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/28548\/revisions"}],"predecessor-version":[{"id":28589,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/28548\/revisions\/28589"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/media\/28587"}],"wp:attachment":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/media?parent=28548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/categories?post=28548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/tags?post=28548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}