10 May 2012 by admin.
I have this dream to someday light our basement with RGB LEDs. They often come with remotes and controllers, which are surprisingly inexpensive. The problem with the remotes you get for cheap on ebay is that you *have* to use the remote to change the lights, and that of course limits you to the buttons on the remote.
I’d like to make an in-wall dimmer/color changer for LED mood lighting, but with the added feature of being compatible with the existing cheap LED remotes on the market.
That means reverse-engineering one. And here it is:

What’s the first thing I do when I get a new gadget? Take it apart, of course. Inside, it’s pretty simple:

There’s a 256-Byte two-wire serial EEPROM in the top left, a 5V linear regulator along the lower edge, and an unmarked 16-pin IC that is the main controller. Three transistors along the side drive the three colors of LEDs, and an external IR receiver connects to the board via the Red/Blue/Black triad.
I’m really not sure what the serial EEPROM is there for–perhaps the memory setting I couldn’t get to work?
I soldered a couple leads to appropriate points and hooked it up to the oscilloscope to capture the incoming signals. Some day I hope to own a logic analyzer, but for now the oscope will suffice, especially when I only need one or two channels.

Run a Single trigger, press a button on the remote, and here’s what I got:

A bunch of zooming/shifting/saving/etc later, I had a bunch of data captured. Here’s the signal you get when pressing the “Red” button (click for big):
When the IR LED is on, the signal goes low, and when it’s off, the signal goes high.
There’s a 9ms low pulse, a 4.5ms high pulse, and then the data starts. Off I ran to find some IR protocols. I found myself in a familiar place–SBProjects, which contains a remarkably thorough knowledgebase on IR remotes and protocols. As it turns out, the protocol is the NEC protocol Each bit is encoded by a 560uS on pulse followed by an off pulse of varying length–560uS off is a logical 0, 1680uS off is a logical one. There are 32 bytes total. The first byte is an address, the second is the inverse of the address, the third is the command, and the fourth is the inverse of the command, with a final on pulse after the last bit. It’s little-endian, so least-significant bit comes first for each byte.
I mapped out all the remote’s buttons, and here’s the result. For all buttons, the address was 0xFF. Only in the command did it differ. The following table contains the buttons and commands. Note that these are little-endian, and written in hex.
Up Down Play Pwr 0x3A 0xBA 0x82 0x02 Red Grn Blu Wht 1A 9A A2 22 2A AA 92 12 0A 8A B2 32 38 B8 78 F8 18 98 58 D8 RUp GUp BUp Quick 28 A8 68 E8 RDn GDn BDn Slow 08 88 48 C8 DIY1 DIY2 DIY3 AUTO 30 B0 70 F0 DIY4 DIY5 DIY6 Flash 10 90 50 D0 JMP3 JMP7 Fade Fade7 20 A0 60 E0
It’s pretty much a binary key matrix–the remote is just sending a code for the key that was pressed, rather than RGB values or anything more complex. The first four rows have A as the second nybble (little-endian, though!), the next four have 8 (0xA minus 0×1), the last three have 0 (0×8 minus 0×8). The second column is the same as the first column except for the first bit being flipped. The third column is the same as the first, except the second bit is flipped, and the third column has both the first and second bits flipped compared to the first column.
All the decoding must be done in the controller.
The controller outputs a PWM signal for each color. I noticed that the PWM frequency didn’t seem all that high–I could at times detect the flashing. (As an aside, it drives me nuts that car companies use stupidly low PWM frequencies for LED tail/brake lights, but that’s another subject) So I checked out the wave form for the outputs.
Each output is turned on for 840uS per cycle. To vary the brightness, the controller adjusts the off time. That varies from 5.36mS at the dimmest setting to 320uS at the brightest. That means the controller only gets up to about 72% duty cycle at its brightest setting, and down to 14% at the lowest setting. Since humans percieve brightness logarithmically, there’s a big low end that’s getting missed, although it might be too dim at that end to be useful.
Where am I going next with this? I’m not sure yet, but at least it’s now documented.
Posted in Uncategorized | Print | 1 Comment »
22 March 2012 by admin.
Our suppliers were out of a critical part, and it took several weeks to get more. But they’re back!
Posted in Uncategorized | Print | No Comments »
29 February 2012 by admin.
Find ‘em here.
Posted in Uncategorized | Print | No Comments »
9 February 2012 by admin.
I had no idea there would be so much interest in the function generator kit, and ran out almost immediately. More are on the way! If you’d like to be notified as soon as we have more, you can click the “Notify me of updates to Tiny Function Generator Kit 1Hz-40KHz” link in the right-hand column of the product page, or email me at info@allgaiershops.com. Thanks for your patience!
Posted in Uncategorized | Print | No Comments »
8 February 2012 by admin.
One of my very first forays into programming microcontrollers came when I needed a square-wave generator. It was super simple, based on a Tiny25, only had sixteen discrete frequencies (each frequency was double the previous), and was housed in a rough wood container I made for it. Now, I’ve made something better.
An ATTiny25 still forms the core of it, but it’s a whole lot better. The frequency range is 256 steps, increasing exponentially from approximately 1HZ to 40KHz. It outputs simultaneous sine, triangle, and square waves, with adjustable duty cycle/triangle wave shape. It has independent amplitude control on each output. And it’s all on one palm-sized, single-sided PCB.
The output isn’t perfect–it’s only 6-bit, although the firmware originally was 8-bit and can easily be reverted. The output filter could probably be improved (it’s currently a simple RC filter). The maximum frequency is limited by 1) the speed of the built-in PLL on the microcontroller (64MHz), which I use for the PWM clock and 2) how fast I can load the timer with the proper values for generating PWM. I have it down to 20 cycles + ISR overhead. And it updates the output 48 times per cycle maximum (and fewer at high frequencies, so the triangle and sine waves aren’t as accurate up there).
But it works pretty well. Here’s an o-scope screenshot (yes, someday I need to hook up the o-scope to the computer):
I got enough parts for several prototypes, and since it works, I’ve put together some kits in the store. You can find those here.
Also, if you’re interested in making improvements (and I’m sure there are plenty to be made), here is the source code, the schematic, and the board layout.
We’re out of stock! Sorry about that–I had no idea this many people would want a kit, and I ran out of stock almost immediately. I’ve ordered a whole big batch now, and should have more stock on hand in a couple weeks.
Posted in Uncategorized | Print | 13 Comments »
1 February 2012 by admin.
A coworker at my previous job had a sign in his office that read: ”There comes a time on every project when you just have to shoot the engineer and start production.” Why? Because engineers will continue to tweak a design ad infinitum, even if it’s already suitable for production.
Such was the case of a recent post on Hackaday, which detailed one person’s creation of a USB-powered LiPo battery charger. One commenter suggested ditching the USB plug in favor of using the PCB itself for the USB connection. So I did it. But, being an engineer, I found that insufficient. So I also managed to shrink the footprint. And did it all on a single-layer PCB. For fun.

