My new go-to linux dev machine is a Chromebook…


The other day I arrived at work to discover I had left my laptop at home. I hot-desk some days each week in Liverpool in fabulous SensorCity (@SensorCityUK) and was lost without a keyboard and ability to geek. Fortunately, just 5 minutes walk away is the local branch of a well-known UK “previously-loved” chain, so I went for a meander. I returned with an ASUS C101PA ChromeBook for less than half-price. It has a 10.1″ 1200×800 touchscreen with 6-core ARM CPU, 4GB RAM, 16GB eMMC, USB-C charging and a 9-hour battery – what should a geek do???

The answer is to enable Chrome Developer mode and install xenial ubuntu, of course – note that you should backup before enabling as this will factory reset your chromebook and delete all your data. Warning over.

It is possible to run a full linux desktop (something lightweight, like xfce, bearing in mind the free space on the eMMC), but I like working with a command line and you will see that you end up with linux running in one or more Chrome Tabs, while retaining full access to the Chrome/Android side of things – browser, email, 6Music on BBC Radio iPlayer, etc.

So, The best instructions are those available from the master – take a look at https://github.com/dnschneid/crouton

Here are the basics:

1. Enable developer mode – https://www.howtogeek.com/210817/how-to-enable-developer-mode-on-your-chromebook/
2. Download the current version of crouton from here – crouton
3. Open a shell (Ctrl+Alt+T, type shell and hit enter)
4. Run sudo sh ~/Downloads/crouton -t core – wait patiently and answer the prompts to add user, etc.
5. Done! Run sudo enter-chroot

The result is an arm64 install of ubuntu xenial that has access to serial over USB, USB and SD card storage

So far, I have:

1. mbed-cli to build and flash code to STMicro Nucleo boards – this installed build-essential, git, python, etc.
2. go version go1.10.3

I am very impressed. So, don’t dismiss chromebooks as over-sized androids, poor iPad substitutes, especially if you can pick up a bargain…

There is a great article on the ARM mbed website about their support of LoRaWAN.
https://os.mbed.com/blog/entry/Adding-a-LoRaWAN-stack-to-Mbed-OS-58/

Their code has improved a lot this year. Previously, it was a little tricky to work with – there is now a clean install available on github that can be built locally from the command line on Mac, Windows or linux. using the GNU ARM embedded toolchain and mbed-os.

I describe below a simple recipe to use this code with the STMicro DISCO-L072CZ-LRWAN1 evaluation board (pictured). The code can be simply adapted to run with the sx1272 mbed shield on STMicro Nucleo boards and there is also support for the RAKWireless RAK811 node.

1. Setup the GNU ARM embedded toolchain and install mbed-cli:

On a Mac – assuming python, git and brew are available:

brew update && brew upgrade
brew install gcc-arm-embedded
git clone https://github.com/ARMmbed/mbed-cli
cd mbed-cli
python setup.py install

check the install location of arm-none-eabi-gcc with
which arm-none-eabi-gcc

should be /usr/local/bin, so set path for mbed
mbed config -G ARM_PATH "/usr/local/bin"

2. Pull the example code from the mbed github and create the local mbed-os environment in the folder

git clone https://github.com/ARMmbed/mbed-os-example-lorawan.git
cd mbed-os-example-lorawan/
mbed deploy
mbed new .

3. Configure for your node
edit mbedapp.json to configure lora.device-eui, lora.application-eui, lora.application-key

4. compile and send to evaluation board (assumes there is only one ST-Link/Nucleo/DISCO board connected)
mbed compile -m DISCO_L072CZ_LRWAN1 -t GCC_ARM --flash

Any questions? Please get in touch…

Using node-red with ST NUCLEO L073RZ Sx1272

I have been working with the great LoRaWAN combo from STMicroelectronics – a low-cost dev board based on a ARM®32-bit Cortex®-M0+ CPU, coupled with the Sx1272 on an Arduino-compatible shield.

Using the online mbed compiler – https://developer.mbed.org/compiler/ , I modded the demo code – LoRaWAN-demo-72 – to add simple output to an OLED display – see attached photo.

My node-red install runs on a server hosted by https://www.scaleway.com/ that costs around €3/month. I designed a very simple activity monitor – the design of which may help others.

