Werner Almesberger | 30 Mar 22:44 2015

Anelok: UI walk-through, authentication idea, better timing, power-saving

Assorted updates:

I made a first attempt at implementing the account display. It doesn't
look particularly pretty yet but it's a start. Here is a walk-through
of Anelok's current menu hierarchy:


We start with a dark screen. Pressing "middle" brings up the logo and
releasing the sensor again leads us to the login screen. As long as
there is no input, the "setup" icon is shown. Pressing "top" leads to
the login-setup menu, which contains left/right switching, the
firmware build version, the device ID, the status of the radio chip,
and a few more technical items. (Note: all this is from the simulator.
IDs are different on the real device.)

Entering the correct pattern at the login screen leads to the account
selection list. Once more, there is a setup option, which at the
moment leads to a dummy menu. Try to select anything, and out comes
the apologetic ghost. That ghost also appears at many more places
where the respective next screen hasn't been implemented yet.

Selecting an account shows more detailed information: the account
name, a URL (or similar), the user/login name, and the password. Right
now, all this is pretty uniform but there could of course be more

I show two example accounts, a quite generic account ("Mail"), and one
where the password isn't shown ("e-Bank"). When scrolling down to the
password and pressing "middle" (see the eye icon), the password is
(Continue reading)

Werner Almesberger | 29 Mar 17:13 2015

Anelok: revisiting the migration from gitorious

I'm still trying to make up my mind whether Anelok's new home shall
be GitHub or GitLab. I looked for side-by-side comparisons, and they
all suggest that there's virtually no difference in terms of

Those who chose GitLab over GitHub usually did so because they needed
private (i.e., without public access) repos and GitHub (where you have
to pay for any private repos) was getting too expensive.

Virtually all who mention GitLab are running a local version, be it
for the cost issue or be it just because they don't want to depend on
a third party for the service.



Those who chose GitHub over GitLab usually did so because they found
that running their local installation and keeping up with the
frequent updates was too much of an effort.



For Anelok, running a local copy is not on the radar at the moment.
Instead, a reliable - both in terms of day to day operation as in
the longer-term viability - "cloud" service is important.
(Continue reading)

Werner Almesberger | 28 Mar 04:40 2015

Anelok: energy efficiency, second steps

This time I tackled the wasteful touch sensor:


"display off in ui_off" is where we left off the last time, with an
average standby current of about 6.7 mA.

"use msleep also in init_cal" eliminates the last bastion of mdelay,
the touch sensor calibration. Anelok now takes little naps between

So far, so good, but it still busy-waits while the touch sensor
controller is sampling. So this was next. This involved a bit of
infrastructure work, e.g., teaching the firmware how to handle
interrupts (unexpectedly painless), and deepening my understanding of
how wakeups from a deep sleep are handled in this processor (that took
a while. See fw/plat/sleep.c for details.)

"deep-sleep while waiting for TSI" shows the result of all this: the
MCU now spends most of its time in deep sleep while in standby.
Standby current is down to 0.9 mA, most of which should now be the
boost converter.

One unexpected side-effect of all this is that the calibration seems
to take about twice as long as before. Not sure why. Deep sleep itself
should only add about 1 ms to the whole process, but this difference
is much longer. To be investigated later.

- Werner

(Continue reading)

Werner Almesberger | 27 Mar 00:03 2015

Anelok: energy efficiency, first steps

After the not-so-good-looking power consumption I measured after
the rework, I now tried to bring it down a little by improving the
firmware. What follows are a few easy modifications.

To see the effect of a change, I ran a script that powers
Anelok, lets it boot and enter "standby" mode, then cuts power
again. During all this, it measures the current consumption with
a multimeter.

The multimeter (Fluke 8845A) is not nearly as fast as an
oscilloscope, so the time resolution is limited and short spikes
may appear smaller than they really are.

The script repeats each test five times. Here are the results:


Step 0: the lay of the land

"git ac435a21": is the situation with the original code. Let's
examine a typical sequence:

8.1 s: power from the lab supply is switched on. The supply
  (Hola DP-1805A) is set to 2.4 V, current limited to 100 mA.
  The switching is done by labsw (using relays).

  The boot loader waits for USB to appear. It is not every
  power-efficient at this (it busy-waits) and draws about 9.1 mA.
  Eventually, it gives up and ...
(Continue reading)

Werner Almesberger | 25 Mar 08:03 2015

Anelok: power supply rework results

I compared the Anelok board that had the boost converter rework
with the one that didn't. I used a fairly elaborate setup for this,
with lab power supply, meter, scope, another meter, and all this
lovingly interwoven by a ragtag collection of all sorts of cables.

We'll get to the problems this setup caused later. First the results:

Voltage	Board behaviour
(V)	original	reworked
-------	---------------	---------------
3.0	ok		ok
2.6	ok		ok
2.5	display errors	ok
2.4	turned off	ok
1.9	-		ok
1.8	-		unstable

The operation I tried was to have Anelok sit at the setup menu, and
then I scrolled up and down.

"Unstable" here means that the display brightness oscillated and
that the board reset / hung when scrolling.

What's good is that the rework greatly improved the minimum voltage
at which the board would work, i.e., 1.9 V instead of 2.6 V.

However, 1.9 V is still pretty high and when looking at my voltage
measurements, I saw that what really arrived at the end of the
(Continue reading)

Werner Almesberger | 17 Mar 19:15 2015

Anelok: look what the cat brought in !

It's a dead battery !


1047 hours is pretty close to the theoretical 1077 I calculated
from the nominal capacity Sony publish and the guesstimated age
of the cell.

