[ about | machines | pics | projects | repos | weblog ]

[ ~derf ]

Projects

App::Raps2 v0.53
Password safe, take two
App::Slackeria v0.12
Project status overview
Travel-Routing-DE-VRR v2.01
Interface to the VRR online itinerary service

News

2012-04-15 00:00 icli v0.41

icli-0.41.tar.gz (signature)

  • Add icli host/service as icli -h host -s service shortcut
  • Add -u / --force-recheck option (Patch by Hugh Brown)

First, there's an excellent parallel port howto on epanorama.net.

What I'd like to add: You can't just control LEDs or relay coils / transistors with the parallel port, it's also pretty easy to talk to microcontrollers (an ATTiny 2313 in my case).

interfacing

Basically, you need one or two parallel port pins as inputs to the AVR, and then come up with some sort of protocol.

one-wire

No clock signal, so we rely on proper timing. The most primitive solution is to toggle the pin n times and have the AVR increment a counter on every toggle, then read the counter value after a fixed time without counter increment has passed. Excruciatingly slow, but dead simple to implement both on the computer and the AVR.

two-wire

One pin for data, one for the clock (e.g. set data, then toggle clock, set an AVR interrupt on rising edge on clock to read data pin). I didn't try it yet.

more?

So far, the computer talks to the AVR but not vice versa. Two-way communication shouldn't be hard, but I didn't try it yet. If I do, I may write a new entry.

hardware

To be on the safe side, I decided to completely isolate the parallel port from the rest of the circuit.

components used:

  • KB817 opto-coupler. forward voltage ~1.2V, collector-emitter voltage 35V/6V
  • 3.3K resistor between opto-coupler and parallel port, since the parallel port provides 2.4 to 5V
  • BC338-40 transistor to make sure the opto-coupler output is registered by the microcontroller

The rest is usual stuff. The parallel port circuit is located in the bottom left of the schematic.

software

microcontroller

Assuming the transistor (optocoupler) is connected to INT0

  • set an interrupt on INT0 rising edge: increment counter and reset timeout
  • set a timer interrupt: check timeout, if zero handle counter as command

code snippet:

ISR(INT0_vect)
{
    cli();
    command++;
    cmd_wait = 6;
}

ISR(TIMER1_COMPA_vect)
{
    if (cmd_wait)
        cmd_wait--;
    else if (command) {
        run_command();
        command = 0;
    }
}

the whole file is available on github: main.c

computer

I'm using the parapin library, see pgctl.c on github. Note that timing is important here, so I'm running the code at the lowest possible niceness.

That's it. An example project is available as derf/pgctl on github.

The whole point of this post is: interfacing with the parallel port is easy. It doesn't have a future, but if you still have one, you can use it for quite a lot of things.

Travel-Routing-DE-VRR-2.01.tar.gz (signature)

  • Fix bug in departure_stop_and_platform where the arrival_stop was used in case of unknown platforms
  • Document -E / --extended-info in efa(1)

