Archive

Posts Tagged ‘raspberry pi’

BASpi I/O is a Raspberry Pi HAT Expansion Board for Building Automation (BACNet)

February 13th, 2018 No comments

BACNet is a data communication protocol for Building Automation and Control Networks that has been developed, supported and maintained by ASHRAE (American Society of Heating, Refrigerating and Air-Conditioning Engineers) Standing Standard Project Committee since 1987, and used as building automation standard in the US, Europe, and more than 30 other countries. It’s used for HVACs, lightings, elevators, fire safety, and other systems used in buildings. It’s also known as ISO 16484-6 standard.

I had never heard of it, but this afternoon, I’ve come across Contemporary Controls BASPi I/O, a Raspberry Pi add-on specifically designed for BACNet, and providing 12 physical I/O points including 6 Universal Inputs and 6 Relay Outputs.

Click to Enlarge

BASPi I/O specifications and features:

  • BACnet/IP Server – 12 physical points and 24 virtual points
  • BACnet/IP over Ethernet or Wi-Fi
  • Resident Sedona Virtual Machine (SVM)
  • Input/Output — 12-points of physical I/O
    • 6x configurable Universal Inputs: Analog Input, Binary Input, Resistance, Thermistor (10KT2, 10KT3, 20K), Pulse Input (40Hz)
    • 6x Relay Outputs
    • 24x Virtual Points used to read or write data to/from wiresheet by a BACnet client/supervisor station
  • Compatible with Raspberry Pi 3 board

The board is programmable with free Sedona Application Editor, configurable using your web browser, and supports 48 Web Components for  live monitoring and control of wiresheet points from the BASpi’s web page.

Sedona Application Editor – Click to Enlarge

You’ll need to install Raspbian on your Raspberry Pi 3 board, as well as firmware files provided by Contemporary Controls, or download an all-in-one firmware image provided by Contemporary Controls.

The component also provided a turnkey solution called BASpi System (BASpi-SYS) with the following items:

  • Raspberry Pi 3 board
  • BASpi I/O board
  • 8GB pSLC industrial grade μSD card with pre-written image
  • Enclosure case
  • 100-240V AC input, 5VDC output wall power supply
  • Free graphical programming tool – Sedona Application Editor
  • Quick Start Guide for beginners

Pricing for the board and complete system has not be announced yet, but according to the product page, both will be launched on March 1, 2018.

The board is especially interesting thanks to its configurable physical I/Os, but if you just want to control some GPIOs over BACNet, you can do so with Raspberry Pi board – plus any suitable optional I/O board – running BACNet Stack, and browse the device using tools such as BACNet Browser, or CAC BASNet Explorer as shown in details in the video below.

Via LinuxGizmos

Embedded Linux Conference & IoT Summit 2018 Schedule

February 13th, 2018 No comments

The Embedded Linux Conference 2018 and the OpenIoT Summit 2018 will jointly take place next month, on March 12 – 14, 2018 in Portland, Oregon, USA. The former is a “vendor-neutral technical conference for companies and developers using Linux in embedded products”, while the latter is a “technical conference for the developers and architects working on industrial IoT”. The Linux Foundation has already published the schedule, and it’s always useful to learn what will be discussed about even for people who won’t attend.

With that in mind, here’s my own virtual schedule with some of the talks I find interesting / relevant to this blog.

Monday, March 12

  • 10:50 – 11:40 – Progress in the Embedded GPU Ecosystem by Robert Foss, Collabora Ltd.

Ten years ago no one would have expected the embedded GPU ecosystem in Linux to be what it is now. Today, a large number of GPUs have Open Source support and for those that aren’t supported yet, improvements are happening at a rapid pace.

In just the last year Vivante GPUs have gained mainline support and Mali GPUs have seen good progress being made.

In this talk, Robert will cover GPUs in the embedded space and give an overview about their current status, what lies ahead and how the Open Source state of the art compares to the proprietary alternatives.

  •  11:50 – 12:40 – Zephyr LTS Release, What to Expect and Why are We Doing This by Anas Nashif, Intel

After eleven 1.x.x releases of Zephyr since the project has launched 2 years ago, the Zephyr project is planning to release Zephyr LTS in 2018 with many new features that have been in the works for the last year, stable APIs and with the goal of taking a subset of the released project code through various certification activities.

In this talk the status plans for Zephyr LTS will be presented and discussed and the next steps that the project will take after the LTS release.

  • 14:00 – 14:50 – Preempt-RT Raspberry Pi Linux by Tiejun Chen, VMware

As we know, the Raspberry Pi is a series of small single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and in developing countries. Now it is very popular around our IoT world, and you can see many guys use Pi to build great things, and even it can play a role in the production environment. The official Raspberry Pi Linux maintains Linux kernel specific to Pi platform. But it does not include Preempt RT Linux support. Obviously, in some IoT cases we really need to meet hard real time requirement. In this presentation, we will review if-how we can integrate Preempt RT Linux patches to Pi Linux, an see what the problems are for this particular hardware platform.

  • 15:00 – 15:50 – OpenEmbedded/Yocto on RISC-V – New Kid on the Block by Khem Raj, Comcast

RISC-V a new open source ISA based architecture is rapidly gaining acceptance in embedded space. Several core packages e.g. gcc toolchain, linux kernel, binutils, newlib, qemu has already been ported for RISC-V. At this point, OpenEmbedded is one of first embedded linux distribution frameworks to support RISC-V architecture. This talk will cover the status of support as the core support has been upstreamed into OpenEmbedded-core, additionally SOC layer meta-riscv is also created which would serve as common layer for all RISC-V based SOCs.

  • 16:10 – 17:00 – Bluetooth Mesh with Zephyr OS and Linux by Johan Hedberg, Intel

