This is only a preview of the November 2016 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 "50A Battery Charger Controller":
Items relevant to "Passive Line To Phono Input Converter":
Articles in this series:
Items relevant to "Micromite Plus LCD BackPack":
Items relevant to "WiFi Controlled Switch Using A Raspberry Pi & Smartphone":
Purchase a printed copy of this issue for $10.00. |
By Nicholas Vinen
Based on Geoff Graham’s Micromite
Plus & Micromite LCD BackPack
The Micromite Plus
LCD BackPack
The Explore 64 and the Micromite LCD BackPack have had an
illicit affair and here are the secret baby photos to prove it! It
has its mother’s eyes and father’s brain. OK, that’s not really
true; what we have done is taken the best features of each project
and put them together onto a single board. Use it to supercharge
your BackPack project or just as a convenient and cost-effective
controller module.
R
EADERS WILL have noticed that
we’ve published a number of
projects based on the Micromite LCD
BackPack, first described in our February 2016 issue. It’s a very convenient way of providing user control and
feedback for a project and combines
the user interface and control logic in
a compact module. Because it doesn’t
cost too much, we can integrate it
into a larger project without making
it overly expensive. And thanks to
Geoff Graham’s MMBasic interpreter,
constructors can easily upgrade and
modify our designs.
As it stands, the biggest problem
with the BackPack is the limitation
64 Silicon Chip
of the DIP (through-hole) PIC32 processor. It has significantly less flash
memory and RAM and a much lower
operating frequency compared to the
surface-mount versions. The BASIC
interpreter overhead exacerbates all
of these. It also lacks the SD card and
USB interfaces introduced with the
Micromite Plus in the August issue.
The micro used in the Micromite
Plus Explore 64/100 projects puts the
original to shame, with a much more
generous helping of RAM and flash,
much better speed (2.5 times as fast)
and sufficient spare memory and pins
to implement onboard microSD card
and USB interfaces. But while the Ex-
plore 64 can interface with many different displays, you have to wire it up
yourself and the 5-inch touchscreen
is quite expensive. So those projects
can’t easily replace the LCD BackPack.
But this one can! We have combined
the convenience and low cost of the
original BackPack with all those new
Micromite Plus features. The Micromite Plus LCD BackPack uses the same
2.8-inch touchscreen TFT as before
but has the enhanced processor and
peripherals of the Explore 64.
Backwards compatibility
One of the main aims when designing the Plus BackPack was to make it
siliconchip.com.au
easy to improve projects that used the
original BackPack. The original BackPack has three main connectors: one
for 5V power and the serial terminal
(CON1, four pins), one for the TFT interface (CON3, 14 pins) and one for interfacing to external circuitry (CON2,
18 pins). It also has an in-circuit serial programming (ICSP) connector for
the microcontroller (CON4, six pins).
On the Micromite Plus LCD BackPack, we have fitted identical connectors, with the same names, positions
and sizes. The PCB is the same size
too, with mounting holes in the same
positions. So it’s largely a “drop-in”
replacement.
There are differences, however, in
some of the pin numbers and properties assigned to these connectors. Going through each connector in turn,
these differences are:
• CON1: the pinout is still 5V/Tx/
Rx/GND, however the Micromite Plus
uses pins 58 and 6 as the console Tx
and Rx, compared to pins 11 and 12
on the original Micromite and the Micromite Mk2. However, the difference
in these pin numbers should not affect
usage at all.
• CON2: we have kept the functions
of each pin in this I/O header as close
as possible to those for the original
BackPack. However to keep the functions identical, we had to change most
of the pin numbers. That means that
you will need to change the software to
use the new pin numbers – see Table 1
for a comparison. Note that this same
information is also shown in the circuit diagram which is discussed below.
There are only two small losses of
function in this header (this was unavoidable). First, pins 8 and 11 are no
longer 5V-tolerant and second, pins 9
and 10 can no longer operate as count
inputs. But there are two extra benefits to the new configuration: four new
analog-capable inputs at pins 5, 6, 8
and 11 and the SPI bus is no longer
shared with the one driving the TFT
and touch sensor.
• CON3: this is intended to plug into
the same ILI9341-based TFT display
as the original BackPack. The pin
functions are essentially the same although again, some of the numbers
have changed and thus the display/
touch initialisation commands have
changed (we’ll go over this later). Table
2 shows how the pins are connected
to the display board on both the original and new designs.
siliconchip.com.au
Features & Specifications
•
Display: 65,536 colour, 2.8-inch (7cm) diagonal TFT LCD with 320 x 240 pixel
resolution and software backlight brightness control
•
•
Input system: resistive touchscreen
•
•
Available memory: 100KB flash program space, 100KB RAM
•
•
Digital I/O current capability: 15mA sink/source
•
•
USB support: Integrated USB 2.0 interface with virtual serial port
•
Interpreter: Built-in MMBasic with support for 64-bit integers, floating point,
strings, arrays and user-defined subroutines and functions
•
Standard Micromite features: includes built-in communications protocols, PWM
and SERVO outputs, variable CPU speed, sleep mode, watchdog timer and automatic start & run
•
Additional features: built-in support for infrared remote receivers, temperature sensors, humidity sensors, distance sensors, numeric keypads and battery-backed real-time clocks
•
Graphics commands: CLS, PIXEL, LINE, BOX, RBOX, CIRCLE, TEXT and BITMAP,
using the full range of colours
•
Advanced graphics commands: these include on-screen keyboards, buttons,
switches, check boxes and radio buttons
•
•
•
Font support: six built-in fonts plus the ability to load custom user fonts
•
•
Dimensions: 50 x 86 x 27mm (same as original LCD BackPack)
•
Overall cost: similar to original LCD BackPack
Processor: Microchip 32-bit 120MHz microcontroller with 512KB flash memory
and 128KB RAM
I/Os: 31 free input/output pins including 17 analog inputs, 14 5V-tolerant pins,
hardware SPI and I2C buses, two (or three) serial ports, four PWM outputs, a
PS/2 keyboard interface, three frequency counting inputs, a wake-up pin (for
sleep mode) and an infrared input pin
Communications protocols: SPI, I2C, asynchronous serial, RS-232, IEEE 485 and
Dallas 1-Wire
SD card support: handles cards up to 64GB with onboard microSD socket and
SD card socket on back of display module
Code editing: on-screen editor support when PS/2 keyboard is connected
Power supply: 5V (4.5-5.5V) <at> 80mA (backlight off) up to 250mA (backlight at
full brightness)
Compatibility: connector positions and pin-outs compatible with original LCD
BackPack
As noted earlier, the SPI2 bus is used
for the TFT (this is required by MMBasic) while the SPI1 bus is connected
to CON2, for interfacing with external
circuitry. This has a major advantage
compared to the original BackPack
as MMBasic’s use of the SPI bus for
graphics commands and touch sensing will not interfere with SPI data sent
via CON2. This is especially helpful
when using touch interrupts or using
the SPI bus or graphics commands in
interrupt handler routines.
Another major improvement over
the original BackPack is the deletion
of VR1 for TFT backlight control. The
backlight is now driven by a Mosfet
which can have its gate controlled via
the PWM2A output for software-controlled dimming over a wide range.
The backlight can be turned off entirely when not used, which is especially helpful for battery-powered devices as it typically draws most of the
supply current.
• CON4: the ICSP header is connected to PGED1/PGEC1 in both versions,
which are pins 4 and 5 on the original
November 2016 65
Table 1: CON2 Functions In Original BackPack vs Plus BackPack
Pin Number
Original BackPack
Plus BackPack
1
RESET
RESET
2
3 SPI OUT
8 SPI1 OUT
3
4
12
4
5
14
5
9 COM2:TX
11 COM2:TX
6
10 COM2:RX
13 COM2:RX
7
14 SPI IN
45 SPI1 IN
8
16 COUNT/WAKEUP/IR
51 COUNT/WAKEUP/IR
9
17
COUNT/I2C
44 I2C CLOCK
CLOCK
10
18 COUNT/I2C DATA
43 I2C DATA
11
21 COM1:TX
15 COM1:TX
12
22 COM1:RX
59 COM1:RX
13
24
24
14
25 SPI CLK
50 SPI1 CLK
15
26
27
16
+3.3V
+3.3V
17
+5V
+5V
18
GND
GND
Note: blue indicates analog pin. Red indicate 5V-tolerant pin.
Table 2: CON3 Functions In Original BackPack vs Plus BackPack
Pin Number
TFT Pin
Original BackPack
Plus BackPack
1
VCC
+5V
+5V
2
GND
GND
GND
3
CS-bar
6 PWM1C
29
4
RESET
23
23 COUNT
5
D/C
2
2
6
SDI (MOSI)
3 SPI OUT
5 SPI2 OUT
7
SCK
25 SPI CLK
4 SPI2 CLK
8
LED (backlight)
to VR1
to pin 53 (PWM2A)
via Q1 & Q2
9
SDO (MOSI)
14 SPI IN
47 SPI2 IN/PWM2B
10
T_CLK
25 SPI CLK
4 SPI2 CLK
11
T_CS
7 COM1:ENABLE
1
12
T_DIN
3 SPI OUT
5 SPI2 OUT
13
T_DO
14 SPI IN
47 SPI2 IN/PWM2B
14
T_IRQ
15 COUNT
3
BackPack and pins 16 and 15 on the
Plus BackPack. On the original BackPack, these pins were also routed to
CON2 and so the external circuit design had to take this into account if the
chip could be re-programmed in-situ.
In contrast, on the Plus BackPack,
66 Silicon Chip
only pin 11 on CON2 (pin 21 of the micro, COM1:TX) is so affected. The other programming pin is routed to new
header CON5 and will rarely be used.
So in summary, to adapt software designed for the original LCD BackPack
to the Plus BackPack, I/O pin numbers
will need to be adjusted and you will
need to ensure that you use the SPI1
bus and that pins 8 and 11 of CON2 are
not required to be 5V-tolerant.
New features
Five new connectors have been
added, with the following functions:
• CON6: since the Micromite Plus
has many more I/O pins than the original Micromite, we’ve added this extra
21-pin header to give access to most
of those additional pins, for projects
which may exhaust the connections
available on CON2. This connector’s
pin-out has some similarities to CON6
on the Explore 64. However, we’ve had
to use a number of different pins here
because the others were already in use
for other purposes.
In summary, the pins on CON6 consist of nine analog-capable inputs, 11
5V-tolerant digital inputs, four PWMcapable outputs, two pins which can
be used to connect a PS/2 keyboard,
two counting inputs plus the same
3-pin SPI bus which is wired to CON2.
Note that besides this shared SPI bus,
none of the other pins are used for any
other purpose and thus you are free
to do what you like with them (with
one slight exception, see the following section).
• CON5: this 3-pin header provides
a convenient place to connect to the
COM3 Tx/Rx pins (16 & 17 on IC1) as
well as pin 33, if it is not being used
as USBID (ie, if shorting block SB1 is
not shorted). Unless you need to use
the COM3 port, you’re unlikely to need
this header and it can be left off.
Note that pins 16 & 17 are already
connected to CON4 and CON6 respectively, however since CON4 is for incircuit programming, you would not
want to connect a COM port there.
Note also that pin 33, USBID is only really needed for “USB on-the-go” (USB
OTG) which would probably require a
different connector for CON8 and thus
is most useful as a 5V-tolerant general
purpose digital input; it can not operate as an output.
• CON7: this allows the use of the
SD card socket on the TFT module. To
use this, you need to fit a 4-pin female
socket in this location and a matching
pin header on the back of the TFT module. The SD card’s CS-bar, MOSI, MISO
and SCK lines are routed to pins 21, 5,
47 and 4 on IC1 respectively. Since the
latter three pins are SPI2 OUT, SPI2 IN
and SPI2 CLK, this makes interfacing
siliconchip.com.au
with an SD card easy; the commands
to do this are shown later.
Power for the SD card on the TFT
module comes from a 3.3V regulator
(on the module) that draws from the
5V supplied via CON3. So one advantage of using that SD card socket
is that it doesn’t reduce the current
available from the 3.3V rail on the
BackPack PCB.
• CON8: the onboard USB socket
which can be used as a serial console.
It’s quite convenient since all you need
is a USB Type-A to microUSB cable
to communicate with the Micromite
Plus. However as noted in the earlier
articles on the Micromite Plus, it has
the disadvantage that the console is
reset whenever the micro is reset (eg,
when S1 is pressed). However, our
experience has been that this is not
necessary very often so you certainly
can program the Micromite Plus via
this port.
If JP1 is fitted, then the unit will be
powered from this cable as well but
take care that you don’t back-feed 5V
into the USB port since this could damage your PC. In other words, only fit
JP1 if you are not powering the board
from any other source.
The alternative to using CON8 for
programming and communications
is to use a USB/serial adaptor (as explained in multiple previous articles)
and wire it up to CON1 (see Fig.3). This
will allow the serial port to continue
operating even if the Plus BackPack
is reset. Power can also be supplied
to the board via CON1, with the same
proviso as above.
• CON9: the onboard microSD card
socket. This is wired in parallel with
CON7 so if using this, you can’t use
the SD card socket on the TFT module
and vice versa.
The card is powered directly from
the onboard 3.3V supply (from lowdropout linear regulator REG1) and
is provided with a 10µF bypass capacitor. The only additional connection is from pin 22 of IC1 to the card
detect switch on the socket. Later on,
we’ll show the command to configure
the Micromite to use this pin to detect
card insertions and removals.
Circuit description
The full circuit of the Micromite
Plus BackPack board is shown in Fig.1.
It consists mostly of microcontroller
IC1 and its connections to CON1CON9, so essentially we have already
siliconchip.com.au
Parts List
1 double-sided PCB, code
07110161, 86 x 50mm
1 ILI9341-based LCD module,
320 x 240 pixels, 2.8-inch
diagonal, with touch controller
1 right-angle, through-hole,
tactile pushbutton switch,
short actuator (S1)
1 20MHz crystal, low profile
HC-49 (X1)
2 4-pin headers, 2.54mm pitch
(CON1 & SD card connector
on display module)
1 18-pin header, 2.54mm pitch
(CON2)
1 14-pin female header, 2.54mm
pitch (CON3)
1 6-pin right-angle header,
2.54mm pitch (CON4; optional)
1 3-pin header, 2.54mm pitch
(CON5; optional)
1 21-pin header, 2.54mm pitch
(CON6)
1 4-pin female header, 2.54mm
pitch (CON7)
1 SMD mini USB type B socket
(CON8) (Altronics P1308 or
similar)
1 microSD card socket (CON9)
(Altronics P5717 or similar)
1 2-pin header, 2.54mm pitch,
with shorting block (JP1)
4 M3 x 12mm tapped spacers
4 M3 x 6mm machine screws
4 M3 x 8mm machine screws
4 Nylon washers, 3mm ID, 6mm
OD, 1mm thickness
1 laser-cut jiffy box lid and UB5
jiffy box (optional)
1 USB-to-serial adaptor and
jumper leads (optional, see text)
described most of it above. But let’s go
over a few details.
IC1 has a 20MHz crystal connected
between oscillator pins 39 and 40, with
22pF load capacitors. Its 100MHz or
120MHz clock signal is derived from
this using an internal PLL (phaselocked loop) frequency multiplier
that’s configured by the MMBasic software. A 10µF ceramic capacitor from
pin 56 to ground stabilises its internal
core supply rail.
Display backlight control is via IC1’s
output pin 53, referred to in MMBasic
as PWM 2A. Note that the PWM 2B
function is shared with SPI2 IN, which
is already dedicated to the display in-
1 5V regulated power supply
(see text)
Semiconductors
1 PIC32MX470F512H-120/PT
microcontroller programmed
with 0710816A.HEX (IC1)
1 MCP1703A(T)-3302E/DB
low-dropout 3.3V regulator,
SOT-223 (REG1)
1 MCP120(T)-270I/TT 2.7V
supply supervisor, SOT-23
(IC2; optional – see text)
1 DMP2215L P-channel Mosfet,
SOT-23 (Q1)
1 2N7002 N-channel Mosfet,
SOT-23 (Q2)
1 green SMD LED* (LED1)
Capacitors*
4 10µF 6.3V ceramic, X5R or X7R
6 100nF 50V ceramic, X5R or
X7R
2 22pF ceramic, C0G/NP0
Resistors (1% or 5%)*
2 10kΩ
1 470Ω
2 1kΩ
1 10Ω
* Use SMD 3216 (1206 imperial)
size; 2012/0805 sizes are also suitable but are not recommended for
beginners
Where to buy parts
A complete kit for the Micromite
Plus LCD BackPack will be available
from the SILICON CHIP online shop,
along with suitable laser-cut lids and
separate items such as the PCB and
programmed microcontroller.
terface, so there is no issue with interaction between these two PWM functions that share the same timer. Pin
53 drives the gate of N-channel Mosfet Q2, which has a 10kΩ pull-down
resistor so that it is held off when the
microcontroller is powering up, reset
or not operating for some other reason.
When pin 53 goes high, Q2 switches
on and this pulls the gate of P-channel Mosfet Q1 low. It is normally held
high by a 1kΩ resistor from the 5V rail.
When the gate of Q1 is pulled low, Q1
switches on, allowing power to flow
from the 5V rail into the backlight LED
anode pin, marked LED on CON3. The
higher the duty cycle of the PWM sigNovember 2016 67
10 µF
X5R
Tx
Rx
CON6
+3.3V
OUT
IN
PWM1B
A
4x
100nF
10 µF
GND
X5R
λ
LED1
POWER/
CONSOLE
Vdd
58
RF0
6
RG8/AN18
CON8
26
10
AVdd
Vdd
Vdd
Vdd
CON5
17
COM3:RX
MICROMITE I/O
RESET
TO IC1 PIN 7
SPI1 OUT
(3)
8
12
(4)
14
(5)
(9)
(10)
(14)
(16)
(17)
COM2:TX
11
COM2:RX
13
SP1I IN
45
COUNT/WAKEUP/IR
51
I2C CLOCK
44
I C DATA
43
2
(18)
RB6/AN6
SDA2/RF4
SCL2/RF5
RE0
RE1
AN20/RE2
RE3
AN21/RE4
RG9/AN19
RB4/AN4
RB2/AN2
59
COM1:RX
(22)
24
(24)
50
SPI1 CLK
(25)
27
(26)
IC1
PIC3 2 MX470PIC32MX470F512H
RD3/AN26
RD10
AN10/RB10
RD5
Vdd
Vss
62
PWM 1C
AN23/RE6
RB12/AN12
AN27/RE7
AN8/RB8
MCLR
PWM 2A
Q1
DMP2215L
SCK
Q2
2N7002
LED
SDO (MISO)
SPI2 CLK
T_CLK
1
T_CS
5
SPI2 OUT
T_DIN
47
SPI2 IN/PWM2B
T_DO
3
T_IRQ
21
ILI9341-BASED TFT DISPLAY
CON9
PMA7/RB9/AN9
OSC2 AVss Vss
40
20
9
Vss
25
Vss
41
22
CS
Vcap
MISO
56
SCK
X1 20MHz
10 µF
CON7
X5R
22pF
1
2
3
DI
3V3 4
SCK 5
GND 6
7
8
CS
MOSI
DO
+3.3V
PGD
CON4
1
2
3
4
5
PROGRAMMING
(ICSP) HEADER
PIN NUMBERS IN RED
INDICATE 5V TOLERANT INPUTS
20 1 6
PIN NUMBERS IN BLUE INDICATE
ANALOG-CAPABLE INPUTS
10 µF
X5R
MICRO SD
CARD SOCKET
IC1
1
SC
CD
PGC
Vcc
GND
MCLR
CARD DETECT
OPTIONAL
D/C
SDI (MOSI)
TO SD CARD
SOCKET
RB1/AN1/PGEC1
22pF
RESET
2
RB0/AN0/PGED1
39
GND
CS
53
4
SCK2/AN16/RG6
CON2
100nF
VCC
10kΩ
RD2/AN25
470Ω
63
64
COUNT
RB11/AN11
IC2 MCP120-270
RST
61
23
RF1
OSC1
RESET
S1
32
60
RD9
RC13
15
55
31
29
AN14/RB14
AN17/RG7
10kΩ
54
PS/2 KEYBOARD DATA
1kΩ
+5V
7
30
+5V
RD11
AN22/RE5
16
52
PS/2 KEYBOARD CLOCK
RB3/AN3
GND
+3.3V
28
CON3
+3.3V
+5V
50
COUNT
RB5/AN5
COM1:TX
(21)
42
46
18
48
49
28
52
30
54
55
31
32
60
61
62
63
64
49
SPI1 CLK
TO IC1 PIN 50
VUSB 3V3
RD8
RD0
RB7/AN7
SOSCO/RC14
AN24/RD1
AN13/RB13
RD4
AN15/RB15
RD6
RD7
INPUT ONLY
48
COUNT
35
57
38
34
VBUS
36
D–
37
D+
33
RF3/USBID
SB1
EXTRA
I/Os
18
100nF
1
2
3
X
4
16
46
+3.3V
19
COM3:TX
45
PWM1A
+3.3V
MINI USB
TYPE B
33
17
PWM2B/SPI1 IN
1k
10Ω
JP1
17
TO IC1 PIN 45
8
COM3:RX
TO IC1 PIN 17
K
GND
42
SPI1 OUT
TO IC1 PIN 8
ADDITIONAL I/Os
REG1 MCP1703A-33E
CON1
5V
MICROMITE+ EXPLORE 64
CATHODE
DOT
MCP120
LED
Vin
GND
RST
A
MCP1703
Vss
K
Vdd
Vout
Fig.1: the complete circuit diagram for the Micromite Plus LCD BackPack. It’s primarily composed of PIC32 micro
controller IC1, which is programmed with the Micromite Plus firmware, plus connectors CON1-CON9 which give
access to the I/O pins, interface with the touchscreen and provide the USB, serial and SD card interfaces. Mosfets Q1 &
Q2 provide display backlight dimming while REG1 derives IC1’s 3.3V supply from the externally supplied, regulated
5V rail. Pin numbers shown in parentheses refer to the original LCD BackPack.
nal from pin 53, the brighter the backlight. Commands to control the backlight will be shown later.
The MCLR reset input of IC1 is held
68 Silicon Chip
high by a 10kΩ pull-up resistor from
the 3.3V rail, preventing spurious resets. The chip can be reset either by
pressing onboard tactile pushbutton
switch S1 or by pulling pin 1 of CON4
low. A 470Ω series resistor limits the
current drawn from this pin when S1
is pressed.
siliconchip.com.au
X1 20MHz
22pF
22pF
10 µF
100nF 07110161
RevC
= 5V tolerant
GND
RX
TX
5V
GND
5V
3V3
27
50
24
59
15
43
44
51
45
13
11
14
12
8
RESET
10kΩ
CON3
Micromite+
LCD
BackPack
S1
1
10 µF
33
10 µF 1kΩ
1kΩ
CON9
microSD
K
K
1
42 8 17 45 46 18 48 49 50 28 52 30 54 55 31 32 60 61 62 63 64
CON5
17 16
CON8
USB
100nF
IC1
PIC32MX
470F
512H
10 µF
CON2
CON4 ICSP
SB1
100nF
1
SD
CON8
10kΩ
CON5
1617
16
1733
33
CON1
LED1
(ALTERNATIVE)
470Ω 100nF
Q2
2N7002
Q1
DMP2215L
10Ω
MCP1703A-3302E/DB CON3
REG1 TOUCHSCREEN
SILICON
CHIP
LED1
© 2016
5V
TX
RX
GND
Vbus
RESET
8
12
14
11
13
45
51
100nF
44
43
15
59
24
50
27
3V3
5V
GND
JP1
Reset
(IC2)
(1 00nF)
(MCP120-270)
CON4 ICSP
S1
CON7
CON1
CON2
CON6
64 63 62 61 60 32 31 55 54 30 52 28 50 49 48 18 46 45 17 8 42
CON6
Fig.2: follow these top and bottom overlay diagrams to assemble the Micromite Plus LCD BackPack PCB. Most of the
parts are SMDs and are fitted to the top side which later faces the rear of the attached LCD module. I/O connectors
CON1, CON2, CON5 and CON6, along with in-circuit programming header CON4, are fitted to the other side. Reset
switch S1, USB socket CON8 and microSD card socket CON9 are accessed via the edges of the module.
Like the LCD BackPack and Explore
64, the Plus BackPack has provision
for IC2, an MCP120 2.7V supply supervisor which will reset IC1 should
the nominally 3.3V supply drop below
2.7V. Normally, this is not necessary,
however it may prevent the unit from
misbehaving in a harsh environment.
If you want to fit the MCP120, the only
other component you need is fit is its
adjacent 100nF bypass capacitor.
Power supply
The unit is intended to be powered
from an external regulated 5V supply.
The acceptable voltage range is 4.55.5V which means that the USB port
of a PC or a USB charger is quite suitable for powering the Plus BackPack,
either via CON8 or flying leads connected between pins 1 and 4 of CON1.
Current drain is up to 250mA with
full brightness on the display backlight and the Micromite running at full
speed. With the display backlight off,
the supply current is more like 80mA
and this can be reduced if the Micromite is in sleep mode or running at
less than maximum speed.
Note that you must not use an unregulated 5V supply as these can easily
reach over 6V which is the threshold
for damage to REG1 and possibly other
components (eg, the display module).
REG1 is a 250mA 3.3V low-dropout
regulator which can deliver the rated
250mA with just 3.925V at the input.
Its own supply current is just 2µA with
a light load. It has 10µF input bypass
and output filter capacitors.
IC1 has five 100nF bypass capacitors, located near its five supply pins,
siliconchip.com.au
with a 10Ω resistor to help filter its
analog supply (AVDD). Finally, LED1
indicates when power is present and
is fed with around 1mA thanks to its
1kΩ series current limiting resistor.
Note that pads are provided to mount
LED1 on either side of the PCB, depending on your preference.
PCB design
The Micromite Plus LCD BackPack
is built on a double-sided PCB measuring 86 x 50mm which is identical
to the size of the original Micromite
LCD BackPack. Most of the components are on one side, which ends up
facing the back of the display module.
Fig.2 shows the details.
Besides routing all the tracks from
IC1 to the various connectors, our main
goal was to keep high-speed signals
separated to prevent cross-talk and to
provide a low-resistance ground plane
across the whole board to minimise
EMI and inductive coupling between
tracks. As such, it is studded with numerous vias between the top and bottom layer ground planes, including
many under IC1.
CON3 and CON7 are located to plug
straight into the display module and
the four mounting holes are spaced
to suit that module too. CON1, CON2
and CON6 can either be mounted on
the back of the module or on the display side but using right-angle headers. CON5 can be left off in most cases
and if you only need a few I/O pins,
you don’t need to fit CON6 either.
The microSD card socket, CON9, is
best used for permanent storage such
as graphics or program data; it may
be possible to design a case to allow
access to insert and remove this card
from outside but it would be difficult.
This would be easier to arrange with
the SD card socket on the display module, as the larger full-size SD card protrudes much further.
CON4 would normally be fitted as a
right-angle header on the bottom of the
board as shown on Fig.2, to reduce the
overall height of the module, although
there’s nothing stopping you from using a straight header should you wish.
CON8 and S1 are easily accessed from
the side of the module, despite being
mounted between the two boards, although note that a cable plugged into
CON8 may interfere with plugging a
PICkit 3 into CON4 if using a rightangle header.
Should you wish to mount some
sort of “shield” on the back of the
BackPack module (like we did in the
Touchscreen Voltage/Current Reference in next month’s issue), the four
mounting positions can be used to attach spacers on either side of the board.
Construction
Construction is quite similar to the
Micromite Plus Explore 64 as we are
using mostly the same parts. The only
slightly tricky components to fit are
IC1, CON8 and CON9 as these have
relatively close pin spacings. The
other components either have wide
spacings or are conventional throughhole types.
The essential tools are a good magnifier, plenty of flux and a steady hand.
The magnifier needs to be at least x3
power and preferably x10. A jeweller’s
November 2016 69
The Micromite
Backpack PCB
plugs directly
into a 2.8-inch
LCD. Note that
this view shows
a prototype PCB;
the ICSP header
(if used) goes on
the other side
of the PCB in
the final version
and there are
other minor
differences.
loupe can be used but the best option
is a stereo microscope and SILICON CHIP
reviewed some good candidates in the
July 2014 and November 2015 issues.
The flux should be a good quality flux
paste/gel such as Cat. H1650A from
Altronics or Cat. NS3036 from Jaycar.
Fig.2 shows the parts layout on the
Plus BackPack PCB. The first step is
to install microcontroller IC1. Apply
flux to all of its pads, then position
the chip so that its pin 1 (marked with
a dimple) is lined up with the pin 1
marking on the PCB. Then hold it in
position using a toothpick or tweezers
and solder one corner pin.
An alternative technique is to first
apply solder to one pad, then heat
the solder on that pad while quickly
sliding the IC into place, after which
you lift the iron off the board. This
requires more practice but you can
make several attempts, as long as you
avoid spreading the solder onto adjacent pins.
Now check that the IC is correctly
aligned; if not, re-melt the solder while
gently nudging it into position. Once
it’s in position, apply more flux to all
the pins and solder each one in turn,
then recheck the first pin and add fresh
solder if necessary.
The technique here is simple; put a
very small amount of solder on your
iron’s tip, touch the tip to the solder
pad and slide it forwards to gently
touch the first pin. The solder should
70 Silicon Chip
freely flow around the pin and the
pad. You should then be able to solder at least 15 more pins (one side of
the IC) before you need to add more
solder to the iron.
The secret is to be generous with
the flux, as this will allow the solder
to flow freely onto the pads and their
corresponding pins. Alternatively, if
you have a mini-wave tip or a very
steady hand, with sufficient flux in
place, you can drag solder across one
side (16 pins) in a single movement.
Often you will find that you are actually soldering two or more pins simultaneously but the solder will not
usually bridge the pins. If it does, this
is an indication that you have too
much solder on your iron. If any pins
are bridged, come back later with solder wick (and more flux) and remove
the excess.
The SD card connector is next on
the list. It’s located on the PCB by two
small plastic pins that match two holes
on the board. Solder its four mounting
lugs first, followed by the signal pins.
These pins are soldered using the same
technique as for IC1.
Note that the SD card connector’s
pins are fragile and the plastic they
are embedded in will melt if too much
heat is applied, so only touch the soldering iron to the pins for a very short
time. As before, apply plenty of flux
before soldering.
The mini USB connector can now go
in. It also has locating pins to position
it correctly. You may have to push it
down firmly for it to sit flush with the
board. Once again, solder the mounting lugs first and then the signal pins.
These are a bit of a challenge as they
are partially under the connector’s
body and you will need a fine-tipped
soldering bit to reach them; we have
extended the pads outside the body to
make this easier.
You can now solder REG1 in place.
This has a large tab which connects to
the copper ground plane on the PCB.
Start by applying flux to all four pads,
then slide it into place and solder one
of the smaller leads before checking the
positioning. Once you’re happy, solder
the other smaller leads and finally the
large tab. It may take a few seconds to
heat the part and PCB up enough to get
a good solder joint on that tab.
Follow with small Mosfets Q1 and
Q2. These devices have wide pin
spacings and heat up quite fast, so
you should have them in place pretty
quickly. If fitting the optional supply
supervisor, IC2, which also comes in
an SOT-23 package, whack that on
now as well.
Passive SMD components
Soldering the passive SMD components requires a slightly different
technique. Start by applying flux to
one solder pad and then tin it by applying a thin layer of solder to it. That
done, you have two choices.
First, you can place the component
in position and hold it still with a
toothpick or tweezers while you apply the iron’s tip to the end sitting on
the tinned pad and the component
lead will sink into the solder underneath. Alternatively, you can slide
the component into place while heating the solder on the pad. The second
technique will probably require more
practice but it may be quicker once
you get used to it.
Either way, once the component is
secure, apply more flux and solder the
other end before returning to the first
to make sure that the joint is good.
Once again, the secret is to use plenty of flux and don’t forget that it may
have boiled off one of the pads while
you were soldering the other end of
the component, so keep reapplying it.
Solder the six resistors and 12 capacitors using this method.
LED1 (the power indicator LED) is
the last SMD to be fitted. This device
siliconchip.com.au
USB
USB-To-Serial
Converter
Micromite Plus
BackPack PCB
Fig.3: the Micromite LCD BackPack is connected to your PC using a USB-toserial converter. All programming and control of the Micromite is carried
out via the console using a terminal emulator on the PC. Once the program is
debugged and running, you can then disconnect the USB-to-serial converter.
is polarised and should be marked
with a bar or dot on the cathode end.
Some LEDs might be different so it is
a good practice to use a multimeter’s
diode test facility to check the polarity. Solder it in place with the cathode
towards the top edge of the board, as
shown in Fig.2.
It’s up to you whether to put it on
the same side of the board as the other
SMDs, where it will ultimately face towards the front of the unit (ie, aimed
at the back of the TFT module) or on
the other side, where it will be more
visible but facing the back of the unit.
Through-hole components
Install crystal X1 using the usual
method. PCBs supplied by SILICON
CHIP will have solder mask over the
top side of the mounting pads so it
should be possible to push the crystal
can right down onto the PCB surface
before soldering it.
Next comes tactile pushbutton S1,
which is soldered into place with its
actuator sticking out (barely) over the
edge of the PCB. Push its pins all the
way down before soldering them. Now
you can solder headers CON3 and
CON7 in place, on the same side as
the other components. You may find
it best to temporarily plug in the TFT
module and attach it using the tapped
spacers to ensure these are positioned
correctly.
Now you can solder CON1, CON2
and optionally CON4, CON5 & CON6
to the opposite side of the PCB. Make
sure they’re all straight and flat on
the board before soldering more than
two pins.
JP1 can go on either side of the
board. We’ve shown it on the side that
will face the TFT module but this does
siliconchip.com.au
make it difficult to change when the
display module is in place (which may
or may not be a good thing).
Finally, it’s time to attach the TFT
module. Use M3 x 6mm machine
screws to attach M3 x 12mm tapped
spacers to each mounting hole, with
the spacers on the same side as CON3
and CON7. Then plug the module
into both CON3 and CON7 (noting
that you’ll need to fit the 4-pin male
header on the TFT module, as it comes
without it). Attach the module to the
spacers using the slightly longer machine screws, with the Nylon washers
under each screw head. These will be
used as spacers later if you decide to
attach the whole thing to the lid of a
box or case.
Loading the firmware
Programmed PIC32s are available
from the SILICON CHIP Online Shop
and will be supplied with any Micromite Plus LCD BackPack kits purchased. If using a blank PIC32 chip,
you will need to program it yourself.
In this case, you will need a suitable
programmer such as a PICkit 3 from
Microchip. This can be used to program IC1 via CON4.
The first step is to download the
firmware from the SILICON CHIP website and extract the Micromite Plus
hex file (ie, the firmware). It’s then just
a matter of using your computer and
the MPLAB software supplied with
the PICkit 3 (or downloaded from Microchip) to program the hex file into
the microcontroller; see page 26 of the
February 2016 issue for further details.
During this procedure, the PICkit
3 will verify the programming operation by reading back the data on the
chip. If it reports a fault, you will need
to fix that before progressing. Usually, though, the programming operation will be verified as OK, indicating
that the PIC32 has been correctly programmed.
Serial console
To set up and use the Plus BackPack,
you must connect a terminal emulator
to its console. The console is a serial
interface over which you can issue
commands to MMBasic to configure
the chip and edit or run programs.
MMBasic also uses the console to display error messages.
As mentioned earlier, the Plus BackPack actually has two consoles, one
serial and one USB. A USB-to-serial
converter is required in order to use
the hard-wired serial console. One end
of this converter plugs into a USB port
on your computer, while the other end
connects to the Micromite’s serial console – see Fig.3. To your computer, it
will look like a serial port (via USB),
while the connection to the Micromite
Plus is a standard serial interface with
TTL (0-3.3V) signals levels.
JP1 must be installed if you want to
power the Plus BackPack via CON8.
However, it must NOT be fitted if you
are powering the unit externally and if
there’s any chance you will use CON8
to access the USB console. So check
whether your fitting of JP1 is correct
before proceeding.
We recommend converters based
on the CP2102 chip. These are available from the SILICON CHIP online
shop at www.siliconchip.com.au/
Shop/7/3437 They are each supplied
with a short DuPont female/female
cable which plugs straight into the
Plus BackPack board.
Fig.3 shows how a CP2102-based
November 2016 71
ner). This can be done using a logic
probe, oscilloscope or, at a pinch, a
moving coil multimeter. If you do see
some activity, the fault is probably either an incorrect console connection
or is in the USB-to-serial converter.
User manuals
Connectors CON1 & CON2
are mounted on the rear
of the Backpack PCB as
shown in the photo. CON4
& CON5 also go on this
side of the board in the
final version – see Fig.2.
converter is connected to the BackPack
(other types should be similar). Note
that the converter feeds through the
5V supply rail derived from the PC’s
USB port to power the Plus BackPack.
When the converter is plugged into
your computer and the correct driver
is installed, it will appear as a serial
port (eg, COM3 in Windows). You then
need to start a terminal emulator on
your computer. For Windows, we recommend Tera Term V4.88 which can
be downloaded for free from http://
tera-term.en.lo4d.com You will need
to set its interface speed to 38,400 baud
and connect it to the serial port created
by the USB-to-serial converter.
Once that’s been done, hit the Enter
key in the terminal emulator and you
should see the Micromite’s prompt
(“>”) – Fig.4. You can then enter, edit
and run programs from the command
prompt using nothing more than the
terminal emulator and a USB cable.
Testing
If you don’t see the Micromite’s
prompt, something is definitely wrong
and you will need to go through the
following troubleshooting procedure.
The first step is to measure the current
drawn by the Plus BackPack from the
5V power supply. With nothing attached to its I/O pins, this should be
60-80mA. If it is substantially more or
less than this, it indicates that something is wrong with either the soldering, the microcontroller or its power
supply.
If this is the case, check that +3.3V is
present on pins 10, 26, 38, 57 & 35 of
72 Silicon Chip
IC1 and on various other components
– see Fig.1. If this checks out, check
that the capacitor connected to pin 56
(Vcap) of IC1 is correctly soldered and
is the correct type; it must be a 10µF
multi-layer ceramic type. A faulty capacitor will prevent the internal CPU
from running and the current drain
will be quite low (less than 10mA).
A disconnected pin can also prevent
the micro from running, so check the
soldering on IC1’s pins. It’s easy to miss
a pin and leave it floating just above
its solder pad and without a decent
magnifier and bright light, this may
not be obvious.
Another cause of low current drain
is either not programming the Micromite Plus firmware into the chip or
ignoring an error during this operation. Check that the micro has been
correctly programmed.
If the current drain is about right, the
next step is to attach the Plus BackPack
console to your computer or terminal
emulator as shown in Fig.3. You could
also try using the USB connector as
the console.
With the console connected, press
the Reset button on the BackPack
and you should see the start-up banner as shown in Fig.4. Note that you
will not see this banner if you are using the USB console because resetting
the Plus BackPack will also reset the
USB interface.
If you don’t see the start-up banner you should check the console Tx
pin for some activity when the Reset
button is pressed (this indicates that
MMBasic is outputting its start-up ban-
The Micromite Plus is quite an advanced device. After all, it is a full
computer with a multitude of facilities. As a result, it has two user manuals which together add up to almost
200 pages.
The first manual is called the “Micromite User Manual” and it describes
the features that are standard across
the whole Micromite range, from the
original 28-pin version to the 100-pin
Micromite Plus (featured in the September & October 2016 issues).
The extra features of the Micromite
Plus are described in the “Micromite
Plus Addendum” which covers subjects such as the GUI functions, the SD
card interface and other features that
are only found in the Micromite Plus.
Both manuals are in PDF format and
available for free download from the
SILICON CHIP website. Before you build
and test the Plus BackPack, it would
be worthwhile downloading and looking through them as they provide a lot
more information than we can fit into
these pages.
Configuring the display
While MMBasic for the Micromite
Plus has inbuilt support for 10 different LCD panels, the Plus BackPack is
specifically designed to attach to the
2.8-inch diagonal 320x240 display
with an ILI9341 controller. For details
on how to connect it to other types of
display, see the Explore 64 article in
the August 2016 issue (pages 70 & 71).
Before configuring the display, you
need to turn the backlight on or else it
will be very difficult to see anything.
Do this using the following command:
PWM 2, 1000, 50
This sets the brightness to 50% (approximately). You can adjust this value
later if required. Assuming you can see
that the backlight is now on, proceed
to configure the display as follows:
OPTION LCDPANEL ILI9341, L,
2, 23, 29
To test the display, enter the command:
GUI TEST LCDPANEL
siliconchip.com.au
You should immediately see an animated display of colour circles being
rapidly drawn on top of each other.
Pressing the space bar on the console’s
keyboard stops the test. Note that once
the display has been configured, you
don’t need to do it again as the configuration options are stored in the micro’s flash memory.
Configuring touch
Once the LCD panel has been configured, you can set up touch sensing
using the following command:
OPTION TOUCH 1, 3
If you have connected a piezo buzzer to one of the unit’s pins via a driving transistor and want this buzzer to
click when the screen is touched, you
can add this pin number onto the end
of the command (with a comma separating it from the final digit).
As with other options, this command only needs to be run once and
every time the Micromite is restarted,
MMBasic will automatically initialise
the touch controller. If the touch facility is no longer required, the command
OPTION TOUCH DISABLE can be used
to disable the touch feature and return
the I/O pins for general use.
Before the touch facility can be used,
it must be calibrated using the GUI
CALIBRATE command. The calibration
process starts with MMBasic displaying a target in the top-left corner of the
screen. A blunt, pointed object such
as a stylus is then pressed exactly in
the centre of the target and held down
for at least one second. MMBasic will
record this location and then continue the calibration by sequentially displaying the target in the other three
corners of the screen.
Following calibration, you can test
the touch facility using the GUI TEST
TOUCH command which will blank
the screen and wait for a touch. When
the screen is touched with a stylus, a
white dot will appear on the display.
If the calibration was carried out successfully, this dot will be displayed
exactly under the location of the stylus. Pressing the space bar on the console’s keyboard exits the test routine.
Configuring an SD card
Now that you’ve set up the display
and touch interfaces, you can configure it to use an SD card. Assuming you
have fitted CON7 and the matching
header on the TFT module, you can
siliconchip.com.au
plug a full-size SD card into the socket
on the back of the display. Whether or
not you have done this, you also have
the option of plugging a microSD card
into the onboard socket. You can’t use
both at the same time, though.
We would have liked to provide
separate CS lines so that both sockets could be used however the Micromite Plus software requires a reboot
to change the CS pin, making this impractical. So for now, they are connected in parallel and only one can
be used at a time.
Before plugging in the card, you
need to run the OPTION SDCARD command. Note that this must be entered
at the command prompt and can not
be used in a program. To set up the
microSD card socket, use:
OPTION SDCARD 21, 22
or for the full-size card socket:
OPTION SDCARD 21
Unfortunately, the TFT module does
not break out the card detect pin on the
full-size socket, so you can’t change
the card while the unit is running.
After running either command, you
will need to restart the Plus BackPack
(eg, with reset button S1). After that,
MMBasic will automatically initialise
the SD card interface each time.
SD card not required
If the SD card is no longer required, the command OPTION SDCARD
DISABLE can be used which will disable the SD card and return the I/O
pins for general use.
To verify the configuration, you
can use the command OPTION LIST
to list all options that have been set,
including the configuration of the SD
card. As another test, you can pop an
SD card into the slot and run the command FILES. This will list all the files
and directories on the card.
Note that some SD cards can be
temperamental and may not work so
if you encounter a problem here, try a
few SD cards before deciding that you
have a fault. For example, some cards
(especially high capacity, fast types)
may demand more current than the
power supply on the Plus BackPack
can provide.
USB interface
The USB interface on the Plus BackPack doesn’t need configuring. MMBasic monitors the interface and if it de-
Fig.4: this is what you should see in
your terminal emulator when you
press the reset button on the Micromite
Plus LCD BackPack. If you don’t see
this, the probable reason is that the
USB-serial converter is not connected
correctly.
tects a host computer, it will automatically configure it for serial emulation
over USB.
A Windows-based host computer
(versions before Windows 10) will require the installation of the “SILICON
CHIP Serial Port Driver”, which can
be downloaded from the SILICON CHIP
website. Macintosh and Linux based
computers do not need a device driver, as support is built into the operating system.
Windows 10 should not require any
drivers to be installed.
Once configured, the USB interface
works just like a serial port that’s connected to the console. You can start up
a terminal emulator such as Tera Term
for Windows and tell it to connect to
the virtual serial port created by the
Micromite Plus.
Anything outputted by the Micromite Plus will be sent out on both the
USB interface and the serial console.
Similarly, anything received on either of these interfaces will be sent to
MMBasic.
One benefit of using the USB interface as the console is that you can
disable the serial console. This allows
you to use the I/O pins allocated to the
serial console for other duties, including use as a fourth serial I/O port. This
is described further in the “Micromite
Plus Addendum”.
Further details
We’re publishing further information on how to use the graphics, GUI,
SD card and touch functions of the
Micromite Plus in two feature articles,
one in this month’s issue (p58-62) and
the second in next month’s issue. For
further details, refer to the Micromite
user manual and addendum, available
for free download from the SILICON
CHIP website, Geoff Graham’s website
at http://geoffg.net and The Back Shed
forum at www.thebackshed.com SC
November 2016 73
|