lo-tech Blog

Raspberry Pi VGA HAT, 24-bit 1080p

lo-tech-vga-r01-banner

The Raspberry Pi uses HDMI for it’s built-in display interface, and it’s well documented that a second screen can be connected to the GPIO header when switched to ‘display parallel interface’ (DPI) mode. The DPI is powered from the Raspberry Pi’s GPU and so has the same performance and capabilities as the HDMI port – 1080p, 24-bit colour, 60Hz.

Project boards exist already to connect a VGA screen to the GPIO, but these are very simple designs and have some limitations such as 6-bit colour and sensitivity to interference from the wireless peripherals in the RPi 3. The RPi GPIO is also stressed by the TTL control signals in the VGA interface and the project boards lack the certifications needed to be offered as finished products.

The Lo-tech Raspberry Pi VGA Board aims to address these problems, providing a true-colour VGA Adapter in a ‘HAT’ PCB format that will provide a reliable VGA output for primary or secondary display purposes whilst protecting the RPi, both from ESD when the screen is connected hot and from over-stressing the GPIO outputs via buffering of the key control signals.

I’m excited to report that this board has just cleared EMC testing, meeting EN 55032:2015 Class B limits, and ESD testing, passing BS EN 61000-4-2:2009 level 4, and so can be pre-ordered today (first deliveries expected approx. February 2017).

vga-r01-slider

Graceful Shutdown with APC BackUPS HS 500

APC’s BackUPS HS 500 UPS has been around forever, as has it’s firmware. Still, a wall-mountable network connected UPS with three switchable outputs for less than £100 from one of the most reputable brands seems like a good deal to me.

backups-hs-500-banner

There are issues with this product though. The web interface doesn’t work on any recent browser and it’s also impossible to configure it without Windows 2000 (XP if you’re lucky). So graceful shutdown is a non-starter then.

Having suffered a few prolonged power-outages recently I thought perhaps it’s time this problem was solved. Fortunately, Anton Bagayev has posted on Github a script to control the outlets from Linux, using Curl to interact with it’s primitive web interface, and this can easily be adapted into a shutdown script – I’ve called this check-power and have it running via cron every minute. When the UPS is on battery and run-time goes to 13 minutes or less, it calls some other shutdown script as needed:

#!/bin/bash
# This script uses the web interface of the APC BackUPS HS-500 to check it's status, and
# calls some other script to effect a host shutdown, should the UPS be on battery and the
# runtime be less than 13 minutes.
# temp file for operational status - battery level etc
STATUS="/tmp/apc-500-status.tmp"
UPS="[ip-address-goes-here]"

# get output values from web-control
curl -sl "http://$UPS/status.cgi" | tr -dc '[:print:]\n' > $STATUS
# Extract the unit operating status fields - battery level etc
LOAD="$(cat $STATUS | grep -o '[0-9]* Watts' | grep -o '[0-9]*')"
BATTERYLEVEL="$(cat $STATUS | grep -o '[0-9]* %' | grep -o '[0-9]*')"
RUNTIME="$(cat $STATUS | grep -o '[0-9]* minutes' | grep -o '[0-9]*')"
BATTERYSTATUS="$(cat $STATUS | egrep -o 'Charged|Charging|Discharged|Discharging')"
UPSSTATUS="$(cat $STATUS | egrep -o 'On Line|On Battery' | sed 's/ / /g')"
LASTTEST="$(cat $STATUS | egrep -o 'Result of last self-test is:.*(Passed|Failed)</font>' | egrep -o '(Passed|Failed)')"
LASTTRANSFER="$(cat $STATUS | egrep -o 'No&nbsp;Transfer|Blackout' | sed 's/&nbsp;/ /g')"
# show active configuration
logger "UPS Status $UPSSTATUS, $RUNTIME minutes remaining (load: $LOAD Watts)"
if [ "$UPSSTATUS" == "On Battery" ]; then
 if [ $RUNTIME -le 13 ]; then
 logger "UPS Critical: $RUNTIME minutes remaining. Starting shutdown procedure."
 [call-shutdown-script-goes-here]
 fi
fi
# garbage collector
rm -f $STATUS

