computer. I had one I used with my digital camera that
worked, but if you don’t have one laying around you will
need a USB male to micro B cable. Order a Bluetooth low energy module.
Since the Curiosity board comes with solder pads for
the Microchip Low Energy Bluetooth module RN4020, I
used it. It cost $8.83 from Microchip (see Resources #2).
Alternately, I could have purchased a “BLE2 click” which is
a RN4020 (see Resources #3) already mounted on a
board that can plug directly into the mikroBUS socket on
the Curiosity board. It would save me some soldering, but
would add $30 to my expenses. In either case, you will
want to download the RN4020 user’s guide for future
reference (see Resources #4). Download the required software for programming the microprocessor.
Start by downloading the MPLABX IDE (integrated
development environment), XC8 compiler, and XC16
compiler from http://microchipdeveloper.com/
tls0101:start and www.microchip.com/mplab/compilers.
The first link is to a tutorial for MPLABX IDE which is used
to configure and program the PIC. Click on the “Required
Tools and Files for Lab Exercises” link under Table of
Contents on this page.
Download the MPLABX IDE and the XC16 complier,
then go to the second link and download the XC8
complier. You’ll use the XC8 compiler for programming
the PIC16F1619 used in this project, and the XC16
compiler for when you get around to working through the
Later, as you continue to develop your skills, you’ll
want to come back to work through parts of this tutorial.
As of this writing, MPLBX IDE is at version 3. 55 and XC8 is
at version 1.36. Later versions should be very similar, but
you may need to do a little extrapolation. Learn enough embedded C programming to utilize the MPLABX IDE with the Code Configurator.
The Code Configurator is part of the MPLABX IDE
and makes programming the PIC significantly easier —
If you’re following along on this journey, you can
probably skip this step for the time being. I’ll provide all
the C code needed for this project in a file at the article
link. Once you decide to branch out on your own, I would
recommend you check out an excellent embedded C
programming tutorial located on the Microchip website
(see Resources #5).
The tutorial covers all the basics with meaningful
exercises and instructions. It uses the simulator in the
MPLABX IDE, so the tutorial can be used without the
development board. I would also recommend you
download the PIC16F1619 code ZIP file from the
Curiosity home page (see Resources #1). This download
contains two useful documents: “MPLAM XC8 Getting
Started Guide” and a ReadMe file with simple program
descriptions that I found very useful while I was learning
to code. I would recommend working through the tutorial
first and then the other two documents. Download the phone app.
Download “Bluetooth Smart Data” which is available
at the Apple App Store. If you have an Android phone,
you’ll need to contact your local Microchip sales office for
the phone app. Since I only have iOS devices, I can’t
speak to the use of the Android app, but I assume it
would work the same.
I really wanted to develop my own iPhone app to talk
to the circuit, but currently this step is still beyond my
reach. Maybe one day someone will write an eloquently
simple straightforward article on mobile app development,
but until then — and for this project — we’ll use the app
developed by Microchip for communicating with the
RN4020. Verify the operation of the Curiosity board.
Plug the Curiosity integrated programmer/debugger
board into the USB port on the computer; then, read
through the short Curiosity Development Board User’s
Guide (see Resources #6). Next, verify the functionality of
the board using the demonstration program that comes
programmed in the onboard PIC16F1619. Connect the RN4020 Bluetooth module to the Curiosity board.
If you are using the BLE2 click module, then simply
plug it into the mikroBUS socket on the Curiosity board. If
December 2017 33