0% found this document useful (0 votes)
25 views34 pages

Motherboard BW

Uploaded by

alaa19772008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views34 pages

Motherboard BW

Uploaded by

alaa19772008
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

MOTHERBOARD

INSTRUCTION MANUAL

v0.93
The Kit

104

22

202

202

202

202

202

202

202

202

202

202

202

202

202

202

202

202

202

202
Printed Circuit Board Components

The Printed Circuit Board (PCB) is made of then applied. This is the silkscreen layer, which The kit comes with a variety of components.
resin and fiberglass, with a layer of copper on is where the footprints, designations and oth- They make the circuit function. Designing cir-
the top and bottom. This is a 2 layer board, but er information are found. Short Circuit PCBs cuits can be incredibly complicated. Our kits
boards with more layers are common. We can have the traces drawn on this layer, to help you are designed to be simple to learn. They are
use PCB design software like the free KiCAD, follow the circuit. not always the most efficient or effective way
or Eagle, Altium etc to lay out our circuit. The to design devices with these functions. They
circuit is comprised of footprints that hold the are designed to teach various concepts that
various components, and traces which are can be applied in your own designs.
copper connections between certain com-
ponents.

When the finished design is sent to the man-


ufacturer, they etch away the copper that isn’t
needed to form the circuit. The board is then
coated in a coloured layer that protects the
circuit. This is the mask. A different colour is
The Manual
There is quite a lot of information in this man- Circuit Explanation Coding Basics
ual, so here is a run down of each section and
what you are likely to find. The rest of the Circuit section of this manual Follow the tutorial to make your D13 LED blink.
explains how and why the circuit works. You This is the famous sketch that most people
The manual is a work in progress and we can skip this bit and head straight to building start with when programming Arduinos and
would appreciate your feedback. Please head your kit, then check back later to learn how it Arduino compatible boards.
to the forums if you have any ideas or con- works. Or you can go head first into the how
structive criticism. As the manual is digital, we and why, then start building. It’s up to you. Project Ideas
will be updating it regularly.
Assembly Instructions Here are some of the devices you can make
Symbols and Designations when combining your Motherboard with other
This is where you can learn how to solder kits from Short Circuits. Be sure to check out
Use this table to identify the different compo- your components to the PCB. The tips at the the selection at www.shortcircuits.cc
nents, connections and features of the PCB start are very useful. They may prevent you
and schematic. from getting frustrated. The soldering iron can
be hard to tame. Make sure to keep that tip
PCB Design tinned and shiny! The diagrams on the right Component Index
pages show the components mentioned in
This is the PCB design, which features the the instructions. You can use this to match the The Component Index will give you details
ground plane that’s on the back of the board. components to the footprints on the board, about each component (except some connec-
This isn’t shown on the PCBs silkscreen, but and to make sure you are using the correct tors). We’ve included information about how
you can see it’s borders if you angle the board resistor in the correct place. the component works, its construction, how to
at a light. find out if it has failed and much more. You can
Testing for Faults use this as a reference when designing circuits
Schematic or trying to fix them.
Be sure to go through this section to minimise
The schematic shows the circuit design in it’s any risk of breaking something. If you have a
simplest form. Each part of the circuit is shown short and you connect the board to power, you
separately. Connections within these sections might overheat a component, or burn out the
are shown with white lines. You can find tags power supply.
next to pins connected to other parts of the
circuit. Each tag has a corresponding tag in Programming
the part of the circuit that it is connected to.
This section will show you how to upload code
Bill of Materials to the Motherboard.

The Bill of Materials (BOM) is a list of parts and


their values. This can be used to find replace-
ment parts or to check the datasheets for each
component.
MOTHERBOARD
The MOTHERBOARD kit lets you build a circuit with a microcontroller at its heart. A microcon-
troller controls inputs and outputs depending on how you program it and what is connected to
it. Inputs could be in the form of sensors, switches or other microcontrollers. Outputs could be
as simple as an LED (Light Emitting Diode), number display or speakers, or as complicated as a
3D printer.

The MOTHERBOARD includes screw terminals for digital and analog Inputs and Outputs, a
voltage protection circuit, headers to connect a USB FTDI module (used for programming), and
a Bluetooth module. We’ve also included a Real Time Clock (RTC) circuit on board, so making a
clock with the DIGITISER display is a breeze. This kit will be the “brain” of your project, so lets
get familiar with its functionality!

Contents

Circuit 6
Assembly Instructions 18
Programming Guide 20
Projects 30
Component Index 32
Kit Contents
1 x Atmega328P-PU
1 x DIP-28 Socket
1 x DS1307 RTC
1 x DIP-8 Socket
3 x 0.1uF Capacitors 104

2 x 22pF Capacitors 22

2 x Blue LEDs
1 x Zener Diode
1 x Fuse

1 x Printed Circuit Board 2 x 2K Ohm Resistors


5 x 10K Ohm Resistors
1 x 16MHz Crystal
Tools Needed 1 x 32.768KHz Crystal
1 x 2032 Battery Holder
1 x USB Micro-B Socket
Soldering Iron Screwdriver
2mm 1 x Momentary Switch
1 x 4 Position Header
1 x 6 Position Header
Solder Alan Key
0.3 - 0.5mm 2mm 11 x Screw Terminals
4 x 5mm M3 Hex Screws
4 x Female/Female Standoffs
Side Cutters
18 x 2K SMD Resistors
202

202

202

202

202

202

202

202

202

202

202

202

202

202

202

202

202

202

18 x Blue SMD LEDs


Circuit - Symbols and Designations
PCB SCHEMATIC DESIGNATION
Copper power trace

Copper signal trace

Copper trace on back of board

Through hole solder pads

Surface mount solder pads

Resistor R

Ceramic capacitor C

LED D

Crystal Y

Momentary Switch SW

Header J
14
15
16
17
18
19

10

23
24
25
26
27
28

12
13
11
9

2
3
4
5
6
Microcontroller U
ATmega328P

20
8

U1
22

7
21

Connected to VCC +5V

Connected to GND plane GND

Fuse F

Micro USB J
D+
D-
VBUS

ID

GND
Shield

Zener diode D

Screw terminal J

Mechanical hole
6

Jumper JP
Circuit - PCB Design

MOTHERBOARD
VCC

GND

Tx

Rx
FTDI
J3 C5

R3
DTR

R4
D13 Bluetooth
Rx

D2 Tx

VCC

NC
R1 C3 C4

R5
GND
Y2 J4
Y1
RESET
U2
1
U1
1 SW1
ATMEGA328P DS1307

BT1
PWR

D3
R6-7
C1 C2
R2 CR2032
D1

J1 F1
POWER
USB

Vout
GND

GND
Vin

D10

D12

D13
D2

A0
D3

D5

D8

D9

A2

A5
D6

D11

A3
D4

A4
D7

A1

J2

CIRCUIT
Ground (GND) Copper Area On Back of PCB
Circuit - Schematic
Power In and Out Microcontroller Circuit

+5V +5V +5V


J1 F1 J2
5V IN 0.5A Fuse 5V OUT

D1
5.1V Zener Diode
GND GND 20 7
D7 13
+5V
+5V D6 12
D5 11
D4 6
D3 5
D+
D-
VBUS

ID

R1 D2 4
GND 10K Tx 3
Shield Rx 2
+5V
J4 RESET 1
Micro USB SW1 A5 28
GND RESET A4 27 C1
GND
U1
A3 26 100nF
A2 25
ATmega328P
C3 Y1 A1 24
22pF 16MHz A0 23 GND
IO (Inputs and Outputs)
XTAL2 10
GND

