User Tools

Site Tools


oak:tutorials:ultrasonic

This is an old revision of the document!


Oak: Using an Ultrasonic Sensor

Currently a Work in Progress


{{http://digistump.com/wiki/_media/oak/tutorials/us-100_ultrasonic_2.png?500

In this lesson, we will connect an ultrasonic sensor to the Oak. An ultrasonic sensor, using the properties of sound, not only detect an object, but also how far away the object is. The sensor generates a high frequency sound, then listens to the echo received back to the sensor. The time interval from send to receive allows you to calculate the distance.

Components

Part Quantity Identification
Oak with soldered headers 1
Breadboard1
Ultrasonic Sensor1US-100 Y401
Jumper wires6

Note: The HC-SR04 sensor is NOT being used in this tutorial as it uses 5v. Instead a US-100 sensor, which operates from 3v - 5v is used.

Particle.publish will be used to send the sensor data to the cloud. To view the data, you will need a free Particle account, which you can get here if you done have one already: https://build.particle.io/signup.

Concepts

PulseIn

Particle.publish

Circuit

The US-100 Ultrasonic sensor has a number of configurations available. In this example we will be configuring it for digital output. In order to do so first remove the jumper on the back of the sensor (with the jumper engaged, the sensor will be in analog mode). The rest of the connections are straight forward:

  • Connect the VCC pin to the Oak VCC
  • Connect both GND pins to the Oak GND (via GND rail)
  • Connect the Trig pin to Oak pin #2
  • Connect the Echo pin to Oak pin #4


{{http://digistump.com/wiki/_media/oak/tutorials/us-100_ultrasonic_2.png?500

Here's a picture of the actual setup. Note the differences from the sketch: The sensor is facing outward from the breadboard, and the Oak is 180. You can also see here that the jumper does NOT connect the 2 rear pins, thereby enabling digital mode.

Code


{{http://digistump.com/wiki/_media/oak/tutorials/ultrasonic.gif?400

Conclusion

oak/tutorials/ultrasonic.1469830040.txt.gz · Last modified: 2016/07/29 15:07 by brohan