GPS Receiver With M5Stack StickC-Plus2

by joejackson2003 in Circuits > Sensors

156 Views, 0 Favorites, 0 Comments

GPS Receiver With M5Stack StickC-Plus2

IMG_20250830_134211.jpg
IMG_20250830_134149.jpg
IMG_20250830_134235.jpg

This is a modification of my other weather sensor project with the previous model of the M5Stick. This time, we're using the updated StickC-Plus2. The main purpose of this project to receive GPS signal from the M5Stack GPS unit or other suitable units using the same protocol. I actually did not try the M5Stack but got it to work immediately with the Seeed Studio Grove-GPS receiver.

I'm still using the ENV Hat with pressure, temperature and humidity sensor. They work fine together.

If you're only interested in the GPS part of this project, you can easily comment out the parts in the code for the ENV Hat.

Supplies

  1. M5Stack StickC-Plus2. You can get if from ThePiHut, for example.
  2. Sensor hat, M5Stack M5StickC ENV III HAT
  3. Grove GPS sensor. From ThePiHut, for example.

Connect External Sensor Hat and GPS Unit to StickC Unit

  1. The ENV Hat fits into the external 8-pin connector on the side. If not supplied with the hat, I would recommend some heavy duty double-stick tape, such as 3M VHB foam tape to reduce flex and bending of the connectors between the hat and the M5Stick.
  2. The Grove GPS unit connects with the supplied 4-pin Grove cable to the M5 unit.

Prepare Software

  1. You need to burn the firmware using M5Burner software for your preferred platform. This allows to pass information of your Wifi network to the unit, so it can connect immediately to your home network and issue an API key that you can then use to connect to the unit through your browser. Please note that at the time of writing, you need to use the Windows version of M5Burner to burn the firmware for the StickC-Plus2. You will not find the appropriate firmware in the Linux version.
  2. Start up the StickC-Plus2. Once it is connected to your Wifi, it will display an API key that you need in a moment. Programming of the M5StickC can be done either through Arduino IDE (not covered in this Instructable) or through an online IDE provided by M5Stack. There are two versions UiFlow and UiFlow2. For this project, I used the older UiFlow.
  3. In UiFlow, on the bottom left of the status bar, find the place to enter the API key. It should then allow you to connect to the unit, upload and test code. There is a slight distinction between "Run" and "Download" (buttons on right lower corner). Run just sends the project temporarily to the M5Stick for testing. Once you switch off and reboot, this project is no longer in memory. Conversely, if you choose "Download", it saves it in memory and will be permanent (until you reprogram it).

Upload Project File to M5Stick

  1. Full project file can be found here. This was developed in UIFlow using a combination of Blockly and custom blocks of code.
  2. In UIFlow, create a new project. In settings (menu on top right), select the correct device (StickC Plus2) and enter your API key that you should be able to read off the display of the M5Stick. Please note you need to use the exact version of the M5Stick. You will get runtime errors if you use a different version.
  3. Open the project file that you downloaded in step 1.
  4. Your M5Stick should already be connected.
  5. Run the script. The code should start running immediately


Basic Operation of Software

buttons.jpg

This needs essentially no user interaction to function and do its job.


The M5StickC-Plus2 only has 3 physical buttons. Button A, B and power button.

Switching on: Press the Power button briefly (1-2 s). It should show a menu very briefly and then automatically run the .py file we have transferred.

Switching off: As an alternative to holding the power button for about 6s (according to M5Stack specifications), you can also hold the B button for about 1s and then release, it will switch the unit off immediately.

If you have both ENV Hat and GPS connected, the program will immediately display pressure and temperature. It will communicate with the GPS unit and get data as soon as available.

If you are near a window, you will usually receive time information from the GPS unit within 20-30s. GPS fix usually takes about 1 minute.

The unit will run fine if you disconnect the GPS unit. It will just not display any time or GPS location.

If you do not use the ENV Hat, the program will stall. You can comment out the appropriate sections in the code if you have no need for the ENV Hat (e.g. lines 11, 19, 20, 38, 39).