Pages

Tuesday, April 19, 2016

Prototyping Internet of Things Ideas and Networks - Book Excerpts

Microcontroller is the main component to build an IoT Device.

Dig further into the ways of interfacing microcontroller with the real world using the “Interfacing with Hardware” page on the Arduino Playground website:(http://playground.arduino.cc//Main/InterfacingWithHardware). .

From the perspective of the electronics, the starting point for prototyping is usually a “breadboard”. This lets you push-fit components and wires to make up circuits without requiring any soldering and therefore makes experimentation easy.

8-bit microcontrollers are still in use, although the price of 32-bit microcontrollers is now dropping to the level where they’re starting to be edged out.

There are lots of microcontroller manufacturers (Atmel, Microchip, NXP, Texas Instruments, to name a few), each with a range of chips for different applications.

The ubiquitous Arduino platform is based around Atmel’s AVR ATmega family of microcontroller chips.

SYSTEM-ON-CHIPS
In between the low-end microcontroller and a full-blown PC sits the SoC (the Raspberry Pi).

RAM
If you want to run standard encryption protocols, you will need at least 4KB RAM, and preferably more.

Networking

The device has to connect to the rest of the world. Wired Ethernet is often the simplest for the user and cheapest, but it requires a physical cable. Wireless solutions avoid that requirement with a more complicated configuration. WiFi is the most widely deployed to provide an existing infrastructure for connections, but it can be more expensive and consumes more power than some of its competitors. ZigBee is a technology aimed particularly at sensor networks and scenarios such as home automation. The recent Bluetooth LE protocol (also known as Bluetooth 4.0) has a very low power-consumption profile similar to ZigBee. Standard Bluetooth chips included in phones and laptops.

USB
If your device can rely on a more powerful computer being nearby, tethering to it via USB can be an easy way to provide both power and networking. Some of the microcontrollers can be bought in versions which include support for USB, so choosing one of them reduces the need for an extra chip in your circuit.

Instead of the microcontroller presenting itself as a device, some can also act as the USB “host”. This configuration lets you connect items that would normally expect to be connected to a computer—devices such as phones, for example, using the Android ADK, additional storage capacity, or WiFi
dongles.

Interfacing with Sensors and Other Circuitry
The device has to interact with sensors to gather data about its environment and motors, LEDs, screens, and so on, to provide output. You could connect to the circuitry through some sort of peripheral bus—SPI and I2C being common ones—or through ADC or DAC modules to read or write varying voltages; or through generic GPIO pins, which provide digital on/off inputs or outputs. Different microcontrollers or SoC solutions offer different mixtures of these interfaces in differing numbers.

Arduino board

The “standard” Arduino board has gone through a number of iterations: Arduino NG, Diecimila, Duemilanove, and Uno. The Uno features an ATmega328 microcontroller and a USB socket for
connection to a computer. It has 32KB of storage and 2KB of RAM,

The Uno also provides 14 GPIO pins (of which 6 can also provide PWM output) and 6 10-bit resolution ADC pins. The ATmega’s serial port is made available through both the IO pins, and, via an additional chip, the USB connector.

Integrated Development Environment
To develop using the Arduino, the integrated development environment (IDE) that the team supply at http://arduino.cc is used. This is a fully functional IDE, based on the one used for the Processing language (http://processing.org/). Most Arduino projects consist of a single file of code. IDE mostly is a simple file editor. You use it to check the code (by compiling it) and to push code to the board.

Language
The language usually used for Arduino is a slightly modified dialect of C++ derived from the Wiring platform. It includes some libraries used to read and write data from the I/O pins provided on the Arduino and to do some basic handling for “interrupts” (a way of doing multitasking, at a very low level).
This variant of C++ tries to be forgiving about the ordering of code; for example, it allows you to call functions before they are defined.

The code needs to provide only two routines:
◾ setup(): This routine is run once when the board first boots. You
could use it to set the modes of I/O pins to input or output or to prepare
a data structure which will be used throughout the program.
◾ loop(): This routine is run repeatedly in a tight loop while the Arduino is switched on. Typically, you might check some input, do some calculation on it, and perhaps do some output in response.

In the absence of a screen, the Arduino allows you to write information over the USB cable using Serial.write(). For debugging, information can be accessed using it. The Arduino IDE provides a serial monitor which echoes the data that the Arduino has sent over the USB cable. This could
include any textual information, such as logging information, comments, and details about the data that the Arduino is receiving and processing (to double-check that your calculations are doing the right thing).

The Arduino can be powered using a USB connection from your computer. This capability is usually quite convenient during prototyping because you need the serial connection in any case to program the board. The Arduino also has a socket for an external power supply.

RASPBERRY PI

Raspberry Pi is effectively a computer that can run a real, modern operating system, communicate with a keyboard and mouse, talk to the Internet, and drive a TV/monitor with high-resolution graphics. The Pi Model B has built-in Ethernet. Many makers blogged about their own attempts to use Raspberry Pi and have contributed designs to Thingiverse, Instructables, and others.

Extension boards and other accessories are already available for the Raspberry Pi. Many interesting kits are in development, such as the Gertboard (www.raspberrypi.org/archives/tag/gertboard), designed for conveniently playing with the GPIO pins.

To seriously explore the Raspberry Pi, a copy of the Raspberry Pi User Guide, by Eben Upton and Gareth Halfacree (Wiley, 2012) is to be consulted.

Operating System
For Internet of Things work on Pi, use the Linux based Adafruit distro. The main tweaks of interest in it are:
◾ The sshd (SSH protocol daemon) is enabled by default, so you can connect to the console remotely.
◾ The device registers itself using zero-configuration networking (zeroconf) with the name raspberrypi.local, so you don’t need to know or guess which IP address it picks up from the network in order to make a connection.

Readily available libraries on PyPi
(https://pypi.python.org/pypi) may provide code that other people have written, used, and thoroughly tested.

Node.js is used by some board brands.

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight
and efficient, perfect for data-intensive real-time applications that run across distributed devices.
—http://nodejs.org/

Node.js is a rich environment with a host of libraries available to integrate into the app. Currently, the convenient npm (Node Packaged Modules) utility isn’t bundled with the IDE, but this is an item for a future version. In the meantime, online help and forums should get you over any possible stumbling blocks.

IoT Prototyping with Node.js and Firebase (Ubiquity Dev Summit 2016)

Google Developers
___________________

___________________

GETTING STARTED WITH AN API
The most important part of a web service, with regards to an Internet of Things device, is the Application Programming Interface, or API. An API is a way of accessing a service to interact with another computer application. The interaction can be with a cloud application.

Excerpts from the Book

Designing the Internet of Things

by Adrian McEwen and Hakim Cassimally
Wiley, 2014

Create Prototypes and Get to Market Faster Using Intel® Edison Technology
Intel® Edison technology is a hardware and software platform that, when combined with sensors and your imagination, empowers you to invent new Internet-enabled products and solutions.https://software.intel.com/en-us/iot/hardware/edison

Prototyping tools for the Internet of Things
Our hardware development kits give you a microcontroller and connectivity (Wi-Fi or cellular) along with powerful software development tools and a cloud back-end. Add the internet to your product with a single line of code.https://www.particle.io/prototype

Internet of Things Hardware Round-up

As a platform, shiftr.io provides you with the ability to share your data and access data of others. Sharing data publicly is encouraged by the platform's design. In the future, we plan to have additional features that allow more interactions between users and their namespaces.

Using shiftr.io everyone is able to rapidly prototype connected objects and build a network of connected things. Start building prototypes for the Internet of Things now!https://shiftr.io/