Whether you’re an expert in embedded systems or a beginner who’s just discovered the Internet of Things (IoT), it’s always good to take some time to think about how you’re going to approach your first IoT prototype. And, when it comes to prototyping a new “thing” to connect to the IoT, one of the easiest ways to get started is to pick a computing module that will serve as the core of your prototype. This article explains why the Intel Edison IoT devkit is a good choice for developing IoT prototypes and will also suggest some best practices to follow when developing for it.
First, let me introduce myself. I am a fourth-year student majoring in computer and electrical engineering. I have been playing with the Edison since its release in 2014, and have completed many projects with this awesome little board, two of which were selected by Intel as official tutorials for the Edison. Let me give you some advice before we start: To master the Edison, you must be proficient both in software development and hardware design. So even if you prefer one over the other, try to stay focused on both.
First of all, in every project, execution is nothing without proper planning. Before you start working with a new computing module, you should carefully choose the one that best fits your needs. Let’s have a look at what’s available on the market:
- The Arduino is extremely popular among artists and makers; it is relatively cheap, easy to use, plus there is a lot of documentation and a very active community surrounding it. That said, this board has very limited computing power, cannot store a lot of information, and lacks built-in communication capabilities. The Arduino official Wi-Fi shield costs $85, you can find some cheaper third party shield for around $40 and a Bluetooth shield costs $25. Basically trying to turn an Edison into an Arduino won't save you any money but will make your project very complex (you will probably have to deal with compatibility issues). Arduino is around $25 when the Edison starts at $50 and can go up to $100 for an Edison and the Arduino extension board. With respect to computing power, there is a clear difference an Arduino is running at only 16MHz and is not designed to run an OS while the Edison has a 400Mhz dual core and is designed to be compatible with linux.
- The Raspberry Pi 2 is pretty popular too. With 26 general purpose IO pins (GPIO), a fast 900Mhz quad-core ARMv7 microprocessor and low power consumption. The number of IO pins is quite important since it represents the number of different components you can control simultaneously with your board, buttons, LEDs, sensors, etc. It will depend on your project but in general, the more, the better. It’s an interesting product, however, it was primarily designed to provide a cheap computer for all. So it’s a bit too large to integrate into an embedded project. Also, its GPIOs can be very fragile.
- The BeagleBone Black is not as well known as the two previous boards; being somewhat of a mix between a Raspberry Pi and an Arduino. This might seem an interesting compromise, but it has the same GPIO problem as the Raspberry Pi and its hardware has not been updated for more than two years.
- The Intel Edison is the latest development board from Intel. It’s roughly the size of a postage stamp, with very low power consumption and great connectivity (the board has 40 GPIOs and built-in Bluetooth and Wi-Fi). With its 500Mhz Intel Atom dual-core processor, the Edison punches well-above its weight-class given its size and is capable of serving the needs of just about any IoT application. In short, not only does this board have everything you need, it is also small enough that it’s not just for your prototype. It can be used in your production “thing” too.
And here is the icing on the cake: Intel made two extension boards for it. There is the mini breakout board, which gives easy access to the GPIOs while maintaining the small-form factor of the Edison, and there is the Arduino board for Edison, which basically allows you to make your Edison compatible with the shields designed for Arduino. Shields are interface boards that can be plugged on top of the master board and provide complementary features like CNC or Motor Control. SparkFun Electronics also designed extension boards of its own, making the possibilities endless. The only downside of the Edison might be its price (from $45). But keep in mind it offers almost every feature you could want.
At this point, you may have carefully examined your project and decided that the Edison’s size, performance, and connectivity options make it the best hardware for what you want to create. If that’s the case, allow me to share some tips on how to avoid mistakes and optimize your design.
Determine if you will be using an extension board
The Edison’s design allows it to be directly integrated into a finished product as a computing module. This approach will give you the best results. However it requires an extended study conducted by a specialist who understands the final application, the capabilities and electrical features of the Edison computing module, and the advantages and trade-offs of using an extension board. For example, you could choose to use the Arduino extension board which will handle any required voltage translations and give you different options to easily power the board (more on that later). But, the addition of an Arduino extension board comes at a price: your design will be significantly bigger than the Edison itself (see image below).
While attaching an Edison computing module to an Arduino extension board comes with certain advantages, it also radically alters the total package’s size.
Finally, you can choose to go with Intel’s mini breakout board. But, unlike when an Arduino extension board is added, you will have to handle voltage translation by yourself. Then again, you won’t have to design a custom-printed circuit board with a 70-pin connector to access the GPIOs of the Edison.
Shown: The relative size of the mini-breakout board to the postage stamp-sized Intel Edison computing module. The module snaps onto mini-breakout board.
A tip for assigning a task to the GPIOs
Not all of the Edison’s 40 GIPOs are created equal which is why it helps to study the documentation and get to know all of the GPIOs really well.
On the one hand, the GPIOs of the Edison are bi-directional and this has some implications. First, you have to assign a role to the pins you are using (they can work as inputs or outputs). Then, you need to ensure the allocations you just made in your software match the reality.
On the other hand, some pins of the Edison can be used for both a GPIO and a special communication protocol such as UART, I²C, I2S, SPI or SD card interface. So be careful - a bad pin assignment might prevent you from using these handy features.
Also, never apply current to an output, for example. You could end up destroying your Edison.
Be really careful about voltage and current when connecting components
The Edison is a low-power device. So, when configured as outputs, the GPIOs can only supply 3mA at 1.8V. This is extremely low and very often, you will have to build an amplification stage to trigger other electronic components. If the pin is configured as an input, make sure you don’t apply more than 1.8V to it. You will probably need to shift down the voltage from exterior components connected to the Edison. If you are using the Arduino extension board, voltage conversion is automatically taken care of for both inputs and outputs. But you have to make sure the components you wired to the Edison are compatible with its voltage so as to not damage them (the voltage of the Arduino board can be either 3.3V or 5V).
Select an appropriate power source
The Edison accepts an input voltage between 3.15V and 4.5V which allows it to be powered by a standard lithium battery. If you are using the Arduino board or the mini breakout, these boards have an internal voltage regulator which allows you to power the board with an input voltage between 7V and 15V. Whichever power option you choose, the Edison only needs a tiny amount of current, usually around 200mA with peaks at 600mA during Wi-Fi transmission. This means once you’ve met the target voltage, you probably won’t have to deal with power issues so you can maintain a simple design for your power stage. Please note that the Edison also has two onboard regulators delivering 1.8V and 3.3V. However their use is discouraged because they can only supply a small amount of current (100mA) and the power going through the Edison should be kept as low as possible.
Think before you act
Now that you know how to use the Edison for your project, take some time to plan your wiring. You don’t want to be almost done soldering wires to the back of your board only to discover you made a poor pin assignment. Once you have decided which features you want for your project and which components it will take to implement them, you should make a diagram showing how your components are connected. This will help you identify potential flaws in your design and save a lot of time when you finally build your project.
Now that you’re an expert on the Edison’s hardware, let’s have a look at software. Edison is clearly designed for IoT, so your creations might not be easily accessible. This means you have to focus on stability.
Select your Development Environment
To program your board, there are a lot of options: you can choose the Arduino IDE or you can develop in C/C++ or Python using an Eclipse plugin. Or you can also go with HTML5 and Node.js thanks to Intel’s XDK. You can also connect directly to the board through serial or SSH and install binaries, and because the board uses an x86 core, there are plenty of them available on the Internet. Note that if you want to connect to the board through serial, you will need an FTDI converter; there’s one on both the mini breakout and the Arduino board.
Learn to master Yocto Linux
If you decide to use the Edison as a tiny server, you will enjoy a lot of freedom because you’ll have access to a Linux environment. This means you can do pretty much whatever you want. However, by default, the Edison is shipped with a special version of Yocto Linux that’s optimized to be very lightweight. This means there’s no compiler pre-installed. The package manager is a simple dpkg and the repository list is empty. Accepting these defaults, means you will have to spend a few hours configuring the system before use.
Evaluate your storage needs
While Edison has a limited onboard storage of 4GB, you have to take formatting into account to get the actual capacity of the Edison; approximately 3.7GB. Of that, 700MB is allocated to mass storage which means there’s only 3GB left for your data. Last but not least, those 3GB are divided into two partitions of 1.5GB each. You must take this memory mapping into account when developing your application. With the default configuration, you simply cannot deal with very large files. If you really need to, you have two options: remap the partition table of the Edison or add an SD card (which has the added benefit of even more storage).
Pause before coding
If you are using the Edison for your project, chances are it is an ambitious one which means you will probably have many software components. You might depend on multiple programs each of which will have to communicate. Even if your project only depends on a single program, it will probably consist of multiple files or classes. Again, you should take some time to draft a diagram before you start coding to identify your major obstacles.
Don’t get sloppy - keep your code clean and organized
Don’t forget to comment and indent your code. You should use Git to keep track of your modifications. Using Git will also allow you to easily share your project with collaborators. In a perfect world, your project should only rely on code authored by you or your team, though most of the time this is impossible. So when using external libraries, be organized to maintain compatibility and keep your project clean. Put simply, the more libraries you add to the project, the more complex it becomes.
The nice thing about the Edison is that it can help you during each design cycle of a product. You can start modestly with the Arduino board and Arduino IDE, then add complexity to your project until you have reached a desired compromise between consumption, size, cost and usability.