To the basic node-red install, I added node-red-contrib-ttn and node-red-dashboard.

file

The dashboard output looks like this:

file

Here is the node-red code:

[{"id":"cd89d617.a9d0e8","type":"function","z":"546def68.3e374","name":"Extract data","func":"count = {}\nrssi = {}\nsnr = {}\n\n//var b = new Buffer(msg.payload_raw);\n//count.payload = (b[1] << 8 | b[2]).toString();\n//var r = b[3] << 8 | b[4];\n//if ((r & 0x8000) > 0) {\n// r = r - 0x10000;\n//}\n//rssi.payload = r.toString();\n//snr.payload = (b[5]).toString();\n\ncount.payload = msg.counter;\n\nrssi.payload = msg.metadata.gateways[0].rssi;\nsnr.payload = msg.metadata.gateways[0].snr;\n\nreturn [count, rssi, snr];","outputs":"3","noerr":0,"x":230,"y":280,"wires":[["6de8dcb1.29b284"],["72787db7.d4bdf4","a262c4ea.068798"],["21f1441a.e028fc","e6796eca.3e2ec"]]},{"id":"6de8dcb1.29b284","type":"ui_text","z":"546def68.3e374","group":"3d90cd90.e1c9c2","order":7,"width":0,"height":0,"name":"txtCount","label":"Count","format":"{{msg.payload}}","layout":"row-spread","x":440,"y":220,"wires":[]},{"id":"72787db7.d4bdf4","type":"ui_text","z":"546def68.3e374","group":"3d90cd90.e1c9c2","order":5,"width":0,"height":0,"name":"txtRssi","label":"RSSI","format":"{{msg.payload}}","layout":"row-spread","x":430,"y":260,"wires":[]},{"id":"21f1441a.e028fc","type":"ui_text","z":"546def68.3e374","group":"3d90cd90.e1c9c2","order":6,"width":0,"height":0,"name":"txtSnr","label":"SNR","format":"{{msg.payload}}","layout":"row-spread","x":430,"y":340,"wires":[]},{"id":"69c26716.6f6598","type":"ui_text","z":"546def68.3e374","group":"3d90cd90.e1c9c2","order":1,"width":0,"height":0,"name":"txtDevice","label":"Device","format":"{{msg.dev_id}}","layout":"row-spread","x":440,"y":60,"wires":[]},{"id":"89e50c80.55a11","type":"ui_text","z":"546def68.3e374","group":"3d90cd90.e1c9c2","order":3,"width":0,"height":0,"name":"txtDataRate","label":"Data Rate","format":"{{msg.metadata.data_rate}}","layout":"row-spread","x":450,"y":140,"wires":[]},{"id":"d312c0a6.afb48","type":"ui_text","z":"546def68.3e374","group":"3d90cd90.e1c9c2","order":4,"width":0,"height":0,"name":"txtCodingRate","label":"Coding Rate","format":"{{msg.metadata.coding_rate}}","layout":"row-spread","x":460,"y":180,"wires":[]},{"id":"2065149f.497fbc","type":"ui_text","z":"546def68.3e374","group":"3d90cd90.e1c9c2","order":2,"width":0,"height":0,"name":"txtFrequency","label":"Freq.","format":"{{msg.metadata.frequency}}","layout":"row-spread","x":450,"y":100,"wires":[]},{"id":"a262c4ea.068798","type":"ui_chart","z":"546def68.3e374","name":"","group":"3d90cd90.e1c9c2","order":8,"width":0,"height":0,"label":"Signal Strength","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"-150","ymax":"0","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"x":460,"y":300,"wires":[[],[]]},{"id":"e6796eca.3e2ec","type":"ui_chart","z":"546def68.3e374","name":"SNR","group":"3d90cd90.e1c9c2","order":9,"width":0,"height":0,"label":"Signal:Noise Ratio","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"10","removeOlder":1,"removeOlderPoints":"500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"x":430,"y":380,"wires":[[],[]]},{"id":"7819848e.fd117c","type":"ttn uplink","z":"546def68.3e374","name":"unosx1272","app":"c7f29eb8.f2f1f","dev_id":"unosx1272","field":"","x":120,"y":60,"wires":[["cd89d617.a9d0e8","69c26716.6f6598","2065149f.497fbc","89e50c80.55a11","d312c0a6.afb48"]]},{"id":"3d90cd90.e1c9c2","type":"ui_group","z":"546def68.3e374","name":"unosx1272","tab":"a104b487.87dca8","order":2,"disp":true,"width":"6","collapse":false},{"id":"c7f29eb8.f2f1f","type":"ttn app","z":"","appId":"<app-id>","accessKey":"<app-key>","discovery":"discovery.thethingsnetwork.org:1900"},{"id":"a104b487.87dca8","type":"ui_tab","z":"546def68.3e374","name":"devices","icon":"dashboard"}]

 

