Posts with «color sensor» label

Build a single-pixel scanning camera with an RGB sensor

Sensors like the TCS34725 from Adafruit can detect a single color. It stands to reason then, that if you were to aim this sensor at a multitude of points and record the resulting data, you could have a one-pixel camera. As seen here, Tucker Shannon decided to take this concept and run with it, constructing his own with an Arduino Uno and a pair of stepper motors.

The device looks like something akin to some sort of auto-turret, and directs the sensor in a square spiral for image acquisition. The resulting pictures are certainly low-res, but good enough to pick out recognizable forms with a little imagination. 

The color sensor tells the Arduino what color it “sees” at any given time. By pointing it at every single point within a field of view, I can record these colors and use them later to reconstruct an image.

Using two stepper motors, the camera points the sensor at every “pixel” within the photo and records what it sees. It uses these values to “paint” a picture of whats in front of it!

Components include: 1x Arduino Uno, 1x Adafruit RGB Color Sensor TCS34725, x2 BYJ-48 Stepper motor with drivers, x1 3mm OD aluminum tube, x20 M3x6mm fasteners. Alternatively a photoresistor can be used in place of the RGB sensor for black and white photos!

Code for the project can be found on GitHub, and print files are on Thingiverse if you’d like to build your own!

RGB Sensor’s New Job: Cryptocurrency Trade Advisor

[XenonJohn] dabbles in cryptocurrency trading, and when he saw an opportunity to buy an RGB color sensor, his immediate thought — which he admitted to us would probably not be the immediate thought of most normal people — was that he could point it to his laptop screen and have it analyze the ratio of green (buy) orders to red (sell) orders being made for crypto trading. In theory, if at a given moment there are more people looking to buy than there are people looking to sell, the value of a commodity could be expected to go up slightly in the short-term. The reverse is true if a lot of sell orders coming in relative to buy orders. Having this information and possibly acting on it could be useful, but then again it might not. Either way, as far as out-of-left-field project ideas go, promoting an RGB color sensor to Cryptocurrency Trading Advisor is a pretty good one.

Since the RGB sensor only sees what is directly in front of it, [XenonJohn] assembled a sort of simple light guide. By enclosing the area of the screen that contains orders in foil-lined cardboard, the sensor can get a general approximation of the amount of red (sell orders) versus green (buy orders). The data gets read by an Arduino which does a simple analysis and sends alerts when a threshold is crossed. He dubbed it the Crypto-Eye, and a video demo is embedded below.

Could this have been done purely in software? Certainly, but there’s a certain charm to the Crypto-Eye being a standalone device that uses a simple visual input to make buy and sell predictions like a Speak & Spell.

Inventive crypto trading is just a side project for [XenonJohn], he’s better known around these parts for his outstanding contributions to one-wheeled electric vehicles, like this 3000W Electric Unicycle, which also happens to feature an Arduino with 80’s-style voice feedback, just like the Crypto-Eye.

Soda Fridge Hack to Fix a Lazy People Problem

[Paul] participated in a hackathon at work and created a hack to help solve what was ultimately a people problem. A soda fridge at work wasn’t getting refilled when empty. Instead of trying to make people less lazy, [Paul] went with making the fridge more needy.

The first thing [Paul] did was make a soda fridge refill sensor from a scale. As the fridge got emptier, it got lighter. The scale senses that and can decide it’s time for a refill. The only part missing was how to read the output from the scale. To do that, he took an unusual approach.

Soda fridge on an analog scale with color sensor reading the dial

The soda fridge sits on an analog scale with a dial. [Paul] saw there was no need to measure the exact weight of the fridge, only to detect a refill threshold. He came up with a simple hack: colored paper attached to the scale’s dial and an Arduino with an OSEPP COLOR‑01 color sensor pointed at the paper. The dial moves in response to the fridge’s changing weight, and the color sensor reads the color of the paper as it moves under the sensor. With a little bit of trial-and-error calibration and some barely modified sample code for the sensor, it was possible to reliably detect when the fridge required refilling. With the sensor done, it was time to use it to solve the lazy people problem.

In a way, the root problem wasn’t that people couldn’t be bothered to check if the fridge needed a refill – it was that the right people weren’t finding out at the right times. This resulted in spotty refilling as well as soda not being ordered when needed. This hack means that the fridge can now actively announce its state, which now allows things like notifying people via email that it is their turn to refill and re-order. It turns out that a fridge that can tell people what it needs has a much better chance of being serviced, compared to a one that has to wait for people to check up on it.

We’ve seen people interface directly to the load sensors in weight scales before, but this hack took a completely different approach.

Thanks to [Paul] for sharing.


Filed under: Arduino Hacks

New Project: Color Recognition Lock

How to make an basic electronic color sensor and how to use it to make a color activated lock box

Read more on MAKE