OK so now we can control it with Anton’s script – the three outputs are individually switchable – and monitor it with this script, but what about configuration? Firing up a Windows 2000 VM and grabbing some Wireshark captures from the supplied configuration utility (really APC?), this is pretty straightforward too. The utility interacts with the UPS via UDP broadcast with some special command codes to make it do things like set the IP.

With a bit of fiddling, this too can be scripted Linux with a few dependencies (arping, xxd, socat). I’ve called this apc500.sh, and it can set the IP address and name of the device from the Linux command line, and uses Anton’s apc.sh to show device status (which can be modified per the above script to add battery levels etc if required):

#!/bin/bash
# UPS Management script for APC 500 HS
#
# -f - to Find and show detail of the device
# -s - to Set the IP address of the device (0.0.0.0 for DHCP)
# -n - to set the Name of the device
# Command line parameters - what are we doing?
for i in "$@"
do
case $i in
 -f*|--find*)
 FUNCTION="FIND"
 ;;
 -s=*|--setip=*)
 FUNCTION="SETIP"
 IPADDRESS="${i#*=}"
 shift # past argument=value
 ;;
 -n=*|--setname=*)
 FUNCTION="SETNAME"
 NAME="${i#*=}"
 shift # past argument=value
 ;;
 *)
 # unknown option
 ;;
esac
done
if [ "$FUNCTION" = "FIND" ]; then
 # Find UPS via broadcast
 DATA="$(echo '11 50 00 A0 10 50 43 43' | xxd -r -p | socat - UDP4-DATAGRAM:255.255.255.255:9950,so-broadcast,sourceport=9951 | tr -dc '[:print:]\n')"
 MODEL=${DATA:9:15}
 SERIAL=${DATA:24:12}
 MACADD=${DATA:37:12}
 TMP=${MACADD,,}
 MACADDR=${TMP:0:2}:${TMP:2:2}:${TMP:4:2}:${TMP:6:2}:${TMP:8:2}:${TMP:10:2}
 TMP=${DATA:52}
 NAME=${TMP::-1}
 # And lookup the MAC from ARP cache
 IPADD="$(arp -an | grep "$MACADDR" | egrep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*')"
 # Likely, there was nothing there. Check, and use arping (needs root) if we need to
 case "$IPADD" in
 "") IPADD="$(arping "$MACADDR" -c 2 -i eth0 | egrep -o -m 1 '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | head -1)" ;;
 esac
# Print out the information
 echo Model: $MODEL
 echo Serial: $SERIAL
 echo Name: $NAME
 echo MAC Address: $MACADDR
# Now check again to see if we have an IP address. If we do, we can get run-time information, eg battery level etc
 case "$IPADD" in
 "")
 echo "IP Address: Not known"
 ;;
 *)
 echo "IP Address: $IPADD"
 ./apc.sh ip=$IPADD status
 esac
fi;
if [ "$FUNCTION" = "SETIP" ]; then
 # Work out IP in Hex
 IPDEC="$(echo "$IPADDRESS" | sed 's/\./ /g')"
 TMP="$(printf '%02x ' $IPDEC ; echo)"
 IPHEX=${TMP::-1}
 RESULT="$(echo '12 50 00 a0 98 05 45 43 f5 f4 34 f6 '"$IPHEX" | xxd -r -p | socat - UDP4-DATAGRAM:255.255.255.255:9950,so-broadcast | tr -dc '[:print:]\n')"
 case "$RESULT" in
 "") echo "UPS did not respond.";;
 *) echo "UPS acknowledged command."
 esac
fi;
if [ "$FUNCTION" = "SETNAME" ]; then
 TMP="$(echo "$NAME" | xxd -p )"
 NAMEHEX=${TMP::-2}
 RESULT="$(echo '12 50 00 a0 10 08 45 43 f5 '"$NAMEHEX"' 00' | xxd -r -p | socat - UDP4-DATAGRAM:255.255.255.255:9950,so-broadcast | tr -dc '[:print:]\n')"
 case "$RESULT" in
 "") echo "UPS did not respond.";;
 *) echo "UPS acknowledged command."
 esac
fi;
# End of script.

8-bit IDE Adapter rev.3

The Lo-tech 8-bit IDE adapter has been designed around a 3D-printed ISA slot bracket, the primary reason being to keep the card itself within a 100mm width, which helps keep the price down. Until now!

