How to make a DIY digital ruler with Arduino Nano board

How to make a DIY digital ruler with Arduino Nano board

Hello and welcome back. In this project, we will learn how to make a DIY digital ruler with an Arduino Nano board. It’s most suitable for DIY projects, woodworking, crafting, and any type of measurement work. For that, I have mainly used the basic components like the Ultrasonic sensor, Arduino Nano board, and LCD screen. The Ultrasonic sensor helps us measure distances, and we’ll see the measured distances displayed in real-time on the LCD screen. Plus, I’ve made things easier by designing a PCB (printed circuit board), so putting everything together will be a breeze. If you’re interested in replicating this project, you can easily order the PCB with JLCPCB using the Gerber file provided. Also, this tutorial will guide you through the process step by step. By the end of it, you’ll have your very own digital ruler ready to assist you in your future projects. OK, Let’s get started with the making process!

OK, let’s do this project step by step. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.

Step 2

Secondly, let’s order our PCBs. For that, follow the instructions below.

  • First, go to the JLCPCB official website and log in to your account. If you are a new member of this, please use this link. Then, you can get a 60$ coupon for orders to PCBs.
  • JLCPCB $2 for 1-8 layer PCBs — Click on me
  • Then, click the instant quote button and upload the Gerber file. You can download it using the link below. If you have your own Gerber file, please use it.
  • Gerber file — Download
  • I have ordered 5 PCBs with Blue color. You can change them as you like.
  • Then, select the build time and shipping. Finally, click the save to cart button.
  • Next, open your cart and click the secure checkout button. In this step, you can enter your shipping address and shipping method. Then, click the submit order button.
  • Now, you can pay for this using Paypal, Debit card, Credit card, or coupon. Finally, click the pay button. Now it will receive soon. It depends on your shipping method. I have selected the FedEx shipping method.

Step 3

Thirdly, unbox and get your PCBs.

Step 4

Now, solder the Male pin header to the LCD screen.

Step 5

After that, solder one by one component to the PCB. I have used an adjustable soldering iron.

Step 6

OK now connect the LCD screen, Arduino Nano board, and Ultrasonic sensor to the PCB. Then, connect the Arduino Nano board to the computer.

Step 7

Next, copy and paste the following program to the Arduino IDE.

#include <LiquidCrystal.h>//Include library   path---Sketch -> Include Library -> LiquidCrystal
LiquidCrystal lcd(9, 8, 4, 5, 6, 7);//arduino pin(rs=2,e=3,D4=4,D5=5,D6=6,D7=7)

#define Trig 2
#define Echo 3

void setup() {
  lcd.begin(16, 2);// set up the LCD's number of columns and rows
  pinMode(Trig, OUTPUT);
  pinMode(Echo, INPUT);
  lcd.setCursor(2, 0);
  lcd.print("MEASURE YOUR");
  lcd.setCursor(4, 1);


void loop() {
  digitalWrite(Trig, LOW);
  digitalWrite(Trig, HIGH);
  digitalWrite(Trig, LOW);

  long t = pulseIn(Echo, HIGH);
  long inch = t / 74 / 2;
  long cm = t / 29 / 2;

  lcd.setCursor(0, 0);
  lcd.print("Distance: ");
  lcd.print(cm );
  lcd.print("cm  ");

  lcd.setCursor(0, 1);
  lcd.print("Distance: ");
  lcd.print(inch );
  lcd.print("inch  ");

  • Now, select the board and port. After, click the upload button.

Step 8

Finally, remove the USB cable and connect the 5VDC power supply to the Digital ruler. Also, you can control the contrast of the LCD using the potentiometer. Now you can test your project. The full video guide is below. So, we hope to see you in the next project. Have a good day.

Troubleshooting tips

  • Check component status.
  • Select the correct board and port.
  • Check the power source.

How to make a DIY digital ruler with Arduino Nano board

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *