Git Product home page Git Product logo

ultrasonic-music's Introduction

Ultrasonic music

Hello, this is about really simple project, we will need:

• Arduino Mega - you could use any other Arduino Board
• HC-SR04 Ultrasonic Sensor - more later
• Piezo Buzzer or Speaker
• Jumper Cables - Male to Male
• A functioning computer with the Arduino IDE installed

Ultrasonic sensor
We will be using this sensor to measure distances.

It detects the distance of the closest object in front of the sensor (from 3 cm up to 400 cm). As the name indicates, ultrasonic sensors measure distance by using ultrasonic waves. The sensor head emits an ultrasonic wave and receives the wave reflected back from the target. Ultrasonic Sensors measure the distance to the target by measuring the time between the emission and reception.

picture for better understanding
https://www.keyence.com/Images/sensorbasics_ultrasonic_info_img_01_1547954.jpg

You may ask how we calculate the distance. The formula is:
L = 1/2 × T × C
where L is the distance, T is the time between the emission and reception, and C is the sonic speed the value is multiplied by 1/2 because T is the time for go-and-return distance.

How does project work?
We use the distance detection of the sensor to set up different musical notes. So if there is an obstruction at 4 cm it plays one note, and a different note if the obstruction is at 10 cm. Doing this, we can get an octave of notes, which we play using an obstruction. The trigger pin sends out a pulse, and the echo pin receives its echo from the object. They work in unison to determine the time taken to return. We then convert this time into distance.

These are the notes and their ideal distances from the sensor. You can be off by half a centimeter while actually playing.

• e4 - 5cm
• d4# - 9cm
• b3 - 13cm
• d4 - 17cm
• c4 - 21cm
• a3 - 25cm
• d3 - 29cm
• f3 - 33cm
• a3# - 37cm
• g3 - 41cm
• f4 - 45cm
• e4 - 49cm
Best video were you see what it will do: https://youtu.be/O31HjD2ifUE

You can find a curcuit in folder. If you like this project dont forget to give me a star and thats all have a nice day :)

ultrasonic-music's People

Contributors

markodufala 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.