Webcam Heart Rate Monitor Brings Photoplethysmography To Your PC

It seems like within the last ten years, every other gadget to be released has some sort of heart rate monitoring capability. Most modern smartwatches can report your BPMs, and we’ve even seen some headphones with the same ability hitting the market. Most of these devices use an optical measurement method in which skin is illuminated (usually by an LED) and a sensor records changes in skin color and light absorption. This method is called Photoplethysmography (PPG), and has even been implemented (in a simple form) in smartphone apps in which the data is generated by video of your finger covering the phone camera.

The basic theory of operation here has its roots in an experiment you probably undertook as a child. Did you ever hold a flashlight up to your hand to see the light, filtered red by your blood, shine through? That’s exactly what’s happening here. One key detail that is hard to perceive when a flashlight is illuminating your entire hand, however, is that deoxygenated blood is darker in color than oxygenated blood. By observing the frequency of the light-dark color change, we can back out the heart rate.

This is exactly how [Andy Kong] approached two methods of measuring heart rate from a webcam.

Method 1: The Cover-Up

The first detection scheme [Andy] tried is what he refers to as the “phone flashlight trick”. Essentially, you cover the webcam lens entirely with your finger. Ambient light shines through your skin and produces a video stream that looks like a dark red rectangle. Though it may be imperceptible to us, the color changes ever-so-slightly as your heart beats. An FFT of the raw data gives us a heart rate that’s surprisingly accurate. [Andy] even has a live demo up that you can try for yourself (just remember to clean the smudges off your webcam afterwards).

Method 2: Remote Sensing

Now things are getting a bit more advanced. What if you don’t want to clean your webcam after each time you measure your heart rate? Well thankfully there’s a remote sensing option as well.

For this method, [Andy] is actually using OpenCV to measure the cyclical swelling and shrinking of blood vessels in your skin by measuring the color change in your face. It’s absolutely mind-blowing that this works, considering the resolution of a standard webcam. He found the most success by focusing on fleshy patches of skin right below the eyes, though he says others recommend taking a look at the forehead.

Every now and then we see something that works even though it really seems like it shouldn’t. How is a webcam sensitive enough to measure these minute changes in facial color? Why isn’t the signal uselessly noisy? This project is in good company with other neat heart rate measurement tricks we’ve seen. It’s amazing that this works at all, and even more incredible that it works so well.

Better Security, Harry Potter Style

We all know we shouldn’t use 1234 as our password. But we often don’t do the absolute best practice when it comes to passwords. After all, you should have some obscure strange password that is unique for every site. But we all have lots of passwords, so most of us use $pock2020 or something like that. If you know I’m a Star Trek fan, that wouldn’t be super hard to guess. [Phani] writes about a technique called Horcruxing — a term taken from the literary realm of Harry Potter that allowed Voldemort to preserve life by splitting it into multiple parts, all of which were required to bring an end to his villany. [Phani’s] process promises to offer better security than using a single password, without the problems associated with having hundreds of random passwords.

Most people these days use some form of password manager. That’s great because the manager can create 48 character passwords of random words or symbols and even you don’t know the password. Of course, you do know the master password or, at least, you better. So if anyone ever compromised that password, they’d have all your passwords at their fingers. Horcruxing makes sure that the password manager doesn’t know the entire password, just the hard parts of it.

Continue reading “Better Security, Harry Potter Style”

Making Smart Bulbs Smarter With The Power Of MQTT

What’s the point of smart home automation? To make every day tasks easier, of course! According to [Tomasz Cybulski], that wasn’t the case when he installed IKEA smart lights in his closet. It’s handy to have them in a common switch, in this case a remote control, but having to look for it every time he needed the lights could use some improvement. Enter his project to make smart bulbs smarter, through the use of a simple ESP8266.

While hooking a door switch to the lights’ power supply could provide a quick solution, [Tomasz]’s wife wanted to keep the functionality of the remote control, so he had to look elsewhere. These light bulbs use the simple Zigbee protocol, so arranging for other devices was rather trivial. A USB dongle to interface with the protocol was configured for his existing Raspberry Pi automation controller, while an ESP8266 served as the real-world sensor by connecting it to reed switches installed in the closet doors.

With all the hardware sorted out, it’s a simple matter of making it all talk to each other. The ESP8266, using the Tasmota firmware, sends a signal to an MQTT server running on the Raspberry Pi, which in turn translates it to a remote trigger on the Zigbee frequency with the dongle. The lights turn on when the door opens, and off again once it closes. And since there were no further modifications to the lights themselves, the original IKEA controller still works as expected, which we’re sure [Tomasz]’s wife appreciates!

MQTT can be an interesting piece of software that goes beyond just home automation though, and if you already have a server in your home you can use it to transfer your clipboard’s contents to another device. If you are using it for home automation though, here’s an inspiration for a rather unusual dashboard to keep things interesting. Check out this hack in action after the break.

Continue reading “Making Smart Bulbs Smarter With The Power Of MQTT”

Modified Yost Tames Pinout Plethora

Every hacker has an assortment of USB to TTL-serial adapters kicking around in their lab, and we have all been annoyed that each one has a different pinout. You layout a PCB or breadboard for the Sparkfun flavor (GND, CTS, VCC, TXD, RXD, DTR), but when you begin troubleshooting all you can find is a CH340 board (GND, +5V, TXD, RXD, DTR, +3.3V). You have to jumper everything, and it becomes a mess. It wasn’t much better back in the days of RS-232 level signaling, either. While the pinouts were consistent, there were other headaches. Did the connection need a NULL modem adaptor? And if you were unlucky, you might need a DB-25 to DE-9 adaptor, and the really unlucky might need one or more gender changers. Surely there’s a better way.

