Using I2C Addresses as Chip Selects

I2C has a seven-bit address space, and you’re thinking “when do I ever need more than 127 devices on a pair of wires?” So you order up some parts only to find that they have one, two, or three user-configurable address pins for any given device type. And you need a bunch more than four or eight capacitive sensor buttons on your project. What do you do?

If you’re reader [Marv G], you think outside the box and realize that you can change the addresses on the fly by toggling address pins high and low with your microcontroller. That is, you can use a single I2C address pin for each device as a chip select signal just like you would have with SPI.

That’s it, really. [Marv G] goes through all of the other possible options in his writeup, and they’re all unsavory: multiple I2C busses, a multiplexer, buying different sensors, or changing micros. None of these are as straightforward as just running some more wires and toggling these with your micro.

We’d even go so far as to suggest that you could fan these chip select lines out with a shift register or one of those 1-of-N decoder chips, depending on how many I2C devices you need to chip-selectify. (We’re thinking 74HC595 or 74HC154.)

Along the way, we found this nice list of the number of address pins for a bunch of common peripherals provided by [LadyAda], in case you don’t believe us about how ubiquitous this problem is. How many devices on that list have one (1!!) address pin?

At the end of his post, [Marv G] asks if anyone else has thought of this chip select trick before. We hadn’t. Here’s your chance to play the smart-ass in the comments.

Re-purposing Old Electronics to Inspire New Designs

We love seeing how things work. Exploded views are like mechanical eye-candy to most engineers, so when [Chris’] Kindle Touch died, he decided to give it new life… on his wall.

Inspired by others, he decided to mount all the components of his Kindle onto a piece of plastic that he could hang up on his wall. As an electronics design engineer, he’s always looking for new ideas and ways to design and build circuits — what better way to inspire creativity than to see a real product blown apart? Does anyone remember reading [Stephen Biesty’s] Incredible Cross Sections or Incredible Explosions as a child?

The construction is quite simple, relying on mounting holes where possible to screw parts directly to the board, or by using heavy duty double-sided tape. After finishing the Kindle, [Chris] found an old iPod of his and decided to give it the same ritual.

For some more in-depth exploded physical models, take a look Bolt.io’s office art we covered last year!

AVR Hardware Timer Tricked Into One-Shot

[Josh] has written up two posts that those of you who use AVRs might find handy. The first post documents a C library that implements a jitter-free one-shot timer. The second post explains how it works. We think it’s such a good idea that we’re going to spoil it for you, but go ahead and read his links and check out his code.

A one-shot is a pulse generator that runs once and only once. You trigger it, it produces the desired pulse, and that’s all she wrote. Why is this handy? Many external ICs that you’ll interface with have minimum durations for signal pulses that must be respected. You could program the AVR to toggle a pin high and then sit around and wait until it’s time to toggle the pin low again, but this wastes valuable CPU time, isn’t going to be very precise, and is susceptible to timing discrepancies if interrupt routines fire in the mean time.

You’d think that you could use the hardware timers for this, but it’s not straightforward. Normally, the timers are free-running; the counter that’s keeping track of time rolls over the top and starts over again. But we just want one pulse.

[Josh]’s very clever idea abuses the timer/counter’s TOP and MATCH values in “Fast PWM” mode. Essentially you trick the counter into never matching by setting TOP below MATCH. This means that the counter spins in its loop between zero and TOP forever, doing nothing.

To break it out of its loop and enable the one-shot, you manually set the counter to a value above TOP and let it go. As it counts up, it’ll eventually hit MATCH, turn on your pin, and then keep counting. When it rolls over the top (255 + 1 = 0 for the 8-bit AVRs), your pin will be correctly turned off again and then the counter re-enters its loop. The one-shot won’t fire until you manually set the counter higher than TOP again.

So there you have it, a one-shot depending only on the hardware timer/counter module and thus immune to jitter and consuming no CPU time at all. Our hats off to you, [Josh]. Clever hack.

Digital Light Processing, So Many Tiny Mirrors

Did you know there are a million little mirrors flickering back and forth, reflecting light within some modern projectors; like a flip-dot display but at the micro level? In his video, [Ben Krasnow] explains the tiny magic at work in DLP, or digital light processing technology with a scaled up model he constructed of the moving parts.