XTAL1 9
D13 19
D10

D12
D13
D11
D2
D3
D4
D5
D6
D7
D8
D9

C4 D12 18
22pF D11 17
D10 16
D9 15
J5 21
D8 14
Digital IO
8 22
A0
A1
A2
A3
A4
A5

C5
100nF

J6
Analog IO GND GND
8
Module Headers Pin 13 & Power LED IO LED Array (Optional)

J8 C2 A5

VCC
FTDI Interface

D13
100nF
DTR RESET
Rx
A4
Tx R4 R4
VCC +5V 2K 2K
A3
CTS
GND GND D2 D3
Tx LED LED A2
J9 Rx
R2

JUMPER
JP1

JUMPER
JP2
Bluetooth Module
1K
A1
Rx
Tx
GND GND R3 A0
VCC +5V 1K GND GND

D13

D12

RTC Circuit D11

D10
+5V
D9

BT1
CR2032 D8
R24 R25
3 8 10K 10K
D7

6 A5
1 D6
U2 5 A4
DS1307
2 NC D5
7

GND
Y2
32.768MHz
4 D4

JUMPER
JP2
D3

CIRCUIT
D2
GND R5-22 D3-20
2K LED
Bill of Materials (BOM)
Designation Value Name Footprint / Pitch Datasheet
C1, C2, C5 100nF Ceramic Capacitor 2.54mm
C3, C4 22pF Ceramic Capacitor 2.54mm
D1 5.1V Zener Diode 12mm
D2, D3 25mA, 3.3V, Blue LED Ø5mm, 2.54mm
D4 - D21 (opt) 20mA, 2.5V, Blue LED SMD 0805
F1 0.5A Polyfuse 5.1mm
J1 Micro B USB
J2 11 x 2 pos Screw Terminals 3.5mm
J3 4 pos Pin Header 2.54mm
J8 6 pos Pin Header 2.54mm
R1, R2 2K, 1/4W Resistor THT 7mm
R3 - R7 10K, 1/4W Resistor THT 7mm
R8 - R25 (opt) 2K, 1/4W Resistor SMD 0805
SW1 SPST SPST Switch
U1 DIP28 IC Socket DIP28
U1 ATmega328P Microprocessor DIP28
U2 DIP8 IC Socket DIP8
U2 DS1307 RTC Chip DIP8
Y1 16MHz Crystal
Y2 32.768KHz Crystal
BT1 2032 2032 Battery Holder
10
Circuit - Power
USB Power Ground Planes

You can power the board through the Vcc The back of the board is covered with a lay-
and GND terminal blocks. But USB is more er of copper that is connected to GND. This
convenient. It is a difficult part to solder, is called the ground plane. We add this for a
but don’t worry, if you mess it up, you can few reasons. One reason is that its just eas-
snip an old USB cable and connect the ier to design that way. When you need to
red and black wires to the terminal block’s connect something to ground, just connect
VCC In and GND respectively. This USB it directly to the ground plane underneath
socket is not used to communicate with a the component. That way you don’t have to
PC. The data connections aren’t connected. worry about adding any ground traces all
This is because the ATMega328P can’t the way back to the power input. If this was
communicate directly through USB. You D1 a 4 layer board, then a 5V plane would also
need to use an programming board or a be a good idea. Another reason is to add
more feature packed microcontroller to some electromagnetic shielding to the cir-
translate for the 328P. cuit, this reduces the chance of erroneous
results due to the effect of electromagnetic
J1 F1 interference on our circuit.
5v Input
POWER
USB

This is where a regulated 5V can be con-


nected to The MOTHERBOARD (and any Design Considerations
VIN

GND

VOUT

other Boards connected to the 5V Output). GND


This could come from your favourite bench When laying out power traces, and the
power supply, or our upcoming POWER components themselves while designing
BOARD, which provides 5v (for all the 5v PCBs on the computer, it is important to
components in our circuit), and a variable consider current loops. When electric cur-
voltage from 1.2v up to 20v+ (for most other rent moves around your circuit, it can create
needs). As mistakes do happen, we’ve electromagnetic interference (EMI). This
added a Zener Diode and a Fuse to protect 5v Output messes with some sensitive components.
the rest of the circuit from over voltage. If The larger the loop, the more EMI is caused.
the voltage exceeds the breakdown voltage Here we have a convenient 5v output, to This is one of the reasons why using the
of the diode (5.1v), current will start flowing power all the other boards that you want bottom copper layer as one big ground
through the Zener to ground, rather than to use with your microcontroller. Power the plane is preferable. This way, the current
the rest of the circuit where it can damage DIGITISER, the RGB MATRIX, the SENSOR can take the shortest and most direct route
components. This will in turn increase the ARRAY, or any other board we produce. back to the power supply. Try and make
current draw to a point that would trip Boards powered from these outputs also the 5V traces as direct as possible. When

CIRCUIT
the fuse and save your components. (See benefit from the voltage protection circuit we designed this circuit, we had to balance
Component Index for more info) we added to the 5v input. this with readability, so our boards aren’t
optimally designed for EMI.
Circuit - Microcontroller
ATmega328P Microcontroller Crystal Oscillator Load Capacitors C3, C4

The ATmega328P is the brain of our circuit. The crystal oscillator mechanically oscillates These are the load capacitors for the crystal
This chip can read changes in the voltage to provide a square wave signal at a stable oscillator. They are reactive components that
at its input/output pins and also set them to reference frequency. This is used by the mi- help create the feedback loop that enables
a chosen value. Using the Arduino program- crocontroller as a clock signal, or its heart the crystal to start oscillating at the intended
ming software, we are able to program it to beat if you like. It determines how many frequency.
respond to inputs from other modules and times a second the microcontroller can do
send responses to other modules as outputs. the actions needed to execute instructions.
Pin 1
This gives us the ability to create unlimited
ways to manipulate other devices to build and
The first pin of any IC is usually indicated
program useful gadgets. You could read data
by a square pad. Pins are numbered an-
from a Real Time Clock module then process
ti-clockwise.
the data to send to a 7-Segment display... A
Digital Clock! Or you could read the data from
a thermometer and process that data to send
to an RGB LED array... A Graphic Thermome-
ter! The possibilities are near endless! C3 C4 R5

Y1
RESET

U1 SW1
ATMEGA328P

Reset Switch & Pull-Up Resistor

This resets the microcontroller. A Single Pull


C1 C2 Single Throw switch with a 10K Ohm pull-
up resistor. This switch pulls the RESET pin
on the microcontroller to ground (0V) when
pressed. This resets the microcontroller.
Bypass Capacitor C1
As electricity takes the path of least resis-
tance, when the switch is not pressed, the
A decoupling capacitor. It’s function is to Bypass Capacitor C2 only path is to VCC (5V) through the 10K
smooth out any noise (spikes or drops in
resistor. When the switch is pressed, the
voltage) due to other components affecting This is another decoupling capacitor that easiest path is to ground. If the resistor
the power supply to the microcontroller. It ‘de- makes sure the analog reference voltage wasn’t there and the switch was pressed,
couples’ the chip from the other parts of the (AREF) measured from pin 21 of the microcon- there would be an uninterrupted path from
circuit. It does this by holding an amount of troller is at a steady value. In our case, that VCC to GND. This is a short circuit, and will
charge and releasing it when the voltage drops, value is the same as our reference ground, or probably burn out the microcontroller.
to compensate. It is placed between power and approximately 0v.
ground, as close to the IC’s (Integrated Circuit)
12

