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!
Carson LaffertyMichael HerterichObyda Marzouk
Published © GPL3+

Safety Monitoring System for Manual Wheelchairs

To monitor user safety, a sensor cluster collects and graphs data of obstacles in the blind spot, wheelchair speed, and degrees of tilt.

BeginnerShowcase (no instructions)3 hours4,550
Safety Monitoring System for Manual Wheelchairs

Things used in this project

Hardware components

Argon
Particle Argon
×3
Breadboard (generic)
Breadboard (generic)
×1
Elegoo Avoidance Sensor
×1
Elegoo Tilt Sensor
×1
Inertial Measurement Unit (IMU) (6 deg of freedom)
Inertial Measurement Unit (IMU) (6 deg of freedom)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
5 mm LED: Yellow
5 mm LED: Yellow
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
ThingSpeak API
ThingSpeak API

Hand tools and fabrication machines

Tape, Velcro® Stick On Tape/Strip
Tape, Velcro® Stick On Tape/Strip
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Breadboard and Argon Box

Breadboard and Argon Lid

Schematics

IOT Wiring Diagram

Code

Argon 1 Data Collection/Graphing and Comms

C/C++
// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>
#include <Particle.h>

TCPClient client;
unsigned int myChannelNumber = 1358740; //ThingSpeak info
const char * myWriteAPIKey = "Y0D0V28Q7URAHLPY"; // ThingSpeak info

int ObjectYes = 1;
int ObjectNo = 0;
int SpeedYes = 1;
int SpeedNo = 0;
int TiltYes = 1;
int TiltNo = 0;

void setup() {
 
Serial.begin(9600);    
    
Particle.publish("PowerOn", PRIVATE);
Particle.publish("CheckConnection", PRIVATE);
    
Particle.subscribe("ObjectY", WC1OY, MY_DEVICES);
Particle.subscribe("ObjectN", WC2ON, MY_DEVICES);
Particle.subscribe("SpeedY", WC3SY, MY_DEVICES);
Particle.subscribe("SpeedN", WC4SN, MY_DEVICES);
Particle.subscribe("TiltY", WC5TY, MY_DEVICES);
Particle.subscribe("TiltN", WC6TN, MY_DEVICES);

ThingSpeak.begin(client);

}

void loop() {

Particle.subscribe("ObjectY", WC1OY, MY_DEVICES);
Particle.subscribe("ObjectN", WC2ON, MY_DEVICES);
Particle.subscribe("SpeedY", WC3SY, MY_DEVICES);
Particle.subscribe("SpeedN", WC4SN, MY_DEVICES);
Particle.subscribe("TiltY", WC5TY, MY_DEVICES);
Particle.subscribe("TiltN", WC6TN, MY_DEVICES);
delay(500); // buffer for data collection

}

void WC1OY(const char *event, const char *data) {
ThingSpeak.setField(1, ObjectYes); // writing data for graphing
ThingSpeak.writeFields(myChannelNumber, 1, myWriteAPIKey);
delay(16000);
} 
void WC2ON(const char *event, const char *data) {
ThingSpeak.setField(1, ObjectNo); // writing data for graphing
ThingSpeak.writeFields(myChannelNumber, 0, myWriteAPIKey);
delay(16000);    
} 
void WC3SY(const char *event, const char *data) {
ThingSpeak.setField(2, SpeedYes);
ThingSpeak.writeFields(myChannelNumber, 1, myWriteAPIKey);
delay(16000);    
} 

void WC4SN(const char *event, const char *data) {
ThingSpeak.setField(2, SpeedNo);
ThingSpeak.writeFields(myChannelNumber, 0, myWriteAPIKey);
delay(16000);    
} 

void WC5TY(const char *event, const char *data) {
ThingSpeak.setField(3, TiltYes);
ThingSpeak.writeFields(myChannelNumber, 1, myWriteAPIKey);
delay(16000);    
} 

void WC6TN(const char *event, const char *data) {
ThingSpeak.setField(3, TiltNo);
ThingSpeak.writeFields(myChannelNumber, 0, myWriteAPIKey);
delay(16000);    
} 

