Silicon ChipMake it with Micromite - October 2022 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Subscriptions: PE Subscription
  4. Subscriptions
  5. Back Issues: Hare & Forbes Machineryhouse
  6. Publisher's Letter
  7. Feature: Forget leaves on the line! by Mark Nelson
  8. Feature: The Fox Report by Barry Fox
  9. Feature: Net Work by Alan Winstanley
  10. Project: SMD Test Tweezers by Tim Blythman
  11. Project: Tele-com Intercom using analogue phones by Greig Sheridan and Ross Herbert
  12. Project: TOUCHSCREEN AND REMOTE DIGITAL PREAMP WITH TONE CONTROLS by NICHOLAS VINEN AND TIM BLYTHMAN
  13. Feature: Self-Contained 3.8GHz Digital Attenuator by Jim Rowe
  14. Feature: Circuit Surgery by Ian Bell
  15. Feature: Make it with Micromite by Phil Boyce
  16. Feature: Max’s Cool Beans by Max the Magnificent
  17. Feature: AUDIO OUT by Jake Rothman
  18. Feature: KickStart by Mike Tooley
  19. Feature: Electronic Building Blocks by Julian Edgar
  20. PCB Order Form
  21. Advertising Index

This is only a preview of the October 2022 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
Make it with Micromite Phil Boyce – hands on with the mighty PIC-powered, BASIC microcontroller Part 40: Simple PicoMite GPS tracker T his month, we will demonstrate how easy it is to build a simple GPS tracker based around a PicoMite. To do this, we will connect a low-cost Pico GPS module to a PicoMite BackPack. The GPS module that we will use in this article is the Waveshare Pico-GPS-L76X (see Fig 1) – however, you could substitute this with any other model of Pico (or nonPico) GPS receiver with only minor changes to the program code (and possibly the physical connections). There are three main reasons for choosing this specific GPS module, it is: 1. Cheap (approx. £15, incl magnetic GPS antenna mount) 2. Available from many online suppliers 3. Plug-and-play, so no wiring or soldering is required. We will use the 2.8-inch version of the PicoMite BackPack, which incorporates the Waveshare Pico-ResTouch-LCD-2.8 module (discussed in Part 38). Many other screens could be used, but we have chosen this one since not only does it have a suitable pixel-resolution for displaying lots of GPS data, but also it incorporates an onboard micro-SD socket, which is useful for saving logged GPS data to a micro-SD card. The GPS tracker program code is easy to build thanks to MMBASIC’s built-in set of GPS commands. So, grab yourself these three modules (or equivalent) and let’s begin. Setting up the PicoMite BackPack First, you need to set up a PicoMite BackPack with the Waveshare Pico-ResTouch-LCD-2.8. If you already have this BackPack set up then simply jump to the next section (GPS module overview); however, in case you missed Part 38, we will quickly describe the necessary steps. 1. Download the latest PicoMite Firmware (for free) from: https://geoffg.net/picomite.html (Note: scroll to the ‘Downloads’ section at the bottom of the page and click on the ‘DOWNLOAD’ button for: PicoMite firmware V5.07.0x (includes the manual). Remember to ‘Extract all’ to unzip the folder’s contents. 2. Install the PicoMiteV5.07.0x.uf2 Firmware file (from step 1) into the Pico module. Refer to Make it with Micromite, Part 37 or the Getting Started section in the User Manual from step 1 for details on how to do this. 3. Connect the Waveshare Pico-ResTouch-LCD-2.8 display module. You can either use an expander board (recommended), Micromite code The code in this article is available for download from the October 2022 page of the PE website. 46 Fig 1. The low-cost Waveshare Pico-GPS-L76X is designed for use with the Pico. This module has both pins and sockets, enabling us to sandwich it in a stack between the PicoMite and a display module, thus creating a simple GPS Tracker. or plug the display module directly into the PicoMite. Note that if you connect them directly together then you will need to separate them again when you insert the GPS module later. The GPS module is sandwiched between the PicoMite and the display module, so an expander board makes it a little easier to initially set things up – see Fig 2. 4. Connect the PicoMite to your preferred terminal app (eg, TeraTerm), and configure the following OPTIONS: OPTION CPUSPEED 252000 (to run the PicoMite at 252MHz) OPTION SYSTEM SPI GP10,GP11,GP12 (configure the SPI bus) OPTION LCDPANEL ST7789_320,L,GP8,GP15,GP9,GP13 (configure the display module) GUI TEST LCDPANEL (check the screen is set up correctly) OPTION TOUCH GP16,GP17 (configure the touch) GUI CALIBRATE (calibrate the touch) GUI TEST TOUCH (check the touch calibration) OPTION SDCARD GP22 (configure the micro-SD card) The above is just a summary of the required configuration to create a PicoMite BackPack. If you have any issues, or would like to configure a different display module, then please refer to the User Manual (or read Make it with Micromite, Part 38). Practical Electronics | October | 2022 Fig 2. By using an expander board, it is much easier to connect the PicoMite, display module, and GPS module to initially set up the GPS Tracker. Note the orientation of each module. GPS module overview The Waveshare Pico-GPS-L76X GPS is a low-cost, plug-andplay module that is widely available. It has useful benefits such as fast positioning (with battery back-up), high accuracy, low power consumption and various LEDs for indicating the modules operating status. A close-up of both sides of the module is shown in Fig.3. Like most other GPS modules, it has UART for (serial) communication, with a selectable baud rate of between 4800 and 115200bps (9600bps by default). This makes it easy to connect to the PicoMite since the program code just needs to communicate via an MMBASIC COM port. All we need to know is the relevant pin numbers used for serial transmit (Tx) and serial receive (Rx). Refer to Fig.4 for a detailed pinout of the Pico-GPSL76X GPS module – you will see that only four connections are used. Note that there is one small disadvantage of this module – the onboard battery holder supports an ML1220 rechargeable cell. These are hard to source; however, the good news is that a battery is not essential; it just means that on power up the GPS module takes a bit longer to get the initial satellite fix (typically between one and two minutes). (If you find a source of the ML1220, then do please drop me an email with the details.) Connecting the GPS module If you use an expander board, then simply insert the GPS module into any available header. It is important to plug it in the right way round – refer to Fig.2 to see the correct orientation. The alternative is to create a stack of boards. To do this, you will first need to carefully separate the PicoMite from the display module, and then insert the GPS module between them. Again, it is important to get the GPS module the right way round, so refer to Fig.5 to see the correct stack orientation. Once the GPS module is installed, carefully screw the antenna into the larger end of the supplied adaptor, and then insert the smaller end of the adaptor into the socket on the GPS module (item number 3 in Fig.3). Ensure that you position the antenna so that it has a good line of sight to the sky. This is so it stands a better chance of seeing multiple GPS satellites, which in turn means it will receive a better signal containing more accurate data. GPS data 1. L76B module 6. Backup mode wakeup button 2. Battery holder – supports ML1220 rechargeable cell, for preserving ephemeris information and hot starts 7. RT9193-33 – power chip 3. GNSS antenna connector 4. Raspberry Pi Pico header 5. Standby mode switch 8. Status indicators RXD/TXD: UART TX/RX indictor PPS: GPS status indicator PWR: power indicator Fig 3. Top and bottom view of the various on-board elements of the Waveshare Pico-GPS-L76X. Fig 4. Pinout of the Pico-GPS-L76X module. Just four pins are required, two for power, and two for serial communication. Note that the GPS Rx pin is on GP0 (PicoMite COM1 Tx pin), and GPS Tx is on GP1 (PicoMite COM1 Rx pin). Practical Electronics | October | 2022 Before we explore MMBASIC’s built-in GPS commands, let’s first look at the format of GPS data. Fig.6 shows a snapshot of actual raw data grabbed directly from the Pico GPS module (via a USB-to-serial module, and displayed in TeraTerm which was set to a baud rate of 9600). GPS raw data is made of multiple ‘sentences’, each one containing various GPS data. Typically, a set of sentences is output every second from the GPS receiver. The type of each sentence is indicated by the characters at the start of the line (after the initial ‘$’). For example, the second line in Fig 6 is a GNGGA sentence (technically referred to as a ‘Global Positioning System Fix Data’ sentence). A GNGGA sentence contains useful GPS data such as time, latitude, longitude, number of satellites and altitude. The content of this (and other) sentences is well documented online (a worthwhile reference is: http://aprs.gids.nl/nmea/) so we won’t go into further detail here. Note that it is not essential to understand the exact format of sentences for our tracker, we are just providing a reference for readers who want to read more about the specific details. So how do we go about extracting the relevant elements of GPS data in MMBASIC? In earlier versions of the Micromite firmware, serial communication with 47 Fig 5. Here, the PicoMite, GPS and display modules can be seen stacked together. Note the correct orientation of each module. a GPS module meant receiving serial data into a COM port input buffer. The program code then searched for the start of a sentence (indicated by a ‘$’ character), and/or the end of a sentence (Carriage Return and Line Feed). Once detected, the program code would then work through the first few bytes in the sentence to check the type of sentence (and hence, what data follows). In brief, the program code looks for a required sentence match (for example ‘GNGGA’). Only when the required sentence type is found can the relevant data be extracted in a meaningful way. This whole process is quite complex to code, but it is possible. The great news is that everything has now been made so much easier with the PicoMite Firmware thanks to the set of GPS commands (or more specifically, GPS functions). These remove all the programming complexities since all you now need to do is use the appropriate parameter, and the relevant data will automatically be returned. For example, to extract the time you would use GPS(Time); likewise, GPS(Satellites) will return the number of satellites being detected by the GPS antenna. However, before using any of the GPS functions, it is important to include the following two lines of code somewhere near the start of the program: SETPIN GP1,GP0,COM1 OPEN "COM1: 9600,256" As GPS The first line defines the PicoMite’s Rx pin and Tx pin for use with serial port COM1 – in Fig.4 you can see these are GP1 and GP0 respectively. The second line opens up COM1 for use with a serial GPS receiver. The parameters define the baud rate as 9600bps, and a receive buffer size of 256 bytes. MMBASIC’s GPS functions With the above two lines near the start of the program code, we are then able to use any of the GPS functions. The most important function is GPS(VALID). This function should be used before any of the other GPS functions are used to ensure that any subsequent data requested is valid. It returns a value of 0 for invalid data (triggered when a sentence’s checksum value is incorrect), and a value of 1 for valid data (ie, the sentence’s checksum value is as expected). Your program code just needs to check for a value of 1, then it can safely use the required GPS function(s) knowing that the returned data represents a true value. The following is a list of the more common GPS functions available (all are used in our GPS Tracker code): GPS(DATE) Returns the normal date string corrected for local time; eg, 28-08-2022 GPS(TIME) Returns the normal time string corrected for local time; eg, 12:22:53 – note that daylight saving is not taken into account and has to be adjusted in program code using (for example) the EPOCH command GPS(SATELLITES) Returns number of satellites in view GPS(LATITUDE) Returns the latitude in degrees as a floatingpoint number, values are negative south of the equator GPS(LONGITUDE) Returns the longitude in degrees as a floating-point number, values are negative west of the Greenwich meridian GPS(ALTITUDE) Returns the current altitude GPS(SPEED) Returns the ground speed in knots as a floatingpoint number GPS(TRACK) Returns the track over the ground (degrees true) as a floating-point number GPS(FIX) Returns non-zero (true) if the GPS has a fix on sufficient satellites and is producing valid data There are two further functions available for more advanced users (neither are used in our GPS Tracker code): GPS(DOP) Returns DOP (dilution of precision) value GPS(GEOID) Returns the geoid-ellipsoid separation You can try any of the above at the command prompt to see what a function returns. Begin by typing these two lines: SETPIN GP1,GP0,COM1 OPEN "COM1: 9600,256" As GPS Next, type the relevant function at the command prompt, for example: PRINT GPS(DATE) You can then try the other functions without having to type the first two lines again. So continue with something like PRINT GPS(SATELLITES) to see the number of satellites. Remember that in our program we should always check that GPS(VALID) returns a value of 1 (we have not used it at the command prompt as we are just demonstrating the output from the various GPS functions). Fig 6. A sample of GPS raw data as it outputs from the GPS receiver. Note that each sentence starts with a ‘$’ character, followed by the type of sentence, and then all the GPS data follows to the end of the line. 48 Tracker software Now that we have all the hardware connected, it’s time to load the GPS Tracker software into your PicoMite. Practical Electronics | October | 2022 As can be seen from Fig 7, the basic GPS data is formatted onto the 2.8-inch display so that you can continually see what is happening in terms of received data. (Note that the data logged to the SD card is limited to a maximum of one record per second). A useful test at this point is to mount the GPS set up in a vehicle, and then go for a drive with the purpose of gathering a good set of data on the SD card. Please do take all necessary precautions while driving – or put it another way, keep your eyes on the road and not on the GPS tracker’s display! Once a set of data is obtained, remove the SD card from the display module, and insert it into a computer. Open the log file which will be named trkDATA_yymmdd_hhmmss.csv (but with the current date and time values) and you will be able to view the logged data. You can use something like Google maps to plot the longitude and latitude co-ordinates to see the precise location plotted onto a map – doubtless some websites can plot all the data points in one go to show the path taken on your test drive (more on this next month). That’s it. You can see how everything works. Why not edit the program code to make your own custom version of the GPS tracker? Try adding some new features – here are a few ideas:  Change the layout of the screen to show only the data you’re interested in  Add a ‘logged-record’ counter to indicate how many entries have been logged onto the SD card  Add a parameter to the program code that determines how often data is logged to the SD card  Limit logging to the SD card based on a change of position rather than logging every second  Change the data logged to only include the fields you’re interested in Practical Electronics | October | 2022 removed (or is missing), show a warning message  Make a covert tracker unit that does not require a display. Instead, use the PicoMite’s green ‘heartbeat’ LED as a status indicator. Next time When I ordered the GPS module for this article, the supplier accidentally sent me a finger-print reader module instead. They let me keep it (and subsequently sent me the GPS module I had originally ordered). I’ve examined the finger-print reader’s datasheet, and it seemed like something that could easily be connected to the PicoMite, so I challenged myself to see if I could get the PicoMite to communicate with the reader, and sure enough, the PicoMite easily interacted with it. However, the complex part is to get the hardware to learn different fingerprints, store the patterns internally, and then compare any finger (touched onto the reader) against the stored patterns and thus identify the user. Thankfully, all this intelligent functionality is built into the finger-print reader, but that means it is essential to have a thorough understanding of the reader’s datasheet. Data communication between the PicoMite and the reader is quite complex and has to be performed in a very specific way for successful operation. Hence, it is all down to the PicoMite program code which is currently a work in progress. I hope next month to be able to show you how to integrate a low-cost finger-printer reader module into your next project – fingers crossed! Until then, stay safe, and have FUN! Questions? Please email Phil at: contactus<at>micromite.org BACK ISSUES Practical Electronics BACK ISSUES – ONLY £6.49 Practical Electronics The UK’s premier electronics and computing maker magazine Circuit Surgery Timing and metastability in synchronous circuits Build an RGB display project using a Micromite Plus Timing and metastability in synchronous circuits Construct a transistor radio Frequency Reference Mastering Signal Distributor RFID tags for your projects Practical Electronics The UK’s premier electronics and computing maker magazine Circuit Surgery Audio Out Make it with Micromite WIN! Microchip Curiosity HPC Development Board Make it with Micromite Fun display project using a Micromite Plus Nutube Guitar Overdrive and Distortion Pedal WIN! <at>practicalelec Circuit Surgery Transformers and LTspice Audio Out Make it with Micromite Accessing Internet data with your MKC Superb microphone preamplifier Touchscreen Wide-range RCL Box WIN! Microchip PIC24F LCD and USB Curiosity Development Board Programmable Thermal Regulator WIN! Microchip MCP19114 Flyback Standalone Evaluation Board Apr 2021 £4.99 04 9 772632 573016 practicalelectronics PLUS! Techno Talk – No blame, no shame? Cool Beans – Round-up of NeoPixel effects Net Work – Videoconference cameras www.electronpublishing.com <at>practicalelec Mar 2021 £4.99 03 9 772632 573016 practicalelectronics PLUS! PIC n’ Mix Software tools for the PIC18F Ultrabrite LED bike light WIN! Microchip Explorer 16/32 Development Kit WIN! Fabulous low-cost Concrete speakers! <at>practicalelec Jun 2021 £4.99 06 9 772632 573016 practicalelectronics Analogue inputs and using servomotors Don’t miss our Super Summer Sale! Random Number Generator Meet the Micromite Explore-28 Audio Out Constructing the PE Theremin amplifier Circuit Surgery Micro-Cap 12 simulator review WIN! Microchip MPLAB Starter Kit for Serial Memory Products WIN! Clever Controller for dumb chargers Hi-Fi amp on the cheap! Completing the High-power 45V/8A Variable Linear Supply Building the Low-noise theremin PSU PLUS! Cool Beans – Even cooler ping-pong ball lights! Net Work – IP security cameras Techno Talk – The perils of an enquiring mind... www.electronpublishing.com Practical Electronics The UK’s premier electronics and computing maker magazine Make it with Micromite Circuit Surgery Understanding Differential amplifiers Robot Buggy Ultrasound sensing! Techno Talk – Bad science and good Cool Beans – Smoothing LED colour transitions Net Work – Lockdown technology and how we now work www.electronpublishing.com Practical Electronics The UK’s premier electronics and computing maker magazine Flowerpot speakers! A low-cost route to high-quality Hi-Fi Mastering stepper motor drivers Roadies’ Test Signal Generator Tunable HF Preamplifier Techno Talk – Tin whiskers scourge Cool Beans – Bouncing around the Maxiverse Net Work – Hydrogen: a viable alternative to batteries? www.electronpublishing.com Superb PE PIC Development Board Practical Electronics The UK’s premier electronics and computing maker magazine Meet the Cricket: making IoT designs super easy! Programmable Thermal Regulator Make your own PCBs with our precision Solder Reflow Oven PLUS! Audio Out How to make a transistor radio – N NEW E EW PE D NA – ES M IG E N ! The file you need is GPS_Tracker.txt which is available for download from the October 2022 page of the PE website. Once installed, it is worth taking a quick look at the program code to see how it works. As usual, it is well commented so it should be easy to follow what is going on. In summary, the following steps occur: 1. COM1 is set up as a serial port for use with a GPS receiver 2. A welcome message is displayed briefly (it fades in, then fades out) 3. The value of GPS(VALID) is checked: a. If 0 (invalid data), then grey out any current data shown on the 2.8-inch display and make the screen’s border red b. If 1 (valid data) then: i. Extract various GPS data (date, time, satellites, lat, long, altitude, speed, tracking) ii. Make the screen’s border green iii. Display the various GPS data on the 2.8-inch display (see Fig 7) iv. Check if Time is different to last time:  If Time is still the same, then do nothing  If Time is different, then log GPS data to the SD card 4. Go to step 3  Add error checking; for example, when the SD card is – N NEW E EW PE D NA – ES M IG E N ! Fig 7. The GPS tracker program displays various GPS data on the 2.8-inch display. All data is also logged to the micro-SD card. <at>practicalelec Sep 2020 £4.99 09 9 772632 573016 practicalelectronics Making a splash with NeoPixels! Fun LED Christmas Tree offer! PLUS! Techno Talk – Triumph or travesty? Cool Beans – Mastering NeoPixel programming Net Work – The (electric) car’s the star! www.electronpublishing.com <at>practicalelec Dec 2020 £4.99 12 9 772632 573016 practicalelectronics We can supply back issues of PE/EPE by post. We stock magazines back to 2006, except for the following: 2006 Jan, Feb, Mar, Apr, May, Jul 2007 Jun, Jul, Aug 2008 Aug, Nov, Dec 2009 Jan, Mar, Apr 2010 May, Jun, Jul, Aug, Oct, Nov 2011 Jan 2014 Jan 2018 Jan, Nov, Dec 2019 Jan, Feb, Apr, May, Jun Issues from Jan 1999 are available on CD-ROM / DVD-ROM If we do not have a a paper version of a particular issue, then a PDF can be supplied – your email address must be included on your order. Please make sure all components are still available before commencing any project from a back-dated issue. 49