pins as possible.
Circuit - Digital and Analog IO
Digital IO

D2 to D13 are digital Inputs and Outputs.


Digital pins can only read, or write a state
of on (1, 5V) or off (0, 0V). We can however,
still control the brightness of an LED through
PWM (pulse width modulation), which uses
the speed at which the microcontroller can
turn on and off some of its digital pins. If the
pulse is on 50% of the time, then the bright-
ness will be 50%. This is called a duty cycle.
D3, D5, D6, D9, D10 and D11 are PWM ca-
pable. Check for the line underneath its label D2
on the board, or on the pinout diagram of the D3
ATMega328P.
D4

Analog IO D5

D6
Analog pins can read voltage between 0V
D7

ATMEGA328P
and the operating voltage of the microcon-
troller (5V) using the internal Analog to Digital D8
Converter (ADC). The ATmega328P has a D9
10-bit ADC. The largest number that can be
D10
stored in 10-bits is 1024, and as such the an-
alog pins have a resolution of 1/1024. Which D11

1
U1
means at 0V it will read a value of 1, at 5V it D12
will read 1024 and at 2.5V it will read a value
D13
of 512. This is useful when reading things
like photoresistors, or an analog audio input. A0

A1
The ADC cannot output analog signals or
A2
even mimic them with PWM. Also, the pro-
gramming syntax AnalogWrite() has nothing A3
to do with the analog pins. To output sound A4
you would use a PWM pin to create a square
A5
wave (alternating from on to off at a certain
frequency).
J2

CIRCUIT
Circuit - D13 LED
D13 LED

The D13 LED is named after the reference have added jumper pads between the LED Voltage (V), Current (I) and Resistance (R).
Arduino gives to the digital Input Output and ground. If you want to use the LED, then If we know the LED will cause a drop of
(IO) pin of the ATmega328P it is connected solder these two pads together to allow a 3.3V and the source voltage is 5V, then the
to (see the pin-out diagram for all the pin complete circuit through the LED. If you Resistor will take care of the rest. So if we
numbers). It is connected to this IO pin be- don’t like the LED, or you want to connect take the source voltage (5V) from the LED
cause it is also the system clock pin of the a high current draw device to D13, then un- voltage (3.3V), we get the voltage across the
SPI (Serial Peripheral Interface). When you solder the jumpers. resistor (1.7V).
are communicating with the microcontroller
through serial, either with the FTDI module
1 / High / On / VCC / 5V
for programming, or any other device con-
nected to Rx, Tx, MISO, MOSI, etc. The LED 0 / Low / Off / GND / 0V D13 GND / 0V
D2
R1
will turn on when SCK (same pin as D13) is
D13
pulled high, and off when it is pulled low.
That’s why you see it rapidly turning on and
off when these things are communicating. How the circuit works
It’s great to check if your circuit is working V = 5 - 3.3
without programming the chip or having To turn the LED on, you will have to tell
another form of output connected. the microcontroller to output 5V from the V = 1.7
relevant pin. In this case you could use the
You may ask why they aren’t on all the pins following code: From there we can use the typical current
as standard. Well, the current consumption draw of the LED in amps (0.02), together
of the LED, although small, may negative- digitalWrite(13,HIGH) with Ohm’s law, to find the minimum resis-
ly affect a device connected to the same tance needed.
pin, or damage the microcontroller. The (See the programming section for more info)
ATmega328P, according to its datasheet, 1.7
has an absolute maximum current draw of When the microcontroller sets its pin to 5V, R=
40mA per pin and a maximum total current the difference in voltage (potential differ- 0.02
ence) across the resistor and LED will be 5V.
R = 85
draw of 200mA. Fortunately, the other kits
in our series that source current from data This is because the other end of the LED is
pins (RGB MATRIX, DIGITISER etc.) all use connected to GND or 0V.
shift registers, which source very little cur- If the resistor wasn’t added, 5V would be If we used this value, the LED would be at
rent from the ATMega’s pins and instead get applied to the LED which would exceed full brightness and consume 20mA. That
their power from the main 5V input. Shift its recommended limit of 3.3V (check the would be half the pins limit! We can reduce
registers also have a maximum current draw datasheet). this by adding a much higher value resis-
per output pin and per chip that need to be tor. We have used a 2000Ω resistor which
taken into account when designing with To reduce the current going through the LED limits the current to around 0.85mA. You
them, but there are ways around this. Check we can use a resistor in series with it. To could use an even higher value to reduce
out the kits in the series that use them to calculate the value of this resister, we use the current draw and the brightness of the
find out more. Ohm’s Law. (See the section on resistors LED. Using a lower value resistor than our
in the component index for more) Ohm’s calculated minimum would result in the LED
For your convenience, and for flexibility, we law describes the relationship between having a shorter life.
14
Circuit - IO LEDs (Optional)
Data Indicator LEDs

A5

A5

A5
As stated in the previous section, there are
advantages and disadvantages to adding
indicator LEDs to the data pins of the micro-
controller. These are optional because they GND
are very difficult to solder.
+ -
- +

A5

A5

A5
We can use the LEDs to help us understand
the transfer of “data”, or 1’s and 0’s, off’s and
on’s, between the microcontroller and what
it is connected to. A great project to help
with this is to slow down the data transfer
rate between the microcontroller and a shift
register. When the pins are communicating
at a normal rate they will be turning on and fig.1 fig.2 fig.3
off so fast that they will show a consistent
brightness. A clock pin LED will look bright- by hand. We recommend a steady hand and (fig.2, fig.3).
er than a latch pin LED as it will be turning to watch our quick how-to video before tack-
on more often. By adding a delay between ling this upgrade. To turn on the LED circuits, bridge the jumper
each step in the code, you can see exactly pads with solder. If you have successfully
what is happening with the data, clock and There is no need to worry about the polarity installed these components and decide you
latch pins when serial data is being sent. It’s of the resistor, but the LED must be oriented don’t need them any more, you can desolder
a great way to visualise the process (Learn correctly. The indicator triangle, line or other the jumper pads to disconnect them from
more about this from our other kits that use mark on the LED indicates the cathode, or ground and break the circuit.
shift registers). ground terminal. Make sure this indicator
is pointing in the direction of ground in the As the pin is acting as the positive end of the
As space is a concern, and because they circuit (follow the red line from the A5 pin circuit, when the pin goes HIGH (5V) the LED
aren’t needed for normal functionality, we to Ground in fig.1). It doesn’t matter if the will turn on. When the pin goes LOW (0V), the
decided to use surface mount, 0805 (2012 in resistor or the LED comes first in the circuit LED will turn off.
metric - 2.0mm x 1.2mm) resistors and LEDs. so check the two images on the page for
Because of this, it is rather difficult to solder the different ways to install the components
D10

D12
D13
D11
D2
D3
D4
D5
D6
D7
D8
D9

A0
A1
A2
A3
A4
A5

CIRCUIT
D10

D12

D13
D2

D5

D8

A0
D3

D9

A2
D6

D11

A3

A5
D4

A4
D7

A1

J2
Circuit - FTDI and Bluetooth Headers
Bluetooth Header Resistors Capacitor

