Silicon ChipDigital Compass - July 2024 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Jamieson 'Jim' Rowe is retiring
  4. Feature: Repairable Electronics by Dr David Maddison, VK3DSM
  5. Project: Automatic LQ Meter by Charles Kosina
  6. Review: The Raspberry Pi 5 by Tim Blythman
  7. Project: 180-230V DC Motor Speed Controller by John Clarke
  8. Project: New use for Mains Sequencer by John Clarke
  9. Feature: Adding solar charging to a van by Roderick Boswell
  10. Project: Lava Lamp Display by Tim Blythman
  11. Project: Digital Compass by Tim Blythman
  12. Project: Workman 1kW Loudspeaker by Allan Linton-Smith
  13. Vintage Radio: One-valve superhet radio by Fred Lever
  14. Serviceman's Log: Computer abuse by Dave Thompson
  15. Subscriptions
  16. PartShop
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: DC Supply Protectors, June 2024; Fan Speed Controller Mk2, May 2024; Touchscreen Appliance Energy Meter, August-October 2016
  20. Outer Back Cover

This is only a preview of the July 2024 issue of Silicon Chip.

You can view 42 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Automatic LQ Meter":
  • Automatic LQ Meter main PCB (CSE240203A) (AUD $5.00)
  • 16x2 Alphanumeric module with blue backlight (Component, AUD $10.00)
  • Pulse-type rotary encoder with pushbutton and 18t spline shaft (Component, AUD $3.00)
  • Automatic LQ Meter short-form kit (Component, AUD $100.00)
  • Automatic LQ Meter front panel (CSE240204A) (PCB, AUD $5.00)
  • Firmware for the Automatic LQ Meter (Software, Free)
  • Automatic LQ Meter drilling diagram (Panel Artwork, Free)
Items relevant to "180-230V DC Motor Speed Controller":
  • 180-230V DC Motor Speed Controller PCB [11104241] (AUD $15.00)
  • 180-230V DC Motor Speed Controller PCB pattern (PDF download) [11104241] (Free)
  • 180-230V DC Motor Speed Controller lid panel artwork and drilling templates (Free)
Articles in this series:
  • 180-230V DC Motor Speed Controller (July 2024)
  • 180-230V DC Motor Speed Controller Part 2 (August 2024)
Items relevant to "New use for Mains Sequencer":
  • Mains Power-Up Sequencer PCB [10108231] (AUD $15.00)
  • Firmware (ASM and HEX) files for the Mains Power-Up Sequencer (Software, Free)
  • Mains Power-Up Sequencer PCB pattern (PDF download) [10108231] (Free)
  • Panel labels and cutting diagrams for the Mains Power-Up Sequencer (Panel Artwork, Free)
  • Mains Power-Up Sequencer PCB [10108231] (AUD $15.00)
  • PIC16F1459-I/P programmed for the Repurposed Mains Power-Up Sequencer (1010823M.HEX) (Programmed Microcontroller, AUD $10.00)
  • Firmware (ASM and HEX) files for the Mains Power-Up Sequencer (Software, Free)
Articles in this series:
  • Mains Power-Up Sequencer, Pt1 (February 2024)
  • Mains Power-Up Sequencer, Pt2 (March 2024)
  • New use for Mains Sequencer (July 2024)
  • Mains Power-Up Sequencer, part one (February 2025)
  • Mains Power-Up Sequencer, part two (March 2025)
Items relevant to "Lava Lamp Display":
  • Arduino firmware for JMP002 - Lava Lamp Display (Software, Free)
Articles in this series:
  • Symbol USB Keyboard (May 2024)
  • Thermal Fan Controller (May 2024)
  • Wired Infrared Remote Extender (May 2024)
  • Self Toggling Relay (June 2024)
  • Arduino Clap Light (June 2024)
  • Digital Compass (July 2024)
  • Lava Lamp Display (July 2024)
  • JMP007 - Ultrasonic Garage Door Notifier (August 2024)
  • JMP009 - Stroboscope and Tachometer (August 2024)
  • No-IC Colour Shifter (September 2024)
  • IR Helper (September 2024)
  • JMP015 - Analog Servo Gauge (October 2024)
  • JMP012 - WiFi Relay Remote Control (October 2024)
  • JMP013 - Digital spirit level (November 2024)
  • JMP014 - Analog pace clock & stopwatch (November 2024)
  • WiFi weather logger (December 2024)
  • Automatic night light (December 2024)
  • BIG LED clock (January 2025)
  • Gesture-controlled USB lamp (January 2025)
  • Wireless flashing LEDs (February 2025)
  • Transistor tester (February 2025)
  • RF Remote Receiver (March 2025)
  • Continuity Tester (March 2025)
  • Discrete 555 timer (April 2025)
  • Weather monitor (April 2025)
