Embedded programming

group assignment

Compare the performance and development workflows for other architectures

The target is to have a look on various products representing different architectures and to explain the development workflow. Here are the candidates:

About performance... the question is ... to do what ?

Do we want to toggle one single IO port as fast as we can, based on a trigger on another port ? Do we want to display graphics and video ? Do we want to crunch numbers as fast as we can ? Do we want teanagers to ramp up their programming skills at the speed of light ?

Depending on the answer, the architecture, the product we select will vary. Hereafter, I will highlight the benefits for each candidate and the drawbacks as well.

Learnings

The Arduino Uno

The Arduino UNO is an open-source microcontroller board based on the Microchip ATmega328P microcontroller. The board is equipped with sets of digital and analog input/output (I/O) pins that may be interfaced to various expansion boards (shields) and other circuits. The board has 14 Digital pins, 6 Analog pins, and programmable with the Arduino IDE (Integrated Development Environment) via a type B USB cable. It can be powered by a USB cable or by an external 9 volt battery, though it accepts voltages between 7 and 20 volts.

Here is an example of a project based on Arduino. The purpose of this system is to monitor places where water could leak and turn the main water valve if any water leakage is detected.

Arduino Uno fits well for such a project. The system has a well delimited amount of tasks to perform (sense water, drive a motorized valve, send/receive messages to/from a MQTT server. One limitation to mention: there is not enough FLASH to be able to support HTTPS. Since it runs within the boundaries of a residence, this is not a big topic.

I used Arduino IDE and the code is flashed over USB. I found out how to flash it over the LAN but it requires a custom bootloader.

Click here to get all the source code. A few things to mention :

  • A way to live with a limited amount of SRAM (The "F" magic word) : Serial.print(F("Current IP is : "));
  • I leveraged the existing watchdog (yes, there is a watchdog on the Arduino Uno): see wdt.h
  • I used interrupts for the button, to avoid polling and taking into account other events could popup, like a message coming from the MQTT server

From "performance" point of view, Arduino is a great platform for learning and is performant to achieve that task, without the need to have ninja skills in C/C++ but it still requires some programming skills, unless you start with Scratch environment

The Particle Photon

Particle Photon provides everything you need to build a connected product. Particle combines a powerful ARM Cortex M3 micro-controller with a Broadcom Wi-Fi chip in a tiny thumbnail-sized module called the PØ (P-zero).

Here is an example of a project based on a Particle Photon. This is a project developped to motivate young students to go ahead with science and technology

Particle Photon is definitely overkill for such a small project but the product is affordable and, when I did it, WiFi shields were way to expensive in the Arduino world.

By design Photon is a network element and all the coding is done within a web browser and flashed over the air. In theory, Photon does not work when there is no Internet connectivity but I found a way to make it work with just a WiFi router (no Internet) and even in standalone mode without any connectivity

Here is how the IDE looks like

There is a wide set of Web UI to manage your fleet. You can create groups and deploy new firmware over the air for a specific group

From "performance" point of view, Particle Photon offers a lot of tools to manage device fleet and a well documented and easy to understand API. The most obvious advantage is the built in connectivity. There are other products as well, like the Particle Electron, with a built in wireless connectivity that includes a SIM and a data plan for a few dollars per month. As I mention, Particle is by design a networking product and it is possible but not easy to make it work in an isolated environment

The DragonBoard 410C

The DragonBoard™ 410c is a development board based on the 64-bit capable Qualcomm® Snapdragon™ 410E processor. The DragonBoard 410c packs advanced processing power, Wi-Fi, Bluetooth connectivity, and GPS, into a board the size of a credit card. Designed to support rapid software development, education and prototyping, the DragonBoard 410c is an ideal platform for embedded computing and Internet of Things (IoT) products, including robotics, cameras, medical devices, vending machines, smart buildings, digital signage, casino gaming cons....

Here is an example of a project based on the DragonBoard 410C, with a mezzanine where there is an additionnal AVR

For this project, there is a mezzanine board with a lot of connectors but also with an Arduino on board. On the front panel, there is a bar of RGB LEDs and I used the Arduino to drive some fancy sequences based on messages sent by the DragonBoard. See here to get the source code.

You could program in any modern langage but I decided to start in Python (and to learn it by the way..). Here is the source code of a demo use case. The system listens to messages sent by Smoke Detector, display a visual alert on the front panel and then publish a message back to MQTT broker, targeting my Insteon gateway

From "performance" point of view, we are in a different dimension here, with an operating system (Linux - Linaro), with multi-threading support and all the nice things offered with Linux. As we use the mezzanine board, there is no chance that the LED blink rate will be affected when there is some heavy computation on the main CPU

Last comment regarding the IDE. I used PyCharm. Great product but it is a commercial one...

Note: for those interested by the DragonBoard world, there is a wonderfull MOOC published by UCSD on Coursera here