Want to control your project from your We don’t recommend connecting a Blue- When the FTDI module communicates with
phone? How about programming it wire- tooth module and using an FTDI module to the microcontroller, the microcontroller
lessly? Well, here’s a handy header to plug program the chip at the same time. If Tx on needs to be reset at a specific time. To do
in a Bluetooth module to make those things the BT module were to go high (5V) while this, the RESET pin of the microcontroller
possible. This module connects via serial Tx on the FTDI module went low (0V) while needs to be set low then high, just like press-
communication. Rx on the microcontroller connected, you have 5V connected directly ing and releasing the reset button manually.
(Pin 2) connects to Tx on the module, and to ground, which is a short circuit. Because When DTR on the FTDI chip goes low, the
Tx (Pin 3) to Rx, just like the FTDI module. of this, we have put 10k resistors between capacitor is drained and the RESET pin goes
the FTDI and Bluetooth’s data lines. If there low. After a short time, the capacitor will be
When purchasing a BT module, look for an is a short, the amount of current would be charged up through the pull-up resistor (R5),
HC-06 module with 4 pins. minimal. back to 5v, which is the same as releasing
the button.

VCC

GND
FTDI Header
Tx

Rx There are a few ways to communicate with


FTDI
C5
the microcontroller to program its function-
R3

DTR ality. You could take the chip and plug it into
R4

Bluetooth
TX Rx a compatible Arduino Uno that has the USB
functionality on board, then plug that into a
RX Tx
PC. You could program it via another device
VCC
RESET over Bluetooth (using a Bluetooth module).
NC
Or you could use a USB interface chip and
R5

GND
accompanying circuitry (The FTDI module for
example). We’d love to put that on board for
you to build, but all these chips are surface
mount, so not easy to DIY. We’ve added an
FTDI module header instead. These modules
are cheap, easy to find and there is plenty
of documentation available. Make sure the
pins match when buying and inserting the
module.
16
Circuit - Real Time Clock
Crystal DS1307 RTC IC

Just like the ATMega328P, the DS1307 An RTC (Real Time Clock) module has an
needs a crystal to help it keep time. In this RTC chip, a crystal, resistors and a coin cell.
case, the chip requires a 32.768MHz crys- Its job is to keep time even if the rest of the
tal. The membrane in the crystal vibrates at device has lost power. RTC chips run on very
32,768,000 times a second. This oscillator little current, so they can keep time for a long
circuit does not need extra capacitors like time on one coin cell. This is great for when
the ATMega328P’s as this is dealt with inside you want to build a clock using the Digitiser
the Integrated Circuit (IC). kit, or even a graphical clock with the RGB
Matrix. It is also useful for scheduling func-
tions. Maybe you want the RGB LEDs to turn
Y2 on and slowly change brightness as you
wake up... So many possibilities!

U2

DS1307

BT1

A4 / SDA
A5 / SCL
R6-7

I C Communication
2

I2C is another way certain devices can com- 2032 Battery Holder
municate. It uses the SDA and SCL pins on
a microcontroller. These are pins 27 and 28 This holds the 2032 coin cell battery (sold
on the ATmega328P. Many devices can be separately). This is used as backup power
connected to the same I2C pins on a micro- for the RTC. It enables the chip to store the
controller. So go ahead and use the SDA and Pull-Up Resistors correct time even if power is removed from
SCL screw terminals to add other I2C devic- the board.
es. Just remember, if the two devices have Just like the reset switch, these are pull up
the same address, then they can’t be used resistors that hold SDA and SCL signal lines
together. Check the datasheets first. Some high (at 5V) until they are pulled low by the
I2C devices have an address select pin to communicating devices.

CIRCUIT
choose between two addresses. Connecting
that pin to ground or VCC will give you one
address or the other.
Assembly Instructions - Tips
General Soldering tips

1. ALWAYS KEEP YOUR TIP CLEAN 4. SOLDER

To ensure the soldering iron can transfer Leaded solder is much easier to work with,
enough heat from it to your solder/compo- which makes it easier to learn with. It can
nent leg you must keep the tip clean and be hard to find in some countries, but can
shiny. A dull tip means the outside layer often be ordered from China. There are po-
of metal has oxidise. This oxidised layer tential health risks, but these are very low.
is a poor transferrer of heat. Because of Make sure you have a fan pointing away
this, you will have to hold the tip against from your work area to blow the fumes
the component for a longer period of time, away. Work in a well ventilated area.
which can result in the component failing.
It’s also very frustrating. Thinner is better. Working with a thick wire
of solder can get messy. Use 0.4-0.5mm
To keep your soldering iron tip clean, wipe solder for more control. You will have to
it on a wet sponge or wire ball, then apply feed more into the solder joint, but you
some solder to coat it, then wipe it again. have more control when there are other
Ideally, you should do this after every com- pins close by that you want to avoid. This
ponent. At the very least, do it after every is essential when soldering surface mount
4 components. components and Integrated Circuits.

2. CONTACT 5. SAFETY

When soldering, make sure the tip of your 350oC is obviously very hot. Stuff catches
iron is making contact with both the leg of fire at this temperature. Skin fries. Please
the component and the pad on the PCB. be careful. Remember to turn it off when
Apply heat to the area, then, within a sec- you are finished. This will prevent a poten-
ond or two, apply the solder to the point tial house fire and also save your iron tip
of contact. from continued oxidation.

3. HEAT 6. ANGLE OF ATTACK

It’s better to be too hot than too cold. As When soldering, make sure you position
mentioned earlier, when the iron tip isn’t hot the board so that it is easy to access the
enough, you have to hold it on longer. This area you are working on. It is easy to make
allows heat to transfer into the component a mistake when you are trying to maneuver
and could cause a failure. It is better to set your iron into position around some obsta-
your soldering iron a little hot so the solder cle. You may have to spin the board 180
melts instantly and flows around the leg of degrees, or make sure you have snipped
the component with ease. You can start at the legs off the previous component. It’s
around 350oC and adjust from there. Too easy to be impatient so try to plan ahead.
hot and the tip will oxidise too quickly,..
18
MOTHERBOARD
VCC

GND

Tx

Rx
FTDI
J3 C5

R3
DTR

R4
D13 Bluetooth
Rx

D2 Tx

VCC

NC
R1 C3 C4

R5
GND
Y2 J4
16.000 Y1
RESET
U2
1
U1
1 SW1
ATMEGA328P DS1307

BT1
PWR

D3
R6-7
C1 C2
R2 CR2032
D1

J1 F1
POWER
USB

Vout
GND

GND
Vin

202 202 202 202 202 202 202 202 202 202 202 202 202 202 202 202 202 202
D10

D12

D13

A0
D2

D8
D3

D5

D9

A2

A3

A5
D6

D11
D4

A4
D7

A1

ASSEMBLY
J2
Assembly Instructions
There are many ways to assemble a PCB the pad. Solder should wick around the when soldering. Bend the leads into a U
that uses through hole components. One is lead forming a mountain and covering the shape and insert them through the holes
to solder all the lowest profile components pad. Now remove the iron from the pad. near the D1 designation. Pay close atten-
first. This makes sure they are support- This should all take no longer than a few tion to the polarity. Match the white band
ed when you flip the board. Using sticky seconds. Try to avoid holding heat to the on the diode with the white band on the
tape or tack to hold components in place pads for too long. A hotter iron is safer in silkscreen on the PCB. The white band
negates the need, so we’ll order them by this respect, as you shouldn’t have to hold indicates the negative side of the diode.
difficulty and ease of access. Check the bill it on to wait for the solder to melt. After it Yes the positive side is connected to
of materials to make sure you have every- cools, the joint should remain relatively ground. This is because we are using the
thing you need. Also, MAKE SURE YOU shiny. Repeat the process for the rest of the breakdown voltage value of the diode. If we
PUT THE COMPONENTS IN THE FRONT resistor leads. Flip the board back over and exceed the breakdown voltage, current will
OF THE BOARD, NOT THE BACK!!! remove the tape/tack. If any of the resistors flow in the opposite direction to the normal
aren’t flush with the PCB, apply a little heat flow, through the diode, towards ground,
Resistors to the underside while pushing the resistor rather than through our microcontroller or
from the top side. Now snip the leads just other components.
R1 R2 R3 R4 R5 R6 R7 above the solder.

