User Tools

Site Tools


oak:tutorials:ultrasonic

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
oak:tutorials:ultrasonic [2016/07/29 17:18]
brohan
oak:tutorials:ultrasonic [2016/07/29 20:36]
pfeerick missing word?
Line 1: Line 1:
 ===== Oak: Using an Ultrasonic Sensor===== ===== Oak: Using an Ultrasonic Sensor=====
- 
-** Currently a Work in Progress ** 
  
  
Line 7: Line 5:
 {{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​us-100_ultrasonic_2.png?​500}} {{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.+In this lesson, we will connect an ultrasonic sensor to the Oak. An ultrasonic sensor, using the properties of sound, not only detects ​an object, but also detects ​how far away the object is. The sensor generates a high frequency sound, then listens ​for an echo received back to the sensor. The time interval from send to receive allows you to calculate the distance.
  
 ===== Components ===== ===== Components =====
Line 20: Line 18:
 **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.  **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 free Particle account, which you can get here if you done have one already: [[https://​build.particle.io/​signup]].+Particle.publish will be used to send the sensor data to the cloud. To view the data, you will need your free Particle account. You most likely created one when you first set up your Oak. If you don'​t ​have one already ​get yours here: [[https://​build.particle.io/​signup]].
  
 ===== Concepts ===== ===== Concepts =====
  
-=== pulseIn ===+==== pulseIn ===
 + 
 +pulseIn() can be thought of as a specific timer. pulseIn() takes at least 2 parameters, and up to 3, which are: pin, HIGH or LOW, and timeout. pulseIn() reads the pulse width value for the designated pin during a signal HIGH or LOW condition (designated by the state parameter). Pulse width value is the length of time the pin’s voltage remains HIGH or LOW. 
 + 
 +For example, when the state parameter is set to HIGH, the pulseIn() function waits for the pin’s voltage change to HIGH and measures the length of time the pin’s voltage remains HIGH until it changes to LOW. The length of time is measured in millisecond. The maximum pulse width is 71 minutes. If nothing is detected within the specified time-out period, the function abandons the read attempt and returns 0. 
 + 
 +==== Particle.publish ==== 
 + 
 +The Particle.io cloud offers many features that Oak users can take advantage of, some of which are quite in depth, and allow various devices to "​communicate"​ with each other by passing information (like Particle.variable). If you just need something simple, such as a notification when something has happened, Particle.publish() may be what your looking for.  
 + 
 +Particle.publish() can either be public (available to anyone who has the event name and uses Particle.subscribe) or private (only visible to you, your devices, etc). 
  
-===Particle.publish ​===+Particle.publish() takes the name of the event, the data (char or String), TTL (length of time the data is good for), and if its private.
  
  
oak/tutorials/ultrasonic.txt · Last modified: 2017/01/10 00:04 by Rover#18