Items relevant to "Digital Compass":
  • Firmware for JMP008 - Digital Compass (Software, Free)
Articles in this series:
  • Symbol USB Keyboard (May 2024)
  • Thermal Fan Controller (May 2024)
  • Wired Infrared Remote Extender (May 2024)
  • Self Toggling Relay (June 2024)
  • Arduino Clap Light (June 2024)
  • Digital Compass (July 2024)
  • Lava Lamp Display (July 2024)
  • JMP007 - Ultrasonic Garage Door Notifier (August 2024)
  • JMP009 - Stroboscope and Tachometer (August 2024)
  • No-IC Colour Shifter (September 2024)
  • IR Helper (September 2024)
  • JMP015 - Analog Servo Gauge (October 2024)
  • JMP012 - WiFi Relay Remote Control (October 2024)
  • JMP013 - Digital spirit level (November 2024)
  • JMP014 - Analog pace clock & stopwatch (November 2024)
  • WiFi weather logger (December 2024)
  • Automatic night light (December 2024)
  • BIG LED clock (January 2025)
  • Gesture-controlled USB lamp (January 2025)
  • Wireless flashing LEDs (February 2025)
  • Transistor tester (February 2025)
  • RF Remote Receiver (March 2025)
  • Continuity Tester (March 2025)
  • Discrete 555 timer (April 2025)
  • Weather monitor (April 2025)
Items relevant to "Workman 1kW Loudspeaker":
  • 2-Way Passive Crossover PCB [01205141] (AUD $20.00)
  • 2-Way Passive Loudspeaker Crossover PCB pattern (PDF download) [01205141] (Free)

Purchase a printed copy of this issue for $12.50.