Capacitors 16MHz Crystal


C1 C2 C3 C4 C5
2K 2K 10K 10K 10K 10K 10K Y1
104 104 22 22 104
Always remove resistors from the packag-
ing by snipping the leads, not by pulling
them out of the packaging. This prevents 100nF 100nF 22pF 22pF 100nF
16MHz
any glue from being transferred to the
holes in the PCB, or into the holes in your The capacitors are of the ceramic variety
breadboard. and thus polarity is of no concern. There are These are the next shortest components.
however, two different valued capacitors in Start with the Crystal. Polarity doesn’t mat-
Bend the leads as close to the resistor as this kit. The 22pF caps are for the crystal ter with this component, but there is writing
possible to form a U shape. Then insert oscillator circuit (C3 and C4). The 100nF on it, so, if you love chaos, put it in upside
each lead into the holes nearest the specific (0.1uF) caps are placed at C1, C2 and C5. down, or don’t. Not much to this one, just
designator (R1, etc.). Insert all the resistors Check the BOM while assembling PCBs so solder it like you did the resistors. These
and use sticky tape or sticky tack to hold you get the right value components in the have thicker leads, so a little more heat may
them in place. Resistors are not polarized, right places. be needed. Check it’s flush with the board
so they can be inserted in either orientation. and apply pressure and heat if it isn’t.

Flip the board so the leads and the bottom Zener Diode
side of the pads are easily accessible. Tin D1
your iron by applying some solder, then
wiping it clean. The tip should be shiny.
Now, with solder in one hand, and iron in
the other, apply heat with the iron to the The Zener Diode has very thick leads. So
underside of the pad and the lead stick- you may have to turn your iron up a little.
20

ing through, while touching the solder to Short and hot is better than long and cold
MOTHERBOARD
VCC

GND

Tx

Rx
FTDI
J3 C5

R3
DTR

R4
D13 Bluetooth
Rx

D2 Tx

VCC

NC
R1 C3 C4

R5
GND
Y2 J4
16.000 Y1
RESET
U2
1
U1
1 SW1
ATMEGA328P DS1307

BT1
PWR

D3
R6-7
C1 C2
R2 CR2032
D1

J1 F1
POWER
USB

Vout
GND

GND
Vin

D10

D12

D13

A0
D2

D3

D5

D8

D9

A2

A5
D6

D11

A3
D4

A4
D7

A1

ASSEMBLY
J2
Assembly Instructions
32.768MHz Crystal a terribly laborious process. If you decide to Switch
use an Arduino Uno to program the chip, or
SW1
Y2 you accidentally U1 fry the chip, youU2
need to
be able to switch it out. This is why we use
a DIP socket.
32.786MHz The switch is a surface mount component,
Soldering the 28 pins may seem like a so entails a different assembly process.
Thread the legs of the crystal through the daunting task, but it’s actually pretty easy. Without leads to hold the component in
holes marked Y2 then lay the crystal flat on Insert the socket into the area marked U1. place, and having to solder on the same
the PCB within the rectangle. You can use a Pay attention to the semi-circle indicator side as the component, it’s a little tricky to
piece of sticky tack to hold it in place while and match the one on the socket with the hold surface mount components in place
you solder. Flip the board over and solder. one on the board. Now, stick it in place while soldering. It is usually a good idea to
and solder 1 corner pin, then the diagonal- solder one pad first, no matter how many
ly opposite corner. Now check alignment pins the component has. This ensures the
LEDs and whether its flush with the board. Add component will stay in place while soldering
pressure and heat where needed to get it the other pins. First, apply some solder to
D2 D3
in the perfect spot. Now you can solder all the pad. Then hold the switch in place with
the other pins knowing that the socket will tweezers and heat the solder thats on the
stay exactly where it needs to be. The DIP8 pad. The switch is not polarized, so either
LEDs are polarity sensitive. The short lead is Socket would be treated the same as the orientation is acceptable. When you’re
negative and the long lead is positive. You previous socket. happy with the position, solder the other
can also tell by finding the flat edge on the pin in place.
rim of the LED, that’s the negative side. The Headers
flat part of the symbol on the PCB is also J3
J3
J4
J4
negative, so match them when inserting the
LED. Solder the leads from the underside Battery Holder
like all the other components.
BT1

You can treat this like the DIP Socket. Sol-


DIP28 + DIP8 Socket der an end pin, then the other end pin. Align
it with heat on the underside and pressure
from the component side. Then solder the
inner pins.

Position the battery holder to match the pic-


You could solder the chip directly to the ture on the board. Sticky tack in place and
board, but, there are a few disadvantages to solder those pins. Easy.
this. If you accidentally solder it in the wrong
way, then you have to desolder it. Which is
22
MOTHERBOARD
VCC

GND

Tx

Rx
FTDI
J3 C5

R3
DTR

R4
D13 Bluetooth
Rx

D2 Tx

VCC

NC
R1 C3 C4

R5
GND
Y2 J4
16.000 Y1
RESET
U2
1
U1
1 SW1
ATMEGA328P DS1307

BT1
PWR

D3
R6-7
C1 C2
R2 CR2032
D1

J1 F1
POWER
USB

Vout
GND

GND
Vin

D10

D12

D13

A0
D2

D3

D5

D8

D9

A2

A5
D6

D11

A3
D4

A4
D7

A1

