Color Sensor from an RGB LED and a Photocell

When you need to quantify the color of an object, you’ve got quite a few options. You can throw a Raspberry Pi camera and OpenCV at the problem and approach it through software, or you can buy an off-the-shelf RGB sensor and wire it up to an Arduino. Or you can go back to basics and build this reflective RGB sensor from an LED and a photocell.

The principle behind [TechMartian]’s approach is simplicity itself: shine different colored lights on an object and measure how much light it reflects. If you know the red, green, and blue components of the light that correspond to maximum reflectance, then you know the color of the object. Their sensor uses a four-lead RGB LED, but we suppose a Neopixel could be used as well. The photosensor is a simple cadmium sulfide cell, which measures the intensity of light bouncing back from an object as an Arduino drives the LED through all possible colors with PWM signals. The sensor needs to be white balanced before use but seems to give sensible results in the video below. One imagines that a microcontroller-free design would be possible too, with 555s sweeping the PWN signals and op-amps taking care of detection.

And what’s the natural endpoint for a good RGB sensor? A candy sorter, or course, of which we have many examples, from the sleek and polished to the slightly more hackish.

Continue reading “Color Sensor from an RGB LED and a Photocell”

AI Generates Color Palettes; Has Remarkably Good Taste

Color palettes are key to any sort of visual or graphic design. A designer has to identify a handful of key colours to make a design work, making calls on what’s eye catching or what sets the mood appropriately. One of the problems is that it relies heavily on subjective judgement, rather than any known mathematical formula. There are rules one can apply, but rules can also be artistically broken, so it’s never a simple task. To this end, [Jack Qiao] created colormind.io, a tool that uses neural nets to generate color palettes.

It’s a fun tool – there’s a selection of palettes generated from popular media and sunset photos, as well as the option to generate custom palettes yourself. Colours can be locked so you can iterate around those you like, finding others that match well. The results are impressive – the tool is able to generate palettes that seem to blend rather well. We were unable to force it to generate anything truly garish despite a few attempts!

The blog explains the software behind the curtain. After first experimenting with a type of neural net known as an LSTM, [Jack] found the results too bland. The network was afraid to be wrong, so would choose values very much “in the middle”, leading to muted palettes of browns and greys. After switching to a less accuracy-focused network known as a GAN, the results were better – [Jack] says the network now generates what it believes to be “plausible” palettes. The code has been uploaded to GitHub if you’d like to play around with it yourself.

Check out this primer on neural nets if you’d like to learn more. We’d like to know – how do you pick a palette when starting a project? Let us know in the comments.

RGB LEDs: How to Master Gamma and Hue for Perfect Brightness

You would think that there’s nothing to know about RGB LEDs: just buy a (strip of) WS2812s with integrated 24-bit RGB drivers and start shuffling in your data. If you just want to make some shinies, and you don’t care about any sort of accurate color reproduction or consistent brightness, you’re all set.

But if you want to display video, encode data in colors, or just make some pretty art, you might want to think a little bit harder about those RGB values that you’re pushing down the wires. Any LED responds (almost) linearly to pulse-width modulation (PWM), putting out twice as much light when it’s on for twice as long, but the human eye is dramatically nonlinear. You might already know this from the one-LED case, but are you doing it right when you combine red, green, and blue?

It turns out that even getting a color-fade “right” is very tricky. Surprisingly, there’s been new science done on color perception in the last twenty years, even though both eyes and colors have been around approximately forever. In this shorty, I’ll work through just enough to get things 95% right: making yellows, magentas, and cyans about as bright as reds, greens, and blues. In the end, I’ll provide pointers to getting the last 5% right if you really want to geek out. If you’re ready to take your RGB blinkies to the next level, read on!

Continue reading “RGB LEDs: How to Master Gamma and Hue for Perfect Brightness”

Hack Your Brain: the McCollough Effect