And if you’re interested, here is the schematic and layout.
Posted in Uncategorized | Print | No Comments »
9 August 2011 by admin.
Several years ago, after reading a thoroughly entertaining piece on old IBM buckling-spring keyboards (seriously, go read it!), I set off to the local thrift store, and was lucky enough to score an IBM Model M2. It’s smaller and lighter than the Model M, but has the same wonderfully tactile and noisy buckling springs under the keys.
I loved that keyboard, right up until it stopped working. I considered creating an all-new PS/2 controller for it, but then in my many hours of unoccupied time at my old job I found that someone had done something similar on a Model M, but with a USB interface. Thank you, Chris, for the excellent work!
So after reverse-engineering the keyboard matrix, I modified the keymap file, designed my own board (schematic, layout), compiled it, soldered the whole thing together, and….it worked. Well, it wasn’t *quite* that simple–I had a few errors in my keymap, I realized belatedly that the keyboard is too slim for a regular USB-B connector, an errant shield wire in the USB cable shorted one of the data lines (no damage, thank goodness), a too-long leg on one of the components made for a poor connection with one of the membranes, I dropped the keyboard a couple times while inserting all the buckling springs, I *lost* a couple springs and had to order new ones, etc. But with those wrinkles ironed out, the keyboard finally worked. And works. Source code.
My new controller board, next to its predecessor:
A close-up of my board:
The matrix:
The pile of buckling springs and key caps. Yes, you have to remove all 101 of each. And then very delicately replace all the buckling springs when reassembling the board. If you’re going to do this, take all the keycaps off before doing anything else. It’ll make it much easier to undo all the plastic clips that hold the board together.
And lastly, the whole thing back together, hooked up to my modern-day Thinkpad:
The title quote comes from one of my bosses when I asked him if he wanted one, too.
Posted in Uncategorized | Print | No Comments »
9 August 2011 by admin.
Way later than they should be. But they’re here. If you’re looking to use a 40-pin ATMega, you are finally in luck.
Now in (very limited for now!) stock: adapters for ATMega162 and ATMega8515 and for ATMega162/324/644/1284, ATMega16/32, and ATMega8535
Posted in Uncategorized | Print | No Comments »
19 May 2011 by admin.
Want an AVR breadboard adapter, but only need the PCB? You’re in luck. Buy a board, save a buck. Or buy a set of four and save five bucks. Available in the Microcontroller Adapter section of the store.
Posted in avr, product, store | Print | 1 Comment »
24 March 2011 by admin.
At long last, my shipment finally came! There are a few very minor changes in this batch, none of which affect the assembly or use:
I haven’t uploaded a photo of the new kit (it’s hard to work a full-time job, two part-time jobs, get a house ready to move out, and chase 4 kids), but I’ve marked it as back in stock so you can get it. An updated photo will be up tomorrow. If you want it, you can find it here.
Posted in Uncategorized | Print | 1 Comment »