• No se han encontrado resultados

2 Marco Teórico

2.3. Estado Del Arte

2.3.3. Antecedentes Locales

The latest sensation in the world of Microsoft Windows and in particular the IoT is the ability for Windows users to leverage their experience and knowledge of developing applications for Windows on smaller devices. This new offering is called Windows 10 IoT Core. While Microsoft has offered several products designated as “embedded” or “compact” or “embedded compact”, which was a scaled-down version of the operating system, there were many differences and a few bridges that had to be crossed to use them. While highly touted, the offerings never really lived up to the “write the code once and deploy everywhere” mantra. That is, until now.

1 Learning Linux isn’t really so terrible, as you shall see, but if you’ve never used such an operating system, it can be frustratingly difficult to learn how to do even simple tasks.

WHAT ABOUT WINDOWS EMBEDDED?

You may have heard about a version of Windows called Windows Embedded . This was one of the

early attempts to make the Windows operating system lightweight enough to run on low-power, low

capability hardware. Unfortunately, there wasn’t much direction or clear path for developers wanting

to leverage it in their solutions. Fortunately, Windows 10 IoT Core is the answer (replacement) for

embedded Windows applications.

Unlike the previous products meant for smaller platforms, Windows 10 IoT Core shares many of the same components as the flagship operating system for PCs. That is, it has the same core components, kernel, and even some of the middleware is based on the same core code. In fact, the code generated can be binary- compatible with the other platforms, which means you can write code that can run on either the IoT device or your PC. It should be noted that this capability is highly dependent on what the code does. For example, if your code access the general-purpose input/output (GPIO) hardware pins on the low-cost computing board, you cannot run the application on the PC (there are no GPIO pins on the PC). 2

Interacting with Hardware

The ability to access hardware directly—such as the GPIO pins—is what makes Windows 10 IoT Core so attractive to hobbyists and IoT enthusiasts who want to build custom hardware solutions using small, inexpensive hardware.

For example, if you wanted to build a simple device to signal you when someone opens your screen door, you would likely not use a PC costing several hundreds of dollars. Not only would that be expensive and bulky, there isn’t an easy way to connect a simple switch (sensor) to your PC, much less to a PC located elsewhere. It would be much more cost effective to use a simple switch connected to a small, inexpensive set of electronic components using a simple application to turn on an LED or ring a buzzer. What makes the Windows 10 IoT Core even more appealing is you don’t have to relearn how to write software—you can write a Windows application to run on the small device.

Video Support

Since most IoT devices do not include a monitor (some may), Windows 10 IoT Core is designed to run headless (without a monitor) or headed (with a monitor). Headless solutions require less memory since they do not load any video libraries or subsystems. Headed solutions are possible if the hardware chosen supports video (all current hardware options have HDMI video capabilities).

Thus, you can create IoT solutions with visual components or interactive applications, such as those for kiosks, or even interactive help systems. You choose whether the application is headless or headed by the configuration of the device. In fact, the configuration is accessible from the device or remotely through a set of tools running on your PC. You’ll see more about these features later in this chapter.

One Platform, Many Devices

For developers of Windows 10 applications, including IoT solutions, Microsoft has adopted a “one Windows” philosophy where developers can develop their code once and run it on any installation of Windows. This is accomplished with a technology called the Universal Windows Applications API (sometimes called UWP or universal applications or UWP apps).

Thus, developers can create an application that runs on phones, tablets, desktop, and even servers without having to change their code or exchange different libraries. A you will see once you start with the projects in this book, you are developing your applications (apps, scripts, etc.) on your Windows 10 desktop (tablet) and deploying them to the Raspberry Pi—all without having to move the code to the Raspberry Pi, alter it, compile it, and so on. This is a huge improvement for IoT developers over other development choices.

For example, if you chose to use a Raspberry Pi with its default operating system, you would have to learn how to develop Linux applications—complete with learning new development tools (if not a new code editor). With Windows 10, you use an old favorite—Visual Studio—to build and deploy the application. How cool is that?

The real power of the UWP API is discussed in Chapter 4 as you explore how a single application (code) can be compiled on your PC and deployed to the Raspberry Pi. Indeed, the UWP API allows you to write one solution (source code) and deploy it to any Windows 10 device from a phone, low-cost computing board, PC, tablet, and so forth. This opens the possibility of using any of the Windows 10 supported devices in your projects.

Supported Hardware

