04/04/2017

A High Voltage "Battery Meter" Worthy of a Mad Scientist

With the advent of spring, and everything coming back to life after a (not so) long winter's sleep, what could be a more fitting story to choose as Var GladSpexarna's spring production, than Frankenstein.

Apart from the regular tasks given the tech department, there was also a request for a "battery meter", technically a bar graph display with six lights, large enough to be a noticeable prop on stage, and with a design that could fit into the lab of Frankenstein.

The set construction department furnished us with a sturdy box to mount the electronics in, leaving me to work out the electronic details. This effectively meant repurposing the firmware of the by now proven DMX512USB card to control the switching of six lights, and to design a relay circuit suitable for switching mains power.

The duty cycle of the construction is low and it's not switching a lot of power in the first place (not likely to be or become a fire hazard), and the whole thing is to be mounted in a box that is screwed shut (no accidental access), but there are still design parameters that have to be considered because of this.

The DMX512 interface card was built with electrical isolation in mind from the start, so from a design standpoint not much changed in the schematic from previous iterations, more than selecting DPST/DT relays rather than SPST/DT ones for switching the lights. (Wall sockets in Sweden are not polarized, so we can't rely on a specific mains level conductor in a device being live or neutral.) Other measures included paying attention to the wire gauge used and isolation distance, and making sure that there would be no accidental touching of anything conducting mains power even with the cover open.

basic schematic back cover removed
A lot of the work pertaining to mount the lamp sockets in the box, as well as the soldering of the relay circuit once the components arrived, was taken care of by Benjamin Claréus, who for that matter is one of the guys that participated in the original LED bar soldering workshop, and has helped out with similar tasks since then. Although I provided supervision and guidance, this freed up time for me to try to locate and adapt the latest working interface card firmware revision.

He also pitched the use of carbon-filament lamps rather than regular bulbs, something that I had initially written off due to their higher cost. The end result speaks for itself though, and regular bulbs, especially now that they often contain a small halogen bulb inside, would not have been the same.

03/01/2017

Using Xilinx PlanAhead and Vim

The downside to becoming a vim (or emacs for that matter) poweruser, is that every other editor seems lackluster. This includes e.g. the editor that is bulit into Xilinx PlanAhead. There is however the posibillity of having PlanAhead open text files in any editor of your choice (Tools→Options...→General→Text Editor). There are a few suggestions, mostly for Vim and Emacs users, but they all have the problem that a new [terminal] window will be opened for each opened file, which at least is not what I want. I want a single vim window to be opened when editing the first file, and each subsequent opened file to be added as buffers to the same vim instance.

Here's a way to do it:


It's nothing extraordinary, pretty much just making use of vim's client/server capabilites (which it needs to be compiled with) with some slight parameter massaging. The following method should work, but doesn't, at least on my system right now: Just putting the following in the custom editor field:

urxvt -e vim --servername planahead_vim --remote-silent +[line number] [file name]

The principle is good: vim in a terminal with additional parameters to make use of the client/server features (which need to be enabled at compiletime).

The symptoms for how it is not working are that PlanAhead seems to double-quote the line number and file name in a way that makes vim try to open a file where the quotes are part of the filename. I don't remember having this problem the last time I messed around with external editors, maybe I was using ISE at that time. Nevertheless, the workaround is simple:

In the PlanAhead custom editor field put

planahead_vim_shim [file name] [line number]

where the the shim is a bash script containing the following:

#!/bin/bash
f=${1%\"} ; f=${f#\"}
l=${2%\"} ; l=${l#\"}
urxvt -e vim --servername planahead_vim --remote-silent +"$l" "$f"


Of course, you need to make sure the shim is stored somewhere accesible in your PATH (or you can make use of an absolute path of course), and that it has its executable flag set.

Apparently, as discussed here: https://forums.xilinx.com/t5/Design-Entry/PlanAhead-external-text-editor-doesn-t-work/td-p/414211 I'm not the only one getting quotes in my filename.