Archive

Posts Tagged ‘micropython’

Getting Started with MicroPython on ESP32 – Hello World, GPIO, and WiFi

October 16th, 2017 12 comments

I’ve been playing with several ESP32 boards over the months, and tried several firmware images. I started with a tutorial for Arduino Core on ESP32, a few month later I tested ESP32 JavaScript programming with Espruino on ESPino32 board, and recently Espressif Systems sent me ESP32 PICO core development board powered by their ESP32-PICO-D4 SiP, and while I took some pretty photos, I had not used it so far.

So I decided to go with yet another firmware, and this time, I played with MicroPython on ESP32, and will report my experience with basic commands, controlling GPIOs, and WiFi in this getting started post.

Flashing Micropython Firmware to ESP32 Board

Source code is available on Github, as a fork of MicroPython repo as ESP32 support has not been upstreamed yet. We could built the firmware from source, but there’s also a pre-built binary which you can download on MicroPython website.

I’ll be using Ubuntu 16.04 for the instructions, which should be pretty similar for other Linux distributions, especially the ones based on Debian, and if you’re using Windows 10, you should be able to follow the same instructions after installing Windows Subsystem for Linux with Ubuntu on your computer.

Let’s open a terminal, to download the firmware (October 14):

If you have not done so already, install the latest version of esptool:

Now connect the board via a micro USB to USB cable to your computer. The log should like like:

In my case, the device is ttyUSB0, but it may vary depending on the board used. We can now erase the flash, and copy the firmware to the board:

If the last step is successfull,  the output should be similar to the one below:

As a side note, version 2.1 of esptool does not know about ESP32-PICO-D4, but it can still detect an ESP32 device, and the update went through normally.

Hello World Sample / Boot Log with MicroPython

We can test the firmware, by connecting to the board using minicom, screen, putty, or whatever software you feel most comfortable with. I went with minicom, setup a connection to /dev/ttyUSB0 device with 115200 bps baudrate. I immediately tested the print function, and made an hard reset to check out the boot log:

The reset command will first generate some errors message, before rebooting the board:

We can type help function to get some more help:

I also often refered to MicroPython 1.9.2 documentation to write this quick start guide.

LED Blink Sample with MicroPython

The easiest way to test GPIOs is to connect an LED, since the board does not have user LED, only the power lED. I connected a 5V LED to pin 21 via a transistor to make the 3.3V to 5V conversion.

Controlling the LED in the command line interface is easy. Import the machine library, set the pin to output, and change the pin level as needed:

Success! But what about doing a proper blink sample? MicroPython developers’ official PyBoard would show as a USB mass storage drive in you computer, where can copy Python files like boot.py and main.py files, but in the case of ESP32 PICO core, it appears the only option is to use the serial console for programming, as we can’t simply copy files to the board from the host computer.

I  found a solution on Techtutorialsx – which also has plenty of articles about MicroPython on ESP32/ESP8266. We need ampy script that can be install from our Linux terminal:

However, the first time I tried it I got an error:

I installed files module, but the error remained. So instead I installed it for Python 3:

I then created blink.py on my computer to blink the LED every 500 ms:

Before uploading the file to the board, you can try to run it as follow:

If you have plenty of errors here, that’s probably because your code is incorrect. Since I’m not very familiar with Python, it happened to me a couple of times, until I got the code right, and the LED was blinking as expected.

Now that we’ve made sure the code works, we can now copy our sample to the board…

… reconnect to the serial console, and verify the file is there:

To run the program type the following:

The LED should blink again. You can interrupt the program with Ctrl+C, and if you want to soft reset the board, press Ctrl+D.

In order to automatically start the blink program at each boot, rename blink.py to main.py, delete blink.py, and copy main.py instead:

Power cycle the board, and the LED should start blinking almost immediately.

ESP32 WiFi with MicroPython (Station and AP modes)

We’ve got GPIOs working, but one of the most important feature of ESP32 is obvisouly WiFi. I’ll start by configuring the board in station mode. First import the network library, set the board to station mode, and scan access points:

The latter should return a list of access points with ssid, bssid, channel, RSSI, authmode, and hidden status as explained here.

I can then connect the board to one of the access points with:

The log above with IP address should give  a clue, but you can check connection status with the following function:

and use ifconfig to get the IP info:

Switching to AP mode is easy with the three commands below configuring the board with ESP32-PICO-CNX SSID:

At this stage I can see ESP32-PICO-CNX on my phone, but it’s an open connection. We can change that with authmode option that can take 5 values:

  • 0 – open
  • 1 – WEP
  • 2 – WPA-PSK
  • 3 – WPA2-PSK
  • 4 – WPA/WPA2-PSK

I’ll use WPA2-PSK and define the password with the config function.

Working as planned…

ESP32 Web Server with Micropython

Many ESP32 project will require a web interface for monitoring or configuration. Let’s first setup the board as an access point using the command we’ve used above:

Now create webserver.py file based on Python code found here that’s supposed to return the status of some GPIO pins in an HTML table:

Copy the file to the board:

