IOT

DIY Speedometer using GPS Module Arduino & OLED

A speedometer is a device that measures a vehicle’s speed. We have already built an analog speedometer and a digital speedometer using the IR sensor and hall sensor, respectively. We’ll utilize GPS to determine the speed of a moving vehicle today. GPS speedometers are more precise than traditional speedometers because they can track the vehicle and determine its speed in real-time. For navigation and traffic alerts, GPS technology is widely employed in smartphones and vehicles.

In this project, we will build an Arduino GPS speedometer using a Quectel L86 GPS  with an OLED display. 

Materials Used

  • Arduino Nano
  • Quectel L86 GPS  Module
  • 1.3 inch I2C OLED display
  • Breadboard
  • Connecting Jumpers

Proposed System

We’ll create a speedometer with a GPS module, Arduino, and an OLED display in this project. A speedometer, often known as a speed meter, is a gauge that monitors and shows a vehicle’s instantaneous speed. A revolving flexible cable controlled by gearing coupled to the vehicle’s transmission is used in many speedometers. Many current speedometers, on the other hand, are electronic.

A GPS Receiver is required to construct a GPS Speedometer. The ublox NEO-6M GPS Module is the most widely used GPS receiver. However, we will use the Quectel L86 GPS Module because it is small and has a small antenna. The speed-related parameters can be shown on an OLED screen by connecting an L86 GPS Module to an Arduino and a 0.96′′ OLED Display.

How does GPS measure Speed?

Speed can be measured in two ways using GPS devices:

1. Method 1: The simplest and most basic method is based on the distance traveled by the receiver since the previous measurement. The same causes of error that affect the vehicle’s speedometer (wheel size, transmission/drive ratios) do not affect these speed computations. Instead, the GPS’s positional precision, and hence its calculated speed, is determined by the quality of the satellite signal at the time. When the ratio of positional error to positional change is lower, speed estimations will be more accurate at greater speeds. To reduce error, the GPS program may employ a moving average calculation. Some GPS devices do not account for the car’s vertical position, resulting in an under-reporting of speed due to the road’s gradient.

2. Method 2: Alternatively, the GPS might measure its velocity using the Doppler effect. Commercial systems have an accuracy of 0.2–0.5 km/h in ideal conditions, however, this can deteriorate as the signal quality deteriorates.

Quectel L86/L80 GPS Module

Quectel L86 GPS Module

Because of its ultra-compact form and low power requirements, the L86 is an excellent choice for wearable fitness gadgets. While in static reception mode, its Low Power function allows GPS connectivity at about half the power usage of the standard model. The L86 is appropriate for a wide range of IoT applications, including portable devices, automotive, personal tracking, security, and industrial PDAs, thanks to its precision and high sensitivity.

Quectel L80 GPS Module Size

With 66 acquisition channels and 22 tracking channels, the L86 includes a patch antenna on top that measures 16.0mm x 16.0mm x 6.45mm. Even at the indoor signal level, it gathers and tracks satellites in the shortest time possible. The module runs between 2.8 and 4.3 volts, with an average power usage of 20 milliamperes, and a standby power consumption of roughly 1.0 milliamperes. As seen in the diagram below, the Quectel L86/L80 GPS Module has 12 pins.

L86 Pinout

The L86 is a miniature SMD-type module with no male/female header pins for testing. As a result, you can use the 2.54-spacing male header pins and solder them on the L86 PCB from the bottom.

Once you’ve soldered all 12 pins on the L86 Module, it’s ready to use on a breadboard. You may now easily place the module on the breadboard.

Arduino GPS Speedometer Circuit Diagram

Let’s have a look at the Arduino GPS Speedometer circuit diagram. As illustrated in the graphic below, the connection diagram is quite straightforward.

Arduino GPS Speedometer

