Silicon ChipMICROMITE TO SMARTPHONE CONNECTOR VIA BLUETOOTH - September 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: What’s in a name? by Mark Nelson
  8. Feature: The Fox Report by Barry Fox
  9. Feature: Net Work by Alan Winstanley
  10. Project: TOUCHSCREEN AND REMOTE DIGITAL PREAMP WITH TONE CONTROLS by NICHOLAS VINEN AND TIM BLYTHMAN
  11. Project: MICROMITE TO SMARTPHONE CONNECTOR VIA BLUETOOTH by TOM HARTLEY
  12. Project: 20A DC Motor Speed Controller by JOHN CLARKE
  13. Project: USB-PD Triggers, Decoys and Testers 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. PCB Order Form
  19. Advertising Index

This is only a preview of the September 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)
MICROMITE TO SMARTPHONE CONNECTOR VIA BLUETOOTH BY TOM HARTLEY This project demonstrates how to use a Micromite as the heart of an IoT (Internet of Things) device. But there are many other reasons you might wish to connect a Micromite to your Android smartphone, such as making it easy to monitor what your device is doing without going to the trouble or expense of fitting it with an LCD screen. It also makes it really easy to control the software running on the Micromite. Phone Image Source: Android Open Source project T he popular 28-pin Micromite is a great way to get into programming microcontrollers because you need so little to get it up and running, and the BASIC language it uses is easy to learn. But to make the most of it, you really need some sort of screen. That’s why the Micromite LCD BackPack series (PE, May 2017, May 2018, August 2020) has been so popular. It combines the Micromite with a colour touchscreen, giving you an easy way to interact with the device and display information. But that arrangement is considerably more expensive and complex, and a separate screen isn’t always required. In Part 14 of Make it with Micromite (PE, March 2020) we showed how low-cost Bluetooth modules could be used to allow a Micromite to communicate without wires. But what about using such a module to interface with a smartphone? That way, the phone becomes the user interface to the Micromite, so you can get away with a much simpler and cheaper arrangement – assuming you already have a suitable phone. And since smartphones generally have a connection to the internet, the Micromite can become an IoT (internet of things) device and easily share data with other devices. This article explains how to connect a bare Micromite chip to an Android mobile phone to communicate and display data without using a screen. You can even communicate with the Micromite’s terminal 26 output data stream using an Android app, sending it BASIC commands and so on. Basic arrangement After programming a 28-pin Micromite chip via the conventional PC USB connection, I was able to disconnect it from the PC and transmit the Micromite’s terminal output data stream over Bluetooth to an Android App, running on an inexpensive mobile phone. The design requires very few components: 1. A smartphone that is running some version of the Android OS )operating system). 2. A 28-pin Micromite PIC chip loaded with MMBasic, plus a tantalum or ceramic capacitor for the VCAP pin – as recommended by Geoff Graham. 3. An HC-05 Bluetooth module, preferably one with an Enable pushbutton key. 4. A USB-to-TTL converter (eg, one that is based on the ubiquitous CP2102 chip). 5. A short USB extension cable. 6. A BMP180 atmospheric pressure sensor (for this particular demonstration application). 7. A four-AA battery holder modified by tapping the output voltages at 3V and 4.5V. The fourth cell is not needed, so that cell position can be left empty. 8. A small piece of Veroboard. 9. Some hook-up wire. Bluetooth module setup The first job is to configure the Bluetooth module as required by this project. The HC-05 Bluetooth module has many similarities to a modem, and the procedure to set it up will be familiar if you have ever set up serial communications to a modem. Before you can do this, you will need to install a serial terminal Fig.1: the HC-05 Bluetooth transceiver module is wired up to a USB-UART bridge and battery pack so that the Bluetooth module can be set up using a PC. Practical Electronics | September | 2022 program on your computer. For Windows users, Tera Term appears to be the most favoured. For Linux users, the PuTTY SSH Client is recommended. Now, download and install this software. Next, we need to send the Bluetooth module the appropriate commands to set up the baud rate. These are sent as ‘AT’ commands. To do this, you have to connect the module to your computer as sown in Fig.2. Connect the USB-serial adaptor, HC-05 Bluetooth module and battery pack as shown in Fig.2. Start the terminal program on your PC and plug the USB-to-TTL converter into a convenient USB port. This will power up the USB-to-TTL converter but will not power up the HC-05 module. The terminal software will require information about which USB port it should connect to. You can find this in Windows using the Device Manager. In Linux, when there are no other USB devices plugged into the computer, then the usual USB port is: /dev/ttyUSB0 Once you have set that, hold down the button on the HC-05 module and turn the switch on the battery box to the ‘ON’ position. Wait a couple of seconds before releasing the button. The red LED on the HC-05 module should flash slowly. Now type AT on your computer terminal program and press Enter, the module should respond with OK. If it does not, there is probably a baud rate mismatch, so check that the terminal is communicating with the HC-05 at 9600 baud, 8 bits, no parity, one stop bit, no flow control (often described as ‘8-N-1’). Also, the Enter key on your PC must be mapped as a carriage return plus line feed, usually signified in the terminal software as CR/LF. The other baud rate to try is 38,400. Different manufacturers have different default baud rates on first use. Once you get the OK, you can proceed to enter these two commands: AT+UART=38400,1,0 AT+NAME=MMITE01 You should get an OK after each one. If you don’t, you might have a different version of the HC-05 Bluetooth module; see the panel below. Next, check that the settings have been recorded by typing ‘AT+UART’ and pressing enter, which should provide the response 38400,1,0. Then type AT+NAME and press Enter; you should give the response MMITE01. Power off the circuit and install the HC-05 in the test rig described in the next section. Practical Electronics | September | 2022 Fig.2: you need to change some settings in the HC-05 Bluetooth module before using it, via serial commands from a computer. This is how you can connect it up in order to do that. The suggested wiring is in Fig.1. Fig.3: this minimal circuit is all you need to load the MMBasic firmware onto a PIC32, turning it into a Micromite. You can buy an inexpensive preprogrammed 28-pin Micromite from: https://micromite.org/micromites/ Next, install the Bluetooth Terminal app by Kai Morich on the smartphone. You can download it from: https://bit.ly/pe-sep22-sbt Building the circuit Fig.3 shows how to load the firmware onto the PIC32 chip using a PICkit if it is not already loaded. Fig.4 is the minimal circuit to build so that you can interface with the Micromite running MMBasic. However, you won’t be able to do much with such a basic configuration, so we will describe how to get the circuit shown in Fig.5 up and running. This includes a BMP180 temperature/ atmospheric pressure sensor so it can actually do something useful. Note that with the Tx/TxD lines of the two serial modules in parallel, you can only have one active at a time. That’s assuming that the inactive module is not driving its Tx line actively, which is the case with the HC-05 and USB-serial modules I used, but might not be true for all such devices. If both Tx lines are active at the same time, it’s unlikely anything will be damaged (although not impossible), but it certainly isn’t going to work as they will fight each other. Alternative versions of the Bluetooth module We have seen online sellers listing various versions of the HC-05, including the ‘original’ version (likely the one described in this article), a ‘new’ or ‘revised’ version and the HC-06. We ordered some of the new/revised HC-05 modules to try out. They look much the same as the original HC-05, and if you order one from a seller who doesn’t make the distinction, that may well be the one you receive. The new/revised version worked as described in this article, except that it did not respond to the ‘AT’ commands listed in this article at all. However, it seemed to default to 38,400 baud, so we were able to communicate with a Micromite simply by wiring it up and setting that as the baud rate. We haven’t tried the HC-06, but chances are it works much the same way. You might just need to experiment with the baud rate if you cannot communicate with it after selecting 38,400 baud. 27 Reproduced by arrangement with SILICON CHIP magazine 2022. www.siliconchip.com.au Fig.4: the minimal circuit to communicate with the Micromite over USB, using a USB/Serial adaptor. Fig.5: by adding a BMP180-based temperature/pressure sensor module as well as the HC-05 Bluetooth module to the Micromite, we can turn it into something useful. It now reports atmospheric data on the smartphone screen via a terminal App. The test rig connected to a Micromite Explore-28 which was built on a breadboard. This setup should easily work with a Micromite BackPack and 28pin Micromite, assuming the requisite pins are free. While Fig.5 shows both a USBserial and Bluetooth adaptor, you don’t need both; the USB-Serial module is intended mainly for testing and can be left off once you’re confident 28 that the HC-05 is working. Also, you don’t need to connect the BMP180 module; it’s simply there to demonstrate what you can do. Modify the circuit to suit your requirements. The BMP180 sensor communicates using an I2C serial bus, so it is connected to pins 17 and 18 as shown in Fig.5. It also needs a ground connection and a +3V connection. As before, the 4.5V tap on the battery pack is only required to run the HC-05 module. Connect the test rig setup to your PC and terminal program via the USBTTL converter. We have based the software for this demonstration project (BMP180 barometer check prog console only. bas) on the program written by Jim Rowe for the December 2018 article on the GY-68 module with the BMP180 chip (BMP180 barometer check prog.bas). Both are available for download from the Spetember 2022 page of the PE website, but remeber that here you need to use the ‘console only’ version. The only real change is that all lines which pertain to formatting and/or displaying information on the LCD screen have been removed. Instead, it simply prints the data obtained from the BMP180 chip on the console using PRINT commands. Run the program and confirm that it all performs correctly in the usual PC terminal mode. Then shut down the PC terminal and unplug your test rig from the PC’s USB port. Install the Bluetooth Terminal App on your mobile phone (if you haven’t already). Power up the test rig. Notice that the red LED on the HC-05 module is flashing rapidly. Follow the instructions for connecting a Bluetooth device to the Bluetooth Terminal App on your phone. The steps involve registering the HC-05 in your phone’s Bluetooth devices list. It will first show up as an alphanumeric address similar to an IP address but segmented into several pairs of hexadecimal characters. Once you provide the password of 0000 or 1234, your HC-05 should then appear on the list as MMITE01. Now return to the Bluetooth Serial App on the phone and connect to the MMITE01 adaptor. Successful connection to the HC-05 will be detectable by the flashing LED having slowed down considerably. The App should also display precisely what you have previously seen on your PC’s terminal program. If not, then turn the test rig off and on again. When you turn off the test rig, the Bluetooth Terminal App will report it has lost the connection. Just tap on the connect icon in the App, and it should reconnect without any further need for your inputs or adjustments. Practical Electronics | September | 2022 If possible you should try to purchase an HC-05 module which has an ‘Enable pushbutton’ key, as shown at the upper left of this photo. This specific HC-05 is a HiLetgo branded version. mit.edu) because that tool has a Bluetooth connectivity module as a standard built-in item. Python programs run well on mobile phones, so that provides another opportunity for enhancing the usefulness of your data collected by the Micromite. Another possibility is to install a web server on your Android phone, such as KickWeb (https://bit.ly/ pe-sep22-kw). That way, you can use PHP scripts or continuously looping Python programs to forward sensor derived data to services such as Thingspeak (www.thingspeak.com) where your data can be displayed graphically and made available across the whole Internet. Screen 1 shows a typical display on the mobile phone when connected to the Micromite via Bluetooth. This particular App can log received text, so data coming across from the test rig can be saved. Another advantage of using this particular Bluetooth Terminal App is that it adds the current date and time to every line of data received, making it unnecessary to build an RTC module into your circuit. In fact, now that the data is in your phone, you can exploit the fact that your phone is, in reality, a very sophisticated computer and display resource. For example, you can now write your own Android Phone Apps using MIT App Inventor (ai2.appinventor. Screen 1: a very basic display of local barometric pressure (in hectopascals [hPa]) in the smartphone terminal app, delivered by the Micromite. By changing the Micromite BASIC code and hardware, you can get it to report just about anything you want! More Micromite? Our monthly column Make it with Micromite is the best place to learn all about this powerful, easyto-use single-IC microcontroller. STEWART OF READING 17A King Street, Mortimer, near Reading, RG7 3RS Telephone: 0118 933 1111 Fax: 0118 933 2375 USED ELECTRONIC TEST EQUIPMENT Check website www.stewart-of-reading.co.uk Fluke/Philips PM3092 Oscilloscope 2+2 Channel 200MHz Delay TB, Autoset etc – £250 LAMBDA GENESYS LAMBDA GENESYS IFR 2025 IFR 2948B IFR 6843 R&S APN62 Agilent 8712ET HP8903A/B HP8757D HP3325A HP3561A HP6032A HP6622A HP6624A HP6632B HP6644A HP6654A HP8341A HP83630A HP83624A HP8484A HP8560E HP8563A HP8566B HP8662A Marconi 2022E Marconi 2024 Marconi 2030 Marconi 2023A PSU GEN100-15 100V 15A Boxed As New £400 PSU GEN50-30 50V 30A £400 Signal Generator 9kHz – 2.51GHz Opt 04/11 £900 Communication Service Monitor Opts 03/25 Avionics POA Microwave Systems Analyser 10MHz – 20GHz POA Syn Function Generator 1Hz – 260kHz £295 RF Network Analyser 300kHz – 1300MHz POA Audio Analyser £750 – £950 Scaler Network Analyser POA Synthesised Function Generator £195 Dynamic Signal Analyser £650 PSU 0-60V 0-50A 1000W £750 PSU 0-20V 4A Twice or 0-50V 2A Twice £350 PSU 4 Outputs £400 PSU 0-20V 0-5A £195 PSU 0-60V 3.5A £400 PSU 0-60V 0-9A £500 Synthesised Sweep Generator 10MHz – 20GHz £2,000 Synthesised Sweeper 10MHz – 26.5 GHz POA Synthesised Sweeper 2 – 20GHz POA Power Sensor 0.01-18GHz 3nW-10µ W £75 Spectrum Analyser Synthesised 30Hz – 2.9GHz £1,750 Spectrum Analyser Synthesised 9kHz – 22GHz £2,250 Spectrum Analsyer 100Hz – 22GHz £1,200 RF Generator 10kHz – 1280MHz £750 Synthesised AM/FM Signal Generator 10kHz – 1.01GHz £325 Synthesised Signal Generator 9kHz – 2.4GHz £800 Synthesised Signal Generator 10kHz – 1.35GHz £750 Signal Generator 9kHz – 1.2GHz £700 HP33120A HP53131A HP53131A Audio Precision Datron 4708 Druck DPI 515 Datron 1081 HP/Agilent HP 34401A Digital Multimeter 6½ Digit £325 – £375 HP 54600B Oscilloscope Analogue/Digital Dual Trace 100MHz Only £75, with accessories £125 (ALL PRICES PLUS CARRIAGE & VAT) Please check availability before ordering or calling in Keithley 228 Time 9818 Practical Electronics | September | 2022 Marconi 2305 Marconi 2440 Marconi 2945/A/B Marconi 2955 Marconi 2955A Marconi 2955B Marconi 6200 Marconi 6200A Marconi 6200B Marconi 6960B Tektronix TDS3052B Tektronix TDS3032 Tektronix TDS3012 Tektronix 2430A Tektronix 2465B Farnell AP60/50 Farnell XA35/2T Farnell AP100-90 Farnell LF1 Racal 1991 Racal 2101 Racal 9300 Racal 9300B Solartron 7150/PLUS Solatron 1253 Solartron SI 1255 Tasakago TM035-2 Thurlby PL320QMD Thurlby TG210 Function Generator 100 microHz – 15MHz Universal Counter 3GHz Boxed unused Universal Counter 225MHz SYS2712 Audio Analyser – in original box Autocal Multifunction Standard Pressure Calibrator/Controller Autocal Standards Multimeter o er lifier Voltage/Current Source DC Current & Voltage Calibrator Modulation Meter £250 Counter 20GHz £295 Communications Test Set Various Options POA Radio Communications Test Set £595 Radio Communications Test Set £725 Radio Communications Test Set £800 Microwave Test Set £1,500 Microwave Test Set 10MHz – 20GHz £1,950 Microwave Test Set £2,300 Power Meter with 6910 sensor £295 Oscilloscope 500MHz 2.5GS/s £1,250 Oscilloscope 300MHz 2.5GS/s £995 Oscilloscope 2 Channel 100MHz 1.25GS/s £450 Oscilloscope Dual Trace 150MHz 100MS/s £350 Oscilloscope 4 Channel 400MHz £600 PSU 0-60V 0-50A 1kW Switch Mode £300 PSU 0-35V 0-2A Twice Digital £75 Power Supply 100V 90A £900 Sine/Sq Oscillator 10Hz – 1MHz £45 Counter/Timer 160MHz 9 Digit £150 Counter 20GHz LED £295 True RMS Millivoltmeter 5Hz – 20MHz etc £45 As 9300 £75 6½ Digit DMM True RMS IEEE £65/£75 Gain Phase Analyser 1mHz – 20kHz £600 HF Frequency Response Analyser POA PSU 0-35V 0-2A 2 Meters £30 PSU 0-30V 0-2A Twice £160 – £200 Function Generator 0.002-2MHz TTL etc Kenwood Badged £65 d £350 £600 £350 POA POA £400 POA POA POA Marconi 2955B Radio Communications Test Set – £800 29