Raspberry Pi Tablet Based on Sailfish OS

There are so many hacks in this project it’s hard to know where to start. So let’s start at the SailPi tablet which is a Raspberry Pi running the Sailfish OS on an LCD touch screen powered by a cell phone battery pack. The design looks more like a high-tech sandwich with the Pi in the middle than a tablet. Despite the appearance it works, at that’s what counts. COs98UBWsAAQNh5The creator, [Aleksi Suomalainen] expended a lot of effort pulling all the pieces together on this project.

The Sailfish OS project is targeted at creating a new OS for mobile devices, especially cell phones. It is open source which invites developers to contribute to the project. The touch screen user interface is designed for ease of use by gestures from one finger on the hand holding the phone.

[Aleksi] ported Sailfish to a Pi 2 during a hacking week. He’s shared the code for it on his blog. During the hack week he played with accessing the GPIO on the Pi to flash an LED. To get you up and running quickly he provided an image you can load onto an SD.

It appears the Pi is finding a niche for OS hackers in addition to the hardware hackers using the GPIO.

Don’t miss the demo after the break to see the OS running on the Pi. Continue reading “Raspberry Pi Tablet Based on Sailfish OS”

Code Craft: When #define is Considered Harmful

An icon of Computer Science, [Edsger Dijkstra], published a letter in the Communications of the Association of Computer Machinery (ACM) which the editor gave the title “Go To Statement Considered Harmful“. A rousing debate ensued. A similar criticism of macros, i.e. #define, in C/C++ may not rise to that level but they have their own problems.

Macros are part of the preprocessor for the C/C++ languages which manipulates the source code before the actual translation to machine code. But there are risks when macros generate source code. [Bjarne Stroustrup] in creating C++ worked to reduce the need and usage of the preprocessor, especially the use of macros. In his book, The C++ Programming Language he writes,

Don’t use them if you don’t have to. Almost every macro demonstrates a flaw in the programming language, in the program, or in the programmer.

As C retrofitted capabilities of C++, it also reduced the need for macros, thus improving that language.

With the Arduino using the GNU GCC compilers for C and C++ I want to show new coders a couple of places where the preprocessor can cause trouble for the unwary. I’ll demonstrate how to use language features to achieve the same results more cleanly and safely. Of course, all of this applies equally when you use any of these languages on other systems.

We’re only going to be looking at macros in this article but if you want to read more the details about them or the preprocessor see the GNU GCC Manual section on the preprocessor.

Continue reading “Code Craft: When #define is Considered Harmful”

Bespoke, Artisanal, Hand Made Executables

Programmers and software engineers will always use the latest development environments, the trendiest frameworks, and languages they learned only 21 days ago. What if this weren’t the case? What if developers put care into their craft and wrote programs with an old world charm? What if Windows executables were made with the same patience as artisanal firewood, or free range granola? [Steve] has done it. He’s forging a path into the wilds of truly hand crafted executables.

The simplest executable you could run on a Windows box is just a simple .COM file. This is an extremely simple file format that just contains code and data loaded into 0100h, and a jump to another point in the code. The DOS .EXE file format is slightly more complicated, but not by much. [Steve]’s goal was to build a proper Windows executable without a compiler, assembler, linker, or anything else.

Continue reading “Bespoke, Artisanal, Hand Made Executables”

The Worst CAD Package Ever is Still Handy

A lot of great schematics wind up on the back of bar napkins or diner place mats. When inspiration strikes, you have to capture it, after all. Today, you are as likely to draw schematics on a computer and there are plenty of options for that; if you can install software your options are almost limitless. And if you have a modern Web browser, there are lots of good options that don’t even require an install.

But what about those times when you need a quick schematic to pop into a presentation? You are on some ancient conference room computer where you can’t install anything and it’s still running a browser that understands the <BLINK> tag? Try out the Klunky Schematic Editor. Your browser will need Javascript, but that’s about all. No HTML 5 or anything fancy.

Continue reading “The Worst CAD Package Ever is Still Handy”

Computer Learns to Hack Chess

A lot of computers can play chess. [Matthew Lui’s] Giraffe is a chess playing computer, but unlike other common chess programs, Giraffe taught itself to play. It apparently learned pretty well, too, since it is rated as an International Master on the FIDE scale (putting it in the top 2.2% of players. The top chess playing computers clock in at super grandmaster level but they are not self-taught).

Continue reading “Computer Learns to Hack Chess”

HC-SR04 Isn’t the Same as Parallax PING))) But It Can Pretend to Be!

“It’s only software!” A sentence that strikes terror in the heart of an embedded systems software developer. That sentence is often uttered when the software person finds a bug in the hardware and others assume it’s going to be easier for fix in software rather than spin a new hardware revision. No wonder software is always late.

[Clint Stevenson] is his own hardware and software guy, as are most of us. He wanted to use the less expensive HC-SR04 ultrasonic rangefinder in a prototype. Longer term he wanted to have the choice of either a Parallax PING or MaxBotix ultrasonic sensor for their better performance outdoors. His hardware hack of the SR04 made this a software problem which he also managed to solve!

[Clint] was working with the Arduino library, based on the Parallax PING, which uses a single pin for trigger and echo. The HC-SR04 uses separate pins. Originally he modified the Arduino library to accept the two pin approach. But with his long term goal in mind, he also modified the HC-SR04 sensor by removing the on-board pull-up resistor and adding a new one on the connector side to combine the signals. That gave him an SR04 that worked with the single-pin based library.

We’ve seen Parallax PING projects for sensing water depth and to generate music. These could be hacked to use the HC-SR04 using [Clint’s] techniques.

[Arduino and HC-SR04 photo from Blax Lab]

BlocksCAD is Browser-Based 3D Modeling that Teaches You CAD

Considering all of the projects the Raspberry Pi is used for now, the fact that it was originally envisioned to be an educational tool is sometimes forgotten. One of the tools commonly available with it is Scratch, a programming language that is easy to learn and can be seen as a gateway into other computer science realms. Building on this principle, MIT has come up with a new block-based educational tool called BlocksCAD.

BlocksCAD is essentially Scratch combined with OpenSCAD and allows the user to use blocks (similar to Scratch) to build a 3D model. The interface is fairly intuitive, and with some practice even complex shapes can be created using the tools available. Also, everything runs in a browser like the 3D modeling tool we featured a few days ago, so there isn’t anything to download or install.

The key to this project (like the key to Scratch) is that the user isn’t bogged down by syntax, which is often one of the largest hurdles for anyone who is just starting to learn to program. Since it’s possible to avoid syntax but still develop 3D models, this new tool should help anyone interested in the field of 3D modeling or CAD get a start without getting scared away too easily. Of course, if you do end up deep in the field of computer science and want to learn more about this project, the developers have opened up the source code as well.

Thanks for the tip, [Matt]!