gcarkenbout
Published © CC0

Talking Ultrasonic Warning system with Arduino Pro Mini

The system was developed to warn people if they come within a distance of 1, 5 meter to the man or woman porting this system.

IntermediateProtip786
Talking Ultrasonic Warning system with Arduino Pro Mini

Things used in this project

Hardware components

Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Speaker: 0.25W, 8 ohms
Speaker: 0.25W, 8 ohms
×1
Arduino Pro Mini 328 - 5V/16MHz
SparkFun Arduino Pro Mini 328 - 5V/16MHz
×1
Arduino UNO
Arduino UNO
UNO used without the microprocessor to upload code into Arduino Pro Mini
×1

Software apps and online services

Arduino IDE
Arduino IDE
The environment Arduino 1.8.13 was used to compile the program

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires

Story

Read more

Schematics

Layout of Warning system

The wiring of the system can be defined in the image

WarningWarning

Video of the speaking Warning-unit in action

Connections

Interconnection of the Arduino Pro Mini and HC-SR04

Code

SpeakDistance_Void_last

Arduino
The program uploaded in the Arduino Pro Mini and controls the Warning Unit
#include "Talkie.h"
#include "Vocab_US_Large.h"
#include "Vocab_US_Acorn.h"
#include "Vocab_Special.h"

// Define pins for ultrasonic- and ledpins
int const trigPin = 11;
int const echoPin = 12;
int const ledpin = 2;

void setup(){
Serial.begin(9600);
pinMode(trigPin, OUTPUT); // trig pin will have pulses output
pinMode(echoPin, INPUT); // echo pin should be input to get pulse width
pinMode(ledpin, OUTPUT); // led pin is output to control buzzering
}

Talkie voice;

void loop(){
  int duration, distance;
  setup();
  digitalWrite(trigPin, LOW); //reset trigPin
  // Output pulse with 10 microsec width on trigPin
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  // Measure the pulse input in echo pin
  duration = pulseIn(echoPin, HIGH); // duration lenghtened
  // Distance is half the duration devided by 29.1 (from datasheet)
  distance = (duration/2) / 29.1;
  if (distance <= 130) {
    digitalWrite(ledpin, HIGH);
    SpeakLoud();
    } 
  else {
   digitalWrite(ledpin, LOW);
    }
  // Waiting 500 ms 
 delay(500);
}
  
void SpeakLoud(){
   voice.say(spPAUSE2);
   voice.say(sp4_WARNING);
   voice.say(sp4_WARNING);
   voice.say(spa_NOT);
   voice.say(spPAUSE2);
   voice.say(sp3_ONE);
   voice.say(sp2_METER);
   voice.say(sp3_FIFTY);
 }

Credits

gcarkenbout
1 project • 1 follower
Contact

Comments

Please log in or sign up to comment.