(because it's way more awesome than using just a Wiimote)

For this to work, you will need an up-to-date cwiid installation, the most important part is commit b54bd05.

Next, check out neverball svn and apply tilt wii.patch.

Build it (make ENABLE_TILT=wii), then run ./neverball and press the Balance Board's red sync button.

If everything works out, the Power LED should turn on. Now you can use the mouse / keyboard to select the level to play, and then control the level itself using the Balance Board.

There's a (really low-quality) Video (also on Youtube) available. I hope to have a higher resolution and less laggy one by saturday.

For the record, the complete patched tilt wii.c is also available.

Update:
I've got a new Video! (also on Youtube). As you can see, controlling neverball this way is pretty hard :)

With the most recent Patch, you can control the level with the balance board and the camera and menus with the wiimote. Usage: Start neverball, connect wiimote, wait 'til the leds stop blinking, then connect balance board. There are some timing issues right now, so if it crashes while connecting the devices, just try again.

Travel-Routing-DE-VRR-2.00.tar.gz (signature)

  • Now uses the efa.vrr.de XML interface
  • properly decode UTF-8 strings

Travel::Routing::DE::VRR::Route

  • new accessors: duration, ticket_type, fare_adult, fare_child and vehicle_time

Travel::Routing::DE::VRR::Route::Part

  • arrival_stop and departure_stop no longer include the platform, use arrival_stop_and_platform / departure_stop_and_platform instead
  • New accessors: arrival_date, arrival_platform, arrival_sdate, arrival_stime, arrival_stop_and_platform, delay, departure_date, departure_platform, departure_sdate, departure_stime, departure_stop_and_platform, via
  • ->extra no longer contains information about delays, use ->delay instead

efa

  • New -E / --extended-info option to display travel fares

Travel-Status-DE-DeutscheBahn-1.01.tar.gz (signature)

  • Detect ambiguous input errors (available via errstr)
  • Add language switch for additional information (german/english)

Travel::Status::DE::DeutscheBahn::Result

  • Result: Add line (== train) and date accessors

db-ris

  • Add -l / --lang option

Travel-Status-DE-VRR-1.00.tar.gz (signature)

  • switch to efa.vrr.de XML interface
  • properly decode UTF-8 strings
  • Switch from WWW::Mechanize to LWP::UserAgent
  • Add ->lines and Travel::Status::DE::VRR::Line describing all lines serving the given stop

Travel::Status::DE::VRR::Result

  • Add countdown, date, delay, lineref, platform_db, sched_date, sched_time and type accessors

efa-m

  • Add -L / --linelist option
2011-11-02 00:00 App::Hashl v1.00

App-Hashl-1.00.tar.gz (signature)

  • Add "hashl list regex" to filter listed files by name
  • Do not fail when encountering zero-length files

Travel-Status-DE-VRR-0.02.tar.gz (signature)

efa-m

  • Add --platform / --line options to filter output
  • Align times properly if departure list contains a daychange
  • Make --date and --time actually work

Travel-Routing-DE-VRR-1.06.tar.gz (signature)

  • Fix dependencies. We claimed to use WWW::Mechanize but in fact only need LWP::UserAgent

Travel-Status-DE-DeutscheBahn-1.00.tar.gz (signature)

db-ris

  • Add --full-route option

Travel::Status::DE::DeutscheBahn

  • Fix bug when receiving no platform numbers from the DB RIS

Travel::Status::DE::DeutscheBahn::Result

  • Add route_timetable accessor containing station names and their corresponding arrival times

Travel-Status-DE-DeutscheBahn-0.05.tar.gz (signature)

  • Fix ->results returning duplicate connections when accessed more than one time
  • new: Only die when encountering wrong options, set ->errstr otherwise
  • Adds new ->errstr accessor to check for request errors
2011-07-25 00:00 App::Raps2 v0.53

App-Raps2-0.53.tar.gz (signature)

  • Make xclip command configurable (for chrome users, mostly)
  • New --chrome and --xclip-cmd options
2011-07-20 00:00 App::Raps2 v0.52

App-Raps2-0.52.tar.gz (signature)

  • raps2 add: Fix pwgen usage (remove trailing whitespace)
2011-07-20 00:00 App::Raps2 v0.51

App-Raps2-0.51.tar.gz (signature)

  • Major usability improvements
  • New dependency Config::Tiny
  • New configuration file .config/raps2/defaults
  • Add --cost option to set cost for raps2 add
  • raps2 add: Use pwgen to create password if none is specified
  • Add --no-echo, --paste and --pwgen-cmd options for raps2 add / pwgen

App::Raps2

  • new: Add pwgen_cmd argument
  • Add create_defaults, load_defaults, conf and generate_password methods
  • pw_save: Add optional cost argument
  • pw_load, pw_load_info: Now also return the key setup cost

App::Raps2::Password

  • encrypt, decrypt: Now take hash as argument, keys are data/salt/cost

App::Raps2::UI

  • to_clipboard: Return undef if xclip dosn't run, true otherwise

Travel-Routing-DE-VRR-1.05.tar.gz (signature)

  • Documentation fixes (in a few places, the module was prefixed Travel::Status instead of the correct Travel::Routing)
  • Note that we need perl >= 5.10.1 because of the parent pragma

efa

  • Fix connection error handler
2011-07-14 00:00 slackeria v0.12

App-Slackeria-0.12.tar.gz (signature)

  • Note that we actually need perl >= 5.10.1 (for the parent pragma)

slackeria

  • Argument validation, add -h/--help option

App::Slackeria

  • Rename App::Slackeria::Plugin to App::Slackeria::PluginLoader
  • Rename App::Slackeria::Plugin::Base to App::Slackeria::Plugin
  • Move template to separate file, adds dependency File::ShareDir
  • Because of that, we now need Module::Build >= 0.36

App::Slackeria::Plugin::Debian

  • Switch from whohas to custom parser using LWP::Simple and XML::LibXML
  • Now checks version in Debian Sid by default
  • Add 'distribution' configuration parameter to select which Debian distribution (wheezy, sid, etc.) to check
  • Add 'href' configuration parameter

Travel-Status-DE-DeutscheBahn-0.04.tar.gz (signature)

Travel::Status::DE::DeutscheBahn::Result

  • The info accessor now strips the mostly useless "k.A." / "pünktlich" (train on time) text parts
  • Add (slightly experimental) route_interesting accessor
  • Add delay accessor

Travel-Status-DE-DeutscheBahn-0.03.tar.gz (signature)

  • Clarify derl dependency (we actually need >= 5.10.1)
  • Strip leading / trailing whitespace in result fields