In this how-to we are going to do an ultrasonic distance meter device with a Phobos board. You can choose another Class 2 Rhomb PCB to achieve this, for example Deimos board. The objective is to learn how to use an ultra sonic sensor to calculate the distance between it and any object in a mid range distance.
The principle of operation of this project is as follows.
The ultrasonic sensor have 2 parts. Emitter and receiver. An ultrasonic signal is produced by the emitter, bounce back in to the object and returns to the receiver. In that moment, the board software measures the time taked by the signal to get back to the receiver and with this, is possible to calculate the distance.
Bill of materials
- Rhomb.io Class 2 board. For example Phobos or Deimos.
- Duino uno or Duino mega Rhomb.io modules
- Ultrasonic Sensor HC-SR04
- 16×2 I2C LCD Display
- Micro USB cable
Setting up your board
First of all you will need to setup your board putting some tin at 2 solder jumpers. One at the Phobos or Deimos board, other at the Duino Uno or Duino Mega module.
Put some tin at Duino Module “VSYS” solder jumper:
Put some tin at your Rhomb.io Phobos or Deimos board I2C Pull-up solder jumper:
Wiring the components
Here you have the schematics, please use it as reference for assembling the device.
At this tables you can see the pin correspondence between the board and the other elements.
Flashing the software
The first step is downloading the “LCD distance meter” folder from our github repository. Press the “clone or download” button at github.
Download and install the Arduino IDE. Our boards are compatible with Arduino stuff.
Connect the board to your PC and open the downloaded code at the Arduino IDE.
Select the propper COM port of your PC and select the board type according to your master module:
- Arduino / Genuino UNO is compatible with Duino UNO Rhomb.io module
- Arduino / Genuino MEGA is compatible with Duino MEGA Rhomb.io module
Hit the “upload” button at Arduino IDE to start flashing your board with the new software. Once the process finishes, the job is done. You can now test the project.