Start the serial console again, import/run the python sample we’ve copied, and connect to the board (in my case http://192.168.4.1):

 

It works as expected, but we wrote the HTML code inside the Python file, and you need to handle socket programming by yourself. To further simply the task, some MicroPython web servers such as MicroWebSrv, and Picoweb are available.

MicroWebSrv (Not working yet for me)

I tried to install MicroWebSrv first, but never managed to make it work. I still reproduce the step I followed in case somebody finds out what I did wrong. I got the code, and copied files from the Linux terminal:

We can check the files are where they are supposed to be:

Go into the terminal (aka REPL console) to start a basic example, after setting up a connection:

I could connect to the server, but I would always get 404 error.

PicoWeb

So instead I switched to picoweb, adapting the instructions here and there. It’s very easy to install.  First make sure you have a working Internet connection in your board (i.e. set station mode), and install the web server with upip:

That’s the output if everything goes according to plans:

Now let’s go back to the host computer to create an html document, for example index.html:

as well as picowebtest.py sample file that will request the HTML page from the board, and return it to the client.

You’ll need to change “192.168.0.108” by the IP address of your board.

Let’s copy both files to the board…

… go back to the serial console, connect in station mode, and run the sample:

Type or copy/paste the URL in the last line into a web browser, and you should get the output below.

ESP32 Bluetooth with MicroPython

There’s no Bluetooth support in the official MicroPython documentation, because it’s work in progress, and for the most adventurous MrSulry released an alpha version  a few days ago. The Bluetooth API is also in flux, but the basic code to enable Bluetooth should look like:

I’ll update that section once Bluetooth makes it to the stable release, and/or when I’m sure the API is frozen.

Other ESP32 (Micro)Python Resources

I’ve just covered a few things that can be done with MicroPyhon on ESP32, and beside the official documentation, you can also check the various MicroPython ESP32 tutoral on techtutorialsx blog. Loboris also made another MicroPython ESP32 firmware that supports pSRAM as MicroPython may use a lot of RAM. If you’re interested in Python for ESP32, but Zerynth is another option for Python on ESP32 that works with an IDE/GUI available for Windows, Linux and MAC OS X. [Update: Yet other options are Pumbaa a port of MicroPython running on top of Simba, and Pycom version of MicroPython]

TECHBASE Moduino X Series Industrial IoT Modules / Endpoints are Based on ESP32 WiSoC

September 27th, 2017 3 comments

We’ve previously covered TECHBASE ModBerry industrial IoT gateways leveraging Raspberry Pi 3, FriendlyELEC NanoPi M1 Plus, or AAEON’s UP Linux boards. The company has now launched Moduino X series modules powered by Espressif ESP32 WiFi + Bluetooth SoC to be used as end points together with their ModBerry gateways.

Moduino X1

Two models have been developed so far, namely Moduino X1 and X2, with the following specifications:

  • Wireless Module – ESP32-WROVER with ESP32 dual-core Tensilica LX6 processor @ 240 MHz, 4MB pSRAM (512KB as option), 4MB SPI flash;
  • External Storage – X2 only: micro SD card slot
  • Connectivity
    • 802.11 b/g/n WiFi up to 16 Mbps + Bluetooth 4.2 LE with u.FL antenna connector
    • X2 only: 10/100M Ethernet
    • Options: LoRa (Semtech SX1272); Sigfox (TI CC1125); LTE Cat M1/NB1; Zigbee
  • Serial – 2x RS-232/485
  • Display – Optional 0.96″ OLED display with 128×64 resolution
  • Expansion I/Os
    • 4x Digital I/O (0 ~ 3V)
    • 2x Analog Input:
    • A2 Only: 2x analog output (optional)
    • A2 only: support for Techbase ExCard add-on modules for extr RS-232/485 ports, Ethernet ports, PCIe slots, analog input and output, digital I/Os, relays, M-Bus interface, etc…
  • Battery – Optional battery power support (A1 only); optional UPS function with LiPo battery or Supercapacitor
  • Power Supply -5V DC
  • Dimensions
    • A1 – ABS: 90 x 36 x 32 mm (LxWxH); Aluminum: 95 x 35 x 41 mm (LxWxH)
    • A2 – ABS: 90 x 71 x 32 mm (LxWxH); Aluminum: 95 x 71 x 41 mm (LxWxH)

Moduino A1 consumes less than A2, and can be powered by batteries only, but both models can use battery as UPS. The modules support Espressif ESP-IDF SDK, Zephyr Project, Arduino programming, MicroPython, Mongoose OS, and more, and would typically be used as meters & sensor nodes capable of reporting temperature, humidity, pressure, acceleration, & light with attached sensors. More sensors are being developed by the company.

Moduino X2 (right)

Moduino X1 & X2 appear to be available now, but you’d need to contact the company to get price information. Visit Moduino X series product page for more details.

Wemos LOLIN32 Lite Board Powered by ESP32 Rev 1 Chip Sells for $4.90

September 14th, 2017 3 comments

Wemos introduced the first low cost ESP32 board with LOLIN32 board going for $6.90 plus shipping in April, but the company is now back with a new Lite version of the board switching ESP-WROOM-32 module with their own design around ESP32 Rev 1 chip (with various silicon bug fixes), and a lower $4.90 price tag to which you need to add ~$2 for shipping.

Click to Enlarge

Wemos LOLIN32 Lite is also smaller, so we’ll lose some of the pins (mostly extra power pins), but the I/Os look the same:

  • SoC – Espressif ESP32-DOWD6Q Rev 1.0 dual core Tensilica Xtensa LX6 processor with WiFi and BLE
  • Connectivity – 802.11 b/g/n WiFi + Bluetooth LE
  • I/Os via 2x 13-pin headers with digital I/Os, analog inputs, UART, I2C, SPI, VP/VN, DAC…
    • 3.3V I/O voltage
    • Breadboard compatible
  • USB – 1x micro USB port for power and programming/debugging
  • Misc – Reset button
  • Power – 5V via micro USB + battery header for Lithium battery (charging current: 500mA max)
  • Dimensions & Weight – TBD

The board sold on Aliexpress is pre-loaded with micropython firmware, but you could also change that to Arduino, or other supported firmware. The Wiki has limited information for now.

Realtek RTL8195AM Ameba WiFi + NFC Module Sells for $9 Shipped

August 1st, 2017 1 comment

Last year, Realtek Ameba IoT SoCs and development kits launched with boards such as Ameba Arduino, and later, the family got some buzz thanks to $2 RTL8710AF modules like Pine64 Padi IoT stamp, which looked competitive priced against ESP8266 SoC, and featuring an ARM Cortex-M3 core. Back to 2017, ESP8266 appears to still be the preferred platform for makers, and the community around Reatek Ameba processor is relatively small, but maybe the solutions are being integrated into commercial products rather than hobbyists project. Today, as I browsed the web, I noticed that are also some Realtek RTL8195AM module with WiFi, and NFC starting with an “Realtek Ameba-RTL8195AM WiFi & NFC Module” I first found on DFrobot for $15 per unit, but after spending a bit more time searching, I ended finding what looks like the same model for $8.99 including shipping on IC Station.

RTL8195AM module (MJIOT-AMB-02) specifications:

  • SoC – Realtek RTL8195AM ARM Cortex-M3 processor @ 166 MHz with 1MB ROM,2MB SDRAM,512KB SRAM
  • Connectivity – 802.11 b/g/n 1×1 Wi-Fi up to 150 Mbps via u.FL antenna connector, NFC read/write
  • Interfaces via half-holes:
    • 10/100M Ethernet MII/ RMII/RGMII interface
    • 1x USB OTG
    • SDIO device/SD card controller
    • Up to 30x GPIO
    • 2x SPI master-slave, 3x UART (2x HS-UART, 1x log UART), 2x I2C, 4x PWM
    • 2x I2S/PCM
    • 2x ADC, 1x DAC
  • Security – Hardware SSL engine in Realtek SoC
  • Power Supply – 3.0V~3.3V
  • Dimensions – 24 x 19mm
  • Temperature range – -20℃~+85℃

The module can be programmed with the Arduino IDE and Micropython, and you can have access to the SDK via Ameba IoT website. For evaulation, you may consider to order the module with breakout board instead going for $9.74 shipped.

The module appears to be manufactured by Shenzhen Minjun IOT Technology, and you’ll find more technical details and information about the module on the product page. Other RTL8195AM modules include CC&C WM-8195AM, and Rayson WFM-250, none of which appear to support NFC.

FOSDEM 2017 Open Source Meeting Schedule

January 31st, 2017 4 comments

FOSDEM (Free and Open Source Software Developers’ European Meeting) is a 2-day free event for software developers to meet, share ideas and collaborate that happens on the first week-end of February, meaning it will take place on February 4 & 5, 2017 this year. FOSDEM 2017 will features 608 speakers, 653 events, and 54 tracks, with 6 main tracks namely: Architectures, Building, Cloud, Documentation, Miscellaneous, and Security & Encryption.
I won’t be there, but it’s always interesting to look at the schedule, and I made my own virtual schedule focusing especially on talks from “Embedded, mobile and automotive” and “Internet of Things” devrooms.

Saturday 4, 2017

  • 11:00 – 11:25 – Does your coffee machine speaks Bocce; Teach your IoT thing to speak Modbus and it will not stop talking, by Yaacov Zamir

There are many IoT dashboards out on the web, most will require network connection to a server far far away, and use non standard protocols. We will show how to combine free software tools and protocols from the worlds of IT monitoring, Industrial control and IoT to create simple yet robust dashboards.

Modbus is a serial communication protocol developed in 1979 for use with programmable logic controllers (PLCs). In simple terms, it is a method used for transmitting information over serial lines between electronic devices., it’s openly published, royalty-free, simple and robust.

Many industrial controllers can speak Modbus, we can also teach “hobby” devices like Arduino boards and ESP8266 to speak Modbus. Reliable, robust and simple free software Modbus client will be used to acquire the metrics from our device, then the metrics will be collected and sent to Hawkular and Grafana to store and visualize our data.

  • 11:30 – 11:55 – Playing with the lights; Control LIFX WiFi-enabled light bulbs, by Louis Opter

In this talk we’ll take a close look at a one of the “smart” (WiFi-connected) light-bulbs available on the market today. The bulbs expose a small API over UDP that I used to run an interface on a programmable buttons array. We will see how topics like reverse engineering, security, licensing, “self-hosting” and user experience came into play.

monolight is an user interface to control LIFX WiFi-enabled light bulbs. monolight runs on a programmable button array; it is written in Python 3.6 (to have type annotations and asyncio), and it interfaces with the bulbs through a more complex daemon written in C: lightsd.

This talk will start with a live demo of the button grid remotely controlling the light bulbs. We will then explore how it works and some of the motivations behind it (network isolation, trying to not depend on the “cloud”, reliability, user-experience). Finally, we will look into what kind of opportunities even more open IoT products could bring, and open leave the place to Q&A and discussion.

  • 12:00 – 12:30 – Creating the open connected car with GENIVI, by Zeeshan Ali, GENIVI Development Platform (GDP) technical lead

A number of new components have matured in GENIVI to provide a true connected car experience. A couple of them are key connectivity components; namely SOTA (Software Over the Air) and RVI (Remote Vehicle Interface). This talk will discuss both these components, how they work together, the security work done on them and their integration into the GENIVI Development Platform.

This talk will also run down the overall status of GENIVI’s development platform and how it can enable an automotive stack to speak not just with the cloud, but with IoT devices via Iotivity interface.

  • 12:30 – 13:00 – Making Your Own Open Source Raspberry Pi HAT; A Story About Open Source Harware and Open Source Software, by Leon Anavi

This presentation will provide guidelines how to create an open source hardware add-on board for the most popular single board computer Raspberry Pi using free and open source tools from scratch. Specifications of Raspberry Pi Foundation for HAT (Hardware Attached on Top) will be revealed in details. Leon Anavi has been developing an open source Raspberry Pi HAT for IoT for more than a year and now he will share his experience, including the common mistakes for a software engineer getting involved in hardware design and manufacturing. The presentation is appropriate for anyone interested in building entirely open source products that feature open source hardware and open source software. No previous experience or hardware knowledge is required. The main audience are developers, hobbyists, makers, and students. Hopefully the presentation will encourage them to grab a soldering iron and start prototyping their DIY open source device.

  • 13:00 – 13:25 – Building distributed systems with Msgflo; Flow-based-programming over message queues, by Jon Nordby

MsgFlo is a tool to build systems that span multiple processes and devices, for instance IoT sensor networks. Each device acts as a black-box component with input and output ports, mapped to MQTT message queues. One then constructs a system by binding the queues of the components together. Focus on components exchanging data gives good composability and testability, both important in IoT. We will program a system with MsgFlo using Flowhub, a visual live-programming IDE, and test using fbp-spec.

In MsgFlo each process/device is an independent participant, receiving data on input queues, and sending data on output queues. A participant do not know where the data comes from, nor where (if anywhere) the data will go. This strong encapsulation gives good composability and testability. MsgFlo uses a standard message queue protocol (MQTT or AMQP). This makes it easy to use with existing software. As each participant is its own process and communicate over networks, they can be implemented in any programming language. Convenience libraries exist for C++, Python, Arduino, Node.js and Rust. On top of the message queue protocol, a simple discovery mechanism is added. For existing devices without native Msgflo support, the discovery messages can be sent by a dedicated tool.

  • 13:30 – 13:55 – 6LoWPAN in picoTCP, and how to support new Link Layer types, by Jelle De Vleeschouwer

6LoWPAN enables, as the name implies, IPv6-communication over Low-power Wireless Personal Area Networks, e.g. IEEE802.15.4. A lot of resources are available to allow 6LoWPAN over IEEE802.15.4, but how can one extend the 6LoWPAN feature-set for the use with other link layer types? This talk will cover the details about a generic implementation that should work with every link layer type and how one can provide support for ones own custom wireless network. The goal is to give quite a technical and detailed talk with finally a discussion about when 6LoWPAN is actually useful and when is it not.

Last year, as a summer project, a generic 6LoWPAN adaption layer was implemented into picoTCP, an open source embedded TCP/IP-stack developed by Altran Intelligent Systems, with an eye on the IoT. The layer should also be able to allow multiple link-layer extensions, for post-network-layer processing. This could be used for mesh-under routing, link layer security, whatever you want. This talk will cover how one can take advantage of these features and caveats that come with it.

  • 14:00 – 15:00 – Groking the Linux SPI Subsystem by Matt Porter

The Serial Peripheral Interconnect (SPI) bus is a ubiquitous de facto standard found in many embedded systems produced today. The Linux kernel has long supported this bus via a comprehensive framework which supports both SPI master and slave devices. The session will explore the abstractions that the framework provides to expose this hardware to both kernel and userspace clients. The talk will cover which classes of hardware supported and use cases outside the scope of the subsystem today. In addition, we will discuss subtle features of the SPI subsystem that may be used to satisfy hardware and performance requirements in an embedded Linux system.

  • 15:00 – 15:25 – Frosted Embedded POSIX OS; a free POSIX OS for Cortex-M embedded systems, by Brabo Silvius

FROSTED is an acronym that means “FRee Operating System for Tiny Embedded Devices”. The goal of this project is to provide a free kernel for embedded systems, which exposes a POSIX-compliant system call API. In this talk I aim to explain why we started this project, the approach we took to separate the kernel and user-space on Cortex-M CPU’s without MMU, and showcase the latest improvements on networking and supported applications.

  • 15:30 – 16:00 – How to Build an Open Source Embedded Video Player, by Michael Tretter

Video playback for embedded devices such as infotainment systems and media centers demands hardware accelerators to achieve reasonable performance. Unfortunately, vendors provide the drivers for the accelerators only as binary blobs. We demonstrate how we built a video playback system that uses hardware acceleration on i.MX6 by using solely open source software including Gstreamer, Qt QML, the etnaviv GPU driver, and the coda video decoder driver.

The Qt application receives the video streams from a Gstreamer pipeline (using playbin). The Gstreamer pipeline contains a v4l2 decoder element, which uses the coda v4l2 driver for the CODA 960 video encoder and decoder IP core (VPU in the Freescale/NXP Reference Manual), and a sink element to make the frames available to the Qt application. The entire pipeline including the Gstreamer to Qt handover uses dma_bufs to avoid copies in software.This example shows how to use open source drivers to ease the development of video and graphics applications on embedded systems.

  • 16:00 – 16:25 – Project Lighthouse: a low-cost device to help blind people live independently, by David Teller

The Word Health Organization estimates that more than 250 million people suffer from vision impairment, 36 millions of them being entirely blind. In many cases, their impairment prevents them from living independently. To complicate things further, about 90% of them are estimated to live in low-income situations.

Project Lighthouse was started by Mozilla to try and find low-cost technological solutions that can help vision-impaired people live and function on their own. To this date, we have produced several prototypes designed to aid users in a variety of situations. Let’s look at some of them. This will be a relatively low-tech presentation.

  • 16:30 – 16:55 – Scientific MicroPython for Microcontrollers and IoT, IoT programming with Python, by Roberto Colistete Jr

MicroPython is a implementation of Python 3 optimised to run on a microcontroller, created in 2013 by the Physicist Damien P. George. The MicroPython boards runs MicroPython on the bare metal and gives a low-level Python operating system running interactive prompt or scripts.

The MicroPython boards currently use 32 bit microcontrollers clocked at MHz and with RAM limited to tens or hundreds of Kbytes. These are the microcontroller boards with official MicroPython support currently in the beginning 2017 : Pyboard, Pyboard Lite, WiPy 1/2, ESP8266, BBC Micro:bit, LoPy, SiPy, FiPy. They cost between USD3-40, are very small and light, about some to tens of mm in each dimension and about 5-10 g, have low power consumption, so MicroPython boards are affordable and can be embedded in almost anything, almost anywhere.

Some hints will be given to the FOSS community to be open minded about MicroPython : be aware that MicroPython exists, MicroPython is a better programming option than Arduino in many ways, MicroPython boards are available and affordable, porting more Python 3 scientific modules to MicroPython, MicroPython combines well with IoT.

  • 17:00 – 17:25 – Iotivity from devices to cloud; how to make IoT ideas to real using FLOSS, by Philippe Coval & Ziran Sun (Samsung)

The OCF/IoTivity project aims to answer interoperability issues in the IoT world from many different contexts to accommodate a huge range devices from microcontrollers, to consumer electronics such as Tizen wearables or your powerful GNU/Linux system The vision of Iotivity is not restricted to ad hoc environment but also can be connected to Internet and make the service easily accessible by other parties. With cloud access in place, usage scenarios for IoT devices can be enriched immensely.

In this talk we walk through the steps on how to practically handle IoT use cases that tailored towards various topologies. To introduce the approach used in IoTivity, we first give a detailed background introduction on IoTivity framework. Then we will present a demo that shows a few examples, from setting up a basic smart home network to accessing the IoT resource via a third party online service. Challenges and solutions will be addressed from development and implementation aspects for each step of the demo.

We hope this talk will inspire developers to create new IoT prototypes using FLOSS.

  • 17:30 – 17:55 – Open Smart Grid Platform presentation, an Open source IoT platform for large infrastructures, by Jonas van den Bogaard

The Open Smart Grid Platform is an open source IoT platform. The open smart grid platform is a generic IoT platform, built for organizations that manage and/or control large-scale infrastructures. The following use cases are now readily available: smart lighting, smart metering, tariff switching, and microgrids. Furthermore the following use-cases are in development: distribution automation, load management and smart device management. The architecture of the open smart grid platform is modular and consists multiple layers.

The open smart grid platform is highly unique for embracing the open source approach and the following key features:

  • Suitable for scalable environments delivering high performance
  • High availability and multitenant architectures
  • Built with security by design and regularly tested.
  • It has a generic architecture. More use cases and domains are easily added to the platform.
  • The open smart grid platform is based on open standards where possible.

We believe the platform is interesting for developers who have interest in working on use-cases for Smart Cities, Utility Companies and other large-scale infrastructure companies.

  • 18:00 – 19:00 – AGL as a generic secured industrial embedded Linux; factory production line controllers requirements are not that special, by Dominig ar Foll

There is no de facto secured embedded Linux distro while the requirement is becoming more and more critical with the rise of IoT in Industrial domains. When looking under the hood of the Yocto built AGL project (Automotive Linux), it is obvious that it can fit 95% of the most common requirements as a Secured Embedded Linux. We will look how non Automotive industries can easily reuse the AGL code and tools to build their own industrial product and why it’s a safer bet than to build it internally.

Industrial IoT cannot be successful without a serious improvement of the security coverage. Unfortunately there is as today, no of-the-shelves offer and the skills required to create such solution, are at best rare, more often out of reach. AGL as created a customizable embedded Linux distro which is nicely designed for reuse in many domains outside of Automotive. During the presentation we will see how to: – start your development with boards readily available on the Net, – change the BSP and add peripherals using Yocto layers or project like MRAA, – integrate a secure boot in your platform, – add your middleware and your application without breaking the maintained Core OS – develop a UI on the integrated screen and/or an HTML remote browser – update the core OS and your add-ons. – get support and influence the project.

Sunday 5, 2017

  • 10:00 11:00 – How I survived to a SoC with a terrible Linux BSP, Working with jurassic vendor kernels, missing pieces and buggy code, by Luca Ceresoli

In this talk Luca will share some of his experiences with such vendor BSPs, featuring jurassic kernels, non-working drivers, non-existing bootloaders, code of appallingly bad quality, ineffective customer support and Windows-only tools. You will discover why he spent weeks in understanding, fixing and working around BSPs instead of just using them. The effects on the final product quality will be described as well. Luca will also discuss what the options are when you face such a BSP, and what both hackers and vendors can do to improve the situation for everybody’s benefit.

  • 11:00-12:00 – Open Source Car Control, by Josh Hartung

This fall my team launched the Open Source Car Control (OSCC) project, a by-wire control kit that makes autonomous vehicle development accessible and collaborative to developers at every level. In this presentation, we discuss the project and its implications on the development of autonomous cars in a vertically integrated and traditionally closed industry.

A primary barrier to entry in autonomous vehicle development is gaining access to a car that can be controlled with an off-the-shelf computer. Purchasing from an integrator can cost upwards of $100K, and DIY endeavors can result in unreliable and unsafe solutions. The OSCC project acts as a solution to these problems. OSCC is a kit of open hardware and software (based on Arduino) that can be used to take control of the throttle, brake, and steering in modern cars. The result is a fully by-wire test car that can be built for about $10K (USD), including the vehicle. In this discussion, we unpack the impetus and development of the OSCC project, challenges we encountered during development, and the role projects like OSCC have in a necessary “flattening” of the automotive industry.

  • 12:00 – 13:00 – Kernel DLC Metrics, Statistic Analysis and Bug-Patterns, by Nicholas Mc Guire

SIL2LinuxMP strives to qualify a defined GNU/Linux subset for the use in safety-related systems by “assessment of non-compliant development”. To demonstrate that the kernel has achieved suitable reliability and correctness properties basic metrics of such properties and their statistic analysis can be used as part of the argument. Linux has a wealth of analytical tools built-in to it which allow to extract information on compliance, robustness of development, as well as basic metrics on complexity or correctness with respect to defined properties. While IEC 61508 Ed 2 always pairs testing and analysis, we believe that for a high complexity system traditional testing is of relatively low effectiveness and analytical methods need to be the primary path. To this ends we outline some approaches taken:

  • Bug-age analysis
  • Bug-rates and trend analysis
  • Code-complexity/bug relationship
  • Brain-dead correctness analysis
  • Interface and type-correctness analysis
  • API compliance analysis
  • Analysis of build-bot data

While much of the data points to robust and mature code there also are some areas where problems popped up. In this talk we outline the used methods and give examples as well as key findings. FLOSS development has reached a quite impressive maturity, to substantially go beyond we think it will need the use of quantitative process and code metrics – these results from SIL2LinuxMP may be a starting point.

  • 13:00 – 14:00 – Loco Positioning: An OpenSource Local Positioning System for robotics, presentation with a demo of autonomous Crazyflie 2.0 quadcopter, by Arnaud Taffanel

Positioning in robotics has alway been a challenge. For outdoor, robots GPS is solving most of the practical problems, but indoor, precise localization is still done using expensive proprietary systems mainly based on an array of cameras.

In this talk, I will present the loco positioning system: an open source Ultra Wide Band radio-based local positioning system, why we need it and how it works. I will also speak about its usage with the Crazyflie 2.0 open source nano quadcopter, of course ending with an autonomous flying demo.

  • 14:00 14:50 – Free Software For The Machine, by Keith Packard

The Machine is a hardware project at Hewlett Packard Enterprise which takes a new look at computer architecture. With many processors and large amounts of directly addressable storage, The Machine program has offered an equally large opportunity for developing new system software. Our team at HPE has spent the better part of two years writing new software and adapting existing software to expose the capabilities of the hardware to application developers.

As directly addressable storage is such a large part of the new hardware, this presentation will focus on a couple of important bits of free software which expose that to applications, including our Librarian File System and Managed Data Structures libraries. Managed Data Structures introduces a new application programming paradigm where the application works directly on the stable storage form for data structures, eliminating serialization and de-serialization operations.

Finally, the presentation will describe how the hardware is managed, from sequencing power to a rack full of high-performance computing hardware, through constructing custom Linux operating systems for each processor and managing all of them as parts of a single computing platform.

  • 15:00 – 15:25 – Diving into the KiCad source code, by Maciej Sumiński

Let’s be sincere, all of us would love to change something in KiCad. I bet you have an idea for a new tool or another killer feature that would make your life so much easier.

You know what? You are free to do so! Even more, you are welcome to contribute to the project, and it is not that difficult as one may think. Those who have browsed the source code might find it overwhelming at first, but the truth is: you do not have to know everything to create useful extensions.

I would like to invite you for a walk through the KiCad source code to demonstrate how easy it is to add this tool you have always been dreaming about.

  • 15:30 – 16:00 – Testing with volcanoes – Fuego+LAVA, embedded testing going distributed, by Jan-Simon Möller

LAVA and Fuego are great tools individually already. Combining and extending them allows for a much broader test coverage than each tool alone can provide.

The focus of this talk is to share the experiences made and lessons learned so people can integrate such tools better in their own environment. It also raises the pain-points and open issues when setting up a distributed environment.

Especially for Automotive, Long-Term-Support, CIP or Consumer Electronics, advancing the Test-harness is essential to raise the bar and strengthen the confidence in our embedded platforms. Automated testing can improve our ecosystem from two sides: during development (feature does work and does not break things) and during maintenance (no regressions through backports).

  • 16:00 – 16:30 – Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device, by Stefan Schmidt

Adding support for IEEE 802.15.4 and 6LoWPAN to an embedded Linux board opens up new possibilities to communicate with tiny, IoT type of, devices.

Bringing IP connectivity to devices, like sensors, with just a few kilobytes of RAM and limited battery power is an interesting IoT challenge. With the Linux-wpan and 6LoWPAN subsystems we get Linux ready to support the needed wireless standards as well as protocols that connect these tiny devices into the wider Internet. To make Linux a practical border router or smart home hub for such networks.

This talk will show how to add the needed transceiver hardware to an existing hardware and how to enable and configure the Linux-wpan and 6LoWPAN mainline subsystems to use it. The demonstration will include setting up the communication between Linux and other popular IoT operating systems like RIOT or Contiki as well.

  • 16:30 – 17:00 – OpenPowerlink over Xenomai, by Pierre Ficheux

Industrial Ethernet is a successor of classic field bus such as CAN, MODBUS or PROFIBUS. POWERLINK was created by B&R Automation and provides performance and real­-time capabilities based on standard Ethernet hardware. openPOWERLINK is open source and runs on lots of platforms such as Linux, Windows, various RTOS and dedicated hardware (FPGA). We will explain how to use openPOWERLINK on top of Xenomai 3, a powerful real-time extension for Linux kernel based on co-­kernel technology.

FOSDEM 2017 will take place at the ULB Solbosch Campus in Brussels, Belgium, and no registration is required, you just need to show up in order to attend the event.

$55 OpenMV Cam M7 Open Source Computer Vision Board is Powered by an STM32F7 Cortex-M7 MCU

January 2nd, 2017 6 comments

I wrote about Jevois-A33 computer vision camera based on Allwinner A33 quad core Cortex A7 processor last week, and today, I’ve come across OpenMV Cam M7 open source computer vision board based on a much less powerful STMicro STM32F7 ARM Cortex M7 micro-controller, but with the advantage of consuming less power, and exposing some extra I/Os.

openmv-cam-m7OpenMV Cam M7 board specifications & features:

  • MCU – STMicro STM32F765VI ARM Cortex M7 @ up to 216 MHz with 512KB RAM, 2 MB flash.
  • External Storage – micro SD slot
  • Camera
    • Omnivision OV7725 image sensor supporting 640×480 8-bit grayscale images or 320×240 16-bit RGB565 images at 30 FPS
    • 2.8mm lens on a standard M12 lens mount
  • USB – 1x micro USB port (Virtual COM Port and a USB Flash Drive)
  • Expansion – 2x 8-pin headers with SPI, I2C CAN bus, asynchronous serial bus (Tx/Rx), 12-bit ADC, 12-bit DAC, 3x I/Os for servo control; interrupts and PWM on all I/O pins; 3.3V (5V tolerant)
  • Misc – RGB LED and 2x 850nm IR LEDs
  • Power Supply – 5V via micro USB port, 3.6 to 5V via VIN pin
  • Power Consumption (@ 3.3V) – Idle: 110mA;  active no μSD Card: 190mA; active with μSD Card: 200mA
  • Dimensions – 45 x 36 x 30 (H) mm
  • Weight – 16 grams
Click to Enlarge

Click to Enlarge

The camera board supports frame differencing (motion detection), marker tracking, face detection, eye tracking, color tracking (up to 32 colors at the same time), optical flow, edge/line detection, template matching, image capture (BMP/JPG/PPM/PGM), and video recording (MJPEG/GIF). Programming is done in OpenMV IDE using MicroPython language. You’ll find more details in OpenMV Cam’s documentation, and watch a description of the board and a QR code detection demo in the video below.


The computer vision board can be pre-ordered now for $55 on the product page with shipping scheduled for March 2017.

Pycom To Sell WiFi, BLE, LoRa and Sigfox OEM Modules for Your Own Hardware Projects

December 19th, 2016 5 comments

Pycom is the company making some relatively popular IoT boards programmable with Python such as WiPy, LoPy, SiPy, and soon FiPy, supporting respectively WiFi+BLE, LoRa+WiFi+BLE, Sigfox+WiFi+BLE, and for the latter all four plus LTE CAT M1/NB1. Those little boards are great for personal projects and/or to experiment, but for those of you who would like to integrated IoT connectivity into your own hardware projects, Pycom will soon launch three OEM module for corresponding to WiPy, SiPy and LoPy connectivity featues with respectively W01, S01 and L01 modules.

sigfox-lora-wifi-ble-oem-modulesKey features:

  • W01 WipY 2.0 OEM Module – Dual network BLE and WiFi – 7.95 Euros
  • L01 LoPy OEM module – LoRa, WiFi and Bluetooth – 14.95 Euros
  • S01 SiPy OEM module – Sigfox, WiFi and Bluetooth; Available in both 14dB (for Europe) and 22dB (outside Europe) version for respectively 14.95 and 19.95 Euros

All three models have basically the same functionality as the full board, but there are missing the voltage regulator, reverse power supply protection, antenna switch, smd antenna, u.fl connectors, reset switch, LED, headers, and a few passive components found on the development boards. The modules will come in an hermetically sealed trays, and are both CE and FCC certified.

The modules will officially launch in April 2017 with a minimum order quantity of 500 units, and a lead time expected to be 8 to 12 weeks. You can find all three modules on Pycom’s OEM products page.

LoPy Tiny IoT Developer Board Runs MicroPython, Supports LoRa, WiFi and Bluetooth (Crowdfunding)

February 10th, 2016 10 comments

Pycom launched WiPy last year, a WiFi IoT board based on Texas Instruments CC3200 ARM Cortex M4 SoC, and a few months after sending rewards to their Kickstarter backers, they are back on the crowdfunding platform to launch LoPy, another IoT development board that runs MicroPython and offers LoRa, WiFi and Bluetooth LE connectivity.

LoPy Boards, WiPy Board, and Pycom baseboard

LoPy Boards, WiPy Board, and LoPy Expansion Board

LoPy board hardware specifications:

  • SoC – Dual processor @ 160 MHz with WiFi & BLE radio with 400 kB RAM, 1MB flash
  • External Storage – 4MB flash
  • Connectivity
    • 802. 11b/g/n @ 16Mbps with WEP, WPA/WPA2 WiFi security; SSL/TLS support; AES encryption engine.
    • Bluetooth Classic and Low Energy
    • LoRaWAN
      • Semtech LoRa transceiver SX1272 @ 868 MHz (Europe) or 915 MHz (North America).
      • Range – Node: Up to 40km; Nano-Gateway: Up to 5 km
      • Nano Gateway Capacity – Up to 100 nodes.
    • Internal chip antenna and u.fl connectors for external antennas
  • Headers – 2x 14-pin headers for:
    • Up to 24 GPIOs (3.3V tolerant)
    • 2x UART, SPI, I2C
    • DMA, I2S
    • 12-bit ADC and 8-bit DAC.
    • 16-bit and 32-bit timers with PWM.
  • Hash and encryption engines – SHA, MD5, DES, AES
  • Misc – RTC
  • Power Supply – 3.3V to 5.5V
  • Power Consumption
    • Wi-Fi:12 mA in active mode, 5uA in standby
    • LoRa: 3mA in active mode, 39mA during Tx, 14mA during Rx
    • BLE: 8mA in active mode, 2uA in standby.
  • Dimensions – 55mm x 20mm
  • Certifications – EMC, CE, FCC, LoRaWAN

They did not disclose the wireless SoC name, but the specifications look very similar to Espressif ESP32, and ESP8266 should get a proper MicroPython port soon, so at first I thought they could have decided to go with ESP32, even though it’s probably premature even for a Kickstarter project. However, WiFi is said to be limited to 16 Mbps,  one of the pictures indicates a “Cortex-M4 WiFi” is used, and somebody asked whether the chip was ESP32, and they answered that “due to NDA restrictions we can’t give more details about the SoC at this moment”, so it could be also a new Texas Instruments SimpleLink CC3x part with WiFi and Bluetooth. So we’ll have to wait to find out.

LoPy Kit with IP64 enclosure, LoPy Board, antenna, and battery

LoPy Kit with IP64 enclosure, LoPy Board, antenna, and battery (Not available in the Kickstarter campaign, but later).

The board also supports Blynk libraries, can be programmed with Pymakr IDE, and is Microsoft Azure ready. Arduino IDE support is planned as a stretch goal. LoPy can be used as a LoRa node, and as LoRa gateway with up to 100 nodes, so you could easily build your own little IoT network.

LoPy expansion board allows easier development with a USB to serial converter, 3 Female headers, compatible with both LoPy and WiPy board, a LiPo battery charger with JST connector, a microSD card socket, user LED and push button, and various jumpers to enable/disable features. You’ll probably want to include the antenna kit as well, unless you have your own, as it’s not included in the standard pledges.

Setting up a LoRa Connection in Python

Setting up a LoRa Connection in Python

The company has already raised over 58,000 Euros out of their 50,000 Euros target so the project will go ahead. All early bird rewards are gone, but you can still pledge 29 Euros to get a LoPy board, and most will probably want to add 5 Euros to get the LoRa antenna kit too, or simply pledge 48 Euros to get a complete kit with the board, the antenna, and the expansion board. Shipping adds 7 Euros, and delivery is scheduled for August 2016.