Hello world! Today I made a pretty handy thing. A distance meter with a ultrasonic distance sensor. It works perfect and can be used for a lot of things, like robot positioning etc. Don't mind the phone and Bluetooth module you don't need it, I'm just displaying the value on my phone with my android serial monitor app. Follow the next steps for the Schematic Code & parts list.Step 1: Parts list
Just wire it up like the schematic and it should work after uploading the code.
If you are using a LCD with a I2C then make sure you use the right address, I already set the lines for using a I2C, you just need to uncomment them, and remove or comment this line below:
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
Here are the most common addresses. Look at the back of your LCD which screen you have.
//PCF8574 = 0x20, PCF8574A = 0x38, PCF8574AT = 0x3F.
You do not need the Bluetooth module! I just used it to display values on my android app.Parts list:
- Arduino Uno, I used the RobotDyn uno. A Uno with 7 analog pins.
- HC-SR04 Ultrasonic Distance/range sensor.
- LCD 1602A, I used blue screen. (The code also has a setup for a I2C, you need to uncomment that part.)
- Potentiometer 10k
- Set of jumper wires MM/FF/MF
- (OPTIONAL)HC-06 Bluetooth module. To display values on my app.