Coder Social home page Coder Social logo

distancesensor's Introduction

DISTANCE SENSOR

Distance Sensor with Arduino, perfect for cars. With LCD screen, LED, buzzer and pause button. Check a real time emulation in circuits.io. alt tag

 


OUTPUTS & INPUTS

This distance sensor allows 3 different outputs and 1 input:

  • OUTPUTS:
    • LCD Screen: Shows "Distance: XXXcm" and "Range: X" (or "PAUSED"), with both contrast and backlight regulators (by two potenciometers)
    • LED: Flashes, faster as the distance is smaller
    • Buzzer: Beeps, faster as the distances is smaller
  • INPUTS:
    • Button: Pause/Resume Button

 

 


CONFIGURATION

Distance Ranges and Beep periods (distanceSensor.ino):

const int rangesSize = 4;
const short int ranges[rangesSize]    = {10, 30, 100, 200};  // cm
const short int periods[rangesSize-1] = {200, 600, 1500};    // ms
  • cm < ranges[0]: LED and the buzzer with continuous light and sound.
  • cm > ranges[rangesSize-1]: LED and the buzzer with no light nor sound.
  • ranges[i] < cm < ranges[i+1]: LED and buzzer with flash and beep every periods[i] milliseconds.

Sensing Range and Frequency (Ultrasonic.cpp):

Time_out=12000;  // 6000 µs = 1m // 30000 µs = 5 m 

Time_out determines the maximum sensing range, proportional to the relation 6000µs->1m (max is 24000µs->4m). It also affects the sensing frequency (the Time_out is the minimum time for each distance measure).

 

 


ABOUT SENSOR (HC-SR04) & EMULATION (circuits.io)

This setup has been developed for the Ultrasonic Sensor HC-SR04, which is not available in circuits.io (another one is shown just for cosmetic reasons). Then, note that:

  • To test the program from circuits.io emulator, go to my project and modify the line in the code (just in case you want to test it with different distances):
// manually set cm=15, cause circuits.io does not handle the HC-SR04 Ultrasonic Sensor
cm=15;
  • The HC-SR04 would be connected as shown in the Breadboard mini "Ultrasonic_Interface":
    • VCC: yellow
    • Trig: orange
    • Echo: red
    • GND: brown
  • Note that it might run slowly, due to the emulation capabilities.

 

 


OTHER NOTES

The ultrasonic distance sensor range is quite wide (around 20º) and it fails when the surface is not perpendicular or homogeneus. Maybe, a setup with many laser distance sensors would solve those issues.

 

 


LICENSE

This software is under MIT license.

distancesensor's People

Contributors

jaimemartinsoler avatar

Stargazers

 avatar  avatar  avatar Shyri Villar avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.