Imran Shamsul
Published

Haptic Proximity Module (HPM) for Low Vision users

The Haptic Proximity Module (HPM) enables people with low vision, or other vision impairments, to engage with their direct surroundings.

IntermediateFull instructions provided5,234
Haptic Proximity Module (HPM) for Low Vision users

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Devantech SRF05 Ultrasonic Sonar Range Finder
×1
3V DC Vibrating Motor
×1
50k 9mm Square Potentiometer Linear Single Gang
×2

Story

Read more

Custom parts and enclosures

SS_CUT_BACK.STL

SS_CUT_FRONT.STL

GERBER.zip

Schematics

HPM_Fritzing%20file.zip

Code

HPM_CODE

Plain text
/* Code Developed by 
SCOTT MITCHELL, PhD. RMIT University scott.mitchell@rmit.edu.au
 &
Daud Imran SHAMSUL AMRI www.imranshamsul.com / imran.shamsul@gmail.com
 
 DATE: 22 OCT 2012
 
 Code for custom design pcb.
 Code functions include: 
 
 - Pot to control max distance (min distance set to 2cm so motor will not power on when set)
 - Power Sensor via Pin
 - Button, when motor off, sensor off.
 - second pot to control PWM output
 
 
 
 */

#include "Ultrasonic.h"

#include "Button.h"

Ultrasonic sensor1(9,10); // Ultrasonic(int TP, int EP);
const int MOT1 = 11; //D11 PWM
const int distPotPin = 6; //A6 distance pot
const int pwrPotPin = 7; //A7 power pot
const int sensor1Power = 8; // D8 PWM8

//distance min and max
const int minDistance = 2;  //dist in CM dont go below 2
const int maxDistance = 200;  //dist in CM

//power min and max
const int minPower = 0;
const int maxPower = 255;

int motorPWM, distPot, distControl; 
int outputPWM, pwrPot, pwrControl; 

long cm; 

boolean motorState = true;

Button button1 = Button(2,PULLUP);  //button control



void setup() {
  pinMode(MOT1, OUTPUT);
  pinMode(sensor1Power, OUTPUT);
  digitalWrite(sensor1Power, HIGH);

  Serial.begin(9600); // this just means you can output to the serial panel
}

void loop()
{ 
  if(button1.uniquePress()){ 
    motorState = !motorState;
  }

  button1.isPressed();

  // check the distance pot
  distPot = analogRead(distPotPin);
  distControl = map(distPot,0,1024,minDistance,maxDistance);


 //check the power pot
  pwrPot = analogRead(pwrPotPin); 
  pwrControl = map(pwrPot,0,1024,minPower,maxPower);


  if(motorState){
    cm = sensor1.Ranging(CM);

    motorPWM = map(cm,distControl,minDistance,minPower,pwrControl); //variable map formula relationship
    motorPWM = constrain(motorPWM, 0, 255);

    analogWrite(MOT1, motorPWM); 
    digitalWrite(sensor1Power, HIGH);
  }
  
  else {
    analogWrite(MOT1, 0);
    digitalWrite(sensor1Power, LOW);
  }


  Serial.print(cm);
  Serial.print("cm Max ");
  Serial.print(distControl);
  Serial.print("cm motorState:");
  Serial.print(motorState);
  Serial.print(" pwr control::");
   Serial.print(pwrControl);
 Serial.print(" PWM ");
  Serial.println(motorPWM);

  // delay(50);
}

Credits

Imran Shamsul

Imran Shamsul

1 project • 2 followers

Comments