Announcing then the rev.3 board, which is now compatible with the Keystone 9202 ISA slot bracket, as available from the usual online electronics retailers such as Mouser.

8-bit-IDE-Adapter-rev-3-front

As well as the slightly larger PCB form factor, this version also includes another jumper (JP3) providing a choice of IO ports, either the default 300h or 320h.

The board keeps everything else the same – XTIDE Universal BIOS powered, 32KB Flash ROM, excellent IDE and SATA device compatibility, high-speed read and write performance, key-pin power for Disk On Module devices, and PC/XT Slot-8 compatibility (with option SMT components fitted).

The Lo-tech 8-bit IDE adapter is available in the store as a bare PCB now.

MIF-IPC-B rev.2

Back in Jul-15 I introduced the Lo-tech MIF-IPC-B, a clone of Roland’s MIF-IPC board that connects the legendary MPU-401 to the IBM PC. Unfortunately an error in the schematic in the address decoder meant the prototypes were effectively useless – but when does anything work first time?

So here at last is the Lo-tech MIF-IPC-B, rev.2 – hopefully with everything as it should be:

MIF-IPC-B-rev2

Full details on this board are available in the wiki now.

The first assembled units are with beta testers now and all being well, PCBs will be available within the next 4-6 weeks.

Best Ever ISA CompactFlash PCB

ISA-CompactFlash-Adapter-Banner

The Lo-tech ISA CompactFlash Board has been a consistent best seller since it’s launch back in 2013. Having been through a number of relatively minor revisions, I’m today pleased to announce availability of the best version yet!

Now formally rev.3 and made in the UK, the PCB features a thicker, 2.5µm gold card-edge connector for long-term durability as well as ENIG finish for easy soldering and bevelled edge.

ISA-CF-rev3

The design also includes ROM address selection, PC/XT slot-8 functionality with disable jumper, and more durable power supply for key-pin powered DoM and CompactFlash adapters with an optional 2.2uF tantalum capacitor at the header.

The SMT components on the back of the board remain optional, meaning this design is still the cheapest, easiest to assemble, fastest, and most compatible storage adapter for PC and PC/XT class hardware.

The ISA CompactFlash PCB is available in the site store now.

MIF-IPC-B

Finally a prototype of the new Lo-tech MIF-IPC-B board, a Roland MIF-IPC compatible adapter that combines the functionality of the original (multiple MPU-401 support) with the compatibility of the revised MIF-IPC-A board (for PC/AT systems). This board also has fully populated resource selector headers, for easier system integration.

MIF-IPC-B-Prototype

Unfortunately the DB-25 is 2mm to far away from the ISA bracket but apart from that it looks good. Next step is to get this to someone that will know what to do with it and what it should be doing – so it’s being sent to a top-secret lab in Maryland testing. Watch this space!

Revised ISA CompactFlash PCB

This board should have been called the ISA CompactFlash Adapter rev.3, but somehow the design made it to fab with the development title rev.2b still intact… but anyway, here it is!

Lo-tech-isa-compactflash-adapter-revision-2b-front-assembled

This revision of this ever popular project has two changes designed to make it even more compatible:

  • a selectable ROM address – either C800h or D800h – makes it possible for this adapter to co-exist with an MFM or RLL device, for example for data transfer (requires SMT resistor R4 to be fitted);
  • a jumper (JP3) to disable CARDSEL drive signal, making it possible for adapters with the SMT components fitted to be used in systems that cannot boot when this signal is present, such as the IBM PS/2 Model 30-286.

Full information in the wikiPCBs are available now!

How Much Faster is the New RaspberryPi?

Another new version of the every-popular RaspberryPi has been released, and this time the form factor has stayed the same (as the B+) and it’s the CPU and memory that get the attention: single-core ARM6 is replaced by quad-core ARM7, and the RAM doubled to 1GB. This opens up the platform to Ubuntu and should help stave off some of the competition for a while.

How much faster is it?

The box claims 6x improvement, and of course real-world scores will depend on the workload and being able to keep those four cores busy. But anyway, here are the Geekbench scores I’ve run on the RP1-B+ and the new RP2-B:

RP1: http://browser.primatelabs.com/geekbench2/2536129

RP2: http://browser.primatelabs.com/geekbench2/2536151