ASSEMBLY
J2
Assembly Instructions
Micro USB Socket wipe the iron away from the pins to make Hold the iron to the LED for too long and it
sure each pin is soldered. Add a little more will melt the other solder joint, so use quick
J1 if it needs. If there is too much solder, clean bursts again.
your iron, touch the pads, then quickly drag Screw Terminals
back away from the socket. This should
pull the excess solder away with the iron. J2
Repeat until each pin has enough solder,
The micro USB socket is by far the hardest but not enough to bridge between two pins.
component to solder in this kit. The pins Giving the area a quick scrub with a tooth-
are tiny, and it involves both through hole brush and some Isopropyl Alcohol will clear We have supplied you with 11 x 2 position
and surface mount soldering. It’s tricky. any excess flux that may cause issues if we screw terminal blocks. To make the 22 posi-
Patience will come in handy with this one. were using the socket for data. A good habit tion block, just connect them all together. If
If you mess it up, don’t worry, you can still to get in even though we are only using the you had a project that only uses a few digi-
power the board using the terminal blocks. socket for power. tal pins, you can just solder those blocks in
Just cut an old USB cable and insert the red and save the other blocks for another proj-
and black wires into the VCC In and GND ect. This means you have flexibility, and we
terminals respectively.
Breathe. only have to order 1 type of terminal block.
Win! They can be a bit loose sometimes, so
*Insert Inspirational Yoda Quote* make sure you align them with the first and
last pins, just like the headers.
Fortunately, the socket should snap in to IO LEDs & Resistors (Optional)
the through holes and hold itself in place. Fuse
So, snap it in (making sure the surface 
F1
mount pins are aligned with the pads), flip - + 202
the board over and solder the through hole
pins in place. Now flip the board and add
solder to the top of the pins. Hold the iron Now would be a good time to solder the
flat against the case of the usb so the solder optional surface mount IO LEDs. After you
sticks to it. solder the terminal blocks they will be a
little harder to get to. Add a little solder to The fuse is not polarity sensitive. The re-
Once the through holes are soldered, it’s a clean iron tip. Then apply the tip to one settable fuse, or PTC (or polyfuse), has
time to tackle the surface mount pins. You side of each of the LED and Resistor foot- bent leads to prevent you from inserting
could just solder pin 1 (GND) and pin 5 prints. Now hold a surface mount LED in the component too far. It leaves an air gap
(VCC), as that is all we are using. But, we some tweezers (take note of the polarity), between the PCB and the fuse itself. As the
are here to learn, so you may as well solder offering it up to the pad with solder on it. fuse is thermally sensitive, the gap helps
them all. The suggested technique tackles Apply some heat with the iron and the LED ensure that it functions within its designed
all the pins at once anyway. Clean your iron should attach itself. Make sure it is seated in parameters. You would definitely get some
(again, you should be doing this before, af- the correct position. You may need to apply kind of soldering badge by now if you were
ter, and during and soldering activity), then dabs of heat to get it in the right place. Don’t in the scouts, so we’ll let you figure this last
apply a little heat to all the pins and pads. hold the iron to the pad for too long. When one out...
After a few seconds, touch the solder to in place, solder the other pad. This should
the pads, adding just a tiny amount. Now be easy as the LED will be stuck in place.
24
MOTHERBOARD
VCC

GND

Tx

Rx
FTDI
J3 C5

R3
DTR

R4
D13 Bluetooth
Rx

D2 Tx

VCC

NC
R1 C3 C4

R5
GND
Y2 J4
16.000 Y1
RESET
U2
1
U1
1 SW1
ATMEGA328P DS1307

BT1
PWR

D3
R6-7
C1 C2
R2 CR2032
D1

J1 F1
POWER
USB

Vout
GND

GND
Vin

202 202 202 202 202 202 202 202 202 202 202 202 202 202 202 202 202 202
D10

D12

D13

A0
D2

D3

D5

D8

D9

A2

A3

A5
D6

D11
D4

A4
D7

A1

J2

CIRCUIT
Testing for faults
Before you power on the board, there are a
few things we need to do. MOTHERBOARD
VCC

Visual Check GND

Tx

Rx
FTDI
Firstly we need to do a visual check of the J3 C5

R3
back of the board. We are looking for solder DTR

R4
D13 Bluetooth
Rx
bridges that connect two pads that aren’t D2 Tx

meant to be connected. A magnifying glass VCC

is a good tool to have when doing this. R1 C3 C4


NC

R5
GND
Y2 J4

If you see any solder bridges, bring your iron 16.000 Y1


RESET
up to temperature and drag it between the U2
1
U1
two pads. You may have to repeat this a few ATMEGA328P 1
DS1307
SW1

times. Make sure your iron is clean or the


BT1
solder won’t cling to it. PWR

D3
Short Circuits R6-7
C1 C2
R2 CR2032

Now we need to check for short circuits (the


D1

bad kind). If we have a short circuit some-


where on the board and we plug a USB pow-
er cable in with no surge protection, you will F1
J1
destroy something. So to check for shorts,
get your multimeter and put it in continuity
POWER
USB

Vout
GND

GND
Vin

mode. Here’s the symbol: Make sure the


202 202 202 202 202 202 202 202 202 202 202 202 202 202 202 202 202 202

D10

D12

D13
D2

D5

D8

A0
D3

D9
D6

D11

A2

A3

A5
D4

A4
D7

A1
black cable is plugged into the common J2
socket and the red cable into the red socket
that also has the Ω symbol on it. Touch the
probes together and make sure it makes a
sound. Now press the black probe on one
of the green circles indicated in the diagram.
These are all connected to the large ground from your meter when the probes are in Polarity
plane on the underside of the board. Note contact with Vout and GND then you have a
the case of the USB socket is a nice big short. Check the back of the board again for Check all the components that are polarity
target and further away from where your solder bridges. Focus on the areas marked dependent. In this circuit, that would be the
other probe will go. Keep it held there while with boxes on the diagram on the next page. LED’s and the Zener Diode. The Zener’s
you press the red probe onto the screw of This is where Vcc and GND are closest. If ev- cathode (white line) should be connected to
the Vout terminal block (the metal screw is erything looks good then it may be the USB Vcc. If this was the other way around, there
connected to ground). Making sure they are socket. Flip the board back over and check would be very little resistance through the
both making contact with metal, listen for a the pads on the socket. Clean it with more diode and would cause a short. If the com-
sound from your multimeter. If there is none, Isopropyl Alcohol then drag your iron over ponents match the silkscreen under them,
excellent, you don’t have a short between them from the back of the pads towards you. they should be good to go. Repeat the con-
26

Vcc and GND. You can jump over to the Repeat the continuity test. tinuity test. If there is still a problem, go back
Power Test. If you here a constant sound and check everything again.
components are polarity dependent. If they
BACK are, check they are the right way round. The
VCC
LED’s flat edge should be pointing towards
GND

Tx
the Jumper Pads and GND.
Rx
FTDI
J3 Install Integrated Circuits
DTR
Bluetooth D13
Rx

Tx D2 Unplug power before next step! Now, we


VCC can push the ICs into their sockets. Grab
CN
C4 C3 R1 the ATMega328P and the DS1307 chips and
R5

GND

J4 Y2 place them carefully in their respective sock-


ets. You may have to bend the legs inwards
RESET

1
to make it fit. Do this on a flat surface so
SW1
DS1307
1
ATMEGA328P
all the legs stay parallel. Make sure you pay
close attention to the polarity. The semi-cir-
BT1
PWR
cles on one end of the chips need to cor-
D3
respond to the semi-circle on the silkscreen
R6-7 (the picture on the board) and the socket.
C2 C1
CR2032 R2 Be careful, the socket could be installed
the wrong way, you can always rely on the

D1
silkscreen though.

F1
Power the circuit through the USB or 5V
J1
through the Vin and GND terminal blocks.
POWER
USB
We have uploaded a “blink” sketch onto
Vout
GND

GND

Vin

A5 A4 A3 A2 A1 A0 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2


the ATMega328P so, if you have soldered
J2
the jumpers near the D13 LED then the LED
should start blinking. If it doesn’t, hook up
an FTDI to USB Serial adapter to the board.
Double check the orientation of this, the pin
labels should match. If they don’t and you
You should not proceed if there is a short red multimeter lead on Vcc (Vout terminal power the board, you could fry the FTDI
between Vcc and GND. block screw or the marked end of the Zen- adapter.
er Diode) and the black lead on GND (USB
Power Test socket case or GND terminal block screw). Upload a sketch using the Programming
The multimeter should read somewhere section of this manual and check if the LED
We can now plug a USB cable in to see if between 4.6V and 5V. If not, check the blinks rapidly when you hit upload in the Ar-
we can light the Power LED. Make sure the USB cable, if it works in another device it duino IDE. If it does, everything is working

