<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>alecu</title>
    <description>Retrofuturismo con alecu</description>
    <link>http://alecu.protocultura.net/</link>
    <atom:link href="http://alecu.protocultura.net/feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Sat, 14 May 2022 03:30:22 +0000</pubDate>
    <lastBuildDate>Sat, 14 May 2022 03:30:22 +0000</lastBuildDate>
    <generator>Jekyll v3.9.2</generator>
    
      <item>
        <title>Playing with Arduino, Raspberry Pi2, Snappy Ubuntu Core, Webgl and Websockets</title>
        <description>&lt;p&gt;This is my demo of how you can use your device running the snappy Ubuntu Core to gather data from an Arduino connected to some specific piece of hardware, and how to use that to update a browser in real time via WebSockets.&lt;/p&gt;

&lt;p&gt;tl;dr, here’s the demo video:&lt;/p&gt;

&lt;iframe width=&quot;853&quot; height=&quot;480&quot; src=&quot;https://www.youtube.com/embed/MSEjZq_Qp6M?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt; &lt;/iframe&gt;

&lt;p&gt;A few months ago I got the Orange Matchbox that I intended to use for my work on the snappy scope, but almost immediately I got moved to some more urgent tasks. Kyle took over that, and ended up producing this awesome video.
My orange matchbox sat on my desk accusingly. I started to shop for ideas on how to use it, and learn about snappy and snapcraft on the process. I decided that it would be fun to use the MinIMU-9 module I have on my hackerspace box. The MinIMU-9 module is a wonderful little thing that holds an accelerometer, a gyroscope, and a magnetometer, all easily accessible via I²C.
So I needed to find a way to somehow show these values in a 3d scene. And since Internet-of-Things devices usually need to show the data they collect in a browser, I figured it would be nice to use webgl and websockets.
After some research I ended up deciding that webgl was too low level, and that something sitting on top like three.js would be much easier. And looking at the page with three.js samples, I got immediately drawn to the “minecraft”-like example. There, I got the base for my demo.
I spent some time trying to write a MinIMU-9 driver using the raspi’s I²C gpio pins, but it was too much hassle, a decided instead to reuse as much as possible for this demo. So I put an arduino in the middle, because the arduino code to convert the I²C data into proper pitch, yaw, roll values is already there, and there’s code to connect to a serial port via websockets available too, so I would only need some tuning.
I ended up doing some changes to the three.js minecraft demo so it would connect via websockets to the raspi’s serial port, and adjust the camera in the scene with the 3d values provided by the MinIMU-9. Also a very tiny change in the code in the Arduino so my “move forward” button would be sent together with the 3d data. And finally, I added a bit of code to the serial-port-json-server so it would serve the html and js files of the modified minecraft demo. Here’s the wiring diagram I used:&lt;/p&gt;

&lt;p&gt;The other part was figuring out the best way to build all of that into a snap package, and get it into the raspi2. There were some back and forths, but it was mostly painless.
I’ve made a few further posts with some details on some of those steps:&lt;/p&gt;

&lt;h4 id=&quot;-how-to-boot-a-raspberry-pi-2-with-the-snappy-ubuntu-core&quot;&gt;● &lt;a href=&quot;/snappy/raspi/2015/11/16/snappy-on-raspi2/&quot;&gt;How to boot a Raspberry Pi 2 with the snappy Ubuntu Core&lt;/a&gt;&lt;/h4&gt;

&lt;h4 id=&quot;-how-to-set-up-snapcraft-inside-a-container-running-on-ubuntu-core&quot;&gt;● &lt;a href=&quot;/snappy/raspi/snapcraft/2015/11/17/snappy-lxc-snapcraft/&quot;&gt;How to set up snapcraft inside a container running on Ubuntu Core&lt;/a&gt;&lt;/h4&gt;

&lt;h4 id=&quot;-how-i-built-the-snap-packages-for-my-snappy-demo-using-snapcraft&quot;&gt;● &lt;a href=&quot;/snappy/raspi/snapcraft/2015/11/18/snappy-build-snapcraft/&quot;&gt;How I built the snap packages for my snappy demo using snapcraft&lt;/a&gt;&lt;/h4&gt;