Mini Projects #008 – by Tim Blythman SILICON CHIP Digital Compass With this digital compass design, you can add an easy-to-read compass display to your off-road vehicle or build a handheld digital compass powered by a battery bank. It uses two modules and three pushbuttons, so it’s easy and quick to build. T his Digital Compass uses the Jaycar XC4496 Compass Magnetometer Module to measure the local magnetic field and determine magnetic north. We then use Jaycar’s XC3715 Quad 14 Segment Alphanumeric Display Module to show the compass bearing. To make the final result neat, we mounted the main components on an XC4482 Prototyping Shield. The shield has space to spare, so we included three pushbuttons as user controls. It is driven by an XC4430 Leonardo Main Board. The magnetometer module is a handy device based on the HMC5883 integrated circuit (or a similar chip). We described how this type of module works in Silicon Chip (November 2018; siliconchip.au/Article/11310). It has an I2C serial interface, so it is easy to connect to a microcontroller with just two wires. Rather than simply giving a compass heading, these modules measure the magnetic field in three different axes, allowing the direction of the magnetic field to be derived using trigonometric calculations. Our Modules series of articles also covered the type of display module we are using in January of this year (siliconchip.au/Article/16092). The display module is also controlled using an I2C interface. Magnetic declination Magnetic declination is a term used to describe the deviation of the magnetic north from true north. This occurs because the magnetic poles are not exactly at the geographic poles. The Wikipedia page about Magnetic declination (https://w.wiki/9doF) has maps showing how this changes over Fig.1: using two modules that connect with an I2C interface makes this a straightforward project. We have seen some variants of the compass module, so make sure you connect to the correct pins, as they could be in a different order. 68 Silicon Chip Australia's electronics magazine siliconchip.com.au These are the main parts we used for this project. You’ll also need some insulated wire to hook everything up. Depending on what headers are provided with the modules, you might also need some header pins to mount them. both space and time (see overleaf). That means the Digital Compass needs a correction factor to give accurate readings, and that factor will depend on your approximate location. The Compass will display positive declination values as E (east) and negative values as W (west), as is the convention. The Compass shows declination values to one degree of precision, but note that it will jump around by a degree or two in normal use. The easiest way to get a usable value is to perform a web search for magnetic declination with the name of your nearest city. To a rough approximation, the east coast of Australia is currently at around +10° (10°E) magnetic declination, with the west coast close to 0° magnetic declination. Circuit details Fig.1 shows the wiring diagram of the Digital Compass. The two critical modules, the magnetic sensor and 14-segment LED display, are supplied with power and connected to the microcontroller via a common I2C bus. The three switches are also connected to the controlling Arduino. The chip on the compass module runs at 3.3V and the module has an onboard voltage regulator. This means that it expects the I2C bus to be at 3.3V. Due to how I2C works, the 5V Leonardo can interface to a 3.3V I2C bus, so there is no problem with the difference between the two in voltages. siliconchip.com.au The display module runs at 5V but has a separate pin for setting the voltage on its I2C pullups; we connect that to 3.3V to maintain compatibility with the compass module. The processor provides the three tactile switches with pullup currents to hold the connected pins at 5V most of the time. It detects that they are pressed when the circuit is closed to ground, pulling those pins to 0V. This circuit could easily be wired up with jumper wires on a breadboard. If you’d like something a bit neater or more permanent, you can follow our instructions for assembling the parts onto a prototyping shield. Construction Before soldering, note the pin markings on the underside of the modules. Refer to Fig.1, but remember that you could be working from the opposite side of the devices. Start by soldering the display module to the prototyping shield. We aligned the module’s edge with the shield’s edge on one side, then used the topmost row of holes to retain the most space within the shield. Space the module vertically away from the shield to avoid short circuits. The compass module solders to the row of pads intended to accept a DIP IC. Note how it very slightly overlaps the display module’s PCB. Because of the height of the 14-segment displays, it does not protrude. There appear to be a few variants of this module; we have used the larger version, but the smaller variant should fit just as well. Next, solder the tactile switches in the space below the display. Ensure none of the leads are touching those from the other switches. The wiring is done underneath the shield to maintain a good appearance. The wire colours we have used are much the same as in Fig.1, although we used yellow wires for the 5V connections to help them stand out from the red shield colour. The colours are merely a guide to assist assembly; you don’t have to use the same ones. Parts List – Digital Compass (JMP008) 1 Arduino Leonardo main board [Jaycar XC4430] 1 prototyping shield [Jaycar XC4482] 1 digital compass module [Jaycar XC4496] 1 quad 14-segment display module [Jaycar XC3715] 3 two-pin tactile switches [Jaycar SP0611] 1 micro-USB cable to suit Leonardo assorted insulated wire straight pin headers (check what is supplied with the modules) Australia's electronics magazine July 2024  69 US/UK World Magnetic Model - Epoch 2020.0 US/UK World Magnetic Model - Epoch 2020.0 Main Field Declination (D) 180° 180° 135°W 135°W 90°W 90°W 45°W 45°W -90 90°E 90°E 70 -20 -80 10 0 -3 0 135°E 135°E 180° 180° 90 k j -20 0 50 10 40 -40 75°N 30 0 -2 -10 20 80 60 -60 75°N 75°N 45°E 45°E -5 -7 -50 0° 0° 0 0 Main Field Declination (D) 0 20 60°N 60°N 60°N 0 -10 10 45°N 45°N 45°N 0 -1 10 30°N 30°N 30°N 0 15°N 15°N 15°N 0° -2 0 0°0° 10 15°S 15°S 15°S 10 30°S 30°S 30°S 20 -30 45°S 45°S 20 -1 0 -2 45°S 0 30 0 -90 40 0 10 -40 20 60°S 60°S -70 50 k j 80 60°S 60 70 30 90 40 75°S 75°S 50 -10 75°S 135°W Main Field Declination (D) k j Position of Dip Poles Miller Cylindrical ProjectionDeclination (D) Main Field Contour interval: 2 degrees Positive (east) Negative (west) Zero (agonic) line Blackout Zones Miller Cylindrical Projection Contour interval: 2 degrees Horizontal Field (H) Strength: 0-2000 nT (Unreliable Zone) 2000-6000 nT (Caution Zone) 90°W 45°W Positive (East) Negative (West) Zero (Agonic) Line 0° -80 -60 90 180° -70 -50 80 -40 70 -30 -20 60 45°E 90°E 135°E 180° Blackout Zones | Horizontal Field (H) Strength Map developed by NOAA/NCEI and CIRES https://ngdc.noaa.gov/geomag/WMM 0–200nT (Unreliable Zone) Published December 2019 Position of Dip Poles 2000–6000nT (Caution Zone) This map shows the magnetic declination across the world in 2020. It changes over time, but the values shown here for Australia and NZ are accurate enough for most contemporary uses of the Digital Compass. Locations near the poles drift more quickly. Map developed by NOAA/NCEI and CIRES https://ngdc.noaa.gov/geomag/WMM (published December 2019). Source: https://w.wiki/9fV6 The blob of solder under the compass module is a 5V connection you can follow back via the PCB tracks. We also made some of the ground connections via PCB tracks. Start by soldering the ground connections as shown in the photo of the shield’s underside. Follow with the blue wires to the switches. Each switch should now have a blue wire at one end and a black wire at the other. Next, solder the 5V wire (and 5V blob) and one 3.3V wire. Then there are two SDA wires and two SCL wires for the I2C bus. Slot the prototyping shield onto the Leonardo, being careful to align all the pins correctly. We are using the SDA and SCL pins near D13, so this should also work with an 70 Silicon Chip Arduino Uno board, although we have not tested it. The software operation is quite straightforward. The Leonardo’s processor reads data from the compass module, calculates a compass heading, then displays that on the 14-segment LED module. We have bundled everything into a single sketch folder, including a basic library for the display module (the file is named XC3715.h) and a library for the compass sensor. The latter comprises the HMC5883L_Simple files from the same library (from James Sleeman) that Jim Rowe used in his 2018 modules article. To program the Arduino, download Screen 1: the default display shows a heading in degrees and updates about twice a second. S2 and S3 adjust the brightness. Screen 2: pressing S1 toggles to an alternative display showing a cardinal compass heading and an arrow pointing north. Software Australia's electronics magazine siliconchip.com.au Silicon Chip PDFs on USB The colours here mostly match Fig.1, except we used yellow for 5V so it stands out from the red shield board. A blob of solder feeds 5V to the compass module (circled in yellow). Some of the 5V and ground connections are made on the shield, too. Using a prototyping shield makes this a compact and tidy project, although you could also try it out on a breadboard with jumper wires. the sketch from siliconchip.au/ Shop/6/430 and unzip it, then open it in the Arduino IDE. Select the Leonardo board option and its serial port via the menus, then upload it. The serial monitor will report some debugging data once that process has finished. After a second or so, you should see a display in degrees (see Screen 1). The displayed bearing should increase if you turn the Digital Compass clockwise and decrease if you turn it anti-clockwise. If you don’t get that reading, check the wiring to the display. If the bearing does not change, you might have a problem with the wiring to the compass module. The serial monitor will also display the bearing, so you can check that the compass module is working, even if the display is not. The default is to display a bearing in degrees, but pressing S1 (the leftmost button) will change to displaying a cardinal (N, NE, E, SE, S, SW, W or NW) compass point, which you can see in Screen 2. There is also a (somewhat squashed) arrow that will point north on the right-hand side of the display. Pressing S2 or S3 will adjust the brightness; the chip on the display module provides 16 steps. If you hold S1, the magnetic declination is shown, and pressing S2 or S3 while S1 is held will adjust it, as shown in Screen 3. You could either use a declination value from a web search or, if you know where north is, you could point the Compass north and manually trim the declination until the Compass reads 0°. After 10 seconds, you might see SAVE flash up on the display (Screen 4). That means the current settings have been saved to EEPROM and will be retained if the Compass is turned off. The settings are reloaded when it SC is restarted. ¯ A treasure trove of Silicon Chip magazines on a 32GB custom-made USB. ¯ Each USB is filled with a set of issues as PDFs – fully searchable and with a separate index – you just need a PDF viewer. ¯ Ordering the USB also provides you with download access for the relevant PDFs, once your order has been processed ¯ 10% off your order (not including postage cost) if you are currently subscribed to the magazine. ¯ Receive an extra discount If you already own digital copies of the magazine (in the block you are ordering). EACH BLOCK OF ISSUES COSTS $100 NOVEMBER 1987 – DECEMBER 1994 JANUARY 1995 – DECEMBER 1999 JANUARY 2000 – DECEMBER 2004 JANUARY 2005 – DECEMBER 2009 JANUARY 2010 – DECEMBER 2014 JANUARY 2015 – DECEMBER 2019 Screen 3: holding S1 allows the magnetic declination to be set. It defaults to 0° and can be set from 99°W to 99°E (−99° to +99°). siliconchip.com.au Screen 4: within 10 seconds of making a change, the Compass will save the settings to non-volatile EEPROM and show this message. Australia's electronics magazine OR PAY $500 FOR ALL SIX (+ POST) WWW.SILICONCHIP.COM. AU/SHOP/DIGITAL_PDFS July 2024  71