ASSEMBLY
jumper pads are soldered together (circled should be fine. Check a different cable, give as it should. Follow the Programming sec-
in the diagram on previous page). Plug the it a wiggle. If that doesn’t work, follow the tions tips to start coding and take control of
USB cable into the socket and the other end path on the board, from the USB socket’s your creation!
into a 5V supply. The PWR LED should light Vcc line (the thick one) through R2, the LED
up indicating the circuit is functioning. If not, and the Jumper Pads. Check everything Still having problems? Head over to the
first check power is getting to the board. Set that should be connected is, and every- forums on our website for help and sup-
your multimeter to DC Voltage: Put your thing that shouldn’t isn’t. Now check if any port. www.shortcircuits.cc
Programming
The ATMega328P cannot communicate ten C++ code into machine code that the FTDI
directly over USB. So when we go to pro- ATMega328P can understand. Either visit
gram the chip, we need to use a go between. the download page HERE and download PWR
GND
There are a few ways to achieve this. The the software for your operating system, or
easiest way would be to plug an FTDI mod- download it from the Windows app store if
ule into the FTDI header and program the you are using Windows. Consider donating FT230X VCC
chip while it’s sitting in the MOTHERBOARD. to the development of the Arduino IDE soft- Tx
ware, as their work has done amazing things
Rx
NOTE: There are many FTDI modules out for the electronics and maker communities,
there, whether you use one from us or opening up so many possibilities. As they FTDI USB Module DTR
somewhere else, always make sure that say “Open source is love!“
the pin names match when connecting it to
the board. If you power it on when it’s con- To program the chip using an FTDI module:
nected incorrectly, you may fry the module
completely. Plug the module into the FTDI header on
the board. WARNING: Double check the
Another option would be to remove the chip FTDI module is oriented correctly, with the
from the board and install it in the DIP28 pin names matching on both the MOTH-
socket on a compatible Arduino Uno (1). ERBOARD silkscreen and the FTDI module
Arduino Uno’s have an extra tiny chip (2) Silkscreen.
that translates the USB signal so the AT-
Mega328P can understand it. Plug a USB cable into the FTDI module and
into a Computer.

Run the Arduino IDE and select Tools, then


Port.
2
Your ATmega board should show up as
“COM#” (the number after COM varies de-
1 pending on what’s connected etc.) Click to
select it.

Then, under Boards, select “Arduino Uno”,


as the MOTHERBOARD is Arduino Uno
To get started without having to learn to compatible.
code, check out the example sketches under
The most complicated option, but probably File > Examples. As you add different librar- Now you can get programming! Read our
the most interesting, would be to use a Blue- ies to the software (Through Tools > Manage quick coding guide for this board, download
tooth module to program the chip wirelessly. Libraries...) You will see new examples relat- some of our example sketches from HERE,
This will be covered in a later guide. ing to the libraries you download. Libraries or find a tutorial online and follow it. There
are pre-written code written by lovely people are plenty of Youtubers with great tutorials.
To program the chip, using whichever that you can use in your projects. They are Lots of written tutorials online as well. Check
method, you will need to download the usually written with specific components out Instructables, the Arduino website and
28

Arduino IDE. This software compiles writ- in mind. others.


Arduino Compatible Pins
Pins / Terminals / IO
ARDUINO ARDUINO
The ATMega328P has lots of different inputs PIN NO. FUNCTION
and outputs that have different capabilities.
2 INT0 D2
As we are using the Arduino IDE (the easiest
and best documented software for this), we 3 INT1 PWM D3
will need to use the pin references they use D4
4
when programming the MOTHERBOARD.
5 PWM D5

DIGITAL IO
Here are some of the different types of pins:
6 PWM D6
INT0 External Interrupt 0 7 D7
INT1 External Interrupt 1
8 D8
These are external interrupt pins. They al- 9 PWM D9
low the microcontroller to carry on with all 10 PWM D10
of its tasks until something triggers one of
these pins. Without them, the microcontrol- 11 MOSI PWM D11
ler would have to constantly check the pins 12 MISO D12
for change, which would get in the way of
13 SCK D13
other functions.
A0

ANALOG IO
14, A0
MOSI Master Out, Slave In (SPI) 15, A1 A1
MISO Master In, Slave Out (SPI)
16, A2 A2
SCK Serial Clock (SPI)
17, A3 A3
These pins are used for the microcontroller’s 18, A4 SDA A4
Serial Peripheral Interface. They are used to
19, A5 SCL A5
communicate between multiple devices. Un-
like the Tx and Rx pins used for FTDI and BT
modules, the SPI bus is synchronous. This
means both Master and Slave are in perfect peripheral it wants to talk to and whether it control. To dim an LED to 50% for example,
time with each other. wants to send or receive data. This means you would send a PWM signal with a 50%

PROGRAMMING
it’s a little slower than SPI. But it’s faster than duty cycle. Which means it is on 50% of the
Tx Rx, and only uses 2 pins. time, and off the other 50%. As this signal
SDA Serial Data (I2C)
pulses at a very high rate, we see the LED
SCL Serial Clock (I2C) dim rather than flicker.
PWM Pulse Width Modulation
I2C is the Inter-Intergrated Circuit protocol.
It allows multiple peripherals to be connect- Pulse Width Modulation varies how much 50% Duty Cycle
ed to just 2 signal wires (1008 devices to time a signal is pulled high. This can be used
be exact). I2C sends bits to indicate which to dim LEDs or to control servos with greater 25% Duty Cycle
Coding Basics - Blink
Lets get started with some code. This as- Also, any global (accessible by any part of
sumes you have no prior knowledge and the code) variables that we will use to store Variables
starts with the basics. This sketch will flash data will be declared here.
the LED repeatedly. A value that represents something in
For our “Blink” sketch, we will need to de- your code. This could be a value that
The first part of your code will handle any clare which pin the LED is connected to. changes or is fixed.
preprocessor directives like:
There are two ways of doing this and either Keywords
• Defining pins with #define will do nicely:
• Including any libraries that your code Reserved words in C programming
will call upon with #include that are part of the syntax/language.

Functions
keyword that defines the variable as constant (read-only).

data type: Integer (signed number from -32768 to 32768). Predefined blocks of code. Data is
passed into a function to perform
Arduino pin number. certain actions. Good for repeating
1 const int LED = 13; the same action again and again.
Used to end a statement.
2 A Variable named “LED” that stores the number
of the pin that is connected to an LED. Data Types

1 #define LED 13 There are many data types in C++.


Each type holds a different range
2 of numbers. See the table on the
next page for a list of data types
preprocessor directive that basically swaps any reference commonly used while programming
to “LED” with the value 13 before the program starts. 8-bit microcontrollers with the Ar-
duino IDE

The C coding language and the Arduino IDE use in almost all sketches are “setup” and Preprocessor Directive
use functions to organise code. A function “loop”. Setup runs once at the start of the
holds code within it and can be initialised by sketch and is used to set up different things. Dealt with before the program starts
other bits of code. 2 functions that Arduino Loop repeats indefinitely.
Structure
indicates that the function setup will not return any information.
The elements used as part of the
3 void setup() part of the Arduino structure. Executes once. Arduino (C++) code.

