Code Craft – Embedding C++: Timing Virtual Functions

Embedded C developers shy away from C++ out of concern for performance. The class construct is one of their main concerns. My previous article Code Craft – Embedding C++: Classes explored whether classes cause code bloat. There was little or no bloat and what is there assures that initialization occurs.

Using classes, and C++ overall, is advantageous because it produces cleaner looking code, in part, by organizing data and the operations on the data into one programming structure. This simple use of classes isn’t the raison d’etre for them but to provide inheritance, or more specifically polymorphism, (from Greek polys, “many, much” and morphē, “form, shape”).

Skeptics feel inheritance simply must introduce nasty increases in timing. Here I once more bravely assert that no such increases occur, and will offer side-by-side comparison as proof.

Continue reading “Code Craft – Embedding C++: Timing Virtual Functions”

Retrotechtacular: A Mechanical UART

We’ve heard it said that no one invented the old mechanical Teletype. One fell from the sky near Skokie, Illinois and people just duplicated them. It is true these old machines were similar to a modern terminal. They sent and received serial data using a printer instead of a screen. But inside, they were mechanical Rube Goldbergs, not full of the electronic circuits you’d think of today.

Teletype was the best-known name, but there were other mechanical monster terminals out there. [Carsten] recently took some pictures of his 99 pound Olivetti mechanical terminal. According to him, there’s only one electronic component within: a bistable solenoid that reads the data. Everything else is mechanical and driven with a motor that keeps everything at the right baud rate (110 baud).

Like the Teletype, it is a miracle these things were able to work as well as they did. Lacking a microcontroller, the terminals could respond to an identity request by spinning a little wheel that had teeth removed to indicate which letters to send (TeleType used a similar scheme). Things that are simple using today’s electronics (like preventing two keys pressed at once from being a problem) turned out to be massive design challenges for these old metal monsters.

Turns out that when [Carsten] last fired the terminal up, a capacitor finally gave up its magic smoke. He plans to fix it, though, and as long as it isn’t a mechanical problem, we bet he will.

We’ve talked about Teletypes a few times in the past, including using them for text messaging and even Twitter.

Is That Google In Your Pants?

Google’s Project Jacquard is tackling the age old gap between controlling your electronic device and touching yourself. They are doing this by weaving conductive thread into clothing in the form of a touch pad. In partnership with Levi Strauss & Co., Google has been designing and producing touch interfaces that are meant to be used by developers however they see fit.

touch-sensitive-jeans-thumbThe approach that Project Jacquard has taken from a hardware standpoint is on point. Rather than having an end user product in mind and design completely towards that goal, the project is focused on the interface as its product. This has the added benefit of endless varieties of textile interface possibilities. As stated in the video embedded after the break, the conductive touch interface can be designed as a visibly noticeable difference in material or seamlessly woven into a garment.

As awesome as this new interface may seem there are some things to consider:

  • Can an unintentional brush with another person “sleeve dial” your boss or mother-in-law?
  • What are the implications of Google putting sensors in your jeans?
  • At what point is haptic feedback inappropriate? and do we have to pay extra for that?

We’ve covered e-textiles before from a conductive thread and thru hole components approach to electro-mechanical implementations.

Continue reading “Is That Google In Your Pants?”

Build An AM Radio Transmitter From A CPLD

[Alex Lao] has been playing around with the CPLD-like parts of a PSoC. Which is to say, he’s been implementing simple logic functions “in hardware” in software. And after getting started with the chip by getting accustomed to the different clock sources, he built a simple AM radio that transmits at 24 MHz.

The device that [Alex] is learning on is a Cypress PSoC 5LP, or more specifically their (cheap) prototyping kit for the part. The chip itself is an ARM microprocessor core with a CPLD and some analog tidbits onboard to make interfacing the micro with the outside world a lot easier. [Alex] doesn’t even mess around with the microprocessor, he’s interested in learning the CPLD side of things.

PRS-CircuitHe starts off with a 24 MHz carrier and a 1 kHz tone signal, and combines them with a logical AND function. When the tone is on, the carrier plays through; that’s AM radio at its most elemental. Everything is logic (square waves) so it’s a messy radio signal, but it’ll get the job done.

Adding a multiplexer up front allows [Alex] to play two tones over his “radio” station. Not bad for some simple logic, and a fantastic Hello World project for a CPLD. We can’t wait to see what [Alex] is up to next!

If you’re interested in getting your feet wet with either CPLDs in general or a CPLD + micro system like Cypress’s, the development kit that [Alex] is using looks like a cheap and painless way to start. (Relatively speaking — PSoCs are a step or two up a steep learning curve from the simpler 8-bit micros or an Arduino.) Hackaday’s own [Bil Herd] has a video on getting started with another member of the Cypres PSoC family, so you should also check that out.

Avoid Procrastination With This Phone Lock Box

Smart phones are great. So great that you may find yourself distracted from working, eating, conversing with other human beings in person, or even sleeping. [Digitaljunky] has this problem (not surprising, really, considering his name) so he built an anti-procrastination box. The box is big enough to hold a smart phone and has an Arduino-based time lock.

The real trick is making the box so that the Arduino can lock and unlock it with a solenoid. [Digitaljunky] doesn’t have a 3D printer, so he used Fimo clay to mold a custom latch piece. A digital display, a FET to drive the solenoid, and a handful of common components round out the design.

Continue reading “Avoid Procrastination With This Phone Lock Box”

Act Now And Receive The Prong Saver For Only $0.00!

Well, actually, you can’t buy this. But for [TVmiller’s] latest project he decided to have some fun with the video — so he made an infomercial for it.

Called the Prong Saver, the device clips onto any appliance’s electrical cord to help prevent you from accidentally pulling too hard and bending the electrical prongs. It’s basically a cord-tension alarm. The question is — can you hear it over the vacuum cleaner?

And just because he could, it’s solar powered. Because why the heck not? He built it using scraps he found around the workshop. That included a solar powered LED key chain, a small piezo speaker, an eyebolt and a compression spring. Anyway, check out the commercial after the break. It had us in stitches.

Continue reading “Act Now And Receive The Prong Saver For Only $0.00!”

Impedance Tomography Is The New X-Ray Machine

Seeing what’s going on inside a human body is pretty difficult. Unless you’re Superman and you have X-ray vision, you’ll need a large, expensive piece of medical equipment. And even then, X-rays are harmful part of the electromagnetic spectrum. Rather than using a large machine or questionable Kryptonian ionizing radiation vision, there’s another option now: electrical impedance tomography.

[Chris Harrison] and the rest of a research team at Carnegie Mellon University have come up with a way to use electrical excitation to view internal impedance cross-sections of an arm. While this doesn’t have the resolution of an X-ray or CT, there’s still a large amount of information that can be gathered from using this method. Different structures in the body, like bone, will have a different impedance than muscle or other tissues. Even flexed muscle changes its impedance from its resting state, and the team have used their sensor as proof-of-concept for hand gesture recognition.

This device is small, low power, and low-cost, and we could easily see it being the “next thing” in smart watch features. Gesture recognition at this level would open up a whole world of possibilities, especially if you don’t have to rely on any non-wearable hardware like ultrasound or LIDAR.