1329 puts the new model roughly comparable to something like an Intel Core Duo T2400 (from 2009), adequate for every-day desktop computing in many cases. For me though the board is much more interesting as a network server or embedded application server.

MediaWiki for example is frustrating on the original RaspberryPi, so with an existing Raspbian image updated to work with the new platform (simply ‘sudo apt-get dist-upgrade’ then reboot), I measured response via ‘time wget …’ – the new board is consistently 3x or 4x faster than the older model, providing sub-second response times in many cases (with APC PHP caching enabled). At least for a small wiki, this makes the platform pretty usable.

SD card read performance remains at about 18MB/s for both boards (measured with a SanDisk Ultra 16GB), but iperf network tests show a usable improvement in full-duplex operation – the RP2 managing about 150Mbps total throughput, compared to about 110Mbps on the RP1.

An interesting aside is the power consumption – it’s slightly up on the original B+, but still it peaked at only about 2W during testing. So a RaspberryPi 2 desktop PC should use at least 15W less than even a carefully specified Intel machine, and with Windows 10 bring readied for the new RaspberryPi, this might not be so unrealistic. Given some 10 million office workers in the UK, saving even 15W on each one would add up to 300 GW hours per annum (and about 200,000 tonnes of CO2).

But anyway, to sum up – a great upgrade to an already useful system, having kept both the price and the power consumption about the same. Form factor is identical to the B+, and the GPIO header pinout is also the same. Micro-SD card storage can be a bottleneck, especially for random workloads, but in very simple testing performed here the board is consistently 3x to 4x faster than the original overall.

A new version of the Lo-tech GPIO Interface for the RaspberryPi is due shortly – watch this space!

Lo-tech TRS-80 IDE Adapter – Now Bootable!

The Lo-tech TRS-80 IDE adapter is an external IDE storage adapter for Tandy TRS-80 model 3/4/4P PCs, enabling connection of standard IDE drives (and CompactFlash cards, with an adapter).

trs-80-ide-assembled

A limitation has been that the machines needed to be booted from floppy disk still, since there is no HDD boot code in the Model 3 and 4 ROMs, and the HDD boot code in the 4P ROM is expecting a WD1010 controller rather than an ATA drive.

Community to the rescue as Audronic, Gazza and Hans have burnt plenty of midnight oil patching the 4P ROM with enough code to get LSDOS 6.3.1 to start up directly from the Lo-tech adapter! Here it is in action:

Currently this has been tested with a number of hard disks (full list in the download) but doesn’t currently work with SD cards. Some DoM devices can though be used, this one having been tested OK. Gazza has kindly put together a RAR achive with the patched ROM binary along with very detailed documentation, which is available via the Lo-tech wiki now.

No more floppy disks needed for your 4P!

Product links have been included here for convenience; Lo-tech has no connection with the sellers.

Metal 3D Printed ISA Slot Brackets

I’ve been experimenting with 3D printing options for Lo-tech ISA card slot brackets for some time, the idea being for customers ultimately to print their own slot brackets at home as the technology becomes ever more accessible – the XT-CF-lite rev.2 adapter bracket is only currently available in .STL format.

Fresh in from iMaterialise are the latest samples – this time in PU coated Bronze:

type-2-bracket-pu-bronze-1

Weight is 19g, and though slightly ‘ripply’ along the flat surface, this bracket has a great, solid feel and seems sturdy enough to take the force required to insert the card. Currently this process is quite expensive, but of course that should come down given time.

Unfortunately the PU coating on this prototype has left the card guides slightly too small for the CompactFlash card, but here’s a plain version (type 3), for example for the Lo-tech RAM, EMS, and 8-bit IDE adapters:

type-3-bracket-pu-bronze-1

Another metal based material available is alumide, “a strong, somewhat rigid material that can take small impacts and resist some pressure while being bent. The surface has a sandy, granular look and is slightly porous”, according to the website.

type-3-bracket-alumide-red

This feels more like the SLA printed ABS, being quite bending and, at 3g, has a light-weight almost paper-like feel. Though certainly up to holding a card in situ, this bracket (like the ABS versions) isn’t strong enough to be used to apply force to insert or remove the card, so requires some care in use.

The bronze process is perfect for this application, just a little pricey at the moment. Stainless steel is another option (and actually gold and titanium too!) but is currently too expensive to seriously consider for this application.