Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
roshan-baig
Published © GPL3+

Blind Stick

This is a blind stick which uses arduino UNO

IntermediateFull instructions provided1,239
Blind Stick

Things used in this project

Hardware components

Solar Cockroach Vibrating Disc Motor
Brown Dog Gadgets Solar Cockroach Vibrating Disc Motor
×3
General Purpose Transistor NPN
General Purpose Transistor NPN
×3
Through Hole Resistor, 1 kohm
Through Hole Resistor, 1 kohm
×3
Arduino UNO
Arduino UNO
for soldering micro may be better
×1
Buzzer
Buzzer
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

This is the circuit diagram

Buzzer - A0
Left side:
ultrasonic sensor
trigger-11
echo-10
motor:
transistor collector- motor ground
transistor base - 1 k ohm, which connects to Dp12
transistor emitter - ground
motor positive - VCC
Middle :
trigger pin-9
echo pin - 6
transistor connections are the same as the left sides, only base connects to 8
Right Side:
trigger pin - 5
echo pin - 3
transistor connections are the same as the left sides, only base connects to 2

Code

The code

C/C++
just copy and paste it
long readDistance(int trigPin, int echoPin)
{
  pinMode(trigPin, OUTPUT);
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  pinMode(echoPin, INPUT);
  return pulseIn(echoPin, HIGH)/2;
}
void setup()
{
  pinMode(A0, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(2, OUTPUT);
  Serial.begin(9600);
}
void loop()
{
  int cm1 = readDistance(11,10)/29.1;
  int cm2 = readDistance(9,6)/29.1;
  int cm3 = readDistance(5,3)/29.1;
  map(A0,0,1023,0,255);
  Serial.println(cm1);
  Serial.println(cm2);
  Serial.println(cm3);
  if(cm1 <= 100)
  {
    digitalWrite(12, HIGH);
    digitalWrite(A0, HIGH);
    delay(1000);
    digitalWrite(A0, LOW);
  } else
  {
    digitalWrite(12, LOW);
  }
   if(cm2 <= 100)
  {
    digitalWrite(8, HIGH);
    digitalWrite(A0, HIGH);
    delay(1000);
    digitalWrite(A0, LOW);
  } else
   {
     digitalWrite(8, LOW);
   }
  if(cm3 <= 100)
  {
    digitalWrite(2, HIGH);
    digitalWrite(A0, HIGH);
    delay(1000);
    digitalWrite(A0, LOW);
  } else
   {
    digitalWrite(2, LOW);
    digitalWrite(A0, LOW);
  }
}

Credits

roshan-baig

roshan-baig

5 projects • 7 followers

Comments