Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Wi-Fi Controlled Servo Motor with MyoWare Muscle Sensor and Arduino

View and Edit Project In Cirkit DesignerImage of Wi-Fi Controlled Servo Motor with MyoWare Muscle Sensor and Arduino

Circuit Documentation

Summary

This circuit involves an Arduino UNO with WiFi capabilities, a MyoWare Muscle Sensor, and a Servo motor. The MyoWare Muscle Sensor reads muscle activity and sends the data to the Arduino, which then transmits the data over WiFi. The Arduino also controls a Servo motor based on the muscle sensor readings.

Component List

  1. Servo

    • Description: A servo motor used for precise control of angular position.
    • Pins: GND, VCC, PWM
  2. MyoWare Muscle Sensor

    • Description: A sensor that measures muscle activity.
    • Pins: +, -, SIG, RAW, SHID, GND
  3. Arduino UNO+WiFi R3 ATmega328P+Node MCU ESP8266 CH340G

    • Description: A microcontroller board with built-in WiFi capabilities.
    • Pins: KORF, RST, 3.5v, 5.0v, GND, VIN, A0, A1, A2, A3, A4, A5, SCL, SDA, ARET, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, TX, RX

Wiring Details

Servo

MyoWare Muscle Sensor

Code Documentation

/*
 * This Arduino sketch reads data from the MyoWare Muscle Sensor and sends it
 * to another Arduino over WiFi. The network name is 'D0' and the password is
 * '00000000'.
 */

#include <ESP8266WiFi.h>
#include <WiFiClient.h>

const char* ssid = "D0";
const char* password = "00000000";

WiFiClient client;

const int muscleSensorPin = A0; // MyoWare Muscle Sensor connected to A0
const int servoPin = 10; // Servo connected to pin 10

void setup() {
  Serial.begin(115200);
  pinMode(muscleSensorPin, INPUT);
  pinMode(servoPin, OUTPUT);
  connectToWiFi();
}

void loop() {
  int muscleValue = analogRead(muscleSensorPin);
  sendData(muscleValue);
  delay(1000); // Send data every second
}

void connectToWiFi() {
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void sendData(int data) {
  if (client.connect("<SECOND_ARDUINO_IP>", 80)) {
    client.print("GET /update?value=");
    client.print(data);
    client.println(" HTTP/1.1");
    client.println("Host: <SECOND_ARDUINO_IP>");
    client.println("Connection: close");
    client.println();
    client.stop();
  } else {
    Serial.println("Connection to server failed");
  }
}

Code Explanation