Get to the Chopper!
The Arduino 101 only costs $30, but it packs quite a bit more than your regular Arduino board. Learn about the 101's specs and how you can use its onboard gyroscope with a fun, 3D project.
The Arduino 101 only costs $30, but it packs quite a bit more than your regular Arduino board. Learn about the 101's specs and how you can use its onboard gyroscope with a fun, 3D project.
Intel has been maneuvering to open up a niche for itself both in the nanocomputer space (currently dominated by the ARM-based Raspberry Pi) with its Edison [1] and in the realm of microcontroller-based maker hobbyism ruled by the Arduino and Arduino-like hardware, which is typically designed around the ATmega chips built by Atmel.
To try to get a foot in the door in the latter camp, Intel and Arduino recently teamed up and produced the Arduino 101 [2]. The 101 looks very much like the Uno (Figure 1), and, in many respects, it is compatible. Even the mount holes for screws are in the same place.
There are a few differences, though. For starters, the 101 has a very conspicuous gold Bluetooth antenna that you can see at the upper right corner. The 101 also has two reset buttons instead of the one on the Uno. The reset button in the bottom left corner resets the sketch, forcing the 101 to start the program over, setup
function and all. The reset button on the other side of the USB port does a hard reset when you push it, doing a power cycle for the hardware (i.e., it switches the board off and then on again). Other, non-visible, differences are shown in Table 1.
Table 1
101 versus Uno
Board | CPU | Speed(MHz) | Flash Memory (KB) | SRAM(KB) | Bluetooth & Gyroscope |
---|---|---|---|---|---|
Uno |
ATmega328 |
16 |
32 |
24 |
– |
101 |
Intel Curie |
32 |
196 |
24 |
+ |
The Intel Curie processor is twice as fast as the ATmega. The board also comes with more memory, and, apart from Bluetooth, it has an onboard gyroscope and accelerometer.
On the other hand, the Uno has more PWM pins – 6 versus 4 on the 101, but, as I have explained other times in this magazine, you can compensate for that by using a dirt cheap and simple analog port expander [3] [4].
Arduino boards with special features often require special setups, which is the case with the 101. To begin, you'll need the recent version of the Arduino IDE, namely 1.6.7 (at the time of writing) or higher. This is unfortunate, because it means you will not be able to program the 101 from the Raspberry Pi: The Pi's repositories come with a much older version, and there is no easy way to compile the latest Arduino IDE source code for Raspbian.
But, hey, version 1.6.7 is available for GNU/Linux 32 and 64 bits, Windows, and Mac OS X. I'm using Linux, so I'll go with that for these examples.
Download the latest version of the IDE [5], install it, and fire it up. Go to Tools | Board: [name of the board you last used] | Boards Manager. Scroll down until you see the Intel Curie Boards option. Click on it then on Install. Once the download and installation is complete, the Arduino 101 will appear on your board list (Figure 2).
In this article, you'll be seeing a project that uses the 101's gyroscope (I'll exploring other features of the 101 in future articles), so you'll also need the Madgwick library [6]. This library contains functions that turn the raw data from gyroscopes and accelerometers into something intelligible – into numbers you can actually use. To install the library, go to Sketch | Include Library | Manage Libraries and use the search box to narrow down the list (Figure 3).
Finally, as the gyroscope gives you information about its orientation in 3D, you will use it to control an object on your screen in 3D. For this, you will be using Panda3D [7], a seriously cool 3D library for Python that lets you create and animate 3D objects (see the box "Installing Panda3D" for more information).
Installing Panda3D
You could install Panda3D from your repositories. Just use your software manager and search for "panda3d" and most Linux distributions will do all the dirty work for you. But, where's the fun in that? Most distros have editions that are at least three version old, and that is unacceptable, so I'll show how to install from source.
The creators of Panda3D recommend you install a series of packages before you attempt to compile the package. For Debian/Ubuntu-like distros, they recommend you run the commands shown in Listing 1.
After that, you can download the source code for Panda3D using:
$ git clone https://github.com/ panda3d/panda3d.git
Move into the panda3d
directory that the instruction above creates, and run the following:
$ python<X> makepanda/makepanda.py --everything --installer --no-egl --no-gles --no-gles2
Where python<X>
is the version of Python you want to use with Panda3D.
The compile starts and will probably show some warnings alerting you to missing dependencies. You have the choice of stopping the compile then and there by hitting Ctrl+C and hunting through your distro's repositories for the packages it asks for or just ignoring the warnings. The dependencies it complains about are very specific and for special cases only. They are things you'll probably never miss, so it is safe to proceed without them.
The compile takes a while. Actually, it takes a long while. But, when it's done, you can use:
$ sudo python makepanda/installpanda.py
to copy the files to the right places.
After installing, remember to run ldconfig
as root so the system is aware of where the Panda3D libraries are installed.
By the way, you will not be able to compile Panda3D for the Raspberry Pi. It takes up too many resources and ends up freezing the Pi. As with the latest version of Arduino, this only works on a regular, x86-based computer.
Listing 1
Install Packages
$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install build-essential pkg-config python-dev libpng-dev libjpeg-dev libtiff-dev zlib1g-dev libssl-dev libx11-dev libgl1-mesa-dev libxrandr-dev libxxf86dga-dev libxcursor-dev bison flex libfreetype6-dev libvorbis-dev libeigen3-dev libopenal-dev libode-dev libbullet-dev nvidia-cg-toolkit libgtk2.0-dev
Pages: 8
Price $15.99
(incl. VAT)