&lt;h4 id=&quot;-my-first-snapcraftyaml&quot;&gt;● &lt;a href=&quot;/snappy/raspi/snapcraft/2015/11/19/my-first-snapcraft-yaml/&quot;&gt;My first snapcraft.yaml&lt;/a&gt;&lt;/h4&gt;

</description>
        <pubDate>Fri, 20 Nov 2015 10:00:00 +0000</pubDate>
        <link>http://alecu.protocultura.net/snappy/arduino/raspi/webgl/websockets/2015/11/20/ubuntu-core-demo/</link>
        <guid isPermaLink="true">http://alecu.protocultura.net/snappy/arduino/raspi/webgl/websockets/2015/11/20/ubuntu-core-demo/</guid>
        
        
        <category>snappy</category>
        
        <category>arduino</category>
        
        <category>raspi</category>
        
        <category>webgl</category>
        
        <category>websockets</category>
        
      </item>
    
      <item>
        <title>My first snapcraft.yaml</title>
        <description>&lt;p&gt;Here’s the snapcraft.yaml file for my demo project:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;minecraft-minimu9&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;vendor&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Alejandro J. Cura &amp;lt;alecu@protocultura.net&amp;gt;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;summary&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;webgl + websockets + MinIMU-9 demo&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;This demo gets data from a MinIMU-9 via websockets, and uses that data to interact with a three.js scene&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;icon.png&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;serial-port-json-server&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;bin/serial-port-json-server&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;parts&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;spjs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;plugin&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;go&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;git://github.com/alecu/serial-port-json-server&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;filesets&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;spjs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;bin/serial-port-json-server&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;snap&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$spjs&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;glue&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;plugin&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;copy&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;html&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;There’s very little boilerplate in the form of summary, description, icon, vendor, and after that there are the interesting sections like “parts” and “services”.
I defined two parts: “spjs” and “glue”.
“spjs” is the serial-port-json-server, a go project that provides a way for a browser to communicate via websockets with a serial port on the server. I’ve forked it with a very small change to make it also serve html files from a folder on the server. Snapcraft will fetch this other repo for serial-port-json-server, will build this as a binary, and add it to the fileset of files to put inside the snap package.
“glue” uses the “copy” snapcraft plugin to copy my html folder into the snap. This folder contains a copy of the “minecraft” demo from three.js, slightly adapted so it no longer accepts input from the mouse and keyboard, and instead it uses a websocket connection to the server, to read the serial port via spjs, and get the serial data from the lines outputted by the MinIMU-9 attached to the Arduino attached to the raspi. Then it processes the pitch-yaw-roll info in the serial lines, and adjusts the 3d camera accordingly, and uses the data from the button pushes in order to move or stay still.
Finally, the “services” section specifies that the serial-port-json-server should be managed by snappy as a system service, so it gets started on boot, and restarted if it ever crashes.&lt;/p&gt;

&lt;hr /&gt;
&lt;p&gt;This post is part 5 in a series of posts on how to get started writting IoT apps for the snappy Ubuntu Core.&lt;/p&gt;

</description>
        <pubDate>Thu, 19 Nov 2015 10:00:00 +0000</pubDate>
        <link>http://alecu.protocultura.net/snappy/raspi/snapcraft/2015/11/19/my-first-snapcraft-yaml/</link>
        <guid isPermaLink="true">http://alecu.protocultura.net/snappy/raspi/snapcraft/2015/11/19/my-first-snapcraft-yaml/</guid>
        
        
        <category>snappy</category>
        
        <category>raspi</category>
        
        <category>snapcraft</category>
        
      </item>
    
      <item>
        <title>How I built the snap packages for my snappy demo using snapcraft</title>
        <description>&lt;p&gt;Inside the lxc container, let’s switch to the “ubuntu” user, and clone my git repo:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;root@my-ubuntu:~#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;su &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; ubuntu
