Archive

Archive for December, 2009

STM Bug Report

December 16th, 2009 No comments

Ever since the implementation of the new Opus Card system by the Montreal’s Public Transportation (STM), there have been lots of malfunctions and bugs.

Crashed STM Ticket Vending Machine

Crashed STM Ticket Vending Machine

The malfunctions were mainly caused by the poor build quality of the smartcards, the poor wireless reader range, the easy demagnetization of the paper tickets, etc. Slowly (very slowly) these malfunctions are being addressed and (sometimes) solved. The unsolved bugs become a part of the daily routine and we Montrealers learn to accept them.

On last weekend, I witnessed a bug that I would have never thought possible in a professional widespread software application that involves so many money transactions: what I usually call a boundary condition bug.

The Bug

Quick note on the STM’s fares (for those who do not live it day-to-day):
There are mainly two transportation systems: the bus and the metro (subway) and the fare pricing is governed by a (somewhat) simple set of rules:

  • There are monthly passes that allow unlimited fares within the month in both the metro and the bus. They are more expensive for adults than for students or elders.
  • There are weekly cards that are similar to the monthly cards by work for a given week.
  • There are tickets (either as a magnetic paper card or as some information on a smartcard) which allow for one fare that allow to take the metro, the bus, or both within a two-hour time limit. Should the time period be elapsed, or should you take the metro or the same bus more than once, you will need another ticket.

Since the Opus Card implementation, one of the first things that came into my mind was the attention required to compute the fare price when a month ends (i.e. at 12:00 on the 31th, 30th, 29th, or 28th), or when a week or a day ends. Everyone who has programed at least a little bit (like me) knows that these boundary conditions are usually exceptions to the normal behaviour of a program and need to be taken into account. I, of course, assumed that such mundane exceptions would be addressed by professional programmers swiftly and painlessly. I was wrong.

On last Saturday, my girlfriend and I took the metro after going to the movies and she swept her card (loaded with tickets) at exactly midnight (00:00 as reported by the STM records) at the metro reader. Around 20 minutes later, we walked into a bus and surprise! another ticket was charged instead of using a transfer from the previous ticket.

The conclusion to this is that when a day ends, there STM fare algorithm fails and defaults to charge you an extra ticket. Unfortunately, It is unlikely that this bug is noticed by the STM any time soon since they are not loosing any profit from it and they do not accept bug reports. Even the lady at the reclamations booth had a hard time to understand what the problem was.

Opus Card FailIn the end, instead of a full refund she got a “courtoisie” ticket which expires on next Sunday (instead of a regular ticket that which expires in around two years). So much for costumer service.

The poor programming quality is also reflected by the poor choice of OS for their vending machines. Let’s just say that using Windows Embedded is the equivalent to eating a faulty grenade: it will rather sooner than later get ugly.

Categories: Info Tags:

Simple Precision-Screwdriver Holder

December 14th, 2009 No comments
Workshop wall

Workshop wall

This is a very simple and quick hack that anybody can do. The objective is to build a holder that will keep all the precision screwdrivers in one place and facilitate the access to them (i.e. it should be easy to see which one is which and they should be easy to take).

Materials

  • A plastic container cap (I love caps)
  • That’s it, you do not need anything else

Tools

  • Drill or strong scissors
  • Precision screwdrivers
  • A nail (maybe)

Doing it

Screwdriver Holder

Screwdriver Holder

  1. Drill or cut a big hole on the top of the cap. This hole will be used to suspend the screwdriver holder.
  2. Punch in the Screwdrivers in the rim of the cap. If you do not trust your screwdrivers to pierce your cap, you may use a nail. Keep in mind that the screwdrivers have to be very snug in the holes since they are only being held-in by friction.
  3. Celebrate! you are done.
Categories: Project, Tools Tags:

Enough with the guesswork, I got Logic

December 11th, 2009 No comments

I just got a shiny new Logic, a tiny 8-channel, 24 MHz logic analyzer from Saleae LLC, and it is beautiful. I’ve been wanting to get a logic analyzer for quite some time and this little guy is definitely worth the 150 bucks it costs.

Logic Unboxing

Logic Unboxing

Logic Analyzer?

(skip this if you already know what a logic analyzer is and do not want to be bored to death)

A logic analyzer is a measurement instrument that allows you to record the logic level (e.g. high or low) of a digital signal throughout time. This means that if you are working with a micro-controller and want to know what is actually happening at the pins, you can use a logic analyzer to record the signals of interest and display them on a time-line on a computer screen. This is very convenient considering that debugging microcontrollers often implies guessing or using lame techniques such as slowing down the execution time and lighting up LEDs in order to see what the program is doing.

In short, a logic analyzer allows you to view digital signals and plot them with respect to time.

Casing

The Logic, by Saleae

The Logic, by Saleae

The Logic has a nice square anodized aluminum body which makes it very sturdy and looks awesome. It is very small (~ 4.5 cm on the side and ~ 0.7 cm high) and features some male headers on the front side and a mini USB port type B on the back. For some reason, I really like the four tiny hex screws that hold together the two aluminum plates that make the body.

Accessories

Cabels & Hooks

Cabels & Hooks

The Logic comes in a nice Logic Case, usually intended for some other electronics such as external hard drives I suppose, that can accommodate itself and its USB cable, its set of wires and the E-Z-hook clips.

What I enjoy the most is that the wires are robust and kink-proof, and they are terminated in female headers, which makes them very easy to use in breadboards and on male pins in general. Also, the hooks are removable and they can connect to harder-to-access pins in a secure way. The wire colour coding follows the resistor colour coding (i.e. Channel 0 is black, channel 1 is brown, etc) and this might be a bit confusing at the beginning since the Ground wire is grey instead of being the usual black.

Finally, the carrying case is a very nice feature since it allows you to have the Logic and all the related items in one single place. The case is a bit too big, but I the extra space could be used to store some extra accessories, such as headers gender-changers (for plugging into female headers) or wire extensions with special ports (e.g. DB-9, RJ-45). I also enjoy the fact that all the components come in their own little zipper-bag that allows you to store the unit in a nice pristine condition (it may not seem like it, but I like to preserve things in their original state, unless they come from the garbage in which case I mod them and unscrupulously use their pieces).

Hardware

I did not want to take the Logic apart in order to see its guts (so far) so I do not have too many details about the hardware other than what is listed in Saleae’s website: (1)the inputs are protected to you don’t fry anything, (2) it can sample at 24 MHz, and (3) it is able to store up to 500 M samples.

Software

The software can be downloaded for free (and used in demo mode) looks really nice but unfortunately, the current stable version works only under the Redmond OS and it does not play very well with Wine in Linux or in my XP virtual machine. I would have really liked to test its Protocol Analyzers, a function that automatically sets the names of the signals and decodes the information accordingly to the protocol being analyzed (e.g. I2C, RS232, SPI, 1-Wire).

Anyways, there is an upcoming cross-platform version of the software that looks very promising and is currently under private beta at the moment. Of course, I could not resist the urge to join the beta testing and I can say that the new software is working very nicely (so far, I have not tested it extensively yet) under my 64-bit Kubuntu setup.

Needless to say, as soon as the software goes public, I will post a more thorough review, so keep posted.

Conclusion

The Logic is a very nice piece of equipment for any hobbyist or professional (provided you do not require to read signals faster than 24 MHz, which is rare specially while debugging). It is built to last fits very nicely in a hacker’s toolbox (or even pocket). I would recommend the Logic to anyone needing a sturdy and easy-to-use Logic analyzer, and I will be using it in my upcoming projects.

Categories: Tools Tags: