Page 1 of 14
SparkFun Blocks for Intel® Edison - Arduino
Block
Introduction
The Arduino Block for Edison provides the Intel® Edison with a direct, serial
link to an Arduino-compatible ATmega328 microprocessor.
Why would you need an Arduino connected to your Edison? Isn’t it powerful
enough to handle anything that may be thrown at it? That’s the problem –
it’s almost too powerful. Because it’s running an operating system, it’s
incapable of real-time processing – the bread-and-butter of smaller
microcontrollers like the ATmega328. Components which require precise
timing – like WS2812 LEDs or servo motors – may be incompatible with the
Edison as it can’t reliably generate clock signals.
The Arduino block allows the Edison to offload those lower-level hardware
tasks. Additional to that, if you’ve already written Arduino code for an
external component, you don’t have to port that code to the Edison – just
run it on an Arduino block!
Suggested Reading
If you are unfamiliar with Blocks, take a look at the General Guide to
Sparkfun Blocks for Intel Edison.
Other tutorials that may help you on your Arduino Block adventure include:
•
•
•
•
Edison Getting Started Guide
Powering Your Project
What is an Arduino?
Using the Arduino Pro Mini 3.3V
Board Overview
Page 2 of 14
•
Expansion Header
– The 70-pin Expansion header breaks out the
functionality of the Intel Edison. This header also passes signals and
power throughout the stack. These function much like an Arduino
Shield.
•
Arduino I/O Pins
– All of the Arduino’s I/O pins are broken out to a
pair of headers (plus a couple in between). This header footprint
exactly matches that of the Arduino Pro Mini – if you have any Mini
shields they should mate exactly to this header.
•
Arduino Programming Header
– The standard 6-pin FTDI header is
used to program the Arduino’s serial bootloader. Plug a 3.3V FTDI
Basic in to program your Arduino.
•
D13 LED
– Every good Arduino needs an LED! This small, green
LED is tied to the Arduino’s pin 13. Great for blinking “Hello, world” or
debugging.
•
Power LED
– The Arduino block has an on-board 3.3V regulator,
and this LED is tied to the output of that regulator.
•
Arduino Reset Button
– This reset button is tied to the Arduino’s
reset line. It will only reset the Arduino; it has no effect on the Edison.
Schematic Overview
The Arduino block pairs the ATmega328 to your Edison via one of two
UARTs. The board defaults to connecting the Arduino to Edison via
UART1. Jumpers (see more below) allow you to select UART2, if your
application requires. Take care using UART2, though, it’s default utility is
for console access to the Edison.
The Arduino Block has an on-board 3.3V voltage regulator, which takes its
input from the Edison’s VSYS bus. Since the Arduino is running at 3.3V, its
clock speed is limited to 8MHz.
If you want to take a closer look at the schematic, download the PDF here.
Jumpers
On the back-side of the Arduino block, there are a handful of jumpers,
which lend extra utility to the board.
Three two-way jumpers – for RX, TX, and DTR – allow you to select
between UART1 (default) and UART2. To switch these jumpers, grab a
hobby knife, cut the default traces, and drop a solder blob between the
middle pad and outer pad of your choice.
Page 3 of 14
The jumper labeled
VIN/VSYS
allows you to remove the VSYS line from
powering the Arduino block. This is handy if you need to isolate the Arduino
block’s power source from the Edison. In this case, you’ll need to supply
power (3.3-12V) externally via the “VIN” pin.
Using the Arduino Block
To use the Arduino Block, attach it to either an Edison or add it to a stack of
other SparkFun Block’s.
Arduino block stacked on top of a GPIO Block and a Base Block.
In order to supply power to your Edison, you’ll need at least one additon
Block in your stack. You can use a Base Block or Battery Block, for
example.
Programming the Arduino
The Arduino on the Arduino Block can be programmed while it’s either on
or off the Edison. Depending on your application, though, it’s recommended
that you load code on the Arduino while it’s disconnected from your Edison
stack, before adding it to the rest of the system.
If you’ve ever uploaded an Arduino sketch to an Arduino Pro or Pro Mini,
you’re already familiar with uploading code to the Arduino block. Connect a
3.3V FTDI Basic to the 6-pin FTDI header on the board.
Using a 3.3V FTDI Basic to program the Arduino on the Arduino Block.
In Arduino (the non-Edison version of Arduino!), select “Arduino Pro or Pro
Mini 3.3V/8MHz” from the Tools > Board menu. If you’re using the latest
release of Arduino (1.6 or later), first select
Arduino Pro or Pro Mini
from
the “Board” menu.
Page 4 of 14
Then select
ATmega328 (3.3V, 8MHz)
from the “Processor” menu.
Then upload away!
Using the Arduino Pins
The Arduino’s I/O pins are all broken out to a pair of headers. These
headers match up exactly to the Arduino Pro Mini. If you have any shields
or piggyback boards for a Pro Mini, it should work seamlessly with the
Arduino Block.
You can solder headers, wires, or any other connectors to these pins.
If you’re soldering headers to the pins, take extra care deciding which side
to solder to. Depending on the rest of your Edison stackup, those headers
might get in the way of connectors on other boards (the USB connectors on
the Base and Console Blocks, in particular).
Connecting the Edison to the Arduino
The Arduino Block connects the Arduino to the Edison through a serial
(UART) connection. Jumpers on the back of the board allow you select
which of the Edison’s two UARTs mate with the Arduino. Unless you can’t
avoid it, we recommend leaving the jumpers in the default configuration –
the Edison’s UART2 is usually devoted to console access.
Page 5 of 14
To program the Edison to control and interact with the Arduino, you’ll need
to use the UART to establish a communication protocol between the
devices. See the next section for an easy example of UART communication
between Arduino and Edison.
Controlling the Arduino Block with
Firmata
Firmata is an established protocol popular within the Arduino realm for
applications that require a separate machine (usually a computer) to control
the Arduino. It’s a serial-based protocol that uses defined messages to set
digital pins, read analog pins, and do everything else you’re used to with
Arduino.
Firmata is so useful, the standard Arduino IDE even ships with the Firmata
library. Here’s an example of how an Edison can be used to control and
interact with an Arduino running Firmata.
Upload StandardFirmata to the Arduino
Before uploading any code to the Edison, let’s load something into the
Arduino. Once the Firmata code is running on your Arduino, you may never
have to upload code to it again.
Using the standard Arduino IDE (i.e.
not
the IDE built for Edison), load up
the “StandardFirmata” sketch by going to
File
>
Examples
>
Firmata
>
StandardFirmata.
If you have the Codebender addon installed, you can
use the embed below to upload the code to your Arduino Block.
StandardFirmata (/example/Firmata/StandardFirmata?board=Arduino%
Edit
Clone & Edit
Download
20Pro%20or%20Pro%20Mini%20(3.3V,%208%20MHz)%20w/%
1 /*
(/?
(https://codebende
2
* Firmata
20ATmega328)
is a generic protocol for communicating with mic
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
* from software on a host computer. It is intended to work
* any host computer software package.
board=Arduino% board=Arduino%
*
* To download a host software package, please clink on the
* to open the download page
20Pro%20or%
browser.
in your default
20Pro%20or%
*
* http://firmata.org/wiki/Download
20Pro%20Mini% 20Pro%20Mini%
*/
/*
Copyright
Copyright
Copyright
Copyright
20(3.3V,%208% 20(3.3V,%208%
(C)
(C)
(C)
(C)
20062008 HansChristoph Steiner. All righ
20MHz)%20w/% 20MHz)%20w/%
20102011 Paul Stoffregen. All rights rese
2009 Shigeru Kobayashi. All rights reserve
20092011 Jeff Hoefs. All rights reserved.
20ATmega328) 20ATmega328)
This library is free software; you can redistribute it an
modify it under the terms of the GNU Lesser General Publi
License as published by the Free Software Foundation; eit
version 2.1 of the License, or (at your option) any later
See file LICENSE.txt for further informations on licensin
formatted using the GNU C formatting and indenting
*/
/*
* TODO: use Program Control to load stored profiles from E
Arduino Pro or Pro Min
With the Firmata firmware uploaded, you can disconnect the FTDI Basic,
and connect the Arduino Block to your Edison stack.
Edison Firmata for Arduino Client