4 { a predefined function that defines the mode of the pin.

5 pinMode(LED,OUTPUT);
6 } function that puts the pin in a low impedance state.
we can use “LED” or “13” here as all instances of LED will be replaced with 13.
7
30
In this case, we need to tell the AT- The function digitalWrite() asks for a pin ref-
Mega328P that D13 will act as an output. erence and either HIGH or LOW. Data Types:
This will allow more current to be supplied (Using ATMega 8bit chips)
to it, as it will be in a low impedance state Without a delay between turning the LED on
(low resistance). We use setup to do this as and off, and off and on, we would not be array
(collection of variables)
it only has to happen once at the beginning. able to see anything happen. As the loop
will last just a few milliseconds.
bool
To blink the LED, we will need to turn it on, (true / false)
then off, then repeat the process indefinitely. delay() asks for a number, in milliseconds
We can use loop to achieve this. that tells it how long to delay all other pro- byte
cesses. The downside is that it will stop ev- (0-255)
The positive lead of our LED is connected to erything, so if you are trying to multiplex the
the pin, so pulling the pin to 5V will turn it on, display on the DIGITISER kit for example, char
(stores ASCII characters)
pulling it to 0V will turn it off. you will need to use an alternative.
float
(numbers with decimals
8 part of the Arduino structure, a function that repeats indefinitely. -3.4028235E+38 to 3.4028235E+38)
9 void loop() a function that pulls a pin LOW or HIGH. int
10 { (-32,768 to 32,767)

11 digitalWrite(LED,HIGH); long
12 delay(1000); This stops all processes for 1000ms. (-2,147,483,648 to 2,147,483,647)

13 digitalWrite(LED,LOW); short
(-32,768 to 32,767)
14 delay(1000);
LOW represents pulling a pin to GND (0V).
15 } string / String()
(text strings)
Curly brackets are used to contain any statements within a function,
16 loop or conditional statement. Always close what has been opened!
unsigned char
(0-255)
save the sketch. If everything is good, and
no warnings are shown in the console at the unsigned int
bottom of the window, hit upload! The Tx/ (0-65,535)

PROGRAMMING
Rx lights on the FTDI module should flicker,
unsigned long
Now hit the compile button to check to see as well as the D13 LED. If they don’t and
(0-4,294,967,295)
if you have anything wrong that the software your code does not upload, check the trou-
can identify. The software will prompt you to bleshooting section. word
(0-65,535)
Project Ideas - Clock
MOTHERBOARD DIGITISER
VCC

GND
R15 R16 R17 R18

Tx

Rx
FTDI D1 D2 D3 D4
J3 C5

R3
DTR

R4
D13 Bluetooth
Rx
R1-4 R7-14
D2 Tx
Q1-4
VCC

C3 C4
NC U1 U2 U3 U4
R1

R5
GND
Y2 J4
16.000 Y1
RESET
U2
1
U1
1 SW1
ATMEGA328P DS1307

BT1
PWR

D3 SW1 SW2
R6-7 RV1
C1 C2
R2 CR2032
D1

74HC595 U5 R5 R6 U6 74HC595

C2

C1
J1 F1
POWER
USB

R19
Vout
GND

GND
Vin

VCC

VCC

SW2

SW2
SER

SER

SER
CLK

CLK

CLK
LAT

LAT

LAT

SW1

POT

SW1

POT
GND

GND

Qh’

Qh’
D10

D12

D13

OE
D2

D3

D5

A0
D6

D8

D9

D11

A2

A3

A5
D4

A4
D7

A1
J2 J1

To build a digital clock capable of display- it firmly into the screw terminal. Make sure instructions in the Programming section
ing the time, date and year, you will need none of the strands of wire are hanging out of this manual.
the MOTHERBOARD and the DIGITISER the edges. Remove any extra slack if the
kits. wire is too long. If you are happy with the Remember to put a battery in the holder
length, you can use it as a guide when cut- (BT1) so the DS1307 can remember the
Connect the DIGITISER up to the MOTH- ting all the other wires. time if you unplug the power.
ERBOARD as shown in the diagram. If you
are going to stack the boards without a If you are going to panel the boards, or
case, then the wires need to be as short as stack them in a case, then leave a decent
possible. A good way to manage this is to amount of slack. Forward planning is key
insert a wire into one of the screw terminals here. Assemble it without wires, and take
on the lower board, then stack the boards some measurements to make sure.
using the provided standoffs. Cut the wire
to length while offering it up to the screw Once connected, head over to the website
terminal directly above it. Now remove the and download the DigiClock sketch and
sheathing from the tip of the wire and push upload it using the Arduino IDE and the
32
Project Ideas - Environment Display
Sensor Array MOTHERBOARD DIGITISER
VCC
MK1 RV1 R15 R16 R17 R18
GND

C1 Tx

Rx
FTDI D1 D2 D3 D4
R1 J3 C5

R3
DTR

R4
D13 Bluetooth

DHT22
DHT11

Rx
R1-4 R7-14
U3

C5 D2
R2 Tx
Q1-4
+
U2 VCC

C3 C4
NC U1 U2 U3 U4
R1

R5
+

LM386
GND

+
C4
C6 Y2 J4
16.000 Y1
RESET
5V C7
U2
1
U1
1 SW1
ATMEGA328P DS1307
+
C2 R3 C8
BT1

U1 PWR

D3
R4-9

SW1 SW2
R6-7 RV1
C3 C1 C2
+
LDR R2 CR2032
Q3-5

3.3V

D1
J2
74HC595 U5 R5 R6 U6 74HC595

R10
C10 C2

C1
J1 F1

POWER
USB
R19

Vout
GND

GND
Vin
VCC

VCC

VCC

VCC

SW2

SW2
Dout
DHT

DHT

DHT

DHT

DHT

DHT

DHT

DHT

LDR

LDR

LDR
CLK
GND

GND

SER

SER

SER
CLK

CLK

CLK
LAT

LAT

LAT

SW1

POT

SW1

POT
MIC

MIC

MIC

GND

GND
Din

CS

Qh’

Qh’
D10

D12

D13

OE
D2

D3

D5

A0
D6

D8

D9

D11

A2

A3

A5
D4

A4
D7

A1
J1 J2 J1

Adding the SENSOR ARRAY to the previ- ning of the code if you do this. at the beginning on the code.
ous build enables you to add temperature
and relative humidity to the digital display. Wire the boards as shown in the diagram Play around with the variables and code to
You can add sound levels and light levels above. You can switch outputs on the better understand it. Then you can make
too, but we’re sticking with a simple clock SENSOR ARRAY and DIGITISER as long as changes to suit your requirements.
and environment sensor display in this you switch to an IO port that has the same
project. label. Switching outputs on the MOTHER-
BOARD is fine, just make sure the Poten-
If you are stacking these, you will get better tiometer is connected to an analog pin,
results if the Sensor Array faces outwards. and the Output Enable pin is connected
This will expose the DHT11 sensor to the to a PWM pin.

PROJECTS
outside world, and minimise the effect of Either write your own code from the hints
heat from the other boards on the sensor. in each kit’s manual, or head over to the
If the board is flipped, it may make sense website and grab the EnvironmentDisplay
to move the connections around a bit, for sketch. Upload the sketch using the Ar-
neatness and to use less wire. Make sure duino IDE and make sure all the functions
you change the pin references at the begin- work. If they don’t check the pin references
This manual was written and designed by Martyn Evans.
The circuit designs are inspired by many different sources with hands on testing and experimentation.
If you recognise anything as your own, and think you deserve a mention,
please feel free to contact admin@shortcircuits.cc and let Martyn know.

© 2021 Short Circuits™ Some Rights Reserved

What is allowed?

All circuits and schematics can be freely shared and modified as open source
All code can be freely shared and modified as open source

What is not allowed?

The manual cannot be modified or redistributed

You might also like