PS3 Eye Lives Again Thanks To Low Prices

[Henry Tonoyan] has started getting into OpenCV and digital control system projects. He needed a decent webcam that could do higher than standard frame rates. As it turns out, the PS3 Eye is actually a pretty capable little camera. Now that it’s kind of obsolete, you can have it for as little as $7 from places like Amazon!

The PS3 Eye has a standard USB interface, and after messing around with it a bit in Linux, [Henry] was able to adjust the frame rate settings for his application. He’s using a library called video for Linux with an application called qv4L2. It’s capable of 60fps at VGA, which we admit isn’t amazing, but at $7, we can’t complain — if you drop down to QVGA (320×240) you can go up to 120fps.

From there you can play around in OpenCV to your heart’s content.

Seeing as the Eye has been out for over 7 years now, it has been used in quite a few hacks since then. From an actual eyeball tracker (seriously), to an interactive projection globe with touch tracking to even a physical tower defense game.

Reading Resistors With OpenCV

Here’s a tip from a wizened engineer I’ve heard several times. If you’re poking around a circuit that has failed, look at the resistor color codes. Sometimes, if a resistor overheats, the color code bands will change color – orange to brown, blue to black, and so forth. If you know your preferred numbers for resistors, you might find a resistor with a value that isn’t made. This is where the circuit was overheating, and you’re probably very close to discovering the problem.

The problem with this technique is that you have to look at and decode all the resistors. If automation and computer vision is more your thing, [Parth] made an Android app that will automatically tell you the value of a resistor by pointing a camera at it.

The code uses OpenCV to scan a small line of pixels in the middle of the screen. Colors are extracted from this, and the value of the resistor is displayed on the screen. It’s perfect for scanning through a few hundred through hole resistors, if you don’t want to learn the politically correct mnemonic they’re teaching these days.

Video below, and the app is available for free on the Google Play store.

Continue reading “Reading Resistors With OpenCV”

Resource monitoring solution

Electricity, Gas and Water – three resources that are vital in our daily lives. Monitoring them using modern technology helps with conservation, but the real impact comes when we use the available data to reduce wasteful usage over time. [Sébastien] was rather embarrassed when a problem was detected in his boiler only during its annual inspection. Investigations showed that the problem occurred 4 months earlier, resulting in a net loss of more than 450 cubic meters, equivalent to 3750 liters per day (about 25 baths every day!). Being a self professed geek, living in a modern “connected” home, it rankled him to the core. What resulted was S-Energy – an energy resource monitoring solution (translated) that checks on electricity, gas and water consumption using a Raspberry Pi, an Arduino, some other bits of hardware and some smart software.

[Sébastien] wanted a system that would warn of abnormal consumption and encourage his household folks to consume less. His first hurdle was the meters themselves. All three utilities used pretty old technology, and the meters did not have pulse data output that is commonplace in modern metering. He could have replaced the old meters, but that was going to cost him a lot of money. reflective-power-meter-sensorSo he figured out a way to extract data from the existing meters. For the Electricity meter, he thought of using current clamps, but punted that idea considering them to be suited more for instantaneous readings and prone for significant drift when measuring cumulative consumption. Eventually, he hit upon a pretty neat hack. He took a slot type opto coupler, cut it in half, and used it as a retro-reflective sensor that detected the black band on the spinning disk of the old electro-mechanical meter. Each turn of the disk corresponds to 4 Watt-hours. A little computation, and he’s able to deduce Watt-hours and Amps used. The sensor is hooked up to an Arduino Pro-mini which then sends the data via a nRF24L01+ module to the main circuit located inside his house. The electronics are housed in a small enclosure, and the opto-sensor looks just taped to the meter. He has a nice tip on aligning the infra-red opto-sensor – use a camera to check it (a phone camera can work well).

Continue reading “Resource monitoring solution”

Mustachioed Nintendo Virtual Boy Gone Augmented Reality