There is a fascinating brain reaction known as the McCollough Effect which is like side-loading malicious code through your eyeballs. Although this looks and smells like an optical illusion, the science would argue otherwise. What Celeste McCollough observed in 1965 can be described as a contingent aftereffect although we refer to this as “The McCollough Effect” due to McCollough being the first to recognize this phenomena. It’s something that can’t be unseen… sometimes affecting your vision for months!

I am not suggesting that you experience the McCollough Effect yourself. We’ll look at the phenomena of the McCollough Effect, and it can be understood without subjecting yourself to it. If you must experience the McCollough Effect you do so at your own risk (here it is presented as a video). But read on to understand what is happening before you take the plunge.

Continue reading “Hack Your Brain: the McCollough Effect”

Smell Colors With A Synesthesia Mask

Synesthesia is a mix-up of sensory perception where stimulation of one sense leads to a stimulation of a second sense. This is the condition where Wednesdays can be blue, the best part of your favorite song can be orange, and six can be up and to the right of seventy-three. While you can’t teach yourself synesthesia – it’s something you’re born with – [Zachary] decided to emulate color to smell synesthesia with his most recent electronics project.

For his synesthesia mask, [Zach] is turning varying amounts of red, green, and blue found with a color sensor into scents. He’s doing this with an off-the-shelf color sensor, an Intel Edison, and a few servos and test tubes filled with essential oils. The color sensor is mounted on a ring, allowing [Zach] to pick which colors he wants to smell, and the scent helmet contains a small electronics box fitted with fans to blow the scent into his face.

There’s more than one type of synesthesia, and if you’re looking for something a little more painful, you can make objects feel loud with a tiny webcam that converts pixels into pulses of a small vibration motor.

Continue reading “Smell Colors With A Synesthesia Mask”

Electronics for Aliens

We are surrounded by displays with “millions” of colors and hundreds of pixels per inch. With super “high fidelity” sound producing what we perceive to be realistic replicas of the real world.

Of course this is not the case, we rarely stop and think how our electronic systems have been crafted around the limitations of human perception. So to explore this issue, in this article we ask the question: “What might an alien think of human technology?”. We will assume a lifeform which senses the world around it much as we do. But has massively improved sensing abilities. In light of these abilities we will dub it the Oculako.

Let’s begin with the now mostly defunct CRT display and see what our hypothetical alien thinks of it. The video below shows a TV screen shot at 10,000 frames per second.

Continue reading “Electronics for Aliens”

Simple Terminal Hack is Fit For Hollywood

We’ve all seen the cheesy hacker scenes in movies and on TV. Three dimensional file system browsers, computer chip cityscapes, and other ridiculous visualizations to make the dull act of sitting at a keyboard look pretty on the silver screen. While real hackers know those things are often silly and impractical, sometimes we do go out of our way to pretty things up a bit.

Hollywood might be able to learn a thing or two from this latest hack. [Yuri] modified his Linux terminal to change the color of the back lights on his laptop’s keyboard. It’s the kind of thing that actually would look good in a modern hacker movie, and [Yuri] is living proof that it’s something that a real-life hacker would actually use!

[Yuri] has been running Simple Terminal. The Simple Terminal project aims to build a replacement for the default xterm program that removes all of the unnecessary features and simplifies the source code. It also aims to make your terminal experience prettier. Part of making things prettier means that you can choose the font color for your terminals, and of course each terminal window can have its own color if you so choose.

[Yuri] happens to own an Alienware laptop. This laptop comes with RGB LEDs behind the keyboard, allowing you to light them up just about any color you could ever want. [Yuri] thought it would be cool if his keyboard color matched the font color of his terminal windows. Thanks to AlienFX, he was able to write a simple patch for Simple Terminal that does exactly this. Now whenever he selects a terminal window, the keyboard automatically switches colors to match the text in that window. Be sure to check out the video below. Continue reading “Simple Terminal Hack is Fit For Hollywood”