LCD projectors work much like old slide projectors. Light is shined through a transparent screen containing the image, which is then focused and enlarged through a lens. DLP projectors however achieve the moving image in a slightly different way. A beam of focused light is shined onto a chip equipped with an array of astonishingly small mirrors. When the mirror is flipped in one direction, it reflects the light out through the lens and creates a visible pixel. When the mirror is tilted the opposite direction, no light is reflected and the pixel is dark. All of these tiny moving parts are actuated by means of static electricity, and since a pixel can effectively only either be in an on or off state without any range of value in-between, the pixel must flutter at a rate fast enough to achieve the illusion of intensity, much like pulsing an LED to create a dimming effect.

In addition to slicing open the protective casing of one of these tiny micro-mirrored chips to give us a look at their physical surface under a microscope, [Ben] also built his own functioning matrix from tiles of mirrors and metal washers sandwiched around pieces of string. A wound electromagnet positioned behind each tile tilts the pixel into position when a current is run through the wire — although he didn’t sink the time needed to build out the full array in this manner (and we don’t blame him). If you do have the time and add in a high powered flash-light, this makes for an awesome way to shine messages on your roommate’s wall.

Continue reading “Digital Light Processing, So Many Tiny Mirrors”

Switchable Magnet with a Simple Circuit

Magnets are awesome. Electromagnets are even cooler. But what if you could make a semi-permanent switchable magnet that acts like an electromagnet, but doesn’t use any energy to hold metal? You’re going to want to take a look at this Low-power Magnetic Hold and Release Mechanism.

It’s actually a very simple concept. It is basically an electromagnet attached to a permanent magnet — it’ll hold any metal object exactly as you’d expect — but if you run current through the inductor attached to it, the magnetic field created by the electricity will temporarily cancel out the field of the magnet — thus freeing your object being held. Since gravity is pretty fast acting, this impulse of current doesn’t need to be very long, only fractions of a second.

Now the real question is how big could you go? We covered another project a while ago called Open Grab which discusses the possibility of using technology like this in Quadcopters.

For a solution that uses no power at all take a look at switchable magnet clamps used for welding — they’re pretty cool — but patent protected of course.

Happy Pi Day. 3.14159265359……

Unless you were alive in 1592, this is the closest to the perfect “Pi day” you’ll ever get.  3/14/15.  And if you want to take a moment to pause at 9:26:53 (am or pm?  Time zone? Country?) we’ll be right there with you. Well, sorta of.

Now, before you laugh, and think Pi is just a number, think again.  It’s almost magical in nature.  It’s effects on our daily lives is found everywhere.  From biology to astrophysics.  In the perspective of history, it can be used as a milestone to mark many different culture’s advancement of math and science.  In short, Pi is a keystone of the modern world.  With out it, we’d never would have gone to the moon. We might sill be on horse back.  And forget electronics.  That fun stuff never would have happened.

(As a side note, on this day, 3/14,  just happens to be Albert Einstein birthday.  Happy birthday!)

We hope you have an awesome Pi day.  We would love to see you in the comments too.  For example, we’d love to hear about and see posts of algorithms that can compute Pi.  How far can you compute Pi on a Raspberry Pi?  Or even child hood stories of your first encounter with that magical number.  Post up, and let us know your thoughts.

We’ll leave you with this cute video after the break, It’s an 8-year-old reciting 200 digits of Pi .  But if you need more digits….There is 1 million digits of pi.

Continue reading “Happy Pi Day. 3.14159265359……”

Nerdalert: German TV Producers’ Amazing Vectorscope Animations

German weekend late-night comedy show “Neo Magazin Royale” has a bunch of super-nerds behind the screens in the production studio. This is apparently what they do when they’re (not) working: making test screens that render as multiple animations on their test equipment.

While others out there are limited to displaying cool graphics on oscilloscopes, these guys have vectorscopes and waveformer monitors. A vectorscope is like an oscilloscope in X-Y mode, but with one screen that decodes the color space and one screen for the audio (in stereo). A waveform monitor that plots out the brightness levels of a test image. Normal studio techs use these to calibrate their colors, brightness, and audio levels.

Apparently, these guys programmed a custom test screen that would: a) encode a small animation of a 20-sided die spinning around the show’s logo in the color channel b) encode the show’s logo in the left and right sound channels, and c) their production company’s logo in the screen’s brightness.

At the end of the video, the director Patrick (in the glasses) admits that they’ve spent about three months working on this project and everyone starts laughing. “And who gets anything from this? Nobody!” says the show’s host.

One way to rectify that, though. Post the source code!