Bluetooth Mesh is a new standard that opens a whole new wave of low-power wireless use cases. It extends the range of communication from a single peer-to-peer connection to a true mesh topology covering large areas, such as an entire building. This paves the way for both home and industrial automation applications. Typical home scenarios include things like controlling the lights in your apartment or adjusting the thermostat. Although Bluetooth 5 was released over a year ago, Bluetooth Mesh can be implemented on any device supporting Bluetooth 4.0 or later. This means that we’ll likely see very rapid market adoption of the feature.

The presentation will give an introduction to Bluetooth Mesh, covering how it works and what kind of features it provides. The talk will also give an overview of Bluetooth Mesh support in Zephyr OS and Linux and how to create new wireless solutions with them.

  • 17:10 – 18:00 – Drive your NAND within Linux by Miquèl Raynal, Bootlin (formerly Free Electrons)

NAND flash chips are almost everywhere, sometimes hidden in eMMCs, sometimes they are just parallel NAND chips under the orders of your favorite NAND controller. Each NAND vendor follows its own rules. Each SoC vendor creates his preferred abstraction for interacting with these chips.

Handling all of that requires some abstraction, and that is currently being enhanced in Linux! A new interface, called exec_op is showing up. It has been designed to match the most diverse situations. It should ease the support of advanced controllers as well as the implementation of vendor-specific NAND flash features.

This talk will start with some basics about NAND memories, especially their weaknesses and how we get rid of them. It will also show how the interaction between NAND chips and controllers has been standardized over the years and how it is planned to drive NAND controllers within Linux.

Tuesday, March 13

  •  10:50 – 11:40 – Comparing and Contrasting Embedded Linux Build Systems and Distributions by Drew Moseley, Mender.io

We will discuss the various options for creating embedded Linux operating systems. We will provide a basic description of each option, including an overview of the workflow for each choice. The talk will cover the advantages and disadvantages of each of these options and provide viewers with a matrix of design considerations to help them pick the right choice for their design. We will cover the following options:

  • Yocto/OpenEmbedded
  • Buildroot
  • OpenWRT/LEDE
  • Slimmed down desktop distributions (e.g. Debian, Raspbian, Ubuntu)

We will also touch upon other tools, such as crosstool-ng and ucLinux, which are peripherally related to building embedded Linux systems. The focus for this section will be to make the viewers aware of these tools as they frequently come up while researching embedded Linux so that you are better informed which tools are available.

  • 11:50 – 12:40 – The Things Network: An IOT Global Phenomenon by Bryan Smith, Tacit Labs

IoT has many connectivity options and systems based on Low Power Networks(LPN’s) such as LoraWAN are showing a great deal of promise. LoraWAN uses the ISM Band which doesn’t require a license for use.

The Things Networks (TTN) is a community about LoraWAN, Low Power Wide Area Network (LPWAN). It’s collaboratively built by passionate people, Open Source Software and Open Governance. The network has a manifesto and fair access policy that governs its use and management. In the session we’ll discuss:

  • The technology behind LoraWAN, TTN and similar networks.
  • TTN’s impact on public and private LPWAN’s.
  • The initiators and communities that install and build LoraWAN gateways.
  • Lastly we’ll discuss the impact of the deployments in real world use cases.

There will also be a live demo of a LoraWAN gateway and node in action on several public networks including TTN as well as others.

  • 14:00 – 14:50 – I + I2C = I3C: What’s in this Additional ‘I’? by Boris Brezillon, Bootlin (formerly Free Electrons)

The MIPI Alliance recently released version 1 of the I3C (pronounce ‘eye-three-see’) bus specification, which is supposed to be an improvement over the long-standing I2C and SPI protocols. Compared to I2C/SPI, I3C provides a higher data rate, lower power consumption and additional features such as dynamic address assignment, host join, in-band interrupts. For the last year or so, Free Electrons has been working with Cadence Design Systems on supporting this new kind of bus in Linux.

With this talk we would like to introduce this new bus and the concepts it brings to the table. We will also detail how we plan to expose the new features exposed by the I3C protocol in Linux and go through future possible improvements of the I3C framework that has already been submitted for review on the Linux kernel mailing list.

  • 15:00 – 15:50 – Android Common Kernel and Out of Mainline Patchset Status by Amit Pundir & John Stultz, Linaro

A quick overview of what the speakers ares going to cover in this session.

  • A brief background on Android common kernels – Out of tree Android patches and how they have evolved over time.
  • The current/active patchset introduction and status – Their use cases in Android and on-going upstreaming efforts if any.
  • A brief Intro to android-mainline-tracking tree.
  • Rebasing latest android-$LTS tree to latest linux release tag
  • Find/Report/Fix Android regressions or ABI breakages in mainline kernel.
  • 16:20 – 17:10 – Tock, The Operating System for a Programmable IoT by Amit Levy, Stanford University

Tock is an open-source operating system for low-power ARM Cortex-M microcontrollers that enables radically different kinds of embedded and IoT products.

In typical embedded systems, every line of code is fully trusted because embedded operating systems lack traditional isolation mechanisms like processes. Unfortunately, this makes developing secure products difficult, and running third-party applications virtually impossible.

Tock uses a language sandbox in the kernel and a process-like hardware enforced mechanism in userspace to isolate third-party and other untrusted code in the system.

In this presentation I’ll introduce Tock’s vision for IoT and how its isolation mechanisms work. Then, I’ll use examples of deployed systems and products using Tock to show how developers can use it to build more secure and extensible IoT systems today.

  • 19:00 – 20:00 – BoF: Open Source Hardware by Drew Fustini, OSH Park