&lt;span class=&quot;gp&quot;&gt;ubuntu@my-ubuntu:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;git clone https://github.com/alecu/minecraft-minimu9.git
&lt;span class=&quot;go&quot;&gt;Cloning into 'minecraft-minimu9'...
remote: Counting objects: 30, done.
remote: Total 30 (delta 0), reused 0 (delta 0), pack-reused 30
Unpacking objects: 100% (30/30), done.
Checking connectivity... done.
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;ubuntu@my-ubuntu:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;minecraft-minimu9
&lt;span class=&quot;gp&quot;&gt;ubuntu@my-ubuntu:~/minecraft-minimu9$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The repository contains a snapcraft.yaml file, that tells snapcraft what steps are needed to build it.
Let’s try that:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;ubuntu@my-ubuntu:~/minecraft-minimu9$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;snapcraft
&lt;span class=&quot;go&quot;&gt;Pulling glue 
Building glue 
cp --preserve=all -R html /home/ubuntu/minecraft-minimu9/parts/glue/install/html
Staging glue 
Snapping glue 
Pulling spjs 
env GOPATH=/home/ubuntu/minecraft-minimu9/parts/spjs/build go get -t -d github.com/alecu/serial-port-json-server
Building spjs 
env GOPATH=/home/ubuntu/minecraft-minimu9/parts/spjs/build go build github.com/alecu/serial-port-json-server
env GOPATH=/home/ubuntu/minecraft-minimu9/parts/spjs/build go install github.com/alecu/serial-port-json-server
env GOPATH=/home/ubuntu/minecraft-minimu9/parts/spjs/build cp -a /home/ubuntu/minecraft-minimu9/parts/spjs/build/bin /home/ubuntu/minecraft-minimu9/parts/spjs/install
Staging spjs 
Snapping spjs 
Generated 'minecraft-minimu9_1_armhf.snap' snap
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;ubuntu@my-ubuntu:~/minecraft-minimu9$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will produce a minecraft-minimu9_1_armhf.snap file that we can install in the base system, like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;snappy &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--allow-unauthenticated&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;~/my-ubuntu-home/minecraft-minimu9/minecraft-minimu9_1_armhf.snap 
&lt;span class=&quot;go&quot;&gt;Installing /home/ubuntu/my-ubuntu-home/minecraft-minimu9/minecraft-minimu9_1_armhf.snap
2015/11/14 04:51:20.191703 verify.go:85: Signature check failed, but installing anyway as requested
Name              Date       Version      Developer 
ubuntu-core       2015-11-13 3            ubuntu    
lxd               2015-11-14 0.21-1       stgraber  
minecraft-minimu9 2015-11-14 IFTYLfgMVOad sideload  
webdm             2015-11-13 0.9.4        canonical 
pi2               2015-11-13 0.16         canonical 
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Since it’s trying to access the serial port, and everything under snappy runs confined, we can give access to the package like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;snappy hw-assign minecraft-minimu9.sideload &lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;/dev/ttyACM0
&lt;span class=&quot;go&quot;&gt;'minecraft-minimu9.sideload' is now allowed to access '/dev/ttyACM0'
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And with that we have our snap package installed, running and able to access the hardware port.&lt;/p&gt;

&lt;p&gt;We can try our demo by pointing a browser at port 8989 of the raspbi’s IP address, eg: http://192.168.1.131:8989/ and we should see something like this:&lt;/p&gt;

&lt;hr /&gt;
&lt;p&gt;This post is part 4 in a series of posts on how to get started writting IoT apps for the snappy Ubuntu Core.&lt;/p&gt;

</description>
        <pubDate>Wed, 18 Nov 2015 10:00:00 +0000</pubDate>
        <link>http://alecu.protocultura.net/snappy/raspi/snapcraft/2015/11/18/snappy-build-snapcraft/</link>
        <guid isPermaLink="true">http://alecu.protocultura.net/snappy/raspi/snapcraft/2015/11/18/snappy-build-snapcraft/</guid>
        
        
        <category>snappy</category>
        
        <category>raspi</category>
        
        <category>snapcraft</category>
        
      </item>
    
      <item>
        <title>How to set up snapcraft inside a container running on Ubuntu Core</title>
        <description>&lt;p&gt;You can set up snapcraft on your PC with Ubuntu, and you’ll be able to compile and build snap packages there, but you won’t be able to run them on the snappy Ubuntu Core running on your Raspi2, because the hardware architecture is not the same. Apps that go into your snap need to be compiled for the ARM cpu in the raspi.&lt;/p&gt;

