# Lego Mindstorms: A Paper Cube

Here is yet another nice video of a Lego Mindstorms factory.

# Arduino: Ethernet with ENC28J60

The two main approaches for connecting an Arduino to an Ethernet network are the “normal” Ethernet shield or a module based on the ENC28J60 chip. While the Ethernet shield is easier to start with, it is comparatively expensive and also of little use for the smaller Arduino models (e.g. Arduino Nano or Pro Mini).

In contrast the ENC28J60 modules are cheap, small, and universally connectable. This comes, however, with the small downside that they are not supported by the Arduino IDE out-of-the-box. Of course, there is a myriad of web pages out there that deal with it in one aspect or another. There are two reasons why I add yet another:

• My ENC28J60 module (bought from AliExpress) is slightly different from the one usually seen. It does not need 3.3 volts but 5 volts, so the product description is wrong in that respect. Also, unlike all the other modules I have seen, it does not come with 10 but 12 connections.

• The usual recommendation for the library is EtherCard, but this did not work for me.

What finally worked for me was using the UIPEthernet library, which can also replace the standard Arduino Ethernet library. I connected the ENC28J60 module with a recently purchased Arduino Nano v3 clone using the following connections

Arduino Nano ENC28J60
SS (Pin 10) CS
MOSI (Pin 11) SI
MISO (Pin 12) SO
SCK (Pin 13) SCK
5V 5V
GND GND

The Arduino Nano pin layout can be found here. The ENC28J60 module module offers a few more connections, as can be seen on the photo below. However, I used only the “usual suspects”.

The next step is to put this thing to use. I am currently planning some kind of data logger for 433 MHz signals, that are typically used for entry-level remote control purposes.

# LaTeX: Hyphenation of \texttt

I have been using $\LaTeX$ since I was 17 and still love it. But one thing has been bugging me for a long time. For a while I had been manually tweaking documents to get proper linebreaks when using the \texttt{} macro. Now I had finally come to the point where this did not work any longer. A search gave me this snippet:

\renewcommand{\texttt}[1]{%
\begingroup
\ttfamily
\begingroup\lccode~=/\lowercase{\endgroup\def~}{/\discretionary{}{}{}}%
\begingroup\lccode~=[\lowercase{\endgroup\def~}{[\discretionary{}{}{}}%
\begingroup\lccode~=.\lowercase{\endgroup\def~}{.\discretionary{}{}{}}%
\catcode/=\active\catcode[=\active\catcode.=\active
\scantokens{#1\noexpand}%
\endgroup
}

It works great!

# Free ESP8266 Book

Mostly as a reminder for myself here is a link to a free book about the ESP8266. It dates from August 2015, so a few things have happened since; including the announcement of its successor, the ESP32 (forum here).

# Mac: Auto-Mounting Network Shares

Admittedly, on the Mac I have always been a pure end-user only. So it is no surprise that I had never looked at Automator, which in hindsight is a real pity. When searching for an easy way to automatically mount CIFS shares from my NAS, I came across a post on Stackoverflow that suggested Automator as one possible way.

I have followed the steps there (adding “Get Specified Servers” first and then “Connect to Servers”) and it works like a charm. The only difference is that I did not use AFP as protocol but SMB. But syntax basically stays the same, so I ended up with
 smb://user@server/share 
What I did differently, though, was the method to invoke my Automator-based application. Instead of adding it to my login items, I chose to have it executed by ControlPlane, whenever the latter detected a connection to my local network. This way, whenever I open my MacBook it automatically re-connects.

# Arduino Pro Mini: stk500_recv(): programmer not responding

Today I joined the many who have issues to program an Arduino Pro Mini or, like in my case, a clone thereof. The error message very many people seem to get is
 stk500_recv(): programmer not responding 
There is an awful lot of stuff on the web how to solve this and I have tried to compile them in a list for others so that they can check:

• Programmer’s driver not installed on PC
• Arduino does not have a bootloader installed
• Arduino has other CPU compared to how it was sold
• Speed of serial port does not match with what Arduino expects
• USB-to-serial adapter has no DTR line
• RX and TX line labels mixed up on the board
• Faulty USB-to-serial converter (brand new CP2102 in my case)

In my case, however, it was even worse. Several of my clone board’s header connections were actually not connected! And among them was TX, so the error message was quite right.

What I did was download the datasheet from Atmel, identify my pin configuration from page 3, and start measuring connections. What I found was that TX on the six-pin header was not connected properly, while it was ok on the twelve-pin header. Also, GND was not connected on the bottom twelve-pin header.

# Kodi on Raspberry Pi 3 with Hifiberry DAC+

Having been a very happy user of the Kodi mediacenter for several years, it was finally time to upgrade to a Raspberry Pi 3 and a Hifiberry DAC+ board for good sound.

For the sound setup I followed these instructions that made the new soundcard appear on Linux level, but not in OSMC (my current Kodi version of choice).

What finally made things work were two changes to the file /boot/config.txt (thanks to this thread):

• Addeddtparam=audio=off
• Removeddtoverlay=lirc-rpi

I am currently listening to some music and the sound is really nice :-).

# WebDAV for Ant

I finally found an Ant task for WebDAV that works (I used cadaver instead because in the past none had worked for me). Thanks a lot to Ole Christian Langfjæran on Github for putting this together. But I needed an additional parameter so that the password can be retrieved from a file instead of being in the Ant script in plain text. So I forked the project and did my additions.

# Thunderbird: Sync all mails via IMAP

This post is mostly meant as a reminder for myself. When adding an email account that had long been in use to Thunderbird, I wanted to have a complete local copy of all mails from all folders. But I did not want to subscribe to hundreds of folders manually and then click each of them to trigger the download.
Luckily, there is an “extended setting” that achieves exactly what I need. You need to go the “normal” settings (not the account ones) and there to the “Advanced” tab. At the bottom there is the “Config Editor” button, which you need to click and confirm the warning.
Then set the property
mail.server.default.check_all_folders_for_new = true` and close the windows.