Thomas James Just a geek.

Technology, Gadgetry, Photography and Software Development

 

Latest Posts

Brew Smith Kit - Hoppy Heart IPA; My first attempt at home brew

by

While out shopping for a few things at Biome in Paddington, we chanced upon the Brew Smith home brew kits. On a whim I decided to get the Hoppy Heart IPA kit ($80, it seems that biome put a $10 premium on them, the Brew Smith online store has them at $70) & an additional Chocolate Paradise Porter ingredient mix ($28, again cheaper at Brew Smith - $20). All up $108, or $105 direct from Brew Smith including interstate shipping. Sorry Biome, but if the brews work out, I'll be ordering the refills online.

Brew Smith Packaging

One of the things that drew me to the kits was the size, or the lack of. The kits are fairly small, only making 4.5L of brew, making them perfect for someone like me with a small apartment.

In the box

The packaging is professional, with the welcome letter a nice touch.

Welcome letter & brochure for cure you're own bacon

Inside the box

All the kit contents

Giving it a go

The instructions in the ingredient bag are easy to follow, but I did still check out a few of the great videos on the site just to make sure I didn't miss anything.

All laid out ready to start

On the boil, followed by the boil-over :(

Malt extract in

The boil over aftermath

It's now sitting in a cupboard for the next 2 days until the last of the hops go in. I'm looking forward to seeing how it turns out.


48 hours later, the magic is happening.

Airlock installed


Will let you know how it tastes in 3 weeks.

.net MicroFramework 4.3 BitConverter

by

The BitConverter was added to the .net microframework in version 4.3 and provides a way to turn an array of bytes into a meaningful primitive such as a long.

var bytes = new byte[] 
{
    0x01, 0x02,
    0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
}
var someValue = BitConverter.ToInt64(bytes, 2);

Using it in my netduino targeting code, I encountered a number of occurrences where the netduino would hard lock and require a reset to become responsive again. I traced this back to some usages of the BitConverter but not others. Essentially the var someValue = ... line in the above code snippet.

In researching this issue I stumbled upon a related bug report in the netmf project, BitConverter startIndex not correct, which suggested that with the way the code was implemented the values being converted needed to be word aligned otherwise it wouldn't work.

It looks like there are alignment issues. 32 bit pointers must be aligned on arm processors. Adding packed would solve this or use memory copy.

I was able to reproduce the issue on the EMX, G400, and Hydra. The Cerb and G120 perform properly, however they crash on non-zero start indexes for the 64bit conversions. I looked at the native code and it seems fine, it just adds the index to the pointer and casts it. It’s essentially: reinterpret_cast(buffer + start_index).

Giving this a try by padding the long value out was successful, ending the hard lock & reset cycle.

Eg

var bytes = new byte[] 
{
    0x01, 0x02, 0x00, 0x00, 
    0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
}
var someValue = BitConverter.ToInt64(bytes, 4);

PC Engines APU - Home router replacement

by

I've not been much of a fan of off-the-shelf home routers for a long while now. Always opting to build a linux box of some sort to do the job, going back this used to be the old white box with a couple of network cards, and until recently it was a DreamPlug plug-pc. The DreamPlug was starting to have some power issues, so it was best to pro-actively replace it.

A colleague suggested I take a look at the PC Engines ALIX, and the (then) in development APU. The ALIX sounded interesting, but given that the APU was right around the corner I decided it was best to wait and get the new model. I ordered the Voyage Wireless Kit once the APU was available for sale, as this included everything I needed (enclosure, SSD, wifi, etc exlcuding PSU), also being shipped from Hong Kong I hoped it would arrive quickly, which it did thanks to SpeedPost.

As an aside, I choose to run a linux based router generally for two reasons. I like being able to script up, and control the configuration of the router without having to use the generally, very crappy web based UIs that most have; and secondly that I can then manage the router as I see fit and are not limited to the provided features of the device (such as multiple IPoverIP tunnels), which usually wont change once released. With linux I can upgrade as new releases occur.

At the heart of the APU is a low power AMD x86/x64 cpu, unlike the DreamPlug which was ARM based. This means that all the regular linux distrobutions will be suitable without needing anythign to specifically target the device. I chose to use Debain.

Internal view of the APU board

Shown left to right, GSM Mini-PCIe, Wifi & 16GB SSD (mSata). There is also a SIM card slot on the underside of the SD card reader, wired up to one of mini-pcie slots.

The voyage kit includes everything needed, except a suitable PSU, with some assembly required. For the PSU i found that an old Apple Airport Extreme PSU works perfectly.

I purchased a USB serial adapter & a null-modem cable to make installing linux a bit easier, as I wasnt familiar with the device. This is nessesary as no form of display-out is provided on the device. I purchased the Serial app for the mac to make the software side of the terminal emulation easier.

Linux Installation

The installation tripped me up and had me scratching my head for a bit trying to get the debian live CD to work with the APU.

The live CD needs to be configured to output to the serial console, using the correct speed for the APU. However, to update the live CD configuration I found that using unetbootin on windows (not Mac if you want to stay sane) was the easist way to get a writeable USB to update the config files. Alternative suggestions are very welcome.

I found that updaing the following successfully allowed the console to be used for display output and a normal linux install to proceed. Once installed and networking setup, everything else was performed over SSH.

The PC Engines forum was quite useful for getting this right, the post 'APU + Ubuntu 14.04 LTS - install via serial console' in particular.

syslinux.cfg include the following at the start of the file:

# D-I config version 2.0
CONSOLE 0
SERIAL 0 115200 0

Update the kernel entry to include console=ttyS0,115200n8 like so:

label unetbootindefault
menu label Default
kernel /isolinux/rescue64
append initrd=/isolinux/initram.igz rescue64 scandelay=1 console=ttyS0,115200n8 -- rescue32 scandelay=1

isolinux/isolinux.cfg include the following at the start of the file:

# D-I config version 2.0
CONSOLE 0
SERIAL 0 115200 0

Linux Setup

I needed to do a couple of things to complete the install on debian. Taking some cues from Debian installer USB Stick for PC Engines APU board with mSATA drive

sysctl

From pcengines-apu-debian-iso / profiles / apu.postinst:

cat >/etc/sysctl.d/apu.conf <<EOF
vm.swappiness=1
vm.vfs_cache_pressure=50
EOF

Ensure the serial console is used by grub

Edit /etc/default/grub, update:

GRUB_CMDLINE_LINUX_DEFAULT="quiet console=ttyS0,115200n8"

Then run (per the instructions in the file):

update-grub

Enable non-free package source for apt

Edit /etc/apt/sources.list ensuring that non-free is used. Then run apt-get update.

Install device firmware

Run the following for the ethernet & wifi firmware:

apt-get install firmware-realtek
apt-get install firmware-atheros

Install sensors for temperature monitoring

apt-get install lm-sensors
sensors-detect
sensors

Final Thoughts

The APU is a very capable little unit, which has been running stable for over a month in a low airflow area. I originally had some concerns about heat disapation but the unit remains about 52.0°C most of the time.

I'm still yet to setup the GSM device as a backup network link, hopefully a future post.

This Gist includes output from a number of common linux utils that provide hardware information, if that's your thing.