Windows 10 IoT Core is designed and optimized to run on smaller devices, such as low-cost computing boards. Furthermore, Windows 10 IoT Core can run headless 3 (without a display) thereby removing the need

for sophisticated graphics (but still supports graphic applications with special libraries). All this is possible with the extensible Universal Windows Platform (UWP) API, as described earlier.

The hardware requirements for running Windows 10 IoT Core include the following. • Memory (headless) : 256MB RAM (at least 128MB free for the operating system) • Memory (with display) : 512MB RAM (at least 256MB free for the operating system) • Storage : 2GB (can be SD card, non-volatile memory, or disk)

• Processor : 400MHz or faster ARM or Intel x86

Currently, the Windows 10 IoT Core runs on the Raspberry Pi, MinnowBoard Max–compatible boards, and the Arrow DragonBoard 410c. All of these boards are considered low-cost computing platforms. I describe each of these briefly in the upcoming sections.

Note Some early documentation, including web sites from Microsoft and Intel report and demonstrate

using early releases of the Windows 10 IoT Core on the Intel Einstein and Galileo boards.

4

However, the latest

releases of Windows 10 IoT Core have dropped support for these boards.

LOW-POWER COMPUTING PLATFORMS

Low-powered computing platforms, sometimes called low-cost computer boards or mini-computers,

are built from inexpensive components designed to run a low-resource-intensive operating system.

Most boards have all the normal features you would expect from a low-cost computer, including video,

USB, and networking features. However, not all boards have all of these features.

3 Oh, no, a harbinger for headless hardware!

The reason they are sometimes called low power isn’t because of their smaller CPUs or memory

capabilities; rather, it is because of their power requirements, which are typically between 5V

and 24V. Since they do not require a massive, PC-like power supply, these boards can be used

in projects that need the capabilities of a computer with a real operating system but do not have

space for a full-sized computer, cannot devote the cost of a computer, or must run on a lower

voltage.

There are many varieties of low-cost computing boards. Some support the full features of a typical

computer (and can be used as a pretty decent laptop alternative), while others have the bare essentials

to make them usable as embedded computers. For example, some boards permit you to connect a

network cable, keyboard, mouse, and monitor for use as a normal laptop or desktop computer while

others have only networking and USB interfaces, requiring you to remotely access them in order to

use them. Fortunately, all the low-cost computing boards available for Windows 10 have support for

networking, video, and USB peripherals.

Raspberry Pi

The Raspberry Pi 3 Model B is the latest iteration of the Raspberry Pi ( www.raspberrypi.org/products/ raspberry-pi-3-model-b/ ). It has all the features of the original Raspberry Pi 2 but with a faster 64-bit quad core processor and onboard Wi-Fi (a first for the Raspberry Pi). However, the Raspberry Pi 2 is more than capable for running Windows 10 IoT Core solutions.

Note I use the term Raspberry Pi henceforth to refer to either the Raspberry Pi 2 or 3.

The Raspberry Pi is a popular board with IoT developers mainly because of its low cost and ease of use. Given the popularity of the Raspberry Pi, I cover it in greater detail in Chapter 3 , including a short tutorial on how to get started using it with its native operating system. Thus, I briefly cover the highlights here and reserve a more detailed discussion on using the board for Chapter 3 .

Note I describe the Raspberry Pi 2 here, but you can use either the Raspberry Pi 2 or Raspberry Pi 3 for

this book.

The Raspberry Pi 2 hardware includes a 900MHz A7 ARM CPU, 1GB RAM, video graphics with HDMI output, four USB ports (up from just two on older boards), Ethernet, a camera interface (CSI), a display interface (DSI), a micro-SD card, and 40 GPIO pins. Figure  2-1 shows the Raspberry Pi 2 board.