Some people just want to watch the world burn. Others want to spread peace, joy and mustaches. [Joe Grand] falls into the latter group this time around. His latest creation is Mustache Mayhem, a hack, video game, and art project all rolled into one. This is a bit of a change from deconstructing circuit boards or designing electronic badges, but not completely new for [Joe], who wrote SCSIcide and Ultra SCSIcide for the Atari 2600 back in the early 2000’s.

Mustache Mayhem is built into a Nintendo Virtual Boy housing. The Virtual Boy itself was broken, and unfortunately was beyond repair. [Joe] removed most of the stock electronics and added a BeagleBone Black, Logitech C920 webcam, an LCD screen and some custom electronics. He kept the original audio amplifier, speakers, and controller connector. Angstrom Linux boots into [Joe’s] software, which uses OpenCV to detect faces and overlay mustaches. Gameplay is simple: Point the console at one or more faces. If you see a mustache, press the A button on the controller! The more faces and mustaches on-screen at once, the more points, or “mojo” the player gets. The code is up on Github, and can be built with Xcode targeted to the Mac, or directly on the BeagleBone Black.

[Joe’s] goal for the project was to make a ridiculous game that looks like it could have come out in the 90’s. He also used Mustache Mayhem as a fun way to learn some new skills which will come in handy for more serious projects in the future.

We caught up with [Joe] for a quick interview about his new creation.

How did you come up with the idea for Mustache Mayhem?

blockI was selling a bunch of my video game collection at PRGE (Portland Retro Gaming Expo) a few years ago and had a broken Virtual Boy that no one bought. A friend of mine was at the table and said I had to do something with it. I thought “People wear cosplay and walk around at conventions, so what if I could do something with the Virtual Boy that you could walk around with?” That was the seed.

A few months later, Texas Instruments sent me the original production release of the BeagleBone Black (rev. A5A). Eighteen months after that I actually started the project. The catalyst was to do something for an upcoming Portland, OR art show (Byte Me 4.0), which is an annual event that shows off interactive technology-based artwork. I wrote up a little description and got accepted. I had less than 2 months to actually get things working and it ended up taking about a month of full-time work. It was much more work than I expected for such a silly project. I originally was going to do something along the lines of walking around in a Doom-like perspective and shooting people when their faces were detected.

That would be pretty darn cool. How did you get from Doom to Mustaches? 

I saw a TI BeagleBoard demo called “boothstache” which drew mustaches on faces and tweeted the pictures. I thought that doing something non-violent with mustaches would be more suitable (and funny) to actually show my kids. I also secretly wanted to use this project as a way to experiment with Linux, write some code, and learn about face detection and image processing with OpenCV, which I plan to use for some actual computer security research in the future. Mustache Mayhem turned out to be a super cool project and I’m really happy with it. I sort of feel guilty spending so much time on it, since it’s basically just a one-off prototype, but I just got so obsessed with making it exactly as I wanted.

You mentioned on your website that Mustache was “designed to challenge the paradigms of personal privacy and entertainment.” What exactly did you mean there?

Continue reading “Mustachioed Nintendo Virtual Boy Gone Augmented Reality”

Face Recognition For Your Next Con

[jwcrawley] is busy planning for the Makevention coming up in Bloomington, Indiana in late August. One problem when working any con is manning the door; it’s a good idea to know how many people are there, and you can’t double count people. Previously, the volunteers used dead trees to estimate how many people have turned up. This year they might go with a more technological solution: face recognition and tracking.

The project is called uWho, and it uses the faceRecognizer class in OpenCV. The purpose of the entire project is to identify who someone is from previous frames. If your face is unknown to the program, your likeness – rather, a few points of data – are added to the database of faces. It’s simple, and according to [jwcrawley], it works.

While this is technically the best way to count how many unique people show up to Makevention, there will be some discussions to see if this solution is appropriate. The program only saves unique data from a face locally, and does nothing online. It’s less evil than whatever Facebook does, but there are obvious privacy implications here.

