Is Via Rail On Time?

Personally, I’m a fan of trains. They’re a nice, albeit slow, way to get around the country. Canada isn’t the best candidate for rail transit, given the rather large space between coasts, but Via Rail does operate regular train service in their corridor between Windsor and Quebec City.

Unfortunately, passenger rail has to yield to commercial rail in Canada which often causes delays. After noticing that some trains have very frequent delays, it seemed like it would be useful to know the average performance of each Via train. Via does not provide this data publicly.

However, they do provide some data about arrival and departure times. Digging into the data available through any browser viewing the Via Rail site, it was possible to query for past scheduled/actual arrival data. The result is TrainStats.ca, a display of Via’s on time performance. Join me after the break as I discuss how this all works, and how to pick a winner when buying your next train ticket.

Continue reading “Is Via Rail On Time?”

A Teensy Logic Analyzer For A 6502

[John] has an interesting, if old piece of tech sitting on his workbench. It’s an Ohio Scientific C3-8P computer from the late 70s by way of a few garages, basements, and attics. As with most tech of this vintage, there are some problems, and [John] found debugging a little frustrating without the ability to trace and watch the programs. He needed a logic analyzer, and found one in an unlikely piece of hardware. [John] built one using a Teensy microcontroller, and further refinement of this project could turn it into a full in-system emulator.

The old Ohio Scientific computer [John] is trying to bring back from the dead is based on the 6502 CPU. That’s sixteen address lines to monitor, eight data lines, and four control lines. These were wired directly to a Teensy 3.1.

Reading and controlling all the signals from a 6502 is a task that falls to Linux. A command line program controls the Teensy and is capable of reading memory, setting trigger addresses, dumping the entire address space to a file, or just recording the last 5,000 clock cycles. This kind of tech existed back in the late 70s and early 80s. It also cost a fortune. Now, with a $20 Teensy and probably another $30 in ribbon cables and test clips, anyone can build a logic analyser for a very old computer system.

Videos below.

Continue reading “A Teensy Logic Analyzer For A 6502”

El Cheapo Phased-Array Sonar

Sonar is a great sensor to add to any small-scale robot project. And for a couple bucks, the ubiquitous HC-SR04 modules make it easy to do. If you’ve ever used these simple sonar units, though, you’ve doubtless noticed that you get back one piece of information only — the range to the closest object that the speaker is pointing at. It doesn’t have to be that way. [Graham Chow] built a simple phased-array using two SR04 modules, and it looks like he’s getting decent results.

PB211200The hack starts out by pulling off the microcontroller and driving the board directly, a hack inspired by [Emil]’s work on reverse engineering the SR04s. Once [Graham] can control the sonar pings and read the results back, the fun begins.

[Graham] uses TI’s Cortex M4F LaunchPad eval kit to generate a ping and receive the reflections. With normal sonar, the time between the ping being sent and its reception is determined by the range to the target. In a phased array, in this case just the two modules, the difference in the times it takes for the ping to return to each module is used to determine the angle to the target.

phased_array_sonar_tableau

If you’re DSP-savvy, [Graham] is using a phase-shifted square wave signal so that the correlations of the sent and returned signals have better peaks. This also helps the peaks in correlation across the two SR04s in the array. We think it’s pretty awesome that [Graham] is resolving a couple of degrees in angular separation when he moved his wine bottle. With a couple more SR04 units, [Graham] could start to get height information back as well.

For not much scratch, [Graham] has himself an experimental setup that lets him play with some pretty heavy signal processing. We’re impressed, and can’t wait to see what’s next. Special thanks to [Graham] for posting up the code.

And thanks [João] for the tip!