|
Raspberry Pi Pico SDKRaspberry Pi Foundation
|
GPS Clock and Armageddon Alarm 2 and GPS Altimeter
My Raspberry Pi Pico Projects - 2 Jed Margolin 18 January 2025
An expanded version of this is on my Web site at www.jmargolin.com/pico-projects-2/
GPS Clock and Armageddon Alarm
Several years ago I did a project called GPS Clock and Armageddon Alarm. This is an updated version.
A GPS Module using the U-blox NEO7M is used to receive the GPS timing signals to show the exact time on a 16x2 LCD display. In addition to the display, the end of each minute is signaled with a musical cord.
It features an Armageddon Alarm Mode. I usually receive 11 or 12 GPS satellites. If the number of satellites drops to four or fewer something bad is happening. The odds that the GPS system is having a technical problem are vanishingly small.
What is happening is Armageddon.
Armageddon can happen in several ways:
a. A huge coronal mass ejection (CME) from the Sun that hits the Earth. The CME will burn out all of the satellites in orbit as well as the power grids (the Eastern Grid, the Western Grid, and the Texas Grid). In 1859 a huge CME (the Carrington Event) hit the Earth and burned out telegraph lines all over North America. See https://en.wikipedia.org/wiki/Carrington_Event . The reason it didn’t burn out anything else was because there wasn’t anything else, not even power lines. The telegraph offices ran on batteries.
b. A Global Thermonuclear War. The first thing everyone will do when they start Armageddon is destroy or otherwise disable everyone else’s satellite navigation systems.
The GPS Clock With Armageddon Alarm will give you instant notice by flashing the red LED and by playing an alarm signal. It also provides a 3.3V logic level signal that you can connect your own alarm to. (The interface depends on what your alarm is so you will have to do that yourself.)
You don’t have to be a Prepper to want to know when the World is Ending.
Since my original project in 2021 the World situation has become much more precarious.
I have also realized that there is one more thing that might cause you to lose GPS reception. An extraterrestrial ship can be hovering over your house getting ready to abduct you. This alarm might alert you so you can greet the ETs wide awake and with a taser. I recommend a taser instead of a firearm because you might not be exactly wide awake and you do not want to put holes in your house (or a loved one) unnecessarily.
The original GPS Clock and Armageddon Alarm used an MSP430G2553 for the GPS stuff and an MSP430G2402 for the PWM sounds. This updated version uses a Raspberry Pi Pico. The Pico is faster, has more memory, and has 2 cores. I use one core for the GPS stuff and the other core for the PWM sounds. Last year I started using the Raspberry Pi Pico instead of the Texas Instruments MSP430G2xxx family of microcontrollers. I posted several projects at www.jmargolin.com/pico-projects. If you have not used the Pico I recommend you read it for background because I tell the story of how I got the Pico SDK installed and how I use it. I say that:
- I suggest that you get the software tools working before you spend money buying parts. Your pain threshold might not be as high as mine.
- and I am separately documenting how I am using the Raspberry Pi Pico tools. Bear in mind that the Raspberry Pi Pico tools use software from several sources. One or more of the software toolmakers (especially Microsoft) could update their tools at any time and break everything. After all, this is Windows.
Those statements are still true. The original article also contains other useful information such as a short piece on making things.
I have done a new board for the Raspberry Pi Pico. It has:
- Raspberry Pi Pico
- 16 x 2 LCD
- Blue 4-pin NEO7M GPS Module
- 3 pushbutton switches
- 1 slide switch
- 1 Green User LED
- 1 Red User LED
- Header for UART
- Header for I2C interface
- Output Filter using MSP6002 for making Pulse Width Modulation (PWM) sounds
- It can be powered by either a 9V DC supply or by the USB port on the Pico, you make the decision when you stuff the board.
- Provision for using a backup battery for the NEO7M
This last part about “Provision for using a backup battery for the NEO7M“ requires some explanation. Although the NEO7M boards that I have gotten from China all came with an EEPROM (a 24C32 type) the NEO7M doesn’t use it. The NEO7M still has the DDC (I2C) interface but it doesn’t use it for backup. I have verified that the NEO7M doesn’t use the EEPROM by putting an oscilloscope probe on the EEPROM’s SCL and SDA pins. There are no signals there at any time. The NEO6M does seem to support the EEPROM, there are signals there. But the NEO7M, no. Apparently, the Chinese companies that make the NEO7M modules are using the boards they use for the NEO6M modules and are putting the EEPROM on it because they don’t know it isn’t being used.
The only way to provide a backup for the NEO7M is in its internal RAM. This requires that it has power at all times. (It uses a separate pin for this.)
The Chinese manufacturers do not use a Lithium Ion battery (like a CR2032). Exporting Lithium Ion batteries from China is a complicated procedure and can take 2 months.
All of the NEO7M modules that I have bought from China use a super capacitor but they are not very super. One lasted 30 minutes. Another lasted 30 seconds.
My board allows you to use your own backup battery. I use a CR2032 in a battery holder with wire leads. It also has its own On-Off switch. You could use 2 AAA batteries in series. My board has a 1N5817 Schottky diode to prevent the NEO7M from trying to charge the battery. (You are not supposed to recharge non-rechargeable batteries.)
This is why you want to use it. Without it the NEO7M has to do a cold start every time it powers up. Part of the startup requires you get the current number of Leap Seconds in order to get the correct time. For various reasons the GPS system does not use the current Leap Second. It does send the current Leap Second but since the number of Leap Seconds does not change very often the GPS system only transmits it every 12.5 minutes.
When you do a cold start the NEOx-M uses a default value for Leap Seconds. The value it uses depends on what it was when the NEO was manufactured since the NEOs that end in “M” use masked ROM and cannot be updated.
Note that using your own backup battery requires that you solder a wire to the super capacitor. Fortunately, you solder it to the super capacitor’s top bracket and the bracket is easily solderable.
If the Chinese manufacturers took off the EEPROM and the super capacitor (which probably isn’t free either) they would have more than enough room to put on 2 x LR44 alkaline batteries. There is no problem exporting alkaline batteries from China.
There is another reason for using a real backup battery. By default the NEO7M sends lots of NMEA messages. I don’t need (or want) all of them and there are some that I want that are not sent by default. You can use u-blox’s u-center program (https://www.u-blox.com/en/product/u-center) to set it up but without backup power you will lose what you have set up.
The way I have dealt with this particular problem is that my programs turn off all of the NEO7M messages and then turn on the ones I want. u-blox does not do a good job documenting how to do this so I used u-center with a second ch340 to capture the data stream as I first turned off all the messages at once and then, one at a time, turned on the ones I want. This code is in my programs.
GPS Altitude and Barometric Altimeter
I live in the mountains outside of Reno, Nevada. I have always been interested in the altitude of my house. According to the GPS App on my phone it would frequently read about 6,000 feet plus or minus a few feet but sometimes it would say 100 or 200 feet lower. Hmm.
Since I already had my own GPS Module (the NEO6M) and had written the software for it (for my GPS Clock) and I already had the BME-280 and had written the software for it I decided to do my own barometric altimeter which uses the air pressure to determine the altitude. It has turned out to be a lot more complicated than I thought.
First, why does the National Weather Service (NWS) and all the radio and TV stations report the Barometric Pressure at sea level even if your community is at an altitude of 4,500 feet? At sea level the standard air pressure on a nice day with the temperature of 15 deg C (59 deg F) is 29.92 inches of Mercury (1013.25 mb). In Reno, at an average altitude of 4,500 feet AMSL (Above Mean Sea Level), the standard air pressure is 859 mb (See https://www.mide.com/air-pressure-at-altitude-calculator). This means that the oxygen level at 4,500 feet is about 85% of what it is at sea level. At an altitude of 6,000 feet AMSL the air pressure is about 812 mb for an oxygen level of about 80% of what it is at sea level.
This has implications for more than just your lungs. It affects all internal combustion engines. With less oxygen they will produce less power unless they have a supercharger or turbocharger. And if they use a carburetor they will run rich. That is because carburetors dole out a measured amount of gas. With less oxygen they run rich. If you have a generator it will produce less than its rated power so you need to take that into account if you are sizing a generator. It also affects the BTU rating of gas furnaces.
So, why does the National Weather Service (NWS) report the Barometric Pressure at sea level? There are several reasons that I discuss in my article on my Web site.
Altitude from air pressure
I am using an approximation of the Barometric Formula (https://en.wikipedia.org/wiki/Barometric_formula) which is a good approximation for altitudes below 9000 meters (about 30,000 feet) and when the temperature at sea level is 15 deg C (59 degrees F). The U.S. Weather Service does not report the temperature at sea level when they report the barometric pressure so it must be the standard 15 deg C. Besides, unless you live on a coast where would you measure the temperature?
Here is the formula most commonly used to calculate the Pressure Altitude from the air pressure:
H = 44330 * [1 - Pa/P0 ^ (0.190295)]
Pa = air pressure at altitude
P0 = air pressure at sea level (barometer)
H = pressure altitude in meters
Height Above Mean Sea Level (AMSL) is not an exact science. However, it is very useful when comparing altitudes. That is why airports report their altitude (however it is they determine what it is) and the current barometric pressure at the airport. As long as all of the aircraft pilots in the vicinity use the same values and the same methods they know where they are vertically in relation to everyone else.
There is a difference between Pressure Altitude and Density Altitude. Air pressure is not affected by temperature so Pressure Altitude is not affected by the air temperature. Otherwise, if you flew into a mass of hot air you would think you are flying higher than you are and you could hit terrain. Density Altitude is affected by the temperature because the temperature does affect the air density and air density affects the aerodynamics of everything: the lift that the wings produce, the thrust of propellers, etc. It also affects the power that engines produce. Pressure Altitude is a way of telling pilots how their aircraft will handle.
GPS altitude is derived by GPS receivers using triangulation of several satellites to determine the distance to the satellites and then subtracting the altitude (for your coordinates) that comes from a mathematical model of the Earth as an oblate spheroid. The Earth is not a perfect spheroid so that GPS altitude cannot be relied on to be accurate.
GPS altitude is less accurate than the Pressure Altitude, sometimes much less accurate. This project allows you to compare them.
My project uses the NEO7M for time, coordinates, and GPS altitude. It uses the BME-280 for temperature, humidity, and air pressure. These things are displayed on the LCD. You can also specify that that they be recorded in a time stamped log in the Pico’s flash memory. Retrieving the log requires that you use the uart. I use the ch340 with the freeware serial program called AccessPort from http://www.sudt.com/en/ap/index.html.
You use it in this mode from the keyboard. The commands are:
- V: Show Version
- B: Show BME-280
- O: Log BME-280 Once
- L: Log BME-280 Every 5 minutes
- X: Stop Logging BME-280
- D: Dump All of the Flash Logs to uart
- E: Erase Data Flash? (then Y/N)
- S: Reset Start Date? (then Y/N)
- P: BME-280 Parameters
- R: Reset Barometric Reference to 29.92
- F: Set Default Local Offset and DST
- H: Repeat This List
Starting the program with SW1 in “Settings” mode allows you to set the Barometric Reference, the Local Offset Hours from UTC, and whether to observe DST. You use it with the LCD and the three pushbutton switches on the board.
Warning: Do not use this project for piloting an aircraft. For that you need to use an FAA certified Barometric Altimeter.
(I hope I didn’t need to tell you that.)
User Flash Memory Erase
If the flash memory that I use gets confused and you need to just erase it I have written a program for that. It uses the uart with the following keyboard commands:
V: Show Version
D: Dump All of the Flash Logs to uart
1: Erase Data Flash
2: Erase Start Date Flash
3: Erase Barometric Reference Flash
4: Erase Local Offset Flash
5: Erase DST Dates Flash
H: Repeat This List
All of the software is on my Web site at www.jmargolin.com/pico-projects-2/
GPS Clock and Armageddon Alarm 2 and GPS Altimeter
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(0)
- 1 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10

-
10design
-
5usability
-
10creativity
-
10content
More by Jed Margolin
-
MyTX4 To Replace The La Crosse TX4U My TX4 Wireless Sensor Transmitter replaces the La Crosse TX4U wireless sensor which is no longer ma...
-
Audio Tone Burst Generator The Audio Tone Burst Generator produces a periodic burst of tone at a User-selected audio frequency ...
-
GPS Clock and Armageddon Alarm 2 and GPS Altimeter My Raspberry Pi Pico Projects - 2 Jed Margolin 18 January 2025An expan...
-
jm_rpi-pico-v6 The Raspberry Pi Pico module is amazing. It is much faster than the Texas Instruments MSP430G2xxx fa...
-
Woof Meter The Woof Meter is for testing subwoofer speakers to measure their Thiele-Small (TS) parameters. Thes...
-
Precision Low Frequency Signal Generator The Precision Low Frequency Signal Generator produces a User-selected signal from 10Hz to 90Hz with ...
-
GPS Clock and Armageddon Alarm A GPS Module using the U-blox NEO6MV2 is used to receive the GPS timing signals to show the exact ti...
-
PB1 - Prototyping Board with Ground Plane and Power Supplies This board is for prototyping circuits using wire wrap. It has a good ground plane and power supplie...
-
Flame Switch This board simulates the electrical characteristic of a flame for troubleshooting residential gas fu...
-
PB2 - Prototyping Board for MSP430G2xxx This board is for prototyping circuits with the Texas Instruments MSP430G2xxx microcontroller. It ca...
-
GP1 - Board for demonstrating how to use an MSP430G2xxx This board is for demonstrating how to use the Texas Instruments MSP430G2xxx microcontroller. The bo...
-
VGA Adapter for Atari Hard Drivin’/Race Drivin’ Cockpit This VGA Adapter for Atari Hard Drivin’/Race Drivin’ Cockpit also provides for delaying horizontal a...
-
Phone Selector/Adapter 2-line to 1-line This converts an RJ11 line with two phone pairs on it to two single line RJ11 jacks. It provides two...
-
Triangle Wave Generator With Adjustable Symmetry This is a simple circuit using only one IC, a TL084 quad opamp. The integrator integrates the output...
-
Voltage Controlled Audio Oscillator with LM13700s This is a voltage controlled audio oscillator using two LM13700s. At 1 KHz ARTA software (http://www...
-
Oscillator - Xtal or RC This is an oscillator that can be stuffed to be either a crystal oscillator (with a 74HC04) or an RC...
-
Sine Wave Generator Using a Johnson Counter This is a 1KHz audio oscillator using a Johnson Counter. ARTA software (http://www.artalabs.hr/) rep...
-
VGA Adapter For Tektronix TDS 360 Oscilloscope The Tektronix TDS 360 is a two-channel digital oscilloscope from the middle 1990s. The sampling rate...
-
Instrumentation Input, high impedance with 16 bit 1MSPS ADC for SPI
96 0 0 -
RGB LED Matrix input module for the Framework Laptop 16
296 0 2 -
-
📦 StackBox: Modular MDF Storage Solution 📦
132 0 2 -
-
-