Project #28 – Sensors – EMG Sensor by OYMotion – Mk33

——

#DonLucElectronics #DonLuc #EMG #Sensors #FireBeetle2ESP32E #ESP32 #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

EMG Sensor by OYMotion

——

EMG Sensor by OYMotion

——

EMG Sensor by OYMotion

——

Gravity: Analog EMG Sensor by OYMotion

This analog surface EMG sensor uses reusable metal dry electrodes and integrated filtering with 1000x amplification of signals within ±1.5 mVolt. The transmitter operates from 3.3~5.5 Volt and provides a 0~3.0 Volt analog signal with a 1.5 Volt reference.

This Gravity analog EMG sensor by DFRobot and OYMotion turns surface muscle activity into an input for interactive projects. Reusable metal dry electrodes collect surface electromyography signals without conductive gel, while integrated amplification and filtering prepare the small signals for reading by Arduino or another suitable analog-input controller. The 0~3.0 Volt output supports muscle-activity waveform experiments and software-based interaction, from contraction-triggered robot commands to wearable effects. The kit includes the electrode board, wrist belt, electrode cable and signal transmitter, providing the core sensing hardware for a muscle-controlled prototype. This EMG sensor is intended for non-medical projects.

DL2610Mk01

1 x DFRobot FireBeetle 2 ESP32-E
1 x Adafruit SSD1306
1 x Gravity: IO Shield for FireBeetle 2
1 x Gravity: Analog EMG Sensor by OYMotion
1 x Gravity: Analog Slide Position Potentiometer
1 x Lithium Ion Battery – 1000mAh
1 x USB 3.0 to Type-C Cable

DL2611Mk01p

DL2611Mk01p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #28 – Sensors – EMG Sensor by OYMotion – Mk33
28-33
DL2611Mk01p.ino
DL2611Mk01
1 x DFRobot FireBeetle 2 ESP32-E
1 x Adafruit SSD1306
1 x Gravity: IO Shield for FireBeetle 2
1 x Gravity: Analog EMG Sensor by OYMotion
1 x Gravity: Analog Slide Position (Potentiometer)
1 x Lithium Ion Battery - 1000mAh
1 x USB 3.0 to Type-C Cable
*/

// Include the Library Code
// Wire
#include <Wire.h>
// Adafruit SSD1306
#include <Adafruit_SSD1306.h>
// Arduino
#include "Arduino.h"
// EMG Filters
#include "EMGFilters.h"

// TIMING DEBUG
#define TIMING_DEBUG 0

// iEMG A0
#define iEMG A0

// EMG Filters
EMGFilters myFilter;

// Discrete filters must works with fixed sample frequence
// our EMG filter only support "SAMPLE_FREQ_500HZ" or "SAMPLE_FREQ_1000HZ"
// other sampleRate inputs will bypass all the EMG_FILTER
int sampleRate = SAMPLE_FREQ_1000HZ;

// For countries where power transmission is at 50 Hz - "NOTCH_FREQ_50HZ"
// For countries where power transmission is at 60 Hz - "NOTCH_FREQ_60HZ"
// Our emg filter only support 50Hz and 60Hz input
// Other inputs will bypass all the EMG_FILTER
int humFreq = NOTCH_FREQ_60HZ;

// Calibration:
// put on the sensors, and release your muscles;
// wait a few seconds, and select the max value as the threshold;
// any value under threshold will be set to zero
// static int Threshold = 0;
int Threshold = 0;

// Time Stamp
unsigned long timeStamp;
// Time Budget
unsigned long timeBudget;

// Envelope
int envlope;

// Slide Position (Potentiometer)
int iSP = A1;
int iSPVal;

// Adafruit SSD1306
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// Software Version Information
String sver = "28-33";

void loop() {
  
  // isEMG
  isEMG();
  
  // isDisplay EMG
  isDisplayEMG();

  // Delay
  delay(1000);

}

getDisplay.ino

// Adafruit SSD1306
// isDisplayUID
void isDisplayUID(){

    // Intentar ambas direcciones
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    //Serial.println("Error con 0x3C, probando 0x3D...");
    if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3D)) {
      //Serial.println("Error OLED en ambas direcciones");
      return;
    }
  }
  
  // Clear Display
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  // Don Luc Electronics
  display.setCursor(0,0);
  display.println("Don Luc Electronics");
  // Motor Drive
  display.setCursor(0,20);
  display.print("DL2611Mk01");
 // Version
  display.setCursor(0,20);
  display.print("Version");
  display.setCursor(0,40);
  display.print( sver );
  // Display
  display.display();

}
// isDisplay EMG
void isDisplayEMG(){

  // Clear Display
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  // Don Luc Electronics
  display.setCursor(0,0);
  display.println("Don Luc Electronics");
  // 
  display.setCursor(0,20);
  // Envelope
  display.print("Envelope");
  // Envelope
  display.setCursor(0,40);
  display.print( envlope );
  // Display
  display.display();

}

getEMG.ino

// EMG
// isEMG
void isEMG(){

  // In order to make sure the ADC sample frequence on arduino,
  // the time cost should be measured each loop
  timeStamp = micros();

  // Slide Position (Potentiometer)
  iSPVal = analogRead( iSP );
  // Mapping Function
  iSPVal = map(iSPVal, 0, 4095, 0, 255); 
  // Threshold
  Threshold = iSPVal;

  // Value
  int Value = analogRead(iEMG);

  // Filter Processing
  int DataAfterFilter = myFilter.update(Value);

  // Envelope
  envlope = sq(DataAfterFilter);

    // Any value under threshold will be set to zero
    envlope = (envlope > Threshold) ? envlope : 0;

    // Time Stamp
    timeStamp = micros() - timeStamp;

    // TIMING DEBUG
    if (TIMING_DEBUG) {
        
        Serial.print("Read Data: "); Serial.println(Value);
        Serial.print("Filtered Data: ");Serial.println(DataAfterFilter);
        Serial.print("Squared Data: ");
        Serial.println(envlope);
        Serial.print("Filters cost time: "); Serial.println(timeStamp);
        // The filter cost average around 520 us

    }

    // If less than timeBudget, then you still have (timeBudget - timeStamp) to
    // do your work
    delayMicroseconds(1000);
    // If more than timeBudget, the sample rate need to reduce to
    // SAMPLE_FREQ_500HZ

}

setup.ino

// Setup
void setup()
{

  // Delay
  delay(100);
  
  // Serial
  Serial.begin(115200);
  
  // Delay
  delay( 100 );

  // Wire
  Wire.begin();

  // Delay
  delay(100);

  // EMG Filters
  myFilter.init(sampleRate, humFreq, true, true, true);

  // Setup for time cost measure
  // Using micros()
  timeBudget = 1e6 / sampleRate;
  // Micros will overflow and auto return to zero every 70 minutes
  
  // Delay
  delay( 100 );

  // Adafruit SSD1306 - UID
  // Don Luc Electronics
  // Version
  isDisplayUID();
  
  // Delay
  delay( 5000 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank, Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Leave a Comment