Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Anip Shah
Published © MIT

An EMG-Controlled Claw With Arduino

EMG-based control of a servo-driven claw via Arduino, enabling precise muscle-actuated manipulation.

IntermediateProtip2 hours2,855
An EMG-Controlled Claw With Arduino

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
EMG Sensor Module
×1
Mechanical Robot Claw
×1
9V battery (generic)
9V battery (generic)
×2
EMax 12g ES08MD high Sensitive servo
Seeed Studio EMax 12g ES08MD high Sensitive servo
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Interfacing EMG module & Servo motor With Arduino nano

Code

EMG controlled Servo Motor

C/C++
* Change the angle of servo in code according to your need.
* Low-pass filter is used to increase accuracy of EMG reading.
#include <Servo.h>

int emgPin = A0;         
int servoPin = 7;       

Servo servo;              
int emgThreshold = 20;   // Adjust this threshold as needed
float emgFiltered = 0.0; // Filtered EMG value
float alpha = 0.2;       // Filter coefficient

void setup() {
  Serial.begin(9600);
  servo.attach(servoPin); 

void loop() {
  int emgValue = analogRead(emgPin); 

  // Apply the low-pass filter
  emgFiltered = (alpha * emgValue) + ((1 - alpha) * emgFiltered);

  if (emgFiltered > emgThreshold) {
   
    servo.write(120); //Change servo position acc. to your requirement
  } else {
    
    servo.write(30);
  }

  Serial.print("EMG Value: ");
  Serial.println(emgFiltered);

  delay(50); // Adjust the delay as needed
}

Credits

Anip Shah

Anip Shah

9 projects • 4 followers
Tech enthusiast and programmer who also happens to be a Biomedical Engineer.

Comments