Skip to content

Commit

Permalink
changes final
Browse files Browse the repository at this point in the history
  • Loading branch information
Zardian18 committed Oct 1, 2022
1 parent ebdb73a commit 5e58d6e
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ In other words, our sensor unit is a **wearable controller**.

For a proof of concept, we've adapted our sensor unit for a very specific physiotherapy exercise - _wrist mobility exercise_. We've fitted our sensor onto a glove that allows the patient to easily perform the said exercise. On a very very fundamental level, if you twist your wrist to the left, the game character moves to the left and if you twist your wrist to the right, the game character moves to the right.

![gif_final](https://user-images.githubusercontent.com/56624437/193396706-3e293204-4cea-4678-ace4-04a4525e6b7f.gif)

## Sounds good, but is it only for the wrist?
We're not the kind to leave you high and dry, which is why we made sure there's plenty to do with our system. The standalone nature of our device makes it easy for us to integrate it for a wide variety of exercises. You can strap it to your head and accordingly gamify neck exercises. Or let's say for example you've broken your hand (praying that it never comes to that) and you want a simpler way to control your mouse. Well, here's the sensor you were looking for to automate the same.

Expand All @@ -22,6 +24,19 @@ Well, I don't know about you, but traditional physiotherapy sounds INCREDIBLY bo
We aim to make physiotherapy fun by integrating traditional exercises with games, thereby gamifying the approach. Using an interactive and rewarding approach for such a procedure makes the patient want to come back and follow up with the doctor. This leads to better treatment and adherence to the exercise program, leading to long term benefits. While we agree that a specialist is needed, we feel that the approach towards physiotherapy could use some changes and we are bringing that change.

## Time to go a bit technical
(INSERT IMAGE OF CIRCUIT)
(INSERT IMAGE OF GLOVE)
![Circuit](https://user-images.githubusercontent.com/56624437/193395574-d6ed1b3f-5a43-4b4f-b352-833de408405b.jpeg)


![Glove](https://user-images.githubusercontent.com/56624437/193395575-f03ce484-dff3-4f05-91fe-7fc4fe2d7e08.jpeg)


![Flowchart](https://user-images.githubusercontent.com/56624437/193396092-12684203-c158-42db-afd4-4c8687b3b780.jpeg)

## Here's what we built in one night ;)

https://drive.google.com/drive/folders/1FN19KEVdUctF4e_bkgBD_r7qY-7iKUb1?usp=sharing

https://drive.google.com/drive/folders/1FN19KEVdUctF4e_bkgBD_r7qY-7iKUb1?usp=sharing



112 changes: 112 additions & 0 deletions WiFiClient.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>

const char* ssid = "Galaxy J6D0AF";
const char* password = "heyitsdsp#68+1";

Adafruit_MPU6050 mpu;
float threshold = 3;

char player_state;
bool player_shoot;

WiFiUDP Udp;
unsigned int port = 25666;
char packet[255];

IPAddress ip(192, 168, 12, 239);
IPAddress gateway(192, 168, 21, 131);
IPAddress subnet(255, 255, 255, 0);

void setup()
{
Serial.begin(115200);
Serial.println();

if (!mpu.begin()) {
Serial.println("Failed to find MPU6050 chip");
while (1) {
delay(10);
}
}

mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
mpu.setGyroRange(MPU6050_RANGE_500_DEG);
mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);

WiFi.hostname("NODE-MC_UWU");
WiFi.config(ip, gateway, subnet);

Serial.printf("Connecting to %s ", ssid);
WiFi.begin(ssid, password);

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

Serial.println("Connection Successful");
Udp.begin(port);
Serial.printf("Listener started at IP %s, at port %d", WiFi.localIP().toString().c_str(), port);
Serial.println();
}

void loop()
{
sensors_event_t a, g, temp;
mpu.getEvent(&a, &g, &temp);

// Player movement!
if(g.gyro.x <= threshold * -1)
{
player_state = 'L';
}
else if(g.gyro.x >= threshold)
{
player_state = 'R';
}

// Player shooting!
if(player_state == 'L' && g.gyro.y <= threshold * -1)
{
player_shoot = true;
}
else if(player_state == 'R' && g.gyro.y >= threshold)
{
player_shoot = true;
}
else if(g.gyro.z >= threshold)
{
player_shoot = true;
}
else
{
player_shoot = false;
}

int packetSize = Udp.parsePacket();
if (packetSize)
{
Serial.printf("Received %d bytes from %s, port %d", packetSize, Udp.remoteIP().toString().c_str(), Udp.remotePort());
int len = Udp.read(packet, 255);
if (len > 0)
{
packet[len] = 0;
}
Serial.printf("UDP packet contents: %s", packet);
Serial.println();
}

String randata = String(random(100));
char char_array[randata.length() + 1];
randata.toCharArray(char_array, randata.length()+1);
Udp.beginPacket (Udp.remoteIP(), Udp.remotePort());
Udp.write(player_state);
Udp.endPacket();

delay(300);
}

0 comments on commit 5e58d6e

Please sign in to comment.