Skip to content

10. Inputs

1. Group Assignment

Please refer to Carla Molin’s page for the group assignment.

2. Individual Assignment

For this week’s assignment, I decided to test out the BN880 GPS module I would be using for my final project.

BN880 - Dual Module

The BN880 is a dual GPS/Compass module. It possesses an embedded magnetometer whose I2C output data can be used to create a sfotware based compass. Furthermore, it provides its GPS coordinates through UART Communication. I have decided to use this dual module as it provides a complete and efficient solution to the tracking feature I am looking to develop. GPS readings could be used to geolocate my project’s base device, whereas the magnetometer’s data could be used to determine the orientation of the camera installed on the base device.

BN880

A. Board Design

I decided to use an ATTiny1614 controller as I have become familiar with its development workflow. The BN880 has 6 I/O ports:

  • VCC
  • GND
  • SCL - Compass
  • SDA - Compass
  • RX - GPS
  • TX - GPS

bnio

The I2C lines needed to be pulled up. I therefore added a pullup resistor to both the clock and data. Furthermore, the ATtiny 1614 has two dedicated sets of UART pins. I connected the first to the FTDI and the second to the GPS. The resulting board can be seen below.

board schematic

board layout

board layout

board layout

B. Gathering Coordinates

board

To read data from the GPS sensor, I used the TinyGPS++ library’s ‘dedicated device’ example sketch. The TinyGPS++ library parses information provided by the GPS in NEMA sentences. It then stores these values and allows us to request specific ones such as the longitude, latitude and altitude. While this is all I would be using this library for, it can also allow us to determine the number of satelites circiling above the module, and provides functions around these features.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
/*
   This sample sketch demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.
   It requires the use of SoftwareSerial.
   sketch was developed by Mikal Hart and modified by Tarek Mahmoud for the FabAcademy week10 assignment
*/
static const int RXPin = 9, TXPin = 8;
static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
  Serial.begin(115200);
  ss.begin(GPSBaud);

  Serial.println(F("DeviceExample.ino"));
  Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
}

void loop()
{
  // This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0)
    if (gps.encode(ss.read()))
      displayInfo();

  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
    while(true);
  }
}

void displayInfo()
{
  Serial.print(F("Location: "));
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F("  Date/Time: "));
  if (gps.date.isValid())
  {
    Serial.print(gps.date.month());
    Serial.print(F("/"));
    Serial.print(gps.date.day());
    Serial.print(F("/"));
    Serial.print(gps.date.year());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F(" "));
  if (gps.time.isValid())
  {
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(gps.time.hour());
    Serial.print(F(":"));
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(F(":"));
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());
    Serial.print(F("."));
    if (gps.time.centisecond() < 10) Serial.print(F("0"));
    Serial.print(gps.time.centisecond());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.println();
}

Baud rate Issue

TLDR - GPS baud rate needs to be set to 9600, in my case.


I had a problem when first testing the code. The GPS baud rate was set to 4800 in the default example program. While the BN880 supports a baud rate of 4800, the program wasn’t able to read the data received from the GPS at that frequency. No serial events would occur after the initial board setup. I looked at the information provided by the seller who claimed the module’s default rate was of 38400 bps. Trying that value yielded the same result as for the previous one. I therefore decided all possible values, starting with 9600 which worked instantly. Beginner’s luck I guess.

The data I was now reading was indicating that the Coordinates sent by the GPS were invalid. This was because I was indoors and the module wasn’t able to communicate with nearby satelites. I moved to the roof of the lab’s building and waited for the GPS to obtain a fix, which took a coouple of minutes. It first detected the date, before recognising the GPS coordinates.

roof

1
2
3
4
5
6
7
8
9
17:38:37.933 -> Location: INVALID  Date/Time: 0/0/2000 00:00:00.0010
17:38:37.933 -> Location: INVALID  Date/Time: 0/0/2000 00:00:00.0010
17:38:37.933 -> Location: INVALID  Date/Time: 0/0/2000 00:00:00.0010
17:38:37.933 -> Location: INVALID  Date/Time: 0/0/2000 00:00:00.0010
17:38:37.933 -> Location: INVALID  Date/Time: 0/0/2000 00:00:00.0010
17:38:37.933 -> Location: INVALID  Date/Time: 0/0/2000 00:00:00.0010
17:38:37.933 -> Location: INVALID  Date/Time: 0/0/2000 00:00:00.0010
17:38:37.933 -> Location: INVALID  Date/Time: 0/0/2000 00:00:00.0010
17:38:37.933 -> Location: INVALID  Date/Time: 0/0/2000 00:00:00.0010
1
2
3
4
5
6
7
8
9
17:44:15.611 -> Location: INVALID  Date/Time: 0/0/2000 15:44:17.0010
17:44:15.649 -> Location: INVALID  Date/Time: 0/0/2000 15:44:17.0010
17:44:15.722 -> Location: INVALID  Date/Time: 0/0/2000 15:44:17.0010
17:44:15.756 -> Location: INVALID  Date/Time: 0/0/2000 15:44:17.0010
17:44:15.794 -> Location: INVALID  Date/Time: 0/0/2000 15:44:17.0010
17:44:15.860 -> Location: INVALID  Date/Time: 0/0/2000 15:44:17.0010
17:44:15.860 -> Location: INVALID  Date/Time: 0/0/2000 15:44:17.0010
17:44:15.860 -> Location: INVALID  Date/Time: 0/0/2000 15:44:17.0010
17:44:16.646 -> Location: INVALID  Date/Time: 0/0/2000 15:44:18.0010
1
2
3
4
5
6
7
8
9
17:51:58.093 -> Location: 41.396720,2.194238  Date/Time: 6/25/2021 15:51:59.0010
17:51:58.197 -> Location: 41.396720,2.194238  Date/Time: 6/25/2021 15:51:59.0010
17:51:58.342 -> Location: 41.396720,2.194238  Date/Time: 6/25/2021 15:51:59.0010
17:51:58.413 -> Location: 41.396720,2.194238  Date/Time: 6/25/2021 15:51:59.0010
17:51:58.482 -> Location: 41.396720,2.194238  Date/Time: 6/25/2021 15:51:59.0036
17:51:58.590 -> Location: 41.396720,2.194238  Date/Time: 6/25/2021 15:51:59.0010
17:51:59.110 -> Location: 41.396724,2.194236  Date/Time: 6/25/2021 15:52:00.0010
17:51:59.179 -> Location: 41.396724,2.194236  Date/Time: 6/25/2021 15:52:00.0010
17:51:59.319 -> Location: 41.396724,2.194236  Date/Time: 6/25/2021 15:52:00.0010

Data Transmited by GPS Module over Serial port


The location data provided was in the format Latitude, Longitude. I verified the given location was correct by entering the given coordinates gpscoordinates.net which gave me the following. Great Success !

coordcheck

Files

Week 10 Files

Kicad Directory

References


Last update: June 25, 2021