Link to the Makevention.

Beating Super Hexagon with OpenCV and DLL Injection

Every few months a game comes along which is so addictive, players can’t seem to put it down – no matter how frustrating it may get. Last year one of those games was Super Hexagon. After fighting his way through several levels, [Val] decided that designing a bot to beat the game would be more efficient than doing it himself. Having played a few rounds of Super Hexagon ourselves, we can’t fault him on that front!

At its core, Super Hexagon is a simple game. Walls move from the screen edges toward a ship located near the center of the screen. The player uses the arrow keys to “orbit” the ship around a central shape. Avoid getting crushed by the walls, and you’re golden. However, the entire game board is constantly spinning, expanding, contracting, flashing, and generally doing things to disorient the player while ever more complex wall patterns move in to kill you. In short, Super Hexagaon makes Touhou bullet hell games look like a cakewalk.

The first step in beating the game is to capture the screen. [Val] tried Fraps and VLC, but lags of 2 seconds or more were not going to work. Then [Val] turned to DLL Injection. Super Hexagon calls the OpenGL function glutSwapBuffers() to implement double buffering. Every frame of the game is rendered in the background. Once rendering is complete glutSwapBuffers() is called to swap the buffers, and the process starts over again. [Val] changed the game code such that his own frame capture function would be called instead of glutSwapBuffers(). Once he was done capturing the game’s video buffer, [Val] then called the real glutSwapBuffers() function. It worked perfectly.

Now that he had an image, [Val] used OpenCV to process it. Although game is graphically very noisy, there are only a few colors used at any one time. It didn’t take much work to come up with an algorithm which would create a binary image of the walls and the ship itself.

step5[Val] cast rays from the center of each wall through the center of the screen. The ray which was longest before intersecting another wall would be the best escape route. This simple solution worked, but only for about 40 seconds. At that point, Super Hexagon would start throwing more complex patterns, and the AI would fail. The final solution was to create an accessibility condition which also took into account how much space was available between the various approaching walls. This new version of the AI was able to beat the game.

So was this a more efficient method than grinding through Super Hexagon manually? Since [Val] now knows all about DLL injection and OpenCV, we sure think it was!

Click past the break to see the [Val’s] bot in action!

Continue reading “Beating Super Hexagon with OpenCV and DLL Injection”

A Raspberry Pi Garage Door Opener

We can never seem to get enough garage door hacks around here. [Tanner’s] project is the most recent entry into this category. He’s managed to hook up a Raspberry Pi to his garage door opener. This greatly extends his range to… well anywhere with an Internet connection.

His hack is relatively simple. He started with the garage door opener remote. He removed the momentary switch that was normally used to active the door. He bridged the electrical connection to create a circuit that was always closed. This meant that as long as the remote had power, the switch would be activated. Now all [Tanner] had to do was remove the battery and hook up the power connectors to his Raspberry Pi. Since the remote works on 3.3V and draws little current, he is able to power the remote directly from the Pi. The Pi just has to turn its pin high momentarily to activate the remote.

The ability to toggle the state of your garage door from anywhere in the world also comes with paranoia. [Tanner] wanted to be able to tell if the door is up, down, or stopped somewhere in the middle while he was away from home. He also wanted to use as little equipment as possible. Since he already had an IP camera in the garage, he decided to use computer vision to do the detection.

He printed off two large, black shapes onto ordinary white computer paper. One was taped to the top of the door and one to the bottom. A custom script runs on the Pi that grabs the latest image from the camera and uses OpenCV to detect the shapes. If both shapes are visible, then the script can assume the door is closed. Otherwise, it’s likely open. This makes it easier for [Tanner] to know if the door is opened or closed without having to check the camera himself.

Can’t get enough garage door hacks? Try these on for size. Continue reading “A Raspberry Pi Garage Door Opener”