The Quectel L86 GPS module has 12 pins, however, for our project, we will only use 5 of them. Connect the L86’s VCC and GND pins to the Arduino’s 3.3V and GND pins. If the V BCKP pin on the L86 is not linked to 3.3V, the module will not work. L86’s Rx and Tx pins are connected to Arduino digital pins 2 and 3, respectively.

An I2C Module is used to power the OLED Display. Connect the OLED’s VCC and GND pins to the Arduino’s 3.3V and GND pins. Connect the SDA and SCL pins to the Arduino A4 and A5 pins, respectively.

Project PCB Gerber File & PCB Ordering Online

If you don’t want to put the circuit together on a breadboard and instead prefer a PCB, this is the PCB for you. EasyEDA online Circuit Schematics & PCB Design tool was used to create the PCB Board for the GPS Speedometer. The schematic is designed first, and then it is translated into a PCB.

The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from https://www.nextpcb.com/

Download Gerber File: Arduino GPS Speedometer

Now you can visit the NextPCB official website by clicking here: https://www.nextpcb.com/. So you will be directed to NextPCB website.

You can now upload the Gerber File and place an order on the website. The PCB quality is excellent. That is why the majority of people entrust NextPCB with their PCB and PCBA needs.

Source Code/Program

The best part about the L80 GPS Module is, that it supports Tiny GPS++ Library. Download the library and add it to the Arduino library folder. Apart from Tiny GPS++ Library, the code also requires SSD1306 Library called Adafruit SSD1306 library.

Here is the complete code. You can copy the code and upload it to the Arduino Nano Board.

#include <SoftwareSerial.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <TinyGPS++.h>

#define rxPin 2
#define txPin 3
SoftwareSerial mygps(rxPin, txPin);

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 //Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C //See datasheet for Address
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

TinyGPSPlus gps;


void setup()
{
Serial.begin(115200);
mygps.begin(9600);

if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS))
{
Serial.println(F(“SSD1306 allocation failed”));
for (;;); // Don’t proceed, loop forever
}
display.clearDisplay();
display.display();
delay(2000);
}

void loop()
{
boolean newData = false;
for (unsigned long start = millis(); millis() – start < 1000;)
{
while (mygps.available())
{
if (gps.encode(mygps.read()))
{
newData = true;
}
}
}

//If newData is true
if (newData == true)
{
newData = false;
display.setTextColor(SSD1306_WHITE);

if (gps.location.isValid() == 1)
{
//String gps_speed = String(gps.speed.kmph());
display.setCursor(0, 0);
display.setTextSize(3);
display.print(gps.speed.kmph());

display.setCursor(75, 20);
display.setTextSize(2);
display.print(“km/h”);

display.setTextSize(1);
display.setCursor(0, 50);
display.print(“SAT:”);
display.setCursor(25, 50);
display.print(gps.satellites.value());

display.setTextSize(1);
display.setCursor(70, 50);
display.print(“ALT:”);
display.setCursor(95, 50);
display.print(gps.altitude.meters(), 0);

display.display();
delay(1500);
display.clearDisplay();
}
}

else
{
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.setTextSize(3);
display.print(“No Data”);
display.display();
delay(1500);
display.clearDisplay();
}
}

Testing the Arduino GPS Speedometer

The code above should be uploaded to the Arduino Nano Board. The OLED Display will show no data at first. This is due to the fact that the L86 GPS receiver is not in sync with the satellite system.

After some time, the GPS begins to receive signals from the nearest satellite system. The indoor-outdoor circumstances influence signal reception and satellite synchronization. The OLED screen displays the speed in kilometers per hour after correct satellite synchronization (kmph). When it is maintained at rest, it may show zero speed.

When the GPS Speedometer is installed in a moving vehicle, it displays the speed in kilometers per hour. It also displays the total number of satellites connected to the system and their height in meters.

GPS Based Speedometer using Arduino

ConclusionI hope all of you are clear about how to design  a Speedometer using GPS Module Arduino & OLED. We MATHA ELECTRONICS will be back soon with more interesting topics.

Leave a Reply

Your email address will not be published.