It turns out there was a better way, although it didn’t seem to have become as popular as one might expect. Back in 1987 [Dave Yost] formalized an interconnection scheme using RJ45 plugs and jacks while at Berkeley.  The signals were arranged in a mirrored fashion so that each cable is always a crossover — just plug two cables back-to-back if you really need a straight thru connection.

Even though he was dealing with RS-232 serial, nothing prevents us from using this scheme for logic level signaling. For example, consider the following 1×10 header pinout, where the original 8-pins are expanded to 10 to allow for power:

This is an extreme example, and can obviously be shrunk depending on how much handshaking, if any, or power is desired. Such a pinout lets you switch between DCE and DTE by simply flipping the connector around. And if a Dupont-style header slips off too easily in your applications, you could always use an RJ connector. This still doesn’t solve the Tower of Babel pinout problem with the USB-TTL adaptors. But standardizing on a serial pinout such as this for your projects and making cables or kludging your TTL adaptors will make serial debugging less painful.

Yost to Sparkfun Adaptor Cable

Back when he released this scheme in 1987, [Dave] pontificated:

“Maybe one day before the year 2,000, the world will have a new, simple, high-speed, flow-controlled, standard type of connection for point-to-point applications currently using RS-232, with an adaptor available to talk to old, RS-232 equipment.”

Let us know your thoughts in the comments below.

Ten Robot Mechanisms For Your Design Toolbox

The convergence of mechanics and electronics in robotics brings with it a lot of challenges. Thanks to 3D printing and low cost components, it’s possible to quickly and easily experiment with a variety of robotics mechanism for various use cases. [Paul Gould] has been doing exactly this, and is giving us a taste of ten designs he will be open sourcing in the near future. Video after the break.

Three of the designs are capstan mechanisms, with different motors and layouts, tested for [Paul]’s latest quadruped robot. Capstan mechanisms are a few centuries old, and were originally used on sailing ships to give the required mechanical advantage to tension large sails and hoist cargo.

Two of the mechanisms employ GUS Simpson Drives, which use a combination of belts and a rolling joint. These were inspired by the LIMS2-AMBIDEX developed at the University of Korea. The ever-popular cycloidal gearbox also makes and appearance in the form of a high torque dual disk linked, two stage, NEMA17 driven gearbox.

[Paul] also built a room sized skycam-like claw robot for his daughter, suspended by four ball chain strings reeled in by four brushless motors with ESP32 powered motor controllers. We are looking forward to having a close look at these designs when [Paul] releases them, and to see how his quadruped robot will turn out.

[Thanks TTN for the tip!]

The X-PC, A Stylish Re-Imagining Of An Old Laptop

There’s one certainty wherever schoolchildren come into contact with computers: the hardware will inevitably emerge worse for the encounter. The school laptops managed by [Neil Lambert] certainly suffered, losing keys and power supplies aplenty. Faced with a pile of broken machines, he came up with the X-PC, a stylish all-in-one desktop computer built around the innards of a laptop.

Inside a modern laptop there is surprisingly little in the way of parts, now that removable media drives are largely a thing of the past and once the battery has been removed from the equation. When the keyboard and trackpad are subtracted and replaced with USB equivalents the inner workings are reduced to a relatively compact motherboard and hard drive alongside the screen.

The screen is encased in a lasercut frame that also mounts the motherboard. It includes a lasercut cover that folds over the top in a living hinge to create an A-frame case that also holds the power supply. As an extra bonus the centre of the A provides handy storage for a keyboard.

Most of us will have encountered enough older laptops with broken parts to recognise the value in this build, seeing how it can transform junk into a useful machine. This certainly isn’t the first time we’ve seen someone try a similar build.

Is This The World’s Smallest Nintendo 64?

A niche activity in console fandom is the shrinking of full-size consoles to smaller formats, taking what could once only be played on the family TV into portable formats that fit in the pocket. In a particularly impressive example of the art, [GmanModz] has made what he claims is the world’s smallest portable Nintendo 64. What makes it particularly noteworthy is that he’s done it not with an emulator or a custom PCB, instead there is a real Nintendo 64 motherboard in there having undergone a significant quantity of trimming.

The video below the break goes into detail on the state of the art in these mods, and shows how he has eschewed the latest tech and instead restricted himself to only using commercially available breakout PCBs and off the shelf modules. The N64 board trimmed down particularly aggressively, requiring a lot of fine magnet wire soldering for the various PCBs replacing the parts removed. The cartridge slot is brought out to the back of the board at a right angle, jutting out from the rear of the 3D printed case above a space for an 18650 cell and allowing an original game cartridge to be played. There is a microcontroller to facilitate a few compromises on lesser uses of the Nintendo control pads, but the result is a fully playable mini handheld console. He does admit that “The battery life sucks, it’s uncomfortable to hold […] But hey — it fits in my pocket. Does your N64?” We can’t fault him on that.

This isn’t the first portable N64 we’ve seen, but will it hold the title of smallest for long? Only time will tell.

Continue reading “Is This The World’s Smallest Nintendo 64?”