IoT Starter Core for Netduino Plus 2
In the world there are tenths billions of smart devices connected to the Internet right now, including all sizes of computers, tablets, cell phones, smart watches, pagers, etc. The IoT technology expects to double this quantity before 2020, which represents a $6 trillion market to be developed in the next few years.
IoT development definitely challenges us to behave differently, compared to current computing environment, based on human interaction with screen, touch, keyboard and mouse. The difference is that IoT devices should interact directly with nature, processing data in a real time basis.
The development process is expected to be more complex and may require proper tools for developers. Did you consider buying an oscilloscope for debugging? In order to speed up the IoT development, this article introduces a IoT Starter Kit that may help to speed up an IoT initiative.
Sources are available at Github repository IoT.Starter.Np2.Core.
Supposing you are trying to become an IoT entrepreneur, how to minimize the risks for an IoT initiative? How to satisfy users, investors and decision makers that support your "idea" for an IoT project? It is common knowledge that some wise steps may reduce the risks:
- Business Plan
- Proof of Concept
- Starter Kit
Then, suppose the original "idea" has grown enough to fit in a profitable business plan and it was accepted by the investors. After that, an executive manager get involved and gathered a compact developer team, well trained to apply an agile methodology that assures a smooth and continuous workflow. Great! Where are we now?
Some time has passed since the investors came in and they are already pushing for results. We should speed up the development process to launch product as soon as possible, they say.
We just started Proof of Concept, when we expect to build the preliminary version that comply with users and investors needs. This is the first version and it should not handle all the complexity required by the final product. The goal is to generate a healthy embryo. Since methodology and team evolve the embryo continuously, we can start it small and each version will add functionality and new tests, until we reach the Pilot prototype.
At this moment, a Starter Kit may help the team to focus in the main concepts behind the IoT initiative and make it actually profitable. Better than that, the resources we got until now - the manager leading the team, applying the methodology for smooth workflow, all them are fully operational, ready to run, immediately after the Starter Kit is installed.
Building the Starter Kit
Since IoT requires smart devices connected to the Internet, we should choose the product platform, which means a
CPU and a
network interface. There are many nice ARM platforms today, including Arduino, Netduino and Raspberry PI, among others. The latest models added wired and/or wireless network interfaces to the processor boards, still keeping the low cost. Naturally, we should get the best one that fits our project and our budget.
We should also consider that hardware and software for the product platform should be kept minimal, just to fit the IoT initiative. Most cases include a custom hardware, maybe a daughter board or a shield added to the Arduino bus. Simulating the team workflow, we conclude that most of their time will be spent programming and testing a software application being executed on the target platform, interacting with the customized hardware.
Then, we need an external development system, installed on a microcomputer, in order to have:
- a programming
language and its compiler generating code for the product;
utilities to load the executable code and debug it on the target platform;
- a library containing
communication software, providing basic Internet services;
- a library with other
utilities, for disk storage, for example;
- software library
modules, developed for IoT, like IR codecs or sensor/motor drivers.
The first platform chosen to build a Starter Kit is Netduino Plus 2, an open-source electronics platform using the .NET Micro Framework running at 168 MHz with 1 MB Flash and 192 KB RAM. Please check article from Guruprasad detailing the Netduino Plus 2.
Main reason that justifies Netduino is the availability of MS Visual Studio as a development tool. We should also mention the C# programming language, its compiler and the corresponding loader/debugger that make life much easier. The .NET software libraries also provide utilities we need to handle disks and other periferals.
To use Netduino, as recommended, install the development environment in the following order:
1) Microsoft Visual Studio Express 2013
2) .NET Micro Framework SDK v4.3
3) .NET MF plug-in for VS2013
4) Netduino SDK v22.214.171.124
To use the Starter Kit, download it from Github at IoT.Starter.Np2.Core. Three VS projects can be found at the
- Controller: contains the main application, described below;
- FileServer: a modified version of Netduino File Server, from Oneleggedredcow, to process files stored at the micro SD disk;
- HttpLibraryV3: a modified version of HTTPLibrary V3, from Nart Schinackow, including HttpServer and corresponding HttpRequest and HttpResponse.
The File Server is capable of executing the following commands:
- List: lists the files that are on the netduino SD card;
- Get: transfers a file from the netduino to the PC;
- Put: transfers a file from the PC to the netduino;
- Delete: deletes a file from the netduino SD card
The HttpLibrary V3 supports a simple authentication method and has also a NtpClient utility to initialize date and time directly from the Internet.
The expected behaviour from the starter is a web server that listen on port 80 and answer with the
home.html file, loaded from SD disk. It also accepts HTTP commands from browser to turn on and off the board´s
OnboardLed. The browser response includes current date/time , in order to check if NtpClient is properly running at initialization. Then, there are three comands to test, supposing IP address below:
The Main() program, shown below, is responsible for the Starter Core functionality. First, it tries to set local time using
used by Http Comand is also declared.
public class Program
static HttpServer Server;
static Credential ServerCredential;
static Configuration ServerConfiguration;
static bool status = false;
public static void Main()
TimeSpan elapsed = TimeSpan.Zero;
var time = NtpClient.GetNetworkTime();
catch (Exception ex)
Debug.Print("Error setting clock: " + ex.Message);
OutputPort onBoardLed = new OutputPort(Pins.ONBOARD_LED, false);
ServerConfiguration = new Configuration(80);
ServerCredential = new Credential("Administrator", "admin", "admin");
Server = new HttpServer(ServerConfiguration, ServerCredential, @"\SD\");
Server.OnServerError += new OnServerErrorDelegate(Server_OnServerError);
Server.OnRequestReceived += new OnRequestReceivedDelegate(Server_OnRequestReceived);
FileServer server = new FileServer(@"\SD\", 1554);
The web server is started using pre-initialized admin credentials, they will be required when browser asks for data. The File Server is also started at port 1554 to handle micro SD disk. At last, a null task loop updates continuously the
onBoardLed, according to HTTP command
The Server_OnRequestReceived(), shown below, sets the
status, depending on the HTTP command received. If no parameter is passed from the browser then
home.html file is sent back to browser.
static void Server_OnRequestReceived(HttpRequest Request, HttpResponse Response)
if (Request.RequestedCommand != null)
status = true;
status = false;
Response.WriteFilesList("<br>" + "Comando " +
": Status = " + status.ToString());
else if (Request.RequestedFile != null)
string FullFileName = Request.FilesPath + Request.RequestedFile;
Response.WriteFile(Request.FilesPath + "home.html");
The screenshot below shows the browser after the HTTP comand sent to the connected Netduino Plus 2. The Starter is now able to establish core functionality and communicate with outside world. It is ready to be equipped with interesting other Things!
Points of Interest
This is the first article about IoT Starter Kit and I expect to improve it with other platforms and also creating real applications that use it.
2016.09.02 - Initial version with Core functionality for Netduino Plus 2.