Shop

Using Vernier Digital (BTD) Sensors with Arduino

When using a digital sensor with Arduino, you should connect it to the Digital 1 port on the Vernier Arduino Interface Shield or a Digital Protoboard Adapter wired as explained in the Connecting Vernier Sensors to the Arduino using a Breadboard section. The following pages describe the programming parameters and provide sample sketches for the following Vernier digital sensors.

Motion Detector

The Motion Detector is probably the most popular of all the Vernier digital sensors. It is used to measure the position of moving objects by sending ultrasound from the gold foil diaphragm and then “listening” for an echo.

The Arduino measures the time from the ultrasound generation to the echo return. The library function, Vernier.readMotionDetector(), uses the speed of sound in room-temperature air and the time for an echo return to calculate the distance to the object in centimeters. Place this function in the loop() portion of your sketch.

 

distance = Vernier.readMotionDetector();

 

The sample sketch, VernierLibTutorialMotionDetector, reads the distance to an object and displays the results to the Serial Monitor or Serial Plotter. It assumes you have plugged a Motion Detector into the Digital 1 port on the Vernier Arduino Interface Shield or a Digital Protoboard Adapter wired to Arduino pins 2, 3, 4, and 5 as explained in the Connecting Vernier Sensors to the Arduino Using a Breadboard section.

404: Not Found

Photogate

Vernier Photogates provide a way to determine when an object passes a location. They are most often used to study free fall, collisions, speed of rolling objects, and period of a pendulum. You can also use them with the Arduino to trigger an action when the Photogate is blocked.

Plug the Photogate into the Digital 1 port on the Vernier Arduino Interface Shield or a Digital Protoboard Adapter wired to Arduino pins 2, 3, 4, and 5 as explained in the Connecting Vernier Sensors to the Arduino Using a Breadboard section. The VernierLib library does not support the Photogate, but the sample sketch, VernierTutorialPhotogate, illustrates how to read the status of the photogate, do timing, and display it on the Serial Monitor. This sketch will also turn on an LED (digital line D13) when the photogate is blocked.

404: Not Found

Radiation Monitor

The Vernier Radiation Monitors detects alpha, beta, gamma, and X-ray radiation. Applications include nuclear counting statistics, shielding, and decay rate measurements. The Radiation Monitor produces a signal that can be detected on the Arduino digital lines.

The Radiation Monitor should be connected to the Digital 1 port on the Vernier Arduino Interface Shield or a Digital Protoboard Adapter wired to Arduino pins 2, 3, 4, and 5 as explained in the Connecting Vernier Sensors to the Arduino Using a Breadboard section. The VernierLib library does not support the Radiation Monitor, but the sample sketch, VernierTutorialRadiation, monitors the sensor and counts the number of radiation events that occur every second. It then reports the number of radiation events on the Serial Monitor.

404: Not Found

Drop Counter

The Vernier Drop Counter records the number of drops that fall from a reagent reservoir. It is often used to perform accurate, automatic titrations. The Drop Counter produces a signal that can be detected on the Arduino digital lines. The Drop Counter should be connected to the Digital 1 port on the Vernier Arduino Interface Shield or a Digital Protoboard Adapter wired to Arduino pins 2, 3, 4, and 5 as explained in the Connecting Vernier Sensors to the Arduino Using a Breadboard section. The VernierLib library does not support the Drop Counter, but the sample sketch, VernierTutorialDropCount, monitors the sensor and counts drop events over a period of ten seconds. It then reports the number of drops on the Serial Monitor. Note the VernierTutorialDropCount sketch can also be used with a Vernier Photogate to count the number of times the photogate beam is blocked during a period of time.
404: Not Found

Rotary Motion Sensor

The Vernier Rotary Motion Sensor is a bidirectional angle sensor designed to measure rotational or linear position. It is commonly used to study rotational dynamics, angular momentum, and the period of a pendulum. It produces a pulse on one digital line when it rotates one direction and on another line when it rotates in the other direction. To keep track of the motion of the Rotary Motion Sensor, you can simply tally pulses in each direction.

The Rotary Motion Sensor should be connected to the Digital 1 port on the Vernier Arduino Interface Shield or a Digital Protoboard Adapter wired to Arduino pins 2, 3, 4, and 5 as explained in the Connecting Vernier Sensors to the Arduino Using a Breadboard section. The VernierLib library does not support the Rotary Motion Sensor, but the sample sketch, VernierTutorialRotaryMotion, tallies the motions in both directions and reports the result every half second.

The pulses that the Rotary Motion Sensor generates are very short. To detect and count them accurately, you need to use “interrupt lines.” Using an interrupt frees the microcontroller to do other tasks while not missing an input from the rotary encoder. (For more information on Arduino interrupts see: http://arduino.cc/en/Reference/AttachInterrupt)

It is useful to know that the Vernier Rotary Motion Sensor can take data in either of two modes. In Normal resolution mode, it measures an angle to the nearest degree. In High-Resolution mode, the Rotary Motion Sensor measures an angle to one quarter of a degree. The VernierTutorialRotaryMotion sketch defaults to Normal resolution, but you can switch to High-Resolution by changing the variable highResOn to True.

404: Not Found