This is only a preview of the January 2021 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
|
Table 1.2: Going Further with the
2N7000 MOSFET
Topic
operation can be altered by varying the
values used in the twin-tee network (see
Going further below). Note that popular
Spice-based simulation software can
often be used to model and optimise
the operation of MOSFET circuits, as
shown in Fig.1.14.
Finally, Fig.1.15 shows a crystalcontrolled oscillator based on a single
2N7000 device. This provides a typical
output of 2Vpk-pk and has been tested
with quartz crystals between 2MHz
and 20MHz. This arrangement forms
the basis of the author’s own simple
Crystal Checker circuit, which he uses
in his workshop.
Going further
Our Going further table (opposite)
will help you locate the component
parts and further information that will
allow you to quickly progress with your
own designs and modifications. It also
provides you with background reading
that will help you get up to speed with
the necessary underpinning knowledge
for key topics discussed.
GET T
LATES HE
T COP
Y
OF
TEACH OUR
-IN SE
RIES
AVAIL
AB
NOW! LE
Source
Notes
2N7000
MOSFET
The 2N7000 is available from many
suppliers, including CPC/Farnell, Mouser,
RS Components and numerous online
suppliers. Data sheets can be downloaded
from manufacturers’ websites including ON
Semiconductor, Fairchild and Vishay
Prices range from a
few pence to about 50p
depending on the quantity
purchased
Audio
amplifiers
For all your audio amplifier requirements,
the PE column Audio Out provides a
treasure chest of tips, hints, designs and
ideas, drawing on Jake Rothman’s decades
of experience in teaching, designing and
building a huge range of audio circuits.
All Audio Out columns are
available via back issues at:
www.electronpublishing.
com
Circuit
simulation
The author’s own book, Electronic Circuits:
Fundamentals and Applications (Fifth
Edition 2020 published by Routledge
9780367421984) provides an introduction
to circuit simulation based on the popular
SPICE-based Tina Pro software
Tina software can be
obtained from www.tina.
com. A cut-down version
can be freely downloaded
from Texas Instruments at:
www.ti.com/tool/TINA-TI
Distortion
A detailed explanation of different types
of distortion can be found in Part 8 of
Electronics Teach-In 7
www.electronpublishing.
com/product/electronicsteach-in-7
Negative
feedback
For a useful introduction and relevant theory
see Part 8 of Electronics Teach-In 7
www.electronpublishing.
com/product/electronicsteach-in-7
Transistor
characteristics
and load lines
The author’s own book, Electronic Circuits:
Fundamentals and Applications (see above)
provides an introduction to transistor
characteristics, load lines and amplifiers.
Order direct from
Electron Publishing
PRICE £8.99
(includes P&P to UK if ordered direct from us)
EE
FR -ROM
CD
ELECTRONICS
TEACH-IN 9
£8.99
FROM THE PUBLISHERS OF
GET TESTING!
Electronic test equipment and measuring
techniques, plus eight projects to build
FREE
CD-ROM
TWO TEACH
-INs
FOR THE PRICE
OF ONE
• Multimeters and a multimeter checker
• Oscilloscopes plus a scope calibrator
• AC Millivoltmeters with a range extender
• Digital measurements plus a logic probe
• Frequency measurements and a signal generator
• Component measurements plus a semiconductor
junction tester
PIC n’ Mix
Including Practical Digital Signal Processing
PLUS...
YOUR GUIDE TO THE BBC MICROBIT
Teach-In 9
Teach-In 9 – Get Testing!
A LOW-COST ARM-BASED SINGLE-BOARD
COMPUTER
Get Testing
Three Microchip
PICkit 4 Debugger
Guides
Files for:
PIC n’ Mix
PLUS
Teach-In 2 -Using
PIC Microcontrollers.
In PDF format
This series of articles provides a broad-based introduction to choosing and using a wide range
of test gear, how to get the best out of each item and the pitfalls to avoid. It provides hints
and tips on using, and – just as importantly – interpreting the results that you get. The series
deals with familiar test gear as well as equipment designed for more specialised applications.
The articles have been designed to have the broadest possible appeal and are applicable to all branches of electronics.
The series crosses the boundaries of analogue and digital electronics with applications that span the full range of
electronics – from a single-stage transistor amplifier to the most sophisticated microcontroller system. There really is
something for everyone!
Each part includes a simple but useful practical test gear project that will build into a handy gadget that will either
extend the features, ranges and usability of an existing item of test equipment or that will serve as a stand-alone
instrument. We’ve kept the cost of these projects as low as possible, and most of them can be built for less than £10
(including components, enclosure and circuit board).
© 2018 Wimborne Publishing Ltd.
www.epemag.com
Teach In 9 Cover.indd 1
01/08/2018 19:56
FREE COVER-MOUNTED CD-ROM
On the free cover-mounted CD-ROM you will find the software for the PIC n’ Mix series of articles. Plus the full Teach-In
2 book – Using PIC Microcontrollers – A practical introduction – in PDF format. Also included are Microchip’s MPLAB
ICD 4 In-Circuit Debugger User’s Guide; MPLAB PICkit 4 In-Circuit Debugger Quick Start Guide; and MPLAB PICkit4
Debugger User’s Guide.
ORDER YOUR COPY TODAY JUST CALL
01202 880299 OR VISIT www.electronpublishing.com
42
Practical Electronics | January | 2021
PIC n’Mix
Mike Hibbett’s column for PIC project enlightenment and related topics
Part 3: PIC18F development board
W
e continue this month with
Flexible – the ability to select which
Simplifying soldering
the process of creating a development board for the PIC18F
processor. In this and the following article we are going to cover the design of
the board, ensuring it supports a number
of different externally connected technologies: GPS location, digital compass,
various display types, speech output, connectivity to a PC connection via USB, Wi-Fi
communication, interfacing with Amazon
Alexa, servomotor control and analogue
input. The focus for this article series will
be on making use of the processor, rather
than diving into the finer details of internal processor peripherals – a hands-on,
practical approach.
In the previous article we selected the processor we will be using – the PIC18F47K42
in a 40-pin DIL package. We chose that
package because it provides lots of I/O
signals yet is very easy to solder (via a
40-pin socket) making it easy to replace
if damaged.
There is a lot of work to do before we
jump in and start designing a PCB. Even
before drawing the schematic, we need to
be clear in our objectives for this board,
writing down some requirements, and
check if any of our items might clash with
each other and (hopefully) find solutions
to those issues. Let’s start by writing down
our key requirements:
Easy to assemble – no tiny surfacemount soldered parts. We want this to
be easily assembled, by any hobbyist
features are fitted at any one time,
without major re-work
Re-usable – easy to re-purpose to
different projects
PC serial communications interface
using an on-board UART-to-USB
converter chip, the MCP2221A-I/P
Header connector for an ESP-01 Wi-Fi
interface
Header for a Micro SD Media card
module
Several three-pin headers for servomotors
Header for a colour touchscreen LCD
FET power switches for external
device control
PICkit 4 header for programming/
debugging
Header pins for external devices with
power and I2C or SPI buses
Two configurable op amps, for analogue input signal conditioning
32kHz crystal for very low-current
operation
Plenty of analogue input and digital
I/O headers
Single status LED, and a power LED
Power input from a standard DC
power brick.
The first requirement is driven by a desire
to enable this board to be built by as many
hobbyists as possible, avoiding the use of
difficult-to-solder surface-mount parts. This
is easy to achieve with most components,
but the USB and SD Media connectors are
only available in hard-to-solder formats.
Thankfully, this has been recognised by
a number of electronics suppliers who
provide very simple and low-cost preassembled carrier boards, as shown in
Fig.1 and Fig.2. We will also use a Wi-Fi
module with a similar simple header
interface (shown in Fig.3). These little
boards enables us to avoid the difficulty
of soldering ICs that are only available in
surface-mount format. Another benefit of
providing these as plug-in features is that
they are optional – buy them only if you
want to use them.
On our PCB, USB connectivity to a PC
is provided by a special IC, the Microchip
MCP2221A-I/P. Our processor does not have
USB built in, and the choice to use an external IC rather than choose a processor with a
USB peripheral is deliberate – in our experience the USB software libraries provided
by Microchip (and other vendors) are very
complicated to use. The MCP2221A provides a simple USB-to-UART conversion,
so our processor we will connect the IC to
one of our serial ports, and the USB cable
will look to the PC like a standard serial
port. This will make software development
Fig.1. USB connector board.
Fig.2. SD-Media connector board.
Practical Electronics | January | 2021
That’s quite a list, but many of these will
be easy to implement, and simply remind
us to include certain components in the
schematic. Many requirements have a
consequence – adding a 32kHz crystal,
for example, means that two GPIO pins
become unavailable. Fortunately, however,
there are many GPIO pins, so that won’t
be an issue for us.
Fig.3. Wi-Fi interface board.
43
comes pre-loaded with software that is
easy to use and communicates with our
processor over one of the UART interfaces
(we have two UARTs on our processor, so
simultaneous Wi-Fi and USB connectivity
will be possible.)
Power supply design
Fig.4. Plug-in option boards.
on both the PC and the processor simple.
Plus, the MCP2221A can run at 3.3V or 5V,
so it’s very flexible.
An SD Media card communicates over
an SPI interface, so we will route one of
the SPI buses to it. SD Media cards operate at a voltage of 3.3V maximum, so bear
that in mind if you are thinking of running
your board at 5V. An external adaptor to
level-shift the signals will be required if
you want to use an SD Media card for data
storage and run the board at 5V simultaneously. This will be true for the Wi-Fi
interface too.
The downside of using standard components in a design like this is that the
PCB will larger than the more usual Microchip development boards, which use
tiny surface-mount components. This is
not really a big issue – the board is for
development purposes, so easy soldering
and easy access to components is more
important than size.
Plug-in options
Although this will be a general-purpose
development board, we do have in mind
some external devices that we would like
to be able to connect to it. Fig.4 shows the
current selection from our lab – An LED
matrix, touch-input colour LCD screen,
GPS module and a bag of over 30 different random sensors that were purchased
cheaply on eBay. We will provide links
for the parts used in upcoming articles,
as we make use of them. Needless to say,
these will just be examples, you are free to
attach whatever you want to your board.
Wi-Fi interface
Choosing a Wi-Fi interface board presented some interesting challenges. The board
has to be cheap, easy to purchase, easy to
solder and easy to use. We settled on a
relatively old device, the ESP-01, which
is based on the ESP8266 processor. This is
such a popular design that it has become
available from dozens of different suppliers and is incredibly cheap – as low as £3
including delivery, if you do not mind the
long delivery times from Asia. The module
44
With those thoughts behind us, it’s time to
make our first key design decisions – how
will we power the board, and how will we
direct the processor’s 36 I/O pins to onboard and external connections?
We’ll start with the power supply design.
So, first, we must decide at what voltage
to run the board: 3.3V or 5V? These two
common operating voltages have for years
been a bone of contention for us, too often
we have tried to pair a 5V external device
with a 3.3V processor development board
(servomotors with a Raspberry Pi for example) or a 3.3V module with a 5V processor
board (a GPS module with an Arduino,
for example.) It’s been such an issue over
the years that we have decided to design
a board that can operate at either voltage,
selected by a simple jumper.
The key ICs in our design have been
selected as ones that can operate at either
voltage, so we only need a power supply
design that can be switched between the
two voltages – and we can do that with
an LM317 regulator and a few resistors.
We will use a beefy TO220-style regulator, as powering some external devices,
particularly servo motors, may bring our
current-consumption requirements up
to around 500mA or so. Plus, we make a
mental note: leave space around the regulator for heatsinking, the LM317 is a linear
regulator, and will get warm at these higher
currents. We could have gone with a much
more efficient switching-regulator design,
but that would add complexity. We will
typically be powering this board from a
wall socket power supply, so power supply
efficiency is not a design requirement.
Studying the datasheet of the LM317
we spot that is has a requirement for a
minimum 3V input to output voltage differential, so to generate a 3.3V or 5V output
will require an input power supply running
at a minimum of 8V DC. 9V and 12V DC
power supplies are common and cheap,
so the regulator choice works well.
We will include a power supply isolation header pin, so 3.3V or 5V can be
supplied to the board directly, if desired.
This will enable the testing of low-power
designs, or allow the addition of a more
efficient power supply should you want
to use a battery.
A barrel jack will be accommodated to
support plugging in a standard DC power
brick. There are several different standards
for barrel jack connectors (different pin diameters) so we have to make a decision on
which to go with – we chose the 2.5mm
P I C 18 F 4 7 K 4 2
MC LR / R E3
1
4 0
R B 7
R A 0
2
39
R B 6
R A 1
3
38
R B 5
R A 2
4
37
R B 4
R A 3
5
36
R B 3
R A 4
6
35
R B 2
R A 5
7
34
R B 1
R E0
8
33
R B 0
R E1
9
32
VDD
R E2
10
31
VSS
VDD
11
30
R D7
VSS
12
29
R D6
R A 7
13
28
R D5
R A 6
14
27
R D4
R C 0
25
26
R C 7
R C 1
16
25
R C 6
R C 2
17
24
R C 5
R C 3
18
23
R C 4
R D0
19
22
R D3
R D1
20
21
R D2
Fig.5. PIC18F47K42 processor pin-out.
version, as that seemed to be the most
common size in our lab. Header pins and
solder pads will also be provided for power
input, as these cost nothing but add flexibility to the choice of power connection.
External header pins
We have left the most complex design decision until last. The processor, shown in
Fig.5, has 36 I/O pins – how will we connect these? Thankfully, the pins are highly
configurable; internal peripherals such as
SPI, I2C and UART interfaces are all able
to be programmed to appear on any pin
from a selection of the 36 pins available.
While this simplifies circuit design and
PCB layout, it does add complexity during
software design. With a general-purpose
development board design, where we make
all pins available, this task is very complicated – but that task can be simplified by
writing up a spreadsheet for the pins, indicating where each one will go.
The approach taken here is that multiple
headers are provided for generic SPI and I2C
devices, several servomotor headers (using
the standard header layout) and specific
headers for the Wi-Fi, USB and Micro SD
Media boards. Two FET-controlled power
output headers are provided, and then all
I/O pins will go to 0.1-inch pitch header
strips. Even the I/O signals that are optionally connected to other headers on
the board will be routed to the generic I/O
headers. Three I/O pins will not be used.
PORTE.3 is shared with the master reset
pin MCLR, which we will keep as a reset
pin. PORTC.0 and PORTC.1 are multiplexed with the external crystal inputs,
which will be taken up with our 32kHz
crystal, for ultra-low power operation.
To finish off, two op amps will be
implemented on the board, but left unconnected, with headers to allow user
choice of where they connect.
Practical Electronics | January | 2021
|