&lt;p&gt;The best option I found for this is installing a full Ubuntu inside a container running on top of my Ubuntu Core in the raspi, and to install snapcraft there. Here’s how you can do it:&lt;/p&gt;

&lt;p&gt;First you need to install the lxd container hypervisor, and import an Ubuntu image:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;snappy &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;lxd
&lt;span class=&quot;go&quot;&gt;Installing lxd
Starting download of lxd
22.32 MB / 22.32 MB [=========================================] 100.00 % 947.18 KB/s 
Done
Starting download of icon for package
24.52 KB / 24.52 KB [==========================================] 100.00 % 101.03 KB/s 
Done
Name        Date       Version Developer 
ubuntu-core 2015-11-13 3       ubuntu    
lxd         2015-11-14 0.21-1  stgraber  
webdm       2015-11-13 0.9.4   canonical 
pi2         2015-11-13 0.16    canonical 
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;lxd-images import ubuntu &lt;span class=&quot;nt&quot;&gt;--alias&lt;/span&gt; ubuntu
&lt;span class=&quot;go&quot;&gt;Downloading the GPG key for http://cloud-images.ubuntu.com
Validating the GPG signature of /tmp/tmpej4uv_fz/download.json.asc
Downloading the image.
Image manifest: http://cloud-images.ubuntu.com/server/releases/trusty/release-20151105/ubuntu-14.04-server-cloudimg-armhf.manifest
Image imported as: 2dbddcb92196b9f74dad7d7cc6e27b4267e6c96062ed1f6f9abc19e5cbdf058d
Setup alias: ubuntu
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;lxc image list images
&lt;span class=&quot;go&quot;&gt;Generating a client certificate. This may take a minute...
If this is your first run, you will need to import images using the 'lxd-images' script.
For example: 'lxd-images import ubuntu --alias ubuntu'.
+--------+--------------+--------+------------------------------------+--------+----------+------------------------------+
| ALIAS  | FINGERPRINT  | PUBLIC |            DESCRIPTION             |  ARCH  |   SIZE   |         UPLOAD DATE          |
+--------+--------------+--------+------------------------------------+--------+----------+------------------------------+
| ubuntu | 2dbddcb92196 | no     | Ubuntu 14.04 LTS server (20151105) | armv7l | 111.25MB | Nov 14, 2015 at 1:53am (UTC) |
+--------+--------------+--------+------------------------------------+--------+----------+------------------------------+
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;lxc launch ubuntu my-ubuntu
&lt;span class=&quot;go&quot;&gt;Creating my-ubuntu done.
Starting my-ubuntu done.
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;With that you’ll have an old-style Ubuntu running inside the container, where you can install every deb package that exists. We now need to get a shell into the container, to be able to install snapcraft and any other thing we may need:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;lxc &lt;span class=&quot;nb&quot;&gt;exec &lt;/span&gt;my-ubuntu &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; /bin/bash
&lt;span class=&quot;gp&quot;&gt;root@my-ubuntu:~#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We’ll try installing snapcraft from the snappy-dev/tools ppa:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;root@my-ubuntu:~#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;add-apt-repository ppa:snappy-dev/tools
&lt;span class=&quot;go&quot;&gt; Official PPA for the Snappy related tools.
 More info: https://launchpad.net/~snappy-dev/+archive/ubuntu/tools
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmp0c21putu/secring.gpg' created
gpg: keyring `/tmp/tmp0c21putu/pubring.gpg' created
gpg: requesting key FC42E99D from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp0c21putu/trustdb.gpg: trustdb created
gpg: key FC42E99D: public key &quot;Launchpad PPA for Snappy Developers&quot; imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;root@my-ubuntu:~#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;apt-get update
&lt;span class=&quot;go&quot;&gt;Get:1 http://ppa.launchpad.net trusty InRelease [16.0 kB]
Get:4 http://ppa.launchpad.net trusty/main Translation-en [2426 B]             
[…]
Fetched 10.3 MB in 53s (191 kB/s)                                              
Reading package lists... Done
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;root@my-ubuntu:~#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;snapcraft
&lt;span class=&quot;go&quot;&gt;Reading package lists... Done
Building dependency tree       
Reading state information... Done
[...]
The following NEW packages will be installed:
  binutils build-essential bzr cpp cpp-4.8 dpkg-dev fakeroot fontconfig-config
[...]
0 upgraded, 116 newly installed, 0 to remove and 9 not upgraded.
Need to get 48.5 MB of archives.
After this operation, 178 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com/ubuntu-ports/ trusty-updates/main libasan0 armhf 4.8.4-2ubuntu1~14.04 [56.8 kB]
[...]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;It will take some time installing every package in the lxc inside the raspi, but when done we’ll have all the tools there to build snap packages.&lt;/p&gt;

&lt;p&gt;I suggest an extra step, to be able to easily retrieve files built in the lxc container. So starting in the Ubuntu Core prompt, let’s create a link to the home folder inside the container root filesystem:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /var/lib/apps/lxd/current/lxd/containers/my-ubuntu/rootfs/home/ubuntu/ ~/my-ubuntu-home&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;With that we’ll be able to access any file created inside the container with the shortcut &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/my-ubuntu-home&lt;/code&gt;&lt;/p&gt;

&lt;hr /&gt;
&lt;p&gt;This post is part 2 in a series of posts on how to get started writting IoT apps for the snappy Ubuntu Core.&lt;/p&gt;

</description>
        <pubDate>Tue, 17 Nov 2015 10:00:00 +0000</pubDate>
        <link>http://alecu.protocultura.net/snappy/raspi/snapcraft/2015/11/17/snappy-lxc-snapcraft/</link>
        <guid isPermaLink="true">http://alecu.protocultura.net/snappy/raspi/snapcraft/2015/11/17/snappy-lxc-snapcraft/</guid>
        
        
        <category>snappy</category>
        
        <category>raspi</category>
        
        <category>snapcraft</category>
        
      </item>
    
      <item>
        <title>How to boot a Raspberry Pi 2 with the snappy Ubuntu Core</title>
        <description>&lt;p&gt;Get the Ubuntu Core image from: &lt;a href=&quot;http://cdimage.ubuntu.com/ubuntu-snappy/15.04/stable&quot;&gt;http://cdimage.ubuntu.com/ubuntu-snappy/15.04/stable&lt;/a&gt;.
You want a file named like: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ubuntu-15.04-snappy-armhf-raspi2.img.xz&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You need to write that as an image into your SD card, so you need either a computer with an SD slot, or an external SD card reader. The Raspberry Pi homepage has &lt;a href=&quot;https://www.raspberrypi.org/documentation/installation/installing-images/&quot;&gt;very nice instructions&lt;/a&gt; on how to do it from several operating systems.&lt;/p&gt;

&lt;p&gt;When done you can put that SD card into your Raspberry Pi 2 and power it on. Make sure to plug it also to an ethernet cable that’s connected to your router.&lt;/p&gt;

&lt;p&gt;It will take a minute or two to boot. Once booted you’ll be able to login by connecting the raspi to a tv or monitor and a keyboard. Or, you can use ssh, but you’ll first need to know the IP address. To do that, try using the “webdm.local” address, like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;alecu@bollo:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;getent hosts webdm.local
&lt;span class=&quot;go&quot;&gt;192.168.1.131   webdm.local&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If that doesn’t work, try installing the nmap package and searching your network for a host with ssh enabled:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;alecu@bollo:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;nmap &lt;span class=&quot;nt&quot;&gt;-p22&lt;/span&gt; 192.168.1.0/24
&lt;span class=&quot;go&quot;&gt;
Starting Nmap 6.47 ( http://nmap.org ) at 2015-11-13 20:00 ART
Nmap scan report for OpenWrt.lan (192.168.1.1)
Host is up (0.00050s latency).
PORT   STATE SERVICE
22/tcp open  ssh

Nmap scan report for 192.168.1.131
Host is up (0.00044s latency).
PORT   STATE SERVICE
22/tcp open  ssh

Nmap scan report for 192.168.1.154
Host is up (0.000090s latency).
PORT   STATE SERVICE
22/tcp open  ssh

Nmap done: 256 IP addresses (3 hosts up) scanned in 3.04 seconds&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Once you’ve found the address, you can ssh into it, using “ubuntu” as both the username and password:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;alecu@bollo:~$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;ssh ubuntu@192.168.1.131
&lt;span class=&quot;go&quot;&gt;ubuntu@192.168.1.131's password: ******
Welcome to Ubuntu 15.04 (GNU/Linux 4.2.0-1014-raspi2 armv7l)

 * Documentation:  https://help.ubuntu.com/
Welcome to snappy Ubuntu Core, a transactionally updated Ubuntu.

 * See https://ubuntu.com/snappy

It's a brave new world here in snappy Ubuntu Core! This machine
does not use apt-get or deb packages. Please see 'snappy --help'
for app installation and transactional updates.

Last login: Fri Nov 13 22:37:16 2015 from 192.168.1.154
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;To run a command as administrator (user &quot;root&quot;), use &quot;sudo &amp;lt;command&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;.
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;See &quot;man sudo_root&quot; for details.

&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;(RaspberryPi2)ubuntu@localhost:~$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;hr /&gt;
&lt;p&gt;This post is part 1 in a series of posts on how to get started writting IoT apps for the snappy Ubuntu Core.&lt;/p&gt;

</description>
        <pubDate>Mon, 16 Nov 2015 10:00:00 +0000</pubDate>
        <link>http://alecu.protocultura.net/snappy/raspi/2015/11/16/snappy-on-raspi2/</link>
        <guid isPermaLink="true">http://alecu.protocultura.net/snappy/raspi/2015/11/16/snappy-on-raspi2/</guid>
        
        
        <category>snappy</category>
        
        <category>raspi</category>
        
      </item>
    
      <item>
        <title>РЕФЛЕКТОР (reflektor) en el Museo del Juguete San Isidro</title>
        <description>&lt;p&gt;This is a video of my first electromechanical game, being presented in the Toy Museum in San Isidro (Buenos Aires):&lt;/p&gt;

&lt;iframe width=&quot;640&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/e7ipcoS6vwA?rel=0&amp;amp;showinfo=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt; &lt;/iframe&gt;

&lt;p&gt;You need to precisely align some mirrors that will allow you to reflect the laser to the goal, but only after solving some puzzles and traps, and you need to do it before time runs out. It’s inspired by a game by Costa Panayi called &lt;a href=&quot;https://en.wikipedia.org/wiki/Deflektor&quot;&gt;Deflektor&lt;/a&gt;, that I used to play in the eighties on a CZ Spectrum.&lt;/p&gt;

&lt;p&gt;Reflektor was made using an Arduino board for the game logic, another Arduino board plus an Adafruit &lt;a href=&quot;https://www.adafruit.com/products/94&quot;&gt;Wave Shield&lt;/a&gt; for the music, a custom board with 74HC595 and L293D chips to drive some stepper motors taken from old floppy drives and printers, an old gutted radio for the controls and speaker, and some random recycled waste. Oh, and a green laser, a smoke machine and some mirrors. It’s all held together by some plywood and a lot of pre-1960’s red and green Meccano pieces.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://github.com/clubdejaqueo/reflektor&quot;&gt;schematics and source code&lt;/a&gt; are available in case you want to build your own. Feel free to contact me with any questions or if you’d like to bring it to your event.&lt;/p&gt;

&lt;p&gt;Here are some &lt;a href=&quot;https://www.flickr.com/photos/alecu/albums/72157635917885536/with/9952299495/&quot;&gt;nicer pictures&lt;/a&gt; of РЕФЛЕКТОР.&lt;/p&gt;

</description>
        <pubDate>Sun, 22 Sep 2013 10:00:00 +0000</pubDate>
        <link>http://alecu.protocultura.net/arduino/electromechanical/games/reflektor/2013/09/22/reflektor/</link>
        <guid isPermaLink="true">http://alecu.protocultura.net/arduino/electromechanical/games/reflektor/2013/09/22/reflektor/</guid>
        
        
        <category>arduino</category>
        
        <category>electromechanical</category>
        
        <category>games</category>
        
        <category>reflektor</category>
        
      </item>
    
  </channel>
</rss>
