Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: HC-SR04 Ultrasonic proximity Teensy 3.0 MIDI

  1. #1

    HC-SR04 Ultrasonic proximity Teensy 3.0 MIDI

    Hey guys,

    Been creating a midi controller for my project work

    It's a synth controller with one available octave on 12 buttons and 2 octave increment and decrement

    I have a button with an led flashing to my midi clock and a ADXL335 with 3 available axis of parameter control with a rgb led as output.

    I showed it to a friend and he passed me a ultrasonic proximity sensor he had from a failed robotics project but I can't get it working...

    Has anyone got one of these working on a teensy 3.0 sending midi?? I just can't get my head around how to implement it

  2. #2
    Guess this has not been done before :/ maybe I'll just use infrared :P

  3. #3
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    I have to admit that I have a hard time to detemint what "that" is. What is it that you want to accomplish with the Proximity sensor ?

    Would you ahve a link to a data sheet ?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,637
    Quote Originally Posted by Deadp1xels View Post
    I showed it to a friend and he passed me a ultrasonic proximity sensor he had from a failed robotics project but I can't get it working...
    Without a link to technical info about this sensor, it's hard to give any advice.

    Even just posting a photo of the sensor, if you don't have any info, might let someone recognize it?

  5. #5
    Sorry folks

    Don't seem to find much on it, seems to be a cheap fleabay item

    I think it being digital is throwing me off.. I'm a simple kind of fellow Haha

    So basically my guess is I send a pulse high and low with a delay on the trigger pin and read from the echo... it just seems unusual to me I have idea why

    Click image for larger version. 

Name:	HC-SR04.jpg 
Views:	157 
Size:	24.5 KB 
ID:	1068

    http://elecfreaks.com/store/download/HC-SR04.pdf

  6. #6
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    Your guess is correct.

    You send it a pulse on its "trig" pin that must be at least 10 uS long.
    It will generate eight 40KHz sound pulses and based on what obstacles are reflecting sound
    It will generate a pulse on its Echo pin and you need tom measure his long that pulse is.
    Then you can use the simple number in the otherwise had to understand spec sheet to calculate the distance.


    They recommend that you sent not more trigger pulse than one every 60ms.

  7. #7
    Seem to get something out of it, certainly not an ideal response but it's something

    Just need to work on getting something more usable for the output, I have a pretty cool idea on how I would implement these in my project

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,637
    Those ultrasonic sensors are great at detecting walls and other hard surfaces.

    People and animals don't reflect the ultrasonic sound nearly as well. It still can work, but the range is pretty limited and the performance isn't nearly as reliable.

  9. #9
    Seems to be the case Paul, seems to pretty unreliable from testing

    I can't seem to get any sort of range I would have hoped, unsuprising from such a cheap sensor and the conditions

    Maybe I'll change it for an IR sensor

  10. #10
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    354
    Here's a link to a thread on the topic.
    http://forum.pjrc.com/threads/18393

    Use Ping2 with the HC-SR04 which is basically the same as ping, but breaks out the send and receive on different pins.

    Playing with one of these, I can get about 4-5 ft range on soft and angled objects, and up to 12 feet on flat hard surfaces.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •