Arduino SFR Ranger Reader

  
Inside:
Repository
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
Arduino SFR Ranger Reader - schematic

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.



Leave Comment

characters left:

New Circuits

.