Open Source Hardware BoF (Birds of a Feather) session for those interested in how Open Source Hardware design can benefit embedded Linux systems.

The session will start will start with a short presentation of a few slides to clarify terminology and highlight Open Source Hardware projects relevant to Linux. The panelists will then lead a discussion with the BoF attendees about the benefits and challenges of designing Open Source Hardware.

Jason and Drew can talk about the experience of working with community, manufacturers, and distributors to create an Open Source Hardware platform. Leon can speak about his experience of learning hardware design as a software engineer, and how he took his Raspberry Pi HATs from concept to product. John can speak about his experience leading an Open Source Hardware platform within a large corporation.

Wednesday, March 14

  • 11:05 – 11:55 – Landscape of Linux IoT Ecosystems by Christian Daudt, Cypress Semiconductor

IoT products are getting richer in their functionality daily, and as a result there is a trend for increased use of Linux in these products. As we are early in the IoT ecosystem cycle, there is a large number of projects and products vying for developer attention as frameworks and protocols to be used in new product development. This talk provides an overview of the options available and how they relate to each other. It covers OS stacks such as EdgeX Foundry, Automotive Grade Linux, Android Things, IoTivity, Tizen, etc.. as well as IoT-tailored cloud integrations from cloud vendors such as AWS, Google, Microsoft.

  • 12:05 – 12:55 – CPU Power Saving Methods for Real-time Workloads by Ramesh Thomas, Intel

Configurations created for real time applications mostly disable power management completely to avoid any impact on latency. It is however, possible to enable power management to a degree to which the impact on latency is tolerable based on application requirements. This presentation addresses how CPU idle states can be enabled and tuned to allow power savings while running real time applications.

The presentation will give a background of the issues faced by real-time applications when CPU power management is enabled. It will then explain tools, configurations and methods that can be used to tune applications and CPU power management in the kernel to be able to save power without impacting the deterministic latency tolerance requirements.

  • 14:30 – 15:20 – Debian for Embedded Systems: Best Practices by Vagrant Cascadian, Aikidev, LLC

As embedded hardware becomes more capable, Debian becomes an attractive OS for projects. Debian provides clear licensing, a solid technical foundation, and over twenty-five thousand software projects already available within Debian.

Unfortunately, embedded system projects may make changes to a customized Debian OS in ways that make it difficult to apply security updates or system upgrades. This can lead to an unmaintained fork of Debian with long-standing security vulnerabilities unfixed in the hands of end-users. Nobody likes bit-rot.

Many of these common pitfalls can be mitigated or avoided entirely by understanding Debian’s culture, infrastructure, technical norms, and contribution processes. These understandings will improve embedded systems using Debian over the long-term.

  • 15:30 – 16:20 – Civil Infrastructure Platform: Industrial Grade Open Source Base-Layer by Yoshitake Kobayashi, Toshiba Corporation, Software Development and Engineering Center

The Civil Infrastructure Platform (CIP) is creating a super long-term supported (SLTS) open source “base layer” of industrial grade software. The base-layer consists of the SLTS kernel and a basic set of open source software and standardization concepts. By establishing this “base layer,” the CIP Project will enable the use and implementation of software building blocks in civil infrastructure projects. Currently, all civil infrastructure systems are built from the ground up, with little re-use of existing software building blocks, which drains resources, money and time. In this devroom, we’ll share project strategy, use cases, roadmap, milestones and policies. We’ll also share technical details for each development activities for the base-layer that includes open source, real-time development tools, testing and answer questions.

  • 16:30 – 17:20 – 3D Printing with Linux and Xenomai by Kendall Auel, 3D Systems Corp.
Software running on embedded Linux with Xenomai is used to control a 3D printer. The lessons learned and practical advice will be shared in this presentation. There were many challenges to overcome. A complete 3D printing system requires precise motion control, thermal control, material delivery and monitoring, and coordinated data transfers. All concurrent real time processes must be coordinated and managed, while providing interactive response to user input. In parallel with the real time processing, the system must slice the 3D model into layers for printing, which is by its nature a compute-bound application. The dual-kernel architecture of Linux with Xenomai was ideal for maintaining low and predictable latencies for real time control, while allowing the complex and resource intensive slicing application to run in parallel.

Selecting the sessions was not easy as most talks are relevant, so I’d recommend checking out the whole schedule.

The Embedded Linux Conference & OpenIoT Summit require registration with the fees listed as follows:

  • Early Bird Fee: US$550 (through January 18, 2018)
  • Standard Fee: US$700 (January 19,  February 17, 2018)
  • Late Fee: US$850 (February 18, 2017 – Event)
  • Academic Fee: US$200 (Student/Faculty attendees will be required to show a valid student/faculty ID at registration.)
  • Hobbyist Fee: US$200 (only if you are paying for yourself to attend this event and are currently active in the community)

How to Use 3G and GPS on Raspberry Pi with ThaiEasyElec 3G HAT Expansion Board

February 11th, 2018 11 comments

Venus Supply is an embedded systems company based in Bangkok, Thailand that sells products through their ThaiEasyElec website/brand, as well as a act as a local distributor for popular DIY electronics items. I previously tested their ESPino32 ESP32 board, and the company has now send me another of their new product called “3G HAT Expansion for Raspberry Pi” and based on Quectel UC20-G that support 3G and GPS/GLONASS connectivity globally, meaning it should work in any country with 2G or 3G coverage.

