Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
the-3d6 committed Nov 21, 2022
0 parents commit 41f59f8
Show file tree
Hide file tree
Showing 12 changed files with 1,180 additions and 0 deletions.
458 changes: 458 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
= uMyo_BLE Library for ESP32 =

This library allows to receive data from uMyo devices using BLE mode of ESP32 radio,
providing muscle activity readings, roll, pitch, yaw angles and 4-bins spectrum

== License ==

Copyright (c) Ultimate Robotics. All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

# uMyo Library for Arduino

This library allows to receive data from uMyo devices using BLE mode of ESP32 radio,
providing muscle activity readings, roll, pitch, yaw angles and 4-bins spectrum

# License

Copyright (c) Ultimate Robotics. All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 changes: 31 additions & 0 deletions examples/umyo_IMU/umyo_IMU.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Obtaining orientation data from uMyo via BLE on ESP32
Usage: run the code on ESP32 device
- open Serial Plotter (or Serial Monitor) at 115200 speed
- turn on uMyo device
- switch it into BLE mode if necessary (to switch, press button once or twice, depending on current mode)
- you should see Yaw, Pitch, Roll angles on a plot (or serial output)
*/

#include <uMyo_BLE.h>

void setup() {
Serial.begin(115200);
uMyo.begin();
}

void loop()
{
int dev_count = uMyo.getDeviceCount(); //if more than one device is present, show all of them
for(int d = 0; d < dev_count; d++)
{
Serial.print(uMyo.getYaw(d));
Serial.print(' ');
Serial.print(uMyo.getPitch(d));
Serial.print(' ');
Serial.print(uMyo.getRoll(d));
if(d < dev_count-1) Serial.print(' ');
else Serial.println();
}
delay(30);
}
39 changes: 39 additions & 0 deletions examples/umyo_LED_strip/umyo_LED_strip.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
Obtaining muscle data from uMyo via BLE on ESP32 and showing
activity level on a connected WS2812 LED strip
*/

#include <uMyo_BLE.h>
#include <FastLED.h>

#define NUM_LEDS 16
#define DATA_PIN 13

CRGB leds[NUM_LEDS];

void setup() {
Serial.begin(115200);
uMyo.begin();
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
for(int l = 0; l < NUM_LEDS; l++)
leds[l] = CRGB(0, 0, 0);
FastLED.show();
}

void loop()
{
int dev_count = uMyo.getDeviceCount(); //if more than one device is present, show all of them
float muscle_level = 0;
if(dev_count > 0) muscle_level = uMyo.getMuscleLevel(0); //take data from the 1st connected device if more than 1 is connected
float max_level = 600; //defines sensitivity - the lower is maximum, the less effort is needed to fill all LEDs
int active_leds = NUM_LEDS * muscle_level / max_level;
int brightness = 150;
for(int l = 0; l < NUM_LEDS; l++)
{
if(l < active_leds) leds[l] = CRGB(l * brightness / NUM_LEDS, 0, brightness/2); //blue -> purple red color scale
else leds[l] = CRGB(0, 0, 0);
}
FastLED.show();
delay(5);
}

27 changes: 27 additions & 0 deletions examples/umyo_basic/umyo_basic.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Obtaining muscle data from uMyo via BLE on ESP32
Usage: run the code on ESP32 device
- open Serial Plotter (or Serial Monitor) at 115200 speed
- turn on uMyo device
- switch it into BLE mode if necessary (to switch, press button once or twice, depending on current mode)
- you should see muscle activity chart on a plot (or as serial output)
*/

#include <uMyo_BLE.h>

void setup() {
Serial.begin(115200);
uMyo.begin();
}

void loop()
{
int dev_count = uMyo.getDeviceCount(); //if more than one device is present, show all of them
for(int d = 0; d < dev_count; d++)
{
Serial.print(uMyo.getMuscleLevel(d));
if(d < dev_count-1) Serial.print(' ');
else Serial.println();
}
delay(30);
}
28 changes: 28 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#######################################
# Syntax Coloring Map For Keyboard
#######################################

#######################################
# Datatypes (KEYWORD1)
#######################################

#######################################
# Methods and Functions (KEYWORD2)
#######################################

uMyo KEYWORD2
begin KEYWORD2
stop KEYWORD2
getDeviceCount KEYWORD2
getBattery KEYWORD2
getID KEYWORD2
getDataID KEYWORD2
getMuscleLevel KEYWORD2
getSpectrum KEYWORD2
getRoll KEYWORD2
getPitch KEYWORD2
getYaw KEYWORD2

#######################################
# Constants (LITERAL1)
#######################################
9 changes: 9 additions & 0 deletions library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name=uMyo_BLE
version=1.0.0
author=the_3d6 from Ultimate Robotics
category=Sensors
maintainer=hi@ultimaterobotics.com.ua
sentence=Allows to get data from uMyo devices using ESP32 device via BLE.
paragraph=Receives data from uMyo devices using BLE radio and makes them available
url=https://github.com/ultimaterobotics/uMyo_BLE
architectures=esp32
Loading

0 comments on commit 41f59f8

Please sign in to comment.