Raspberry Pi Zero W – $10 Citrix endpoint? maybe not…

I received an email from The PiHut on Tuesday, ordered a Raspberry Pi Zero W and case. It arrived two days later – the case, for £6, is impressive; 1 base and 3 lids – one plain, one for camera and one for GPIO access. Note that the case also came with the short ribbon cable required to connect the standard Raspberry Pi camera.

The board is yet another technical marvel from the Pi team and the biggest question for me was how did they find board area to include the WiFi/bluetooth 2.4GHz antenna? It is all explained in this post: https://www.raspberrypi.org/magpi/pi-zero-w-wireless-antenna-design/ – it definitely works.

When starting up headless or remote, the issue always with the official raspbian distribution is the Catch 22 issue of how to configure WiFi without access to a console. One way is to connect a serial console on the GPIO ports; I chose a faster way – use a Micro SD card from an already-configured Pi Zero 😉 – loaded with raspian jessie pixel lite.

As an aside – an alternate linux distribution I often use for Raspberry Pi and other ARM boards comes from DietPI – the beauty of this is that there is a text file in the root of the image that can be edited to include your WiFi SSID and password.

So, the board and WiFi work as expected from my previous experience with the Pi Zero. Next step was to run it as a desktop with the full version of rasbian jessie pixel. Not having a bluetooth keyboard to hand, I decided to use my Logitech K400+ keyboard/trackpad combo, connected via a very useful OTG 4-port USB2.0 hub.

The result? Pixel desktop on a Pi Zero is really not very useful, with this YouTube video hammering the CPU @ 100% with stutter. Of course, the single core 1GHz CPU is the limiting factor and a GUI like Pixel needs the 4-core design of the Raspberry Pi 3 Model B.

However, The Pi Zero W is perfect for my current project, running as a controller for sub-1GHz FSK radio sensors, communicating via LwM2M, parsing the data and then uploading via LoraWAN to an AWS IoT gateway over GSM – if that very brief description has whetted your appetite, then wait for my next post!

 

 

RancherOS, a Docker Linux distro reaches v1.0

rancheros-docker-kernel

Rancher OS is a Linux distribution where components exist in Docker containers and provides a comprehensive container management platform. It is a distribution you should consider if you are into CoreOS and considering that Docker releases code every two months, why not use a platform based on your chosen container tech?