After listing the specifications, going through unboxing and assembly with a Raspberry Pi 2/3 board, I’ll write some quick start guide to show what I had to do to use GPS and connect to 3G with a Hologram SIM card.

3G HAT Expansion for Raspberry Pi Specifications

  • Quectel UC20-G wireless module supporting
    • Cellular
      • 3G – UMTS @ 800/850/900/1900/2100 MHz
      • 2G – GSM @ 850/900/1800/1900 MHz
      • Data – HSPA+ up to 14.4 Mbps Downlink, 5.76 Mbps Uplink, EDGE, GPRS
      • Push-Pull SIM Card with ESD protection
      • Main + Diversity RP-SMA antenna connectors
    • GNSS
      • Qualcomm gpsOne Gen8 engine
      • GPS, GLONASS
      • RP-SMA antenna connector
  • Host interface – USB and UART
  • Audio – Audio codec, and 3.5 audio jack with microphone and mono audio
  • Misc
    • Auto start jumper (J3)
    • Software start/stop via GPIO17 or GPIO18 pin configurable via Jumper “P8”
    • Power switch
    • LED – Status LED, network, power
    • Back-up battery to reduce GPS fix time
  • Raspberry Pi Hat Compatible with 40-pin Raspberry Pi header

Unboxing

I received the kit in a carton box with three zipped packages: one for the board and accessories, and two for the GPS/GLONASS and 3G antennas which are not included by default.

Click to Enlarge

The GPS antenna comes with a 3-meter cable which should make it suitable to install in most cars or trucks, and the HAT package includes an extra zip bag with spacers, screws, nuts, and a 40-pin female header. I’ve also been told a 25cm micro USB cable should be included, but it seems they forgot it for my package…

Click to Enlarge

Looking closer at the board we can see Quectel UC20GB module in the center of the board, the three RP-SMA antenna connectors clearly marked with DIV, GNSS, and MAIN, the micro USB port for power and data, the 3.5mm audio jack, and in the top right connector J3 2-pin header to enable autostart, 3-pin P8 header to select GPIO 17 or GPIO 18 for software on/off, and the power key to manually start or stop the the module.

Click to Enlarge

They’ve also given access the the 40-pin RPi header using male pins, as a 4-pin UART connector.

The other side of the battery comes the audio codec board based on Nuvoton NAU8814Y mono audio codec, the SIM card slot fitted with a black dummy SIM card, a CR1220 coincell battery for GPS fix backup, and a 40-pin female header used for connection to the Raspberry Pi.

Click to Enlarge

I’ve been told the battery supploes power to the internal clock engine of the module, which can calculate the new position of satellites and get GPS fix faster  from data used up to 3 days ago.

3G HAT Assembly and Configuration with Raspberry Pi 2/3

Assembly is pretty straightforward,  first install the four spacers  on the Raspberry Pi board and fasten them with the nuts underneath the board, instead of the 40-pin female header on Raspberry Pi board, place the 3G HAT on top, and fasten the remaining four screws.
Connect the cellular antenna to the MAIN connector, and the GPS antenna to the GNSS connector. You’ll also need to flash Raspbian to a micro SD card. I’ll run the same Raspbian Stretch Lite image as I used with ANAVI Light pHAT starter kit.
If you want to follow the instructions provided by ThaiEasyElec (in Thai only for now, but easy enough to follow, and an English version is coming), you’ll need a GUI, so I’d recommend you install the full Raspbian Stretch image and connect an HDMI display, although you may run VNC client as well. I’ll do something a little different as I’ll do an headless setup instead, using Ethernet and SSH most of the time, but to test 3G, I’ll also disable Ethernet, so I also connected a USB to serial cable as shown below in order to access the serial console.

Click to Enlarge

Find a (short) micro USB to USB cable to connect the micro USB port of the HAT expansion board to the one of the USB ports of the Raspberry Pi to power on the board. I also had to remove the dummy SIM card, and insert my own SIM card with the contacts facing the board. After installation, we’ll see around 3mm of the SIM card, but that’s normal. Finally, you’ll need to decide how you want to manage the power: either with the power button, J3 jumper to autostart, or with pin 17 or 18 from the Raspberry Pi. I decided to move the jumper to J3 to always power on the module, but if you run on batteries, you’ll probably want to use the GPIO pin instead.

Verify the 3G HAT is Recognized in Linux

Now we are ready to start our Raspberry Pi board, and login to a terminal via SSH, serial, or in the desktop. We should find Quectel UC20 module with 05c6:9003 VID:PID with lsusb:

If you don’t see it, make sure the USB cable is connected, and you’ve powered the module up. I recommend you move the jumper to J3 at first like I did. Then you should see four ttyUSB devices:

Each are used by the module as follows:

  • /dev/ttyUSB0 – DM interface – Diagnose port (no used in this review)
  • /dev/ttyUSB1 –  NMEA interface – For GPS NMEA sentence output (read-only)
  • /dev/ttyUSB2 – AT interface (for GPS)
  • /dev/ttyUSB3 – Modem interface for PPP connections and AT command

Controlling GPS and Handling GPS Data

ThaiEasyElec uses Putty for Linux, but since I’m doing this headless I’ll install picocom intead:

Now we can connect to /dev/ttyUSB2 using 115200 8N1 to send some AT commands to the module:

The first command (AT+QGPS=1) turns the GNSS module on, and the second one (AT+QGPSEND) turns it off.

Let’s keep it on for now, and connect to /dev/ttyUSB1 @ 9600 baud to check NMEA output which should be updated every second when GPS is enabled:

