A Raspberry Pi As An Offboard Display Adapter

The humble USB-C port has brought us so many advantages over its USB ancestors, one of which is as a handy display output for laptops. Simply add an inexpensive adapter and you can hook up everything from a mobile phone upwards to an HDMI display or projector. There’s a snag though, merely having USB-C is not enough as the device has to support the display feature. It’s a problem [Gunnar Wolf] had to face with a Lenovo ARM laptop, and his solution is unexpected. Instead of an adapter, he’s used a Raspberry Pi 3 and some software tricks.

The obvious route to an off-board Pi mirroring onboard video is to use VNC, which he tried but found wanting due to lagginess. As a user of the Wayland compositor he found he could instead use wf-recorder and send its output to a stream, and thus capture his screen in a way that the Pi could read over the network. It’s not quite as convenient a solution as a pure-hardware adapter, but at least it allowed him to share the screen.

It’s surprising how often we find projects needing to mirror the display of a computer using what hardware is to hand, at least this one is more elegant than some others.

Hackaday Links Column Banner

Hackaday Links: December 26, 2021

At the time of this writing, the James Webb Space Telescope was perched upon its ride to space, ready for its much-delayed launch from the ESA spaceport in French Guiana. The $10 billion space observatory suffered one final delay (knocks on wood) when predictions of high winds aloft pushed it back from a Christmas Eve launch to a Christmas Day departure, at 12:20 UTC. Given the exigencies of the day, we doubt we’ll be able to watch the launch live — then again, past experience indicates we’ll still be wrapping presents at 4:20 PST. Either way, here’s hoping that everything comes off without a hitch, and that astronomers get the present they’ve been waiting many, many Christmases for.

In other space news, things are getting really interesting on Mars. The ESA announced that their ExoMars Trace Gas Orbiter has detected signs of water in the Valles Marineris. The satellite found a large area of increased hydrogen concentration in the top meter of Martian soil; the assumption is that the hydrogen comes from water, meaning that as much as 40% of the material in the region scanned may be water. If so, that’s a huge find, as we thought most of Mars’ water was locked in the polar regions. The Mariner Valley stretches more than 4,000 km just below the equator, and so may prove to be an important resource for future explorers.

Meanwhile, in Jezero crater, Perseverance has decided to upstage its rotorcraft sidekick for a change by finding signs of organic molecules on Mars. It’s not the first time organic compounds have been found — Perseverance’s cousin Curiosity found some too, ESA’s Mars Express mission spotted methane from on high, and then there were the equivocal but intriguing results from the Viking missions in the 1970s. But the latest evidence is really great news for the scientists who picked Jezero crater as a likely place to search for signs of past life on Mars. The organics found are not proof of life by any means, as there are many ways to make organic molecules abiotically. But then again, if you’re going to find evidence of life on Mars, you’ve got to start with detecting organics.

Back on Earth, getting your laptop stolen would be bad enough. But what if it got yoinked while it was unlocked? Depending on who you are and what you do with that machine, it could be a death sentence. That’s where BusKill could come in handy. It’s a hardware-software approach to securing a laptop when it — or you — suddenly goes missing. A dongle with a breakaway magnetic lanyard gets plugged into a USB port, and the other end of the lanyard gets attached to your person. If you get separated from your machine, the dongle sends customizable commands to either lock the screen or, for the sufficiently paranoid, nuke the hard drive. The designs are all up on GitHub, so check it out and think about what else this could be useful for.

If you like the look of low-poly models but hate the work involved in making them, our friend and Hack Chat alumnus Andrew Sink came up with a solution: an online 3D low-poly generator. The tool is pretty neat; it uses three.js and runs completely in-browser. All you have to do is upload an STL file and set sliders to get rid of as many triangles as you want. Great stuff, and fun to play with even if you don’t need to decimate your polygons.

And finally, what have you done with your oscilloscope for the last three years? Most of us can’t answer that except in the vaguest of terms, but then there’s DrTune, who took three years’ worth of screencaps from this Rigol DS1054z and strung them together into a 60-second movie. He swears he didn’t purposely sync the video to the soundtrack, which is “Flight of the Bumblebee” by Rimsky-Korsakov, but in some places it’s just perfect. See if you can guess what DrTune has been working on by watching the waveforms fly by. And watch for Easter eggs.

Yet Another Rigol DS1054Z Viewer

Tired of squinting at the small numbers on the oscilloscope display, [Alfred] aka [Gaze@] decided to take matters into his own hands and wrote yet another tool to remotely view images from a Rigol DS1054Z. At least that was the initial idea. But, it grew unexpectedly — as [Alfred] says, “the more the project turned out to be fun, the more it got out of hand”. We know the feeling well.

In addition to being able to simply view and export the screen, the program implements waveform measurements (we’re not sure if it is using the measurement ability of the ‘scope, or actually performing measurements in the program). And as you can see in the animated GIF of the program in operation over on the GitHub repository, the numbers are certainly clear and legible. His problem of squinting at the small screen has indeed been solved.

This is coded in Pascal (FPC Lazarus), but we weren’t able to browse the program because [Alfred] hasn’t posted the source code yet. It is written only for Linux, and he has tested it on Ubuntu, Debian, Fedora, and Manjaro. The project relies on Python, PyVisa, and gtk2, and talks to your DS1054Z over USB or LAN. The installation instructions are well documented, but as [Alfred] himself warns, if you encounter trouble arising from subtle dependency version conflicts, you may need to be a nerd and/or a pensioner with unlimited time on your hands to solve them. There is no users guide nor extensive help according to [Alfred]. However, simple hints might be found in hover text or by pressing F1. Disclaimers aside, this looks like an interesting project to try out.

As [Alfred] notes, there are many other tools available to fetch data and images from your Rigol oscilloscope. [Jenny List] wrote a two-part series on using Python to control your test instruments, and here’s an example of a simple Python script that does a screen grab. Do you have a favorite way to remotely operate your oscilloscope? Let us know in the comments below.

Bookworm Playing Bot Tests Programmer’s OCR Skills


Check out this brainy bot with [Jari] whipped up to dominate the Bookworm Deluxe scoreboard. The bot runs on top of a win32 machine, pulling screenshots to see the game board and simulating mouse clicks to play. The video after the jump shows that it plays like a champ, but it took some doing to get this far and [Jari] took the time to share all of the development details.

The hardest part of writing these types of bots is recognizing the game pieces. Check out all of the animation that’s going on in the still shot above… a lot of the tiles are obscured, there are different colors, and the tiles themselves shift as the bot spells and submits each word.

After some trial and error [Jari] settled on an image pre-processor which multiplies pixel values by themselves four times, then looks at each pixel with a 1/6 threshold to produce a black and white face for each tile. From there a bit of Optical Character Recognition compares each tile to a set of known examples. This works remarkably well, leading into the logic and dictionary part of the programming challenge.

Do you think this was easier or harder than the Bejeweled Blitz bot. That one was looking for specific pixel regions, this one is basically a focused roll-your-own OCR script.


Continue reading “Bookworm Playing Bot Tests Programmer’s OCR Skills”