Argon 2 Avoidance Sensor w/ Enabling

C/C++
int Detection = D6; // avoidance sensor
int Enable = D7; // on / off pin for avoidance sensor
int Obj = HIGH; // no obstable
int NoObj = LOW; // obstacle
int val;

void setup() {

pinMode(Detection, INPUT);
pinMode(Enable, OUTPUT);
digitalWrite(Enable, LOW);

Particle.subscribe("PowerOn", start, MY_DEVICES);

Serial.begin(9600);

}

void loop() {
    
val = digitalRead(Detection);

if (val == Obj) { // no obstacle
    
delay(50); // buffer time
Particle.publish("ObjectN", PRIVATE);
delay(50); // Time for sensor to rest
    
}

if (val == NoObj) {

delay(50); // buffer time
Particle.publish("ObjectY", PRIVATE);
delay(50); // Time for sensor to rest    
    
}


}

void start(const char *event, const char *data) {
    digitalWrite(Enable, HIGH);
    
}

Argon 3 Accelerometer and Tilt Sensor w/ Comms Check LED

C/C++
// This #include statement was automatically added by the Particle IDE.
#include <MPU6050.h>

#include <Wire.h> // accelerometer library

#define MPU 0x68 // accelerometer stuff
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;

int Tilt = D2; // Tilt pin
int LED = D3; // connection indication
int val; // tilt variable
int VcX; // velocity
int VcY; // velocity
int VcZ; // velocity

int DeltaTime;
int OldTime = 0;
int NewTime = 60000;


 
void setup() {
Serial.begin(9600);
    
Particle.subscribe("CheckConnection", test, MY_DEVICES);

pinMode(Tilt, INPUT);
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW);

Wire.begin(); // accelerometer setup
Wire.beginTransmission(MPU);
Wire.write(0x6B); 
Wire.write(0);    
Wire.endTransmission(true);

DeltaTime = NewTime - OldTime; // one minute interval as I believe data is sent every 60 seconds
}

void loop() {

  Wire.beginTransmission(MPU);
  Wire.write(0x3B);  
  Wire.endTransmission(false);
  Wire.requestFrom(MPU,12,true);  
  AcX=Wire.read()<<8|Wire.read();    
  AcY=Wire.read()<<8|Wire.read();  
  AcZ=Wire.read()<<8|Wire.read();  
  GyX=Wire.read()<<8|Wire.read();  
  GyY=Wire.read()<<8|Wire.read();  
  GyZ=Wire.read()<<8|Wire.read(); 
  delay(500);
  
    VcX = AcX*(DeltaTime/1000);
    VcY = AcY*(DeltaTime/1000);
    VcZ = AcZ*(DeltaTime/1000);

if (VcX > 2) {
 Particle.publish("SpeedY", PRIVATE);
}

if (VcY > 2) {
 Particle.publish("SpeedY", PRIVATE);
}

if (VcZ > 2) {
 Particle.publish("SpeedY", PRIVATE);
}

if (VcX < 2) {
Particle.publish("SpeedN", PRIVATE);
    
}

if (VcY < 2) {
Particle.publish("SpeedN", PRIVATE);
    
}

if (VcZ < 2) {
Particle.publish("SpeedN", PRIVATE);
    
}

 val = digitalRead(Tilt);
    if (val == HIGH) // tilt sensor is tilted extremely aka wheelchair is knocked over
  {
    Particle.publish("TiltY", PRIVATE);
  }
  if (val == LOW)
  {
    Particle.publish("TiltN", PRIVATE);
  }

}

void test(const char *event, const char *data) {
    digitalWrite(LED, HIGH);
    delay(500);
    digitalWrite(LED, LOW);
    delay(500);
}

Credits

Carson Lafferty

Carson Lafferty

1 project • 3 followers
Michael Herterich

Michael Herterich

1 project • 3 followers
Obyda Marzouk

Obyda Marzouk

0 projects • 2 followers

Comments