That’s the meaning for each field:

  • GPGGA – Global Positioning System Fix Data, Time, Position and related fix data
  • GPRMC – Recommended minimum data
  • GPGSV – Detailed satellite data
  • GPGSA – Overall satellite data
  • GPVTG – Vector track and speed over the ground

GPGSA does not have data in the output above, simply because the GPS fix did not occur yet.

If you just want to enable GNSS each time the module is powered on, run the following command:

To disable this option, simply run the same command with 0 instead of 1. You can also query “autogps” status but running the command without the second parameter:

You’ll find more details about the GNSS AT command set for GPS and GLONASS in  Quectel UC20 GNSS AT Commands Manual (pdf).

Reading NMEA sentences is possible, but not really user friendly, and if we want to see a nice representation of the data we can run the GPS Daemon (gspd) and client (cgps) instad. Let’s exit both picocom sessions with GPS still running, and install the necessary packages:

The daemon will automatically run after installation, so let’s stop it…

… in order to run it with our own parameters, i.e. using /dev/ttyUSB1 NMEA interface:

Now we can run the client as follows:

After a few seconds should get a fix with details information (left) and data about the satellites (right).

I previously played with GPS using NavSpark mini GPS Module (Arduino compatible), and at the time  I could manage to get a GPS fix inside my room, but in this case I had to move the antenna outdoor to get signal. If you want to integrate such capability into your own app, you may want to study cgps source code.

It’s also possible to get the coordinate through /dev/ttyUSB2 terminal using QGPSLOC AT command with one of the following three modes:

  • Mode 0 – format = ddmm.mmmmN/S, dddmm.mmmmE/W
  • Mode 1 – format = ddmm.mmmmmmN/S, dddmm.mmmmmmE/W
  • Mode 2 – format = (-d)dd.ddddd,(-)ddd.ddddd

The fields from left to right: <UTC time>,<latitude>,<longitude>,<hdop>,<altitude>,<fix>,<cog>,<spkm>,<spkn>,<UTC date>,<nsat>

Short explanation for the not-so-obvious fields:

  • <hdop> – Horizontal precision, 0.5-99.9 (quoted from GPGGA sentence)
  • <fix> – GNSS positioning mode (quoted from GNGSA/GPGSA): 2 = 2D positioning; 3 = 3D positioning
  • <cog> – Ground heading based on true north. Format: ddd.mm (quoted from GPVTG sentence)
  • <spkm> – Speed over ground. Format: xxxx.x, unit: Km/h, accurate to one decimal place (quoted from GPVTG sentence)
  • <spkn> – Speed over ground. Format: xxxx.x, unit: knots, accurate to one decimal place (quoted from GPVTG sentence)
  • <nsat> –  Number of satellites, from 00 to 24 (the first 0 will also be transferred, quoted from GPGGA sentence)

3G HAT with Hologram SIM Card

Let’s now move to the cellular part of the module. I’ll use Hologram developer IoT SIM card, but any 3G SIM card should do.

Connection Method 1 – Sakis3G and UMTSkeeper

ThaiEasyElec documentation uses the two following programs to establish a 3G PPP connection:

  • Sakis3G is a parameter and hardware controller for connecting to the Internet.
  • UMTSkeeper is reconnecting with Sakis3G when the connection is down.

Booth can be found in umtskeeper package that we can install from a tarball:

We then need to install some extra packages:

We’re then told to launch Sakis3G in interactive mode to configure the connection. The look of it will depend whether you launch it from the dekstop, a SSH terminal, or a serial terminal. The interface looks really ugly (and messy) from the serial console, so instead I launched it from an SSH terminal:

We need to select 1. Connect with 3G, then 3. Custom tty…, and input /dev/ttyUSB3 for CUSTOM_TTY variable.

The next step auto-detected the correct APN (HOLOGRAM), so I just selected OK, and then was asked about APN_USER and APN_PASS.

Those parameters will also depend on your specific connection. Hologram does not use user and password, but simply pressing Enter will abort the configuration, so I entered 0 for both. After that, Sakig3G will try to connect and it worked!

Pressing Enter will bring us back to the main menu, where we can select Connection Information to find a few more details.

Let’s go back in the top menu, disconnect, and exit Sakis3G. Now we can run umtskeeper with the same parameters:

But the output does not look so good the very first time, since it complains about “no modem connected”:

But eventually we do get a connection. If you connect later, the Internet status message changes to:

Connection Method 2 – PPP Creator Script

While I was eventually successful, the first time I tried Method 1 I failed for some reasons, so at the time I looked for alternatives way to connect, and found Sixfab also used Hologram SIM card with their own RPi 3G/4G shield – also based a a Quectel module, and instead wrote ppp-creator.sh script.

So I downloaded it to my Raspberry Pi board, and executed it which created some other connection scripts.

Now we can run pppd call gprs command to establish a connection:

All good, and even simpler than the first method, although you may have to change the script in case you need APN username and password.

Testing the Connection

Whether we use method 1 or 2, we can now verify ppp0 is indeed up and connected.

I did that with Ethernet connected, so now I’ll disconnect Ethernet, turn it down, and start the script from the serial connection as a background process:

Again we can see on ppp0 is an active connection:

I can test outboud traffic with ping.

All good, but then I tried to connect via SSH using

But it failed to connection, maybe because 10.170.40.106 is a “local IP address”, and the “remote IP address” set to 10.64.64.64 is just a default address as shown in the log while running pppd call gprs.

SSH Tunelling with Hologram SIM card

I’m not familiar enough with 3G/4G connectivity to know if it’s a common issue but in the case of Hologram service we need to setup tunnelling to access via SSH (or another port/service). This can be done via SpaceBrige program or the command line, as you’ll find both methods on the relevant page on Hologram website.

