Silicon ChipMicromite to a Smartphone via Bluetooth - September 2021 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Upcoming price changes
  4. Feature: Advanced Imaging - Part 2 by Dr David Maddison
  5. Feature: The Cromemco Dazzler by Dr Hugo Holden
  6. Project: Touchscreen Digital Preamp with Tone Control – Part 1 by Nicholas Vinen & Tim Blythman
  7. Review: IOT Cricket WiFi Module by Tim Blythman
  8. Project: Second Generation Colour Maximite 2 – Part 2 by Geoff Graham & Peter Mather
  9. Project: Tapped Horn Subwoofer by Phil Prosser
  10. Serviceman's Log: 'Playing' with fire by Dave Thompson
  11. Project: Micromite to a Smartphone via Bluetooth by Tom Hartley
  12. Review: the tinySA Spectrum Analyser by Allan Linton-Smith
  13. PartShop
  14. Vintage Radio: Sanyo 8-P2 TV (1962) by Dr Hugo Holden
  15. Product Showcase
  16. Market Centre
  17. Advertising Index
  18. Notes & Errata: Programmable Hybrid Lab Supply with WiFi, May & June 2021; Hugh-Current Four Battery/Cell Balancer, March & April 2021; Speedo Corrector Mk.3, September 2013
  19. Outer Back Cover

This is only a preview of the September 2021 issue of Silicon Chip.

You can view 43 of the 112 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.

Articles in this series:
  • Advanced Medical & Biometric Imaging – Part 1 (August 2021)
  • Advanced Medical & Biometric Imaging – Part 1 (August 2021)
  • Advanced Imaging - Part 2 (September 2021)
  • Advanced Imaging - Part 2 (September 2021)
Items relevant to "Touchscreen Digital Preamp with Tone Control – Part 1":
  • Touchscreen Digital Preamp PCB [01103191] (AUD $12.50)
  • Touchscreen Digital Preamp ribbon cable/IR adaptor PCB [01103192] (AUD $2.50)
  • PIC32MX170F256B-50I/SP programmed for the Touchscreen Digital Preamp, 2.8in screen version [0110319A.hex] (Programmed Microcontroller, AUD $15.00)
  • PIC32MX170F256B-50I/SP programmed for the Touchscreen Digital Preamp, 3.5in screen version [0110319B.hex] (Programmed Microcontroller, AUD $15.00)
  • Micromite LCD BackPack V3 complete kit (Component, AUD $75.00)
  • Micromite LCD BackPack V2 complete kit (Component, AUD $70.00)
  • Micromite LCD BackPack V1 complete kit (Component, AUD $65.00)
  • Firmware for the Touchscreen Digital Preamp (Software, Free)
  • Touchscreen Digital Preamp PCB patterns (PDF download) [01103191/2] (Free)
Articles in this series:
  • Touchscreen Digital Preamp with Tone Control – Part 1 (September 2021)
  • Touchscreen Digital Preamp with Tone Control – Part 1 (September 2021)
  • Touchscreen Digital Preamp with Tone Control – Part 2 (October 2021)
  • Touchscreen Digital Preamp with Tone Control – Part 2 (October 2021)
Items relevant to "Second Generation Colour Maximite 2 – Part 2":
  • Second-generation Colour Maximite 2 PCB [07108211] (AUD $15.00)
  • Colour Maximite 2 software and documentation (Free)
  • Second-generation Colour Maximite 2 PCB pattern (PDF download) [07108211] (Free)
Articles in this series:
  • Second Generation Colour Maximite 2 – Part 1 (August 2021)
  • Second Generation Colour Maximite 2 – Part 1 (August 2021)
  • Second Generation Colour Maximite 2 – Part 2 (September 2021)
  • Second Generation Colour Maximite 2 – Part 2 (September 2021)
Items relevant to "Tapped Horn Subwoofer":
  • Dimensions and sheet cutting diagrams for the Tapped Horn Subwoofer (Panel Artwork, Free)
Items relevant to "Micromite to a Smartphone via Bluetooth":
  • Micromite Bluetooth sample software (Free)
Items relevant to "Sanyo 8-P2 TV (1962)":
  • Sanyo 8-P2 Diagrams (Software, Free)

Purchase a printed copy of this issue for $10.00.

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 Phone Image Source: easy to control the software running on the Micromite. Android Open Source project T he Micromite Mk2 (January 2015; siliconchip.com.au/Article/8243) 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 (starting in February 2016) 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. The Circuit Notebook section of the May 2015 issue (siliconchip.com.au/ Article/8395) showed how low-cost Bluetooth modules could be used to allow two Micromites 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 82 Silicon Chip display data without using a screen. You can even communicate with the Micromite’s terminal 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 running some version of the Android operating system. 2) A 28-pin Micromite PIC chip loaded with MMBasic, and 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 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 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 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. Australia’s electronics magazine siliconchip.com.au 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 program on your computer. For Windows users, Tera Term appears to be the most favoured. For Linux users, the PuTTY SSH Client is recommended. Download and install this software. Now we need to send the Bluetooth module the appropriate commands to set up the baud rate etc. These are sent as ‘AT’ commands. To do this, you have to connect the module to your computer as per 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. siliconchip.com.au 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 save yourself the hassle by getting a pre-programmed chip from our Online Shop. 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. Next, install the Bluetooth Terminal app by Kai Morich on the smartphone. You can download it from siliconchip. com.au/link/ab8y Building the circuit Fig.3 shows how to load the firmware onto the PIC32 chip using a PICkit if it is not already loaded (or you can purchase a pre-programmed microcontroller). Fig.4 is the minimal circuit to build so that you can interface with the 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. Australia’s electronics magazine September 2021  83 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 the Micromite BackPacks and Explore-28, assuming the requisite pins are free. 84 Silicon Chip Australia’s electronics magazine 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. While Fig.4 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 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 on the program written by Jim Rowe for the December 2017 article on the GY-68 module with the BMP180 chip. It can be found at siliconchip.com.au/Shop/6/4521 The revised version is named “BMP180 barometer check prog console only.bas” and is available for download from the Silicon Chip website associated with this article. 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 siliconchip.com.au 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, 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. 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. mit.edu) because that tool has a Bluetooth connectivity module as a standard built-in item. See our article explaining how to use App Inventor in the February 2021 issue (siliconchip. com.au/Article/14750). 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 (siliconchip.com. au/link/ab8z). 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 SC whole internet. That time of year is nearly here... CHRISTMAS Spice up your festive season with eight LED decorations! Tiny LED Xmas Tree 54 x 41mm PCB SC5181 – $2.50 Tiny LED Cap 55 x 57mm PCB SC5687 – $3.00 Tiny LED Stocking 41 x 83mm PCB SC5688 – $3.00 Tiny LED Reindeer 91 x 98mm PCB SC5689 – $3.00 Tiny LED Bauble 52.5 x 45.5mm SC5690 – $3.00 Tiny LED Sleigh 80 x 92mm PCB SC5691 – $3.00 Tiny LED Star 57 x 54mm PCB SC5692 – $3.00 If possible you should try to purchase a 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. siliconchip.com.au 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! Australia’s electronics magazine Tiny LED Cane 84 x 60mm PCB SC5693 – $3.00 We also sell a kit containing all required components for just $14 per board ➟ SC5579 September 2021  85