Construct the circuit seen in the Kemani/Analog Front End Schematic.
- Instead of using the BOB-09816 OpAmp breakout modules, you may construct your own gain stages. The BOB-09816 (schematic) are simple non-inverting operation amplifier gain stages, with a dc bias at half Vcc.
- If you are using an Amani64 instead of the Kemani,
you only need to build the analog portion of the circuit and connect
the transmit line (pin 41 on the Kemani) to an Amani Dock of choice, as
well as the receive line (Kemani pin 21).
Connect the TX_TRIGGER line to Arduino pin 4. Connect RANGE_PWM to Arduino pin 9. Connect the GND line of the breadboard to the GND connection on the Arduino. (Ppower, GND)
- If you are using an Amani64 instead of the Kemani, simply seat the
Amani on the Arduino. Define your Amani TX_TRIGGER and RANGE_PWM pins
to match the Arduino signals. Amani pin 33 = Arduino pin 4, Amani pin
Connect an external DC power source to power jack J6 of your Kemani or Amani64.
- Technically you may power your Kemani or Amani64 from you Arduino.
If you choose this option I highly advise that you do not rely on USB
power alone as you are driving an analog stage. The Kemani, being a 5V
core device can be powered from the 5V port of the Arduino. The Amani64
receives Arduino power via the JP2 setting.
Connect your Arduino to your computer via USB.
Upload the ArdRanger code to your Arduino. Do not start the Serial Monitor.
Load the VT100 Terminal Emulator. Select the COM Port your Arduino uses. Select 9600bps. Initiate serial connection. Observe the Range Values in the Arduino Ultrasonic Ranger window. They will most likely not reflect an accurate measurement as the gain stages must be adjusted.
- If using Windows XP, use the HyperTerminal application found in Start > All Programs > Accessories > Communications.
Initiate the connection by pressing the “Call” icon or selecting “Call” from the Call Menu.
We will now calibrate the analog section to detect your ceiling. A. Start in a room with a standard ceiling that is flat and is up to 10 feet above your workbench. Estimate the range from your sensor to the ceiling.
B. Adjust the potentiometers of the OpAmp modules all the way clockwise, which sets minimum gain.
C. Observe the range readout to be 34 feet, 10 inches. (10.65 meters). This indicates nothing is being detected.
- This reflects the maximum detection range of the timing circuitry
aboard the Kemani and does not necessarily represent the detection range
of the analog circuit.
D. Begin adjusting the gain of the first stage by adjusting the potentiometer counter-clockwise. Most likely you will rotate it to its full limit without detecting your ceiling.
- Typically we do not crank the gain to “patent pending” in amplifiers
as this typically puts the amplifier into compression. In later
examples we will operate the amplifiers in their linear regions.
E. Slowly adjust the second gain stage potentiometer counter-clockwise and keep an eye on the range readout. Stop adjustment when you first see the range values change to your estimated value.
- Most likely the values will switch back and forth between your
ceiling range and 34’ 10”. This is due to the amplified echo return
amplitude is just now rising above the noise-floor.
F. Continue increasing the gain until your estimate ceiling range becomes a solid, regular reading.
G. Test the range dynamics of your sensor by waving your hand between the sensor and the ceiling. The minimum detection range of this system is 1 foot 2 inches. (0.36 meters)
- The minimum detection range is set by the Kemani/Amani code as it
blanks the receiver during the transmit pulse and transmit artifacts.
H. If you increase the gain too high, you will begin to see range “rabbits” and eventually the ranger will default to the minimum range setting. Reduce the gain until satisfactory.
- The “rabbits” are false return readings that most likely are
triggered by the noise floor having been amplified over the detection
The unit settles at the minimum-range reading as the gain drives the amplifier into compression thus spurious signals and noise trips the detection threshold immediately after the range timer starts.
Calibrate the metric accuracy of the rangefinder. In the Arduino code, you will find a constant defined as RANGE_BIAS. Adjusting this value adjusts the range offset typically caused by circuit timing delays. Place a detectable object a measured distance from the sensor and adjust the RANGE_BIAS constant to calibrate the range reading to the correct value.
- RANGE_BIAS is measured in microseconds. Sound, traveling 343.2m/s,
takes 74 microseconds to travel one inch. Be sure to account for round
In order to make changes to the Arduino code and upload them, the serial connection to the VT100 emulator must be disconnected via the “disconnect” command.
If gain adjustments fail to create solid, constant range readings, try adjusting INTEGRATION_FACTOR in the Arduino code between 1 and 10.
- INTEGRATION_FACTOR in this case simply averages the range readings.
The usefulness of this constant will be seen in later examples as it
will be used to integrate amplitude readings and increase the signal to