I used SpaceBridge program in this case. You can download the client for Windows, Linux, or Mac OS. This is what I had to do in Ubuntu 16.04:

Now you’ll need to enable Tunneling for your device in Hologram dashboard, and get your Hologram API key, which you can generate and copy from your account.

Click OK, select your device(s), input your device port (e.g. 22 for SSH), and the local port on the computer to remotely access your Raspberry Pi over 3G.Click Done, and within a few seconds the tunnerl should be up and running.

I was finally able to connect the Raspberry Pi over SSH using the following command:

I could also get the GPS coordinate from there using cgps client.

If you want to stop the connection manually started with pppd call gprs, find the PID, and kill it:

In your actual project, you’ll want to control the connection using initd scripts or systemd.

I’d like to thanks Venus Supply / ThaiEasyElec for sending the product for review, it’s been fun to try out. If you’re interested you can purchase the board for 2350 THB (~$75) on their website, and may also consider adding the GSM/3G antenna for 120 THB (~$4) as well as the GNSS antenna for 350 THB (~$12).

Raspberry Pi 3 Sold for $29.95 on DFRobot (Promo)

February 9th, 2018 10 comments

As I browsed various sites checking out new arrivals and potential promotion, I found out DFRobot has now a promotion for the Raspberry Pi 3 Model B board for $29.95 apparently taking place between the 8th and 10th of each month (not only February). I added it to my cart to check out shipping to my address, and unless you can pick it up to their office, shipping adds $6, for a total of $35.95 shipped. Whether that is worth it depends where on your locale price and custom regulations.

DFRobot does offer free (DHL) shipping for order over $150, but you can’t just buy 5 Raspberry Pi 3 boards at the discounted price, since the special offer apply to “one only one piece of Pi 3”, so you’d have to purchase something else from their website if you don’t want to pay for shipping. Nevertheless, even if you have nothing to buy right now, but may purchase items from them later, it’s still something to keep in mind, since the discount should be repeated in subsequent months on the same days.

Categories: Hardware Tags: discount, raspberry pi

Sixfab Launches Arduino and Raspberry Pi NB-IoT Shields with Four Sensors

February 8th, 2018 2 comments

SixFab previously introduced a 3G/4G base shield for the Raspberry Pi boards that would take Quectel based mini PCIe card in order to add cellular connectivity to the popular development boards.

The company is now back with NB-IoT shields that should better suited to IoT projects with lower hardware and data costs, and support either 40-pin Raspberry Pi boards or Arduino.

SixFab Raspberry Pi NB-IoT Shield

Specifications & features:

  • Module – Quectel BC95-B20 NB-IoT Module supporting 800MHz frequency (suitable for the European market)
  • Micro SIM card socket, PCB Antenna and u.FL socket for external antenna
  • I/O expansions
    • 4x Channel 12-bit ADC via ADS1015
    • Relay with optocoupler protection (24V DC, 120-220V AC Switching)
    • 3-pin 1-Wire interface for DS18B20, DHT21, etc…
    • 4-pin I2C interface
    • 3.3V reference voltage
  • Sensors
    • MMA8452Q 3-axis accelerometer
    • HDC1080 temperature sensor (-40 to +125 °C)
    • HDC1080 humidity sensor (0 to 100%)
    • ALS-PT19 ambient light sensor
  • Misc – User button and LED
  • Optocoupler (3 – 12 VDC switching)
  • Compatible with Raspberry Pi boards with 40-pin header

SixFab Arduino NB-IoT shield

The Arduino shield is pretty similar to the Raspberry Pi one, except or the lack of ADC and some I/Os, since the Arduino board can handle those:

  • Module – Quectel BC95-B20 NB-IoT Module supporting 800MHz frequency (suitable for the European market)
  • Micro SIM card socket, PCB Antenna and u.FL socket for external antenna
  • I/O expansions – Relay (24V DC, 120-220V AC Switching)
  • Sensors
    • MMA8452Q 3-axis accelerometer
    • HDC1080 temperature sensor (-40 to +125 °C)
    • HDC1080 humidity sensor (0 to 100%)
    • ALS-PT19 ambient light sensor
  • Misc – User button and LED
  • Compatible with Arduino boards

Both boards can be typically used for IoT applications such as smart farming, smart cities, smart home, smart metering, bike sharing, smart parking, asset tracking, environmental monitoring and more.

The company is now taking pre-orders for both boards for $66.75 with delivery scheduled on March 19. If you’re using Arduino and don’t need the sensors nor relay, RakWireless WisLTE board might be worth a look, as it’s a cheaper option at $40 + shipping.

Sixfab NB-IoT Evaluation Board

Sixfab also launched a tiny standalone NB-IoT evaluation board to test NB-IoT network and development with different platforms using a micro USB port to interface with the host platform. It is sold for $51.75 during the pre-order period, and also based on BC95-BC20, which according to Quectel BC95 product page is only suitable for the European market, while China, Korea, and Australia require a different version of the module.

Mozilla Project Things Framework for the IoT Works with Raspberry Pi 3 and Other Boards / Computers

February 7th, 2018 No comments

The Internet of Things today relies on many standards, and for example Google Cloud relies on Weave, Amazon AWS IoT and Samsung SmartThings on MQTT, Apple iCloud and so on. The web also relies on many different markup or programming languages like HTML, JavaScript, PHP, Ruby, etc.. but as a user you don’t need to care, and in most cases, you can access any website with the same web browser.

Last year, Mozilla started working on Project Things to bring the same ease of of use to the IoT, by implementing the proposed Web of Things standard by W3C that aims to reduce IoT fragmentation by allowing different vendors’ IoT offerings to work together.

