The maker community is awash with new ideas. Many are based around the use of technology and bring fresh ways to provide and deliver a service. Others open up the lives of the many with ideas not thought possible before. For the bright sparks with these ideas, the challenge of getting a product design from paper to reality can be daunting. Budding entrepreneurs realize that getting to the market first is crucial, and that dictates a rapid development phase. Embedded single board computers (SBCs), such as Arduino, Raspberry Pi and BeagleBone Black, have quickly become the platform of choice for many makers. The vast majority of SBCs use Linux as the operating system of choice. However, while incorporating a lot of flexibility and features into a design, Linux does require a fair degree of familiarity when getting started, and might well deter those less confident with using an open source operating system. Arduino is perhaps an exception in that it does not use an operating system. This has, however, not in any way limited Arduino’s credibility in bringing simplicity and programming ease to the challenge of real-word interfacing in embedded designs. Hugely popular within the maker community and especially to those new to electronics, Arduino has been credited with re-kindling interest in hobbyist electronics, and in turn, being responsible for igniting the imagination behind many new product ideas.
When it comes to developing a new product, the challenge for many makers is how to prototype a product that combines the very best of what Arduino offers with the user and application familiarity of Microsoft® Windows. Offering a host of connectivity options such as SPI, I2C and UART, together with GPIO, PWM and ADC peripherals, there is no doubt that Arduino provides an extremely credible and capable way of getting a design connected to and sensing the real world. From an application development perspective, it is highly likely you are more versed with developing desktop applications using the Microsoft Visual Studio IDE with languages such as C#, Java and Python rather than Linux. Until recently there wasn’t a straightforward way to integrate the different domains of Windows Desktop and Arduino, but an SBC called LattePanda from DFRobot promises to do just that (Figure 1).
Figure 1: LattePanda from DFRobot.
Essentially an extremely compact single board Windows computer that is pre-installed with Microsoft Windows 10 Home edition, the LattePanda hosts an Intel® Cherry Trail Atom Z8350 quad core microprocessor running at 1.8 GHz in addition to an Arduino-compatible Atmel ATmega32u4 co-processor. Note this a full Windows 10 system, not a cut-down IoT version. Two models are available, a 32 GB e-MMC storage and 2 GB RAM board, or a 64 GB storage and 4 GB RAM version. LattePanda boards are also available without an activated Windows 10 key. As standard connectivity options, the LattePanda has USB 2.0 and USB 3.0, a 100 Mbps Ethernet port, HDMI output, a 3.5 mm audio socket, a microSD socket, Bluetooth 4.0, and Wi-Fi. Figure 2 illustrates the key components and interfaces of the LattePanda. The board is powered by a single 5 VDC, 2.5 amp supply through a micro USB socket. Make sure that the power adapter is capable of supplying at least 2.3 amps during operation to avoid the LattePanda resetting during boot up. Measuring just 88 mm x 70 mm (3.46" x 2.76"), the LattePanda is small enough to incorporate into space-constrained designs. To aid placement within an enclosure, the LattePanda mechanical specifications and 3D model files are available from the board’s forum. When fitting the board into a confined space, it is recommended that forced air cooling is provided via a fan, and suitable heatsinking is employed as the board runs fairly hot during normal operation. A set of custom copper heatsinks is available for use with the LattePanda. A 5 VDC fan supply is provided on the board.
Figure 2: LattePanda main components and interfaces.
In addition to the Windows operating system, the board is pre-loaded with Microsoft’s Visual Studio and the Arduino IDE. The board is capable of headless operation by using a suitable virtual network computing (VNC) terminal application such as TightVNC, or by attaching the LattePanda 1074 x 600 7-inch LCD display panel with its corresponding touch panel. Both the display and the capacitive touch panel connect to the LattePanda via FFC cables and ZIF sockets.
When it comes to using the various peripheral IO, the combination of Windows and Arduino has been well thought out. Figure 3 illustrates the available pin-out. Signals from both the Atom and the ATmega32u4 are available, the majority being from the Arduino via a 24-pin dual row socket. The Atom IO can be found in the U1 area of Figure 3. All 20 GPIO pins (analog A0 – A5 and digital D0 – D13) use 5 V logic and can be used as input or output, 12 of which can be individually set for analog input use. See U2 area of Figure 3. When connecting any sensors or devices to the IO, make sure that they are also using 5 V logic. Logic level converters would be needed should a 3.3 VDC device be employed. Each analog pin has a 10-bit resolution providing 1024 values from an input voltage range of 0 to 5 VDC. Pins D3, D5, D6, D9, D10 and D13 can be used as 8-bit PWM outputs. In addition, D7, D3, D2, D1 and D0 can be used to trigger an external interrupt across a number of different conditions. In keeping with Arduino tradition, there is an LED connected to D13 that can be used with the standard blinking LED sketch.
Figure 3: LattePanda – peripheral pin-outs.
Note that some Arduino pins, D9, D10, D11, A0, A1 and A2, appear both in the core Arduino connector and for use with the DFRobot Gravity sensors.
Pins can be accessed from both an application running on the ATmega32u4 core and the Atom. In addition to the standard GPIO-based IO, serial communications via I2C and SPI are also available from the pin headers. A 6-bit ICSP connector is also provided. Windows applications can easily use the Arduino GPIO pins thanks to the supplied LattePanda Firmata open source library for use with Visual Studio. This gives any application access to, and control of, any pin through the use of the class functions. A detailed explanation of the available library functions along with individual downloadable Visual Studio C# example files can be found here.
Figure 4: Visual Studio screen capture of the code for blinking the on-board LED.
In order to check that everything is working correctly, the Visual Studio C# code that calls the Firmata class library is illustrated in Figure 4. When run, this blinks the on-board LED. Readers familiar with Arduino’s C-based code structure and functions will note the similarity of the class functions to those used within an Arduino sketch.
Creating applications with the LattePanda is made even easier thanks to the availability of a set of sensors custom designed for the board. Comprising a total of 14 sensors and their connecting cables, the Gravity Sensor Starter Kit includes temperature, light, gas and flame sensors, an analog rotational sensor, digital push buttons, various color LEDs, and a relay module. These plug into the row of six 3-pin Gravity connectors on the board, the pin-out of which is indicated in Figure 3.
The board’s I2C bus provides another convenient way of connecting sensors, actuators and displays. The Firmata library provides the necessary class functions to send and receive data directly into a Visual Studio application using the wireBegin, wireRequest and didI2Cdatareceive functions. The example below showcases the use of an I2C 3-axis accelerometer evaluation board from Adafruit. This board uses the ADXL345 ultra-low-power high-resolution 3-axis MEMS sensor from Analog Devices. The MEMS sensor is connected to the LattePanda as illustrated in Figure 5.
Figure 5: Wiring up Adafruit ADXL345 3-axis MEMS sensor to LattePanda.
Power is provided from pins 22 (5 V) and 21 (GND) and the I2C connected to pin 6 – yellow wire SDA and pin 8 – blue wire SCL.
The source code in Figure 6 shows the sensor board being written to using a default sensor address of 0x53 and a default measurement range of 0x2D (2 G). Data is then read back from the sensor continuously and parsed into X, Y and Z axis readings for displaying on the console screen.
Figure 6: C# code showing set up and reading of ADXL345 3-axis MEMS sensor via I2C interface.
The two above examples serve to illustrate not only how quickly an application can be created using the LattePanda, but also the fact that this board provides a pre-certified platform on which applications can be quickly developed and deployed into the market. Rather than having to develop a suitable embedded design from scratch with the associated NRE costs, risks and time to market, a design using an SBC can be implemented within a matter of weeks. Once first-mover advantages have been secured by getting a design into the market and customer installations made, if production volumes support the business case, the engineering team can prepare a bill of materials for a custom design making full use of the mechanical models provided with the LattePanda forum.
Among the many possible applications for LattePanda, using it for an Internet of Things (IoT) solution is an ideal choice. It has enough compute and connectivity resources to read data from a host of wired and wireless connected sensors in real time, aggregate the results, and then forward it to a cloud analysis platform via Wi-Fi or Ethernet communication. This gateway approach is certainly gaining popularity for Industrial Internet of Things (IIoT) applications. Termed ‘fog’ computing, this method is less dependent on having continuous cloud connectivity, since some control functions can be achieved locally without needing to wait for a cloud application to respond. An example is turning on an air conditioning plant once a certain temperature point has been reached. Having the temperature sensor and the plant actuator local to the gateway, the demand for cooler air can be serviced without incurring communications costs, controlling latency and requiring cloud compute resource.
Microsoft’s Azure IoT Hub platform is a popular cloud-computing platform that fully supports the LattePanda SBC. A GitHub repository documents the process involved in getting the board communicating with the Azure platform. This is in addition to information provided by LattePanda. To smooth the development and testing process, Microsoft provides Node.js sample files that test the connectivity to the IoT hub. Before downloading these samples, you first need to use the Azure portal to set up an Azure account and create a new IoT device (Figure 7).
Figure 7: Creating a new Azure IoT hub entry.
Figure 8 illustrates setting up the hub entry details and the naming of the host. This process provides the credentials (connection strings and access keys) that are used to identify and tie a sensor on the LattePanda to the Azure IoT hub. Once this process is completed you can then edit the supplied “simple_sample_device.js” file and enter the connection string prior to building and running the code. Within the Azure IoT hub, the DeviceExplorer utility function provides a means of observing messages the hub is receiving from the LattePanda.
Figure 8: Azure IoT hub – registering a new device.
Once you are satisfied that communication has been established, you are ready to process your application’s design using Azure’s services. For example, you can use Azure Storage service to build a table of sensor readings. Azure Stream Analytics and Azure Power BI are two other examples of Azure apps that can interpret, analyze and display values and trends from the sensor data.
Figure 9: Light sensor Node.js example showing Azure Storage functions.
Figure 9 illustrates the Node.js code example that reads the values from a Gravity light sensor connected to pin ‘A0’ and stores them within an Azure Storage table. The functions that communicate with Azure Storage are highlighted in red.
Developing on LattePanda is very easy. It is a well-supported platform with plenty of vendor documentation, an online community forum and its own GitHub repository containing mechanical models, libraries and code examples. Further, the core operating system, Microsoft Windows 10, is extremely well supported with many commercial development environments and applications available. Additionally, the Arduino co-processor has an extensive community of publications, developers and programming resources. The Arduino IDE is probably the most ubiquitous IDE you will find. Microsoft Visual Studio is the ideal IDE companion, supporting developments in a variety of popular programming languages like C#, Python and F#/.Net.
LattePanda introduces a new concept to the maker community. Being able to combine the Arduino’s ease of real-world interfacing with the vast community of Windows developers and their applications extends the reach of embedded designs much further, opening endless new product opportunities.