Description: This example demonstrates how to read a Devantech SRFxx, an ultrasonic range finder that communicates via the I2C synchronous serial protocol, using Arduino's Wire Library. The I2C protocol utilizes two wires for data transmission: a serial clock pin (SCL) that the Arduino pulses at regular intervals, and a serial data pin (SDA) over which data is exchanged between the two devices. As the clock pulse transitions from low to high (the rising edge), a bit of information containing the address of a specific device and a request for data is transmitted from the Arduino to the I2C devices over the SDA line. When the clock pin shifts from high to low (the falling edge), the addressed device sends its data back to the Arduino over the same line. The I2C protocol allows each enabled device to have a unique address, enabling both master and slave devices to take turns communicating over a single line. This capability allows the Arduino to interact with multiple devices sequentially while only utilizing two pins of the microcontroller. Connect the SDA pin of the SRFxx to analog pin 4 of the Arduino, and the SCL pin to analog pin 5. Power the SRFxx with 5V, adding a 100µF capacitor in parallel with the range finder to stabilize its power supply. When using two SRFxx units on the same line, it is essential to ensure they do not share the same address. Instructions for re-addressing the range finders are available at the end of the provided code.
The Devantech SRFxx ultrasonic range finder operates effectively in various applications, particularly in distance measurement and obstacle detection. The integration of the I2C protocol allows for a compact and efficient communication method, ideal for projects requiring multiple sensors. The use of the Arduino's Wire Library simplifies the coding process, allowing for straightforward implementation of the I2C communication.
To set up the circuit, begin by establishing power connections. The SRFxx should be powered by a stable 5V source, with the addition of a 100µF capacitor placed in parallel to filter out any voltage spikes or noise that may affect sensor performance. This capacitor serves to smooth the power supply, ensuring reliable operation during measurements.
Next, connect the SDA and SCL pins of the SRFxx to the specified analog pins on the Arduino. This connection enables the Arduino to communicate with the sensor using the I2C bus. It is crucial to maintain proper wiring to prevent communication errors. The SDA line carries data, while the SCL line provides the clock signal, synchronizing data transmission between the devices.
In scenarios where multiple SRFxx units are utilized, each device must be assigned a unique address to avoid conflicts on the I2C bus. This can typically be achieved by following the manufacturer’s guidelines for re-addressing the devices, ensuring that each unit can be individually addressed by the Arduino.
The Arduino sketch will handle the initialization of the Wire Library, set the appropriate I2C addresses, and manage the reading of distance measurements from the SRFxx. Proper error handling and data validation should be implemented to ensure accurate readings and robust performance in various environmental conditions. The versatility of the I2C protocol and the SRFxx range finder makes this combination suitable for a wide range of robotics and automation projects.This example shows how to read a Devantech SRFxx, an ultra-sonic range finder which communicates via the I2C synchronous serial protocol, using Arduino`s Wire Library. The I2C protocol involves using two wires to send and receive data: a serial clock pin (SCL) that the Arduino pulses at a regular interval, and a serial data pin (SDA) over which
data is sent between the two devices. As the clock pulse changes from low to high (known as the rising edge of the clock), a bit of information containing the address of a specific device and a request for data, is transferred from the Arduino to the I2C devices over the SDA line. When the clock pin changes from high to low (the falling edge of the clock), the called upon device transmits it`s data back to the Arduino over the same line.
Because the 12C protocol allows for each enabled device to have it`s own unique address, and as both master and slave devices to take turns communicating over a single line, it is possible for your Arduino to communicate with many devices (in turn) while using just two pins of your microcontroller. Attach the SDA pin of your SRFxx to analog pin 4 of your Arduino, and the SCL pin to analog pin 5. Power your SRFxx from 5V, with the addition of a 100uf capacitor in parallel with the range finder to smooth it`s power supply.
If using two SRFxxs on the same line, you must ensure that they do not share the same address. Instructions for re-addressing the range finders can be found at the bottom of the code below.
The discrete components ultrasonic transmitting circuit T/R-40-16 is capable of emitting a series of ultrasonic signals at a frequency of 40 kHz. This circuit operates at a voltage of 9V, with an operating current of 25 mA, and can control...
The board is relatively simple and is based on a PCF8574, which provides the output of a CD 4040 counter to the I2C bus. A DIP switch is included to select the PCF8574 address, along with some LEDs for power...
This is a brief update regarding a project that is currently incomplete. The thermostat for the central heating system in the house has become unreliable recently. A new unit from the heater's manufacturer was quoted at $450 AUD, prompting the...
Many types of insects are sensitive to ultrasonic sounds, which can cause them irritation. This project is designed to repel insects such as mosquitoes and cockroaches using ultrasonic sound waves.
The project utilizes an ultrasonic frequency generator, which emits sound waves...
This article discusses the Diecimila; however, there is a newer article that focuses on the Duemilanove. A shift in topic is presented, providing instructions on how to modify an Arduino board to enable useful functions such as debugging.
The Arduino...
The task involved testing the capacitive properties of food by connecting various edibles to an Arduino. This project, known as BeetBox, was developed by Scott Garner, a student at NYU-ITP, who designed an innovative musical instrument that uses beets as...
A circuit has been designed to detect the duration of an ultrasonic pulse as it travels a certain distance. The input signal is sourced from a 40 kHz ultrasonic receiver. The first stage consists of a 40 kHz band-pass filter...
Displays are always beneficial. Until now, only 7-segment displays have been demonstrated for showing numbers using minimal resources. However, for displaying text or images, a simple LCD screen is required. There are basic LED screens available that operate on serial...
The medical ultrasonic atomizer circuit consists of a power supply circuit, an atomization amount liquid level detection control circuit, an ultrasonic oscillator, and a fan motor (M). The power supply circuit includes a timer (Q), fuses (FU1, FU2), a power...
We use cookies to enhance your experience, analyze traffic, and (if you allow) serve personalized ads.
By clicking Accept All, you agree to our use of cookies.
Learn more