I also checked the resistor: my meter reads 14.886 kOhm at about
32 C. That's within 1% of the nominal value of 15 kOhm.

So the battery did perform pretty much according to expectations.
What I didn't expect was that it would drop relatively quickly to
2.8 V and make its stance there, instead of remaining closer to
2.9 V for a while.

And I now also have a clearer idea of how temperature affects
these cells.

Now that the multimeter is free again, I can finally begin to
test operation on battery power. I already reworked one of my
boards and it is still happy, at least on USB power.

As a reminder, this is the the rework plan:

This is what the cuts look like:

This time I used my Dremel with a small endmill, 12 mil diameter,
(Continue reading)

Werner Almesberger | 14 Mar 02:02 2015

Re: Anelok: the end is near ! (3x)

cristian paul peƱaranda rojas wrote:
> Not github big fan, but you could consider bitbucket as they support
> git as well.

Hmm, "FREE FOR 5 USERS", and
clarifies that "Free private repositories are limited to 5 users".
That sounds rather confining.

> For the mcu, well... What alternatives you have un mind for the long term?

Once I've had earmarked for a long while already is the STM32
line. They're not as well-positioned with small QFN packages
as their Kinetis counterparts, but that could be solved by
going to BGA.

Another one I recently discovered is the Atmel SAM D21 line.
They look pretty similar to the Kinetis KL series, except that
they lack a USB voltage regulator (that kinda sucks) and the
security concept looks a bit odd (maybe I misunderstood some

There may be others, e.g, in the NXP LPC series.

In general, I consider it desirable to be able to quickly
switch chips. E.g, if some severe issue is found, if there is
a security problem, etc. So futher down the road, when the
project (hopefully) has more resources, I would want to have
multiple design variants in a state from which they could
quickly be turned into actual products.
(Continue reading)

Werner Almesberger | 13 Mar 04:46 2015

Anelok: the end is near ! (3x)

1) The battery's end is near. Finally !

It has now dropped below 2.65 V and it looks as if it shouldn't have
more than about 200 hours left before hitting 2 V. I think I'll free
it from its misery a little sooner, though.

Here is a sightly different plot:

This shows the battery voltage by the hour of the day. As one can
see, it's coldest around 7 am (11 UTC) and hottest a bit after 6 pm.

2) Freescale are being eaten by NXP


Given that NXP also have a strong like of MCUs that directly compete
with the Kinetis series, this is probably not good news for the
long-term future of the chips we're using.

But chip with designs that are already on the market will certainly
be available for a good while, so there is no immediate danger for

3) Gitorious about to shut down


This has more immediate consequences since they'll shut down
gitorious by the end of May 2015. Apparently, gitorious was already
(Continue reading)

Werner Almesberger | 23 Feb 10:47 2015

Anelok: battery, display errors, evolution update

Assorted items:

- not to belittle the pure joy and excitement of watching paint dry,
  but monitoring a battery's epic journey towards inevitable doom is
  so much more rewarding:


  So last week's drop was caused by the cold weather, not the battery
  showing first signs of weakness. Now that summerly temperatures are
  back, so is the battery voltage. To be continued ...

- then there is an ugly truth I hadn't revealed yet: sometimes, the
  display of Anelok would look like this:


  I thought that this may have been caused by timing issues in the
  communication between MCU and OLED, but I was a little worried by
  me already having verified the timing some time ago without
  finding any problem - which would then suggest a more fundamental

  Well, while playing with the slider, I noticed that this sort of
  pattern would reproducibly occur at the same positions when
  scrolling. As we know, if you can reproduce it, you can fix it.
  So I did ...

  It turned out to be a missing sanity check in my bit blit
  function, which allowed it to attempt to draw things that were
(Continue reading)

Werner Almesberger | 14 Feb 14:35 2015

Anelok: rework plan, battery update, left-shift, Anelok in China

Just a few minor items for this week:

- I made a plan for reworking existing Anelok boards to make the
  whole system run at 3.3 V:


  More details:


  This looks reasonably simple. Losing the Vsys pad isn't nice but
  not really a problem at this stage.

  In the boost-rework branch, I changed the schematics and the layout
  to reflect the modifications, and they still agree with each other.
  I haven't actually implemented the rework yet, so there may still
  be surprises, such as the idea not working at all.

- meanwhile, the battery is busy discharging and has just passed the
  300 hours mark:


  Not sure if the slight drop towards the end is a first sign of
  weakness or whether this merely reflects the cooler weather of the
  last couple of days. We'll see next week or so.

  The effect of temperature is noteworthy. If we assume that the
  difference between highs and lows is about 10 K, that would mean
(Continue reading)

Werner Almesberger | 6 Feb 22:19 2015

Anelok: battery results, and problems

I made a first attempt to run Anelok from a CR2032 cell. The good
news it that this time it did at least power on :)

Further good news is that the capacitive sensor worked somewhat.
It was a bit "nervous", probably reflecting oscillations in the
supply voltage, but I'm quite happy that it responded at all,
because this means that running on battery affects
self-calibration and the thresholds only lightly.

The not so good news is that things degraded quickly afterwards,
with battery voltage rapidly declining and the resulting voltage
difference between MCU and OLED breaking communication between
the two after a minute or so.

I first suspected that the battery was just too old. It's been
sitting in a drawer for maybe five years. The expiration date is
2018, but who knows if that considers the Buenos Aires climate ?

So I set up an experiment to verify the discharge profile of the
battery (a new one, from the same batch), based on the profile
published by Energizer:


Load resistance is 15 kOhm (+/- 5%, I will measure the exact value
when the experiment is done), ambient temperature about 25-35 C.

This is what the result look like after the first ~115 hours:

(Continue reading)