The camera interface is really interesting. You can buy a camera module like the ones at Adafruit ( http://adafruit.com/categories/177 ) and connect it to the board for use as a remote video-monitoring component. I’ve used this feature extensively by turning a couple of my Raspberry Pi boards into 3D-printing hubs where I can send print jobs over the network to print and check the progress of the prints remotely or as low-cost video surveillance devices.

The LCD interface is also interesting because there is now a 7-inch LCD touch panel that connects to the DSI port ( http://element14.com/community/docs/DOC-78156/l/raspberry-pi-7-touchscreen- display ). I have also seen a number of interesting Raspberry Pi tablets built using the new LCD touch panel. You can learn about one promising example (made by Adafruit, so I expect it to be excellent) at http:// thingiverse.com/thing:1082431 .

To date, the Raspberry Pi has been my go-to board for all manner of small projects due to its low cost and availability. There are also many examples from the community on how to employ the Raspberry Pi in your projects. For more information about the Raspberry Pi, see Chapter 3 .

Tip There is a list of frequently asked questions (FAQ) on using Windows 10 IoT Core that includes a

section on the Raspberry Pi (

http://ms-iot.github.io/content/en-US/Faqs.htm

). You may want to check it

for answers if you encounter a problem using your Raspberry Pi.

WHAT ABOUT THE RASPBERRY PI ZERO?

Sorry, Windows 10 IoT Core does not work on the new and widely popular Raspberry Pi Zero board. The

processor on the Zero is the older processor from one of the original Raspberry Pi boards. Perhaps in

the future a “Zero 2” board is compatible, but for now, you can use only the Raspberry Pi 2 or 3 with

Windows 10 IoT Core.

One of the things I like about the Raspberry Pi is you can run a number of operating systems on it by installing the operating system on a micro-SD card. This allows me to use a single Raspberry Pi for a host of projects; each with its own micro-SD card. In fact, the basic setup at www.raspberrypi.org includes a special boot loaded that permits you to install the operating system of your choice. Sadly, Windows 10 is not on that list (yet) but Windows 10 permits you to load it directly from your PC.

MinnowBoard Max–Compatible Boards

The MinnowBoard Max and compatible boards are a very interesting lot. They use an Intel processor with a wider array of features than the other boards, including an Intel Atom E3826 dual core 1.46GHz CPU, integrated HDMI output Intel HD Graphics with hardware-accelerated drivers (for Linux), 2GB of fast DDR3L 1067MT/s DRAM, 8MB SPI Flash memory, Ethernet, USB, SATA (e.g., a hard drive), micro-SD card drive, GPIO, and more. In many respects, this is the most powerful board of the lot with more features. About the only thing lacking is onboard Wi-Fi but that can be quickly remedied with any number of Wi-Fi USB dongles. 5

One very interesting aspect to the MinnowBoard Max is that the developer has retained compatibility over several iterations of the board. The Microsoft web site lists the MinnowBoard Max as officially supporting Windows 10 IoT Core but actually any MinnowBoard Max derivative will work. In fact, the MinnowBoard Wiki page ( www.minnowboard.org ) refers to the line as simply “MinnowBoard Max– compatible” boards.

When I purchased my board, I bought the latest, most powerful MinnowBoard Max–compatible board available: the MinnowBoard Max Turbot. The Turbot offers a number of minor improvements over the older boards, including improved performance and many smaller improvements in the GPIO subsystem as well as a defect repair or two. Figure  2-2 shows my MinnowBoard Max Turbot. Now, that’s a handsome board, isn’t it?

Figure 2-2. MinnowBoard Max Turbot

The MinnowBoard Max–compatible boards have one thing that may be very important for some IoT solutions that the Raspberry Pi lacks: an onboard Real Time Clock (RTC)—battery not included. You can see the battery holder in the photo between the power and Ethernet connectors on the left side of the board. Older boards did not come with this header installed but you can add it yourself if you know how to solder (or know someone who does). You can set the current date and time using the Unified Extensible Firmware Interface (UEFI) shell date command (see http://wiki.minnowboard.org/Shell_Commands ).

WHAT IS A REAL TIME COCK AND WHY SHOULD I CARE?

A real-time clock allows you to keep accurate time of day for recording date and time of events (or

simply reporting such to the user). Without an RTC, the Raspberry Pi needs either connection to the

Internet to synchronize time or a seed value to keep time itself. However, without a RTC circuit, time

keeping can become inaccurate over long periods.

6

I discuss time keeping in the later chapters with

examples of recording events.

Note The other board supported by Windows 10 IoT Core, the DragonBoard 410c, has a RTC too but it

does not require an external battery, which suggests it must be reset on boot.

Another interesting thing about the MinnowBoard Max is that it is open hardware so if you wanted to build one yourself or a derivative or perhaps an accessory board (called a Lure ), you can find all the information to do so online. In fact, there are a number of vendors offering Lures (add-on boards) for the MinnowBoard Max–compatible boards. The wiki at http://wiki.minnowboard.org/Lures lists a number of available Lures and accessories (and a few retired ones).

I much prefer an open hardware (or open source) solution to proprietary offerings because I find it is often the case that there is more information available about the products if they have a strong (and growing) community to support it. This is the case with the MinnowBoard Max. You can find almost anything you want to know about this board on the http://wiki.minnowboard.org wiki.

Tip You can find additional information about the MinnowBoard Max–compatible boards at

http://wiki. minnowboard.org

.

As you can imagine, given the added performance, these boards do cost quite a bit more than the Raspberry Pi (about $150 vs. about $35) but the jump in performance may warrant the extra cost. If you search around, you may be able to save a bit by buying an older board rather than the newest board described here. Most sites I visited were out of stock but it is just a matter of time before they become more plentiful.

Thus, finding a MinnowBoard Max can be a bit of a challenge. Fortunately, the newer MinnowBoard Max Turbot is 100 percent–compatible (and a bit better) than the original MinnowBoard Max described on the Microsoft Windows 10 IoT web site. In the United States, you can buy a MinnowBoard Max Turbot at NetGate ( http://store.netgate.com/Turbot.aspx ). You can also find the MinnowBoard Turbot at Maker Shed at www.makershed.com/products/minnow-turbot . In the EU, you can find them at RS Components Ltd. ( http://uk.rs-online.com/web/cpo/8842199/?searchTerm=minnowboard+max ).

6 There is much more to this than what I list, but suffice to say a typical clock on a computer cannot keep accurate time. That’s the whole point of the RTC.

Arrow DragonBoard 410c

The Arrow DragonBoard 410c is a low-cost computing board that incorporates the Qualcomm quad core Snapdragon 410 processor. This processor is an ARM Cortex-based single-chip system supporting a wide variety of hardware from USB to networking. The processor runs up to 1.2GHz per core in either 32- or 64-bit mode, which is a bit more powerful than the Raspberry Pi.

The board is a fully featured low-cost computing platform complete with 1GB of RAM, 8GB onboard storage (eMMC), an HDMI 1080p display (with audio over HDMI), Wi-Fi, Bluetooth, GPS (yes, GPS!), USB ports, and even a micro-SD card. Figure  2-3 shows the DragonBoard 410c.

Figure 2-3. Arrow DragonBoard 410c

Interestingly, the DragonBoard 410c can be booted from the onboard memory using the Android 5.1 operating system; provided you haven’t loaded Windows 10 IoT Core because you will overwrite the base operating system. However, you can recover the factoring settings by following the procedure at https:// github.com/96boards/documentation/wiki/Dragonboard-410c-Installation-Guide-for-Linux-and- Android . Figure  2-4 shows the default operating system (Android-based) of the DragonBoard 410c. Thus, you could use the DragonBoard 410c as an ultra-compact desktop or laptop computer.

Note The DragonBoard 410c does not use an SD card to boot Windows 10 IoT Core. I discuss these

differences in a later section.

Given its small size, onboard Wi-Fi, USB, GPIO header, and more, the DragonBoard 410c is a good alternative to the Raspberry Pi. Yes, it does cost more (about $75 versus about $35 for the Raspberry Pi), but if you need the more powerful processor and convenience of onboard Wi-Fi, you may want to consider it for solutions that need a bit more processing power.

Tip For more details on the DragonBoard 410c, visit the Arrow data sheet at

www.arrow.com/en/ products/dragonboard410c/arrow-development-tools#partsDetailsDatasheet

.

The best source for purchasing an Arrow DragonBoard 410c is from the manufacturer directly; go to

www.arrow.com for details on ordering a board to complete your low-cost computer board arsenal. Note that the manufacturer stocks a host of additional electronic components making them another source for gathering components for your IoT project. You can also find it on Maker Shed at www.makershed.com/ products/dragonboard .

So Which One Should I Choose?

The three boards are those that are currently supported for use with Windows 10 IoT Core. Which you choose is largely up to you as each has their merits. Perhaps the most compelling reasons to choose one over the others for most hobbyists and enthusiasts are cost and availability.

At the time of this writing, the Raspberry Pi costs less than the other boards and is much easier to find. The Raspberry Pi costs about $35, the DragonBoard 410c about $75, and the MinnowBoard Max Turbot about $150 making the Raspberry Pi the most economic for initial cost.

Since most readers want to limit their investment (hardware can get expensive quickly once you start