Page 1 of 3
The Intel Edison is a very attractive single board computer for IoT projects. It has WiFi and Bluetooth as standard and it's cheap. The only minor downside is the it doesn't seem quite as easy to use as an Arduino, but when you understand it a little better you'll find it is both flexible and powerful.
Now On Sale!
You can now buy a print edition of Exploring Intel Edison.
You can buy it from:
USA and World Amazon.com
In this chapter we consider the Edison's pros and cons and get an overview of its structure and the ways in which you can make use of it. If you have ever wondered if you need an Edison or an Arduino or even a Raspberry Pi then this is the place to start.
- First Contact
When you are prototyping with the Edison you are going to need to use one of the two main breakout boards - the Arduino or the mini. This chapter explains how to set up the Edison for both configurations.
- In C
- Mraa GPIO
Using the mraa library is the direct way to work with the GPIO lines and you have to master it. Output is easy but you do need to be aware of how long everything takes. Input is also easy but using it can be more difficult. You can use polling or the Edison interrupt system which might not work exactly as you would expect.
- Fast Memory Mapped I/O
There is a faster way to work with GPIO lines - memory mapped I/O. Using this it is possible to generate pulses as short at 0.25 microsecond and read pulse widths of 5 microseconds. However getting things right can be tricky. We look at how to generate fast accurate pulses of a given width and how to measure pulse widths.
- Near Realtime Linux
You need to be aware how running your programs under a non-realtime operating system like Yocto Linux effects timings and how accurately you can create pulse trains and react to the outside world. In this chapter we look the realtime facilities in every version of Linux.
- Sophisticated GPIO - Pulse Width Modulation
Using the PWM mode of the GPIO lines is often the best way of solving control problems. PWM means you can dim an LED or position a servo and all using mraa.
- Sophisticated GPIO - I2C
I2C is a simple communications bus that allows you to connect any of a very large range of sensors.
- I2C - Measuring Temperature
After looking at the theory of using I2C here is a complete case study using the SparkFun HTU21D hardware and software.
- Life At 1.8V
How to convert a 1.8V input or output to work with 5V or 3.3V including how to deal with bidirectional pull-up buses.
- Using the DHT11/22 Temperature Humidity Sensor at 1.8V
In this chapter we make use of all of the ideas introduced in earlier chapters to create a raw interface with the low cost DHT11/22 temperature and humidity sensor. It is an exercise in interfacing two logic families and implementing a protocol directly in C.
The DS18B20 1-Wire Temperature
The Edison doesn't have built in support for the Maxim 1-Wire bus and this means you can't use the very popular DS18B20 temperature sensor. However with a little careful planning you can and you can do it from user rather than kernel space.
- Using the SPI Bus
The SPI bus can be something of a problem because it doesn't have a well defined standard that every device conforms to. Even so, if you only want to work with one specific device it is usually easy to find a configuration that works - as long as you understand what the possibilities are.
- SPI in Practice The MCP3008 AtoD
The SPI bus can be difficult to make work at first, but once you know what to look for about how the slave claims to work it gets easier. To demonstrate how its done let's add eight channels of 12-bit AtoD using the MCP3008.
- Beyond mraa - Controlling the features mraa doesn't.
There is a Linux-based approach to working with GPIO lines and serial buses that is worth knowing about because it provides an alternative to using the mraa library. Sometimes you need this because you are working in a language for which mraa isn't available. It also lets you access features that mraa doesn't make available.
The Intel Edison is remarkable because it is small, uses little power and yet has a lot of computing in a tiny SD card-sized board. It is a core component in Intel's Internet of Things (IOT) initiative where it has a large role to play.
At around $50 an Edison it isn't as cheap as an Arduino or a Raspberry Pi, but it has enough advantages over both to make it a sensible choice for many applications. Also, when you include the cost of the extras needed to provide WiFi and Bluetooth for the other two, then it is price comparable. More to the point there are situations where its small size and low power consumption make it the only sensible choice.
However, the Edison is a little different from the alternatives and you need to know a little more about its characteristics and the best ways to make use of it depending on what you are trying to achieve.
In this first chapter of Exploring Edison we take a look at the general details of the Edison in comparison to two alternatives you may already be familiar with. In looking at each device we'll consider when and why it might be an appropriate choice.
Contrast And Compare
First some basic facts - missing out a lot of fine detail:
1) Arduino Uno
The key feature of the Arduino is that it is simple but very expandable. It doesn't have a full operating system and it doesn't have a video/keyboard interface. It supports a range of digital and analog I/O as standard.
It is programmed with the help of another machine via a USB connection.Once programmed it can run standalone. If you want to use a network, WiFi or Bluetooth then you need an expansion board - a Shield - and a suitable library. The Arduino doesn't have the processing power to handle complex protocols and do something else at the same time.
2) Raspberry Pi
The Pi is a full computer that just happens to have a GPIO interface that you can use to control the real world. It has a video display and keyboard interface and you can use it standalone just like any machine - though it is common to use another PC to configure and program it via a remote console or desktop.
It is good at networking because it has Linux support for it. However, you need to buy add-on USB WiFi or Bluetooth dongles if you want to use either. It also only has digital I/O unless you buy an expansion board for Analog I/O.
3) Intel Edison
The Edison is a full computer, but without a video or keyboard interface. This means you have to work with it via a remote console - either connect via a serial/usb or network connection. Connections to the outside world can be via the built in WiFi, BlueTooth, serial port or USB. Even though it runs Linux it doesn't have a desktop environment only a command line.
It has 40 digital GPIO connections, but no analog I/O. No analog I/O might sound like a problem but for such a small form factor this isn't surprising.
All of the devices connections are made via a tiny 70-pin I/O connector. If you are used to wiring jumper wires directly to a Raspberry Pi or to an Arduino you will need to think again. The connector is intended not for direct connection but to connect to another PCB. For prototyping you need to use a breakout board and for a finished product you would create a custom board.
If you plan to use a prototype as a one off finished device then you need to keep in mind that the need for a breakout board increases the size and cost.
The Edison Architecture
You can see the general structure of the Edison in the diagram below:
You can see that the dual core 500MHz Atom processor has access to memory, WiFi, Bluetooth LE, USB and to the GPIO. You can write programs that work with all of these facilities. The Atom generally runs Yocto Linux which you can treat as a fairly standard Linux for most of the time.
In fact the structure of the Edison is little more complex than this would suggest as there is a second processor on the board - an MCU Micro
One little appreciated feature of the Edison is that it has two separate processors - the Atom Host CPU and a Quark processor acting as an MCU Microprocessor Control Unit.
The MCU is a separate small CPU that handles the interfacing with the outside world. Most of the time you can ignore it because the main Atom CPU talks to it on your behalf. The dual core Atom runs the Linux OS and the MCU is the microcontroller in the system running its own RTOS derived operating system. The MCU is a full 32 bit Intel Quark microcontroller running at 100MHz, which makes it more powerful than your average microcontroller.
Until recently the SDK didn't provide access to the MCU. Instead the host CPU was the only thing you could program and so all Edison programs accessed the GPIO via programs written on the Atom processor running Linux. Now you can also write programs for the MCU that work with the GPIO lines without the need to involve the host CPU. What this means is that you can now use the MCU to preprocess the data and allow the Host to get on with higher level tasks.
For example, a slightly contrived example would be that the MCU could be programmed to pulse a line in morse code corresponding to each letter of the alphabet. The Host processor could then simply pass the character to the MCU and expect it to get on with the task of sending the morse code.
The division of labour here is typical of the way the Host and MCU can be used together. Of course not all, indeed not many applications need this sort of division of labour and in the main you can mostly concentrate on programming the host.
So which system for which applications?
- The Arduino is good for projects that involve a lot of digital and analog I/O and minimal communication and where size and power requirements are not an issue. It is not low power as standard but there are variants suitable for special purposes such as wearables.
- The Raspberry Pi is really a full computer with good communications. Use it when you need to do complicated things, especially if they need screen and keyboard and just basic digital I/O.
- The Edison is also a full computer but without video and keyboard interfaces. If has WiFi and Bluetooth as standard and so is good at communication. Its low power makes it suitable for battery operation.
Of course these are greatly simplified design criteria and in any case there could be a requirement that makes a particular device suitable that we haven't considered.
However, the Edison is clearly a great choice if you are looking for a lot of computing power and connectivity in a low power package.
There is just one complication - the breakout board - and in particular which breakout board.