RancherOS is tiny – the install ISO is ~40MB. They say “…We wanted to run Docker directly on top of the Linux Kernel, and have all user-space Linux services be distributed as Docker containers. By doing this, there would be no need to use a separate software package distribution mechanism for RancherOS itself…” (http://rancher.com/rancher-os/).

Rancher supplies the entire software stack needed to manage containers in production and works well with all the usual suspects (Kubernetes, Mesos, Swarm). The Rancher solution provides orchestration, scheduling, app catalog and authentication – take a look here for detail (http://docs.rancher.com/rancher/latest/en/).

Rancher has pedigree; the team behind Rancher includes co-founder and CEO Sheng Liang, who was was CTO of the Cloud Platforms group at Citrix Systems after their acquisition of Cloud.com, where he was co-founder and CEO.

Is your Windows laptop/tablet feeling bloated?

bloatware

I really enjoyed the UK Citrix User Group meeting in London last week; great speakers, the chance to meet up with old friends and make new business connections.

One tip that came up was a free VMware tool that will optimize a Windows OS. Of course, their intention is for generating a sound base for gold images, but using it on limited-resource laptops can really help by removing unnecessary services and bloatware.

For example – a Lenovo IdeaPad Flex, purchased from the Amazon July sale last year. It has a Celeron CPU (N2840) @ 2.16GHz, 4GB RAM with the rotating HDD swapped out for a 240GB SSD and running Windows 10 64-bit Home edition The problem was, that just with the VMware vSphere client running, CPU was at 25-30% with memory at around 2.7GB used. CPU soared to 100% far too often when just launching and using one or two additional apps.

Goto https://labs.vmware.com/flings/vmware-os-optimization-tool and install on your trial laptop/tablet. Launch and let it do it’s thing. Now if you want to have a go (and have a system backup ready before you do this!) – on the Analyze tab, simply click Analyze and then Optimize. The tool will go through a series of processes; registry updates, features disable, simplify visual effects, scheduled tasks and services disable, apps remove, and so on. It’s a cathartic process as you will soon realize the amount of bloatware in the standard Windows image.

Note that the default optimize will turn off client firewall and this was re-enabled – for my peace of mind. The same scenario as above, running vSphere client now shows CPU usage of around 15-20% and memory usage of around 2GB. The other parameter to monitor would be network activity, as there will now be no Bing checking your weather/celebrity/sports news!

It is possible to pick and choose the optimization process through the tool’s dialog. Of course, it should be noted that the real use for this VMware utility applies equally well to generating optimized images for Citrix XenDesk – or Azure, etc.

The critical next step for software escrow

escrow

Software escrow provides a method where a 3rd-party holds a copy of key software source code in trust for a user in the event that the vendor goes bust, or ceases to comply with terms of their license agreement.

The traditional software release model

Most applications that have been around for a while were developed with a waterfall approach. Code updates were made as and when, or strategically due to competitive feature releases. Updates might be expected annually.

Agile development through SCRUM or kanban enabled releases to be made much more frequently – typically 3 or 4 times per year.

Applications used to be monolithic, running native code or Java on Windows or Unix OS. These apps would be run on each endpoint or on servers within the customer’s own datacenter.

The customer’s own IT admin team would evaluate each update and internally pilot before going live to users. They would take the responsibility for rollout and rollback in the event of issues.

Escrow coverage of code discretely released can be clearly and simply explained; copies of the source code for apps are made available for secure storage by a 3rd party, subject to terms of the escrow agreement. Updates must be allowed for and delivered into the storage solution for immediate access in the event of vendor failure.

The brave new world of SaaS

Software escrow companies currently offer assurance to speedily get up and running on an alternate SaaS platform provider, but the next step will be to cover dynamic code release offered through Continous Integration/Continuous Delivery (CI/CD).

Cloud-based delivery of applications in a SaaS model and, more importantly, CI/CD enables developers to merge updates through development, staging and production servers on a daily basis.

Potential customization of applications on a per-customer or regional basis is provided for by CI/CD.

Interdependence on other, cloud-based services and apps, together with 3rd-party developed libraries may also be included in the CI/CD model.

The software itself and associated libraries may be provided under a number of software agreements, commercial and open-source.

CI/CD allows rolling update across cloud servers and full history for rollback in the event of a code update failure/error.

Secure delivery into and recovery from escrow storage must make use of the same CI/CD solution, which may be dependent on key orchestration applications from a number of providers, such as Jenkins, Atlassian Bamboo, AWS CodeDeploy, Microsoft VSTS, etc.

IaaS – Infrastructure as a Service – checklist

IaaS

First – some simple definitions:

SaaS – applications running in the cloud, e.g. SFDC, Office365, Google Apps. Storage resource, such as Box, DropBox, iCloud

PaaS – computing resource where provider manages server hardware & networking. Users can develop & deliver apps on a scalable, virtualized platform

IaaS – self-provisioned deployment of servers, storage & network. Automated full control of dedicated resources via console or API

Now to decide if this is the right time for an IT transformation strategy in your business:

  • Reduction in CapEx and OpEx
  • Move IT staff from admin to business-facing needs
  • Be more flexible & responsive
  • Faster to stand up new business tools
  • More able to handle activity peaks on critical processes
  • Repurpose server/storage/network on demand
  • Reduce power consumption
  • Decrease need for cooling

Replace your existing diverse server/storage/network solution that is expensive to manage, maintain and upgrade with a fully definable infrastructure on-demand that provides:

  • Clearly-defined costs
  • Current technology
  • Reduced space, power, cooling required
  • Reduced need for dedicated IT admin
  • Full control over resource – no “noisy neighbours”
  • Dedicated hardware
  • Availability on-demand to handle peak requirements easily
  • Easily definable resource for PaaS, SaaS
  • Automated deployment, resilience, scalability & backup
  • Close control over capacity planning & operation
  • All controlled via dashboard and API, easing automation

The extra issue for your enterprise may relate to personal data privacy and potential veto of 3rd-party cloud storage. If so, make IaaS work for you in your datacenter with solutions from:

Cisco, EMC, Oracle, Nutanix, NetApp, HP, SimpliVity, etc.

For more information, here is a link to the 2015 Gartner MQ for Integrated Systems report:

https://www.gartner.com/doc/reprints?id=1-2LFEWKU&ct=150819&st=sb

IoT server development with MeteorKitchen & Cloud9

c9-mk

Once the sensors are in place and your board is publishing data to an MQTT broker, the next steps are to aggregate, display and action. I recommend you try a free account with cloud9 (https://c9.io/c/mdINlHY8cba) and developing in YAML (https://en.wikipedia.org/wiki/YAML) with MeteorKitchen (http://www.meteorkitchen.com/).

From Wikipedia:- “Meteor, or MeteorJS, is a free and open-source JavaScript web framework written using Node.js. Meteor allows for rapid prototyping and produces cross-platform (web, Android, iOS) code. It integrates with MongoDB and uses the Distributed Data Protocol and a publish–subscribe pattern to automatically propagate data changes to clients without requiring the developer to write any synchronization code. On the client, Meteor depends on jQuery and can be used with any JavaScript UI widget library.”

From MeteorKitchen website:- “Meteor Kitchen” is a code generator for Meteor.js. Just describe your application in a simple JSON file and let meteor-kitchen build a complete Meteor application for you. I looked at this and saw that MeteorKitchen also works with YAML and I found this to be a revelation – web development by definition, not having to worry about javascript syntax – you have to try it for yourself!

Cloud9 offers hosted workspaces pre-configured for many common programming platforms and I chose Node.js. Right there in your browser you will see a fully-functional IDE running within a configured Ubuntu instance. In my C9 workspace console I installed Meteor, MeteorKitchen and JSON-YAML parser:

curl https://install.meteor.com/ | sh
curl http://www.meteorkitchen.com/install | /bin/sh
npm install -g js-yaml

There are many examples shown in MeteorKitchen, but as we are discussing IoT, lets take a look at:

https://github.com/perak/kitchen-examples/blob/master/example-iot/example-iot.yaml

The result? – a working reactive web app showing live sensor data, written in 44 lines of code. Enough said, go try!

Samsung IoT platform – wireless everything!

artik5-dev

Samsung recently announced their dev kit for Artik 5 IoT devices. In stock at Digi-Key, priced at £70 and delivered in 3 days. Note that the pic above shows the whole dev kit – Artik 5 is the plug-in board located left of centre. Artik 5 provides ARM7 dual-core CPU @ 1GHz, 512MB LPDDR3 + 4GB eMMC. The module is well-connected wirelessly with WiFI, BLE 4.1 and ZigBee. In addition, there is LoRa (SigFox) and Z-Wave hardware installed on the dev board. To ease development, Arduino connectors and libArduino enable simple prototyping with the Arduino IDE. The eMMC comes with Fedora 22 installed and it took me 30 mins to register on https://developer.artik.io/ configure WiFi and run htop:

Also built-in to the dev board are USB console, MicroSD, audio, 2nd USB port, JTAG, Secure Element – TEE (TrustZone), LiPo battery support and connectors for camera and 480×800 display.

This has to be the most flexible, low-cost and productive way to learn and develop IoT wireless solutions in your favourite coding language – top marks to Samsung! – available here: http://www.digikey.co.uk/product-search/en?keywords=artik