Mozilla has now announced the release of  Project Things “open framework for connecting your devices to the web” suitable not only for hackers and developers, but easy enough to use for end users. The release includes the following key features:

  • Ability to use the microphone on your computer to issue voice commands
  • Rules engine for setting ‘If this, then that’ (IFTTT) logic for how devices interact with each other
  • A floor-plan view to lay out devices on a map of your home
  • Additional device type support, such as smart plugs, dimmable and colored lights, multi-level switches and sensors, and “virtual” versions of them, in case you don’t have a real device
  • All-new add-on system for supporting new protocols and devices
  • New system for safely authorizing third-party applications using OAuth

The framework can work with any platform running Linux or Mac OS X, but the easiest way to get started should be with the Raspberry Pi 3, since Mozilla provides detailed instructions to make your own Things Gateway with RPi 3, as well as a firmware image that you can flash to a micro SD card.

You don’t need extra hardware for WiFi and Bluetooth connectivity since the board already includes those, but you need to control Zigbee or/and Z-Wave devices, you’ll need to add USB dongles such as Digi XStick (ZB mesh version), Sigma Designs UZB Stick or Aeotec Z-Stick (Gen5) which have been tested by the team using compatible smart plugs.

If you don’t own a Raspberry Pi 3, it becomes a little more complicated, but probably not for most of the readers of this blog, since you just need to run some commands in a Terminal as explained in Github.

Via ZDNet

Categories: Linux Tags: gateway, IoT, mozilla, raspberry pi

Getting Started with TinyLIDAR Time-of-Flight Sensor on Arduino and Raspberry Pi

January 30th, 2018 8 comments

TinyLIDAR is an inexpensive and compact board based on STMicro VL53L0X Time-of-Flight (ToF) ranging sensor that allows you to measure distance up to 2 meters using infrared signals, and with up to 60 Hz. Contrary to most other VL52LOX boards, it also includes an STM32L0 micro-controller that takes care of most of the processing, frees up resource on your host board (e.g. Arduino UNO), and should be easier to control thanks to I2C commands.

The project was successfully funded on Indiegogo by close to 600 backers, and the company contacted me to provided a sample of the board, which I have now received, and tested with Arduino (Leonardo), and Raspberry Pi (2).

TinyLIDAR Unboxing

I was expecting a single board, but instead I received a bubble envelop with five small zipped packages.

Click to Enlarge

Opening them up  revealed three TinyLIDAR boards, the corresponding Grove to jumper cables, and a bracket PCB for three TinyLIDAR boards together with headers and screws. So I looks like I received the “3 tinyLiDAR – IGG Special” plus the bracket board that was supposed to be a stretch goal unlocked at $25K (but they only got $23,717). Maybe that’s a good sign for backers, we’ll see.

Click to Enlarge

Due to time constraints, I won’t use the bracket, but only single boards. The brackets can be used with three tinyLIDAR boards using different I2C addresses, and you’ll see an example use with the Follow-me 2 Sketch where the 3 LIDAR boards are mounted on a tilt/pan platform that can track your hand.

Click to Enlarge

The bigger chip on the by is STM32L0 Cortex M0+ microcontroller with the much smaller STMicro VL53L0X laser ToF sensor placed right on top of it on the photo above. There are also a few I/O include the 4-pin I2C Grove connector and through holes, some pogopin for direct UART access, an LED, a reset button, and more, as described in the diagram below.


TinyLIDAR on Arduino

Now, it’s time to play with the board using sample and documentation on a dedicated page.  Refer to this page for the latest versions, as below I’ll link to the versions I used for the review.

To easily evaluate and learn about the platform, the company has made what they call Arduino GUI Terminal sketch to let your control the device from an Arduino board using a serial terminal. https://microelectronicdesign.s3.amazonaws.com/tinyLiDAR_Terminal_GUI_1_1.ino

The company only tested Arduino Uno, but it turns out I don’t have one so I had to use an Arduino Leonardo clone instead, and after initial troubles, and help from my contact at the company (Dinesh), I could use tinyLiDAR_Terminal_GUI_1_24.ino with my boardsince it now supports Arduino Uno, Leonardo, and Mega .If you don’t use Arduino Uno (default), make sure you enable your board accordingly in the code by commenting out the relevant line:

The hardware connections are very easy as you just need to connect the jumper cables to the I2C pins, 5V and GND on the board.

Click to Enlarge

Once this was done I connect a micro USB cable to my computer, and tried to upload the ino sketch file, but it failed to compile. That’s because I forgot to install Arduino I2C Master Library, which can be downloaded here, and you just need to click on Sketch->Include Library->Add .ZIP library, and select the freshly downloaded  I2C_Rev5.zip file to complete the installation. I could then build and upload the program to Arduino Leonardo.

Time to start a serial console using minicom, TeraTerm, Putty or others with 115200 8N1 and no flow control to access the Arduino GUI terminal:

You’ll get a list of command in the terminal, but you may want to read the reference manual to clearly understand each item.

I started with the query command, which worked just fine:

I could also use to read command, but to test accuracy I decided to use a ruler and a small box as shown below.

Click to Enlarge

I tested 5cm and 10 cm:

  • 5cm:

  • 10cm:

Not that good…. But there’s a calibration command as explained in the reference manual:

CD Auto-Calibrate Distance Offset
Perform Offset Distance Calibration on tinyLiDAR.
Before using this calibration command, please set tinyLiDAR to Continuous, High Accuracy mode by issuing
the commands “MC” and “PH”. See example code in Appendix A for details.
ST recommends to use a distance of 100mm to a white target. Therefore, place a white target 100mm away
from tinyLiDAR before running this calibration.
Must specify calibration distance in mm.
The new offset correction distance will be placed in non-volatile memory and used for all subsequent
operations. This calibration takes about 10 seconds to run and the LED will flash slowly during the calibration.
You can reset to our factory defaults by executing the “RESET” command.

So let’s go ahead by placing the board at 10 cm from a white box (OK mine was not exactly white), run MC and PH commands (although it does not look necessary),  before running running CD without parameter to do the actual calibration:

Let’s go back to single step operation (ms) and tinyLIDAR preset (pt), and try the measurements again

  • 5cm:

  • 10cm:

It’s getting better, although the first two steps always seen to be stuck to some previous measurements. I’ve been told it may be due to some buffer in the serial terminal.

Trying some longer distances:

  • 20cm:

  • 30cm:

It’s basically doing the job. If you need more accuracy, longer range, or faster measurements, you can change the mode:

  • PL: long range mode (up to 2m, 33ms)
  • PS: high speed mode (up to 1.2m, 20ms)
  • PH: high accuracy mode (up to 1.2m, 200ms)
  • PT: tinyLiDAR mode (up to 2m, 18ms)

One interesting feature, especially if you run on batteries, is the autonomous mode where the board is configured to automatically check the distance range every X second, and trigger a pulse when within range, without having to send I2C commands from the host, except the initial one. In the Arduino GUI terminal, you can for example run:

From there, you won’t show anything in the Arduino terminal, so you can either monitor the autonomous pin – as shown in the diagram below – with the host board or a multimeter…

… or instead you may consider soldering GND and serial TX pins on tinyLIDAR board, and access the read-only console use a USB to TTL debug board as shown below.

The terminal needs to be set to 115200 7N1 without flow control, and you’ll should an output similar to the one below when you run the A command above:

Just to be extra clear, at this stage I have two serial terminal in my computer:

  • /dev/ttyACM0 connected to Arduino where I can input commands
  • /dev/ttyUSB0 connected directly to tinyLIDAR where I can see debug output (read-only)

If you want to integrate it into your own program, you’ll have to send commands as shown by the Arduino sketch to read distance:

The code above is for Arduino Uno, so if you use Arduino MEGA or Leonardo you’ll need to change the PORT to PORTD, and SCL and SDA to pin 0 and 1 respectively.

TinyLIDAR on Raspberry Pi 2/3

Arduino is cool, but if your project is better suited to Raspberry Pi board, you can also connect tinyLIDAR to the I2C port of Raspberry Pi 2/3, or any other Raspberry Pi boards. The instructions are explained in details on Instructables, also explaining some of the shortcomings of I2C on Raspberry Pi board (lack of clock stretching support, pull up resistors installed). The steps are very details, even suitable to people having never used a Raspberry Pi, so here I’ll go faster focusing on settings specific to tinyLIDAR use.

First you need to scratch the I2C PCB trace on tinyLIDAR with a cutter to disconnect the pull-up resistors since it’s already done on the Raspberry Pi board. Now we can connect tinyLIDAR to the I2C pins, as well as 3.3V and GND.

I used the same Raspbian Stretch Lite image with SSH enabled (/boot/ssh file present) as I did for ANAVI Light pHAT. Now we need to install pigpio in Raspberry Pi as follows:

You’ll also need o run raspi-config to enable I2C.

The next step is optional, but I still recommend it as at the beginning I had trouble finding tinyLIDAR. That’s the step to detect tinyLIDAR I2C address:

We can see 0x10 I2C address is detected, and that’s our tinyLIDAR board. If you don’t have any addresses detected, re-check your connections.

Now that we have confident the hardware is OK, we can install “RPI TinyLIDAR Terminal GUI”:

and launch it with:


From there, it’s the same as in the Arduino terminal GUI, for example read and query commands:

Again the RPi terminal GUI is just for evaluation, but you can study the Python in order to integrate support for tinyLIDAR into your own Python application.

That’s all for this getting started guide.

The crowdfunding campaign is now over, but you can buy TinyLIDAR board directly on MicroElectronic Design website for $24.95.  You’ll also find the bracket board for $4.95 and a pack of 100 mounting screws on that page. Further details may also be found on the product page.

$2 USB “18650 Battery Shield” Powers Arduino, ESP32, and Other Low Power Boards with a 18650 Battery

January 29th, 2018 10 comments

If you’re looking for battery power for one of your projects, you may consider a “18650 battery shield” – going for just above $2 on Aliexpress or eBay  – for powering Arduino boards, Espressif ESP8266 or ESP32 boards, or any board that can be powered by 5V up to 2A via USB or headers, or by 3V up to 1A via headers.

Specifications listed on eBay/Aliexpress:

  • Power Input – 5 to 8V via micro USB port up to 0.5A charging
  • Power Output
    • 5V via Type A USB port
    • 3V up to 1A via 3x 2-pin header
    • 5V up to 2A via 3x 2-pin headers
  • Misc – 1 switch control USB output, LED for charging status (green = full, red = charging)
  • Battery protection (Over-charge or Over-discharge)
  • Dimensions – 9.8 x 2.9 cm

You’ll need to add your own 18650 battery, and be careful about polarity while installing it, since putting it in the wrong direction would destroy the charging chip. Some sellers also stuff “Raspberry Pi” keyword in the product title, and they often do this for search engine optimization (SEO), but at least some people have shown it to work with a Raspberry Pi board too. It’s unclear whether it can act as a basic UPS (Uninterruptible Power Supply) without status. Has anybody tried?

Thanks to Harley for the tip.