The Quest for Mice With Frickin’ Laser Beams (Pointed At Their Brains), Building A Laser Controller

The logo for the field is kind of cute though.
The logo for the field is kind of cute though.

[Scott Harden] is working on a research project involving optogenetics. From what we were able to piece together optogenetics is like this: someone genetically modifies a mouse to have cell behaviors which can activated by light sensitive proteins. The mice then have a frikin’ lasers mounted on their heads, but pointing inwards towards their brains not out towards Mr. Bond’s.

Naturally, to make any guesses about the resulting output behavior from the mouse the input light has to be very controlled and exact. [Scott] had a laser and he had a driver, but he didn’t have a controller to fire the pulses. To make things more difficult, the research was already underway and the controller had to be built

The expensive laser driver had a bizarre output of maybe positive 28 volts or, perhaps, negative 28 volts… at eight amps. It was an industry standard in a very small industry. He didn’t have a really good way to measure or verify this without either destroying his measuring equipment or the laser driver. So he decided to just build a voltage-agnostic input on his controller. As a bonus the opto-isolated input would protect the expensive controller.

The kind of travesty that can occur when [Stefan Kiese] doesn't have access to nice project boxes.
The kind of travesty that can occur when [Scott] doesn’t have access to nice project boxes.
The output is handled by an ATtiny85. He admits that a 555 circuit could generate the signal he needed, but to get a precision pulse it was easier to just hook up a microcontroller to a crystal and know that it’s 100% correct. Otherwise he’d have to spend all day with an oscilloscope fiddling with potentiometers. Only a few Hackaday readers relish the thought as a relaxing Sunday afternoon.

He packaged everything in a nice project box. He keeps them on hand to prevent him from building circuits on whatever he can find. Adding some tricks from the ham-radio hobby made the box look very professional. He was pleased and surprised to find that the box worked on his first try.

AVR vs PIC, Round 223: Fight!

Get ready to rumble! [Thierry] made the exact same Hello-World-esque project with two microcontrollers (that are now technically produced by the same firm!) to see how the experience went.

It’s not just an LED-blinker, though. He added in a light-detection function so that it only switches on at night. It uses the Forest Mims trick of reverse-biasing the LED and waiting for it to discharge its internal capacitance. The point is, however, that it gives the chip something to do instead of simply sleeping.

Although he’s an AVR user by habit, [Thierry] finds in favor of the PIC because it’s got a lower power draw both when idling and when awake and doing some computation. This is largely because the PIC has an onboard low-power oscillator that lets it limp along at 32 kHz, but also because the chip has a lower power consumption in general. In the end, it’s probably a 10% advantage to the PIC on power.

If you’re competent with one of the two chips, but not the other, his two versions of the same code would be a great way to start familiarizing yourself with the other. We really like his isDarkerThan() function which makes extensive use of sleep modes on both chips during the LED’s discharge period. And honestly, at this level the code for the two is more similar than different.

(Oh, and did you notice [Thierry]’s use of a paper clip as a coin-cell holder? It’s a hack!)

Surprisingly, we’ve managed to avoid taking a stray bullet from the crossfire that occasionally breaks out between the PIC and AVR fans. We have covered a “shootout” before, and PIC won that round too, although it was similarly close. Will the Microchip purchase of Atmel calm the flames? Let’s find out in the comment section. We have our popcorn ready!

Rainbow Cats Announce Engagement

[ANTALIFE] is going to tie the knot sometime in 2017. Instead of sending out paper announcements or just updating his Facebook status, he wanted to give their family members something lasting and memorable, like a small trinket with a pair of light-up cats.

This project is pretty simple in theory. A pair of RGB LEDs cycle through the colors of the rainbow with the help of an ATtiny25 and resistors carefully chosen for each LED. But there are several challenges at play here. [ANTALIFE] wanted to design something quite small that would last at least a day on a single CR2032 coin cell. This project was his first foray into SMD/SMT design and construction. We think that this warrants its own congratulations, especially since it looks as though he made at least a dozen of these things.

[ANTALIFE] made things much easier for himself with the purchase of a cheap hot air rework station and used a chip clip to program the ‘tiny. The cats are a design from Thingiverse, which he modified to turn them into bride and groom. Watch a whole line of them glow after the break. We sincerely hope that a larger version of these cats end up on top of the wedding cake.

For anyone with an undying love blinkenlights and impending nuptials, don’t forget the light-up invitations, wedding attire, and centerpieces.

Continue reading “Rainbow Cats Announce Engagement”

The ATtiny MIDI Plug Synth

MIDI was created over thirty years ago to connect electronic instruments, synths, sequencers, and computers together. Of course, this means MIDI was meant to be used with computers that are now thirty years old, and now even the tiniest microcontrollers have enough processing power to take a MIDI signal and create digital audio. [mitxela]’s polyphonic synth for the ATtiny 2313 does just that, using only two kilobytes of Flash and fitting inside a MIDI jack.

Putting a MIDI synth into a MIDI plug is something we’ve seen a few times before. In fact, [mitxela] did the same thing a few months ago with an ATtiny85, and [Jan Ostman]’s DSP-G1 does the same thing with a tiny ARM chip. Building one of these with an ATtiny2313 is really pushing the envelope, though. With only 2 kB of Flash memory and 128 bytes of RAM, there’s not a lot of space in this chip. Making a polyphonic synth plug is even harder.

The circuit for [mitxela]’s chip is extremely simple, with power and MIDI data provided by a MIDI keyboard, a 20 MHz crystal, and audio output provided eight digital pins summed with a bunch of resistors. Yes, this is only a square wave synth, and the polyphony is limited to eight channels. It works, as the video below spells out.

Is it a good synth? No, not really. By [mitxela]’s own assertion, it’s not a practical solution to anything, the dead bug construction takes an hour to put together, and the synth itself is limited to square waves with some ugly quantization, at that. It is a neat exercise in developing unique audio devices and especially hackey, making it a very cool build. And it doesn’t sound half bad.

Continue reading “The ATtiny MIDI Plug Synth”

Converting A GameCube Controller To USB

The GameCube controller is a favorite among the console enthusiasts new and old, and with Nintendo’s recent release of the Smash Bros. edition of this controller, this is a controller that has been in production for a very, very long time. [Garrett] likes using the GameCube controller on his PC, but this requires either a bulky USB adapter, or an off-brand GameCube ‘style’ controller that leaves something to be desired. Instead of compromising, [Garrett] turned his GameCube controller into a native USB device with a custom PCB and a bit of programming.

First, the hardware. [Garrett] turned to the ATtiny84. This chip is the big brother of the ubiquitous 8-pin ATtiny85. The design of the circuit board is just under a square inch and includes connections for the USB differential pairs, 5V, signal, and ground coming from the controller board.

The software stack includes the micronucleus bootloader for USB firmware updates and V-USB to handle the USB protocol. There are even a few additions inspired by [Garrett]’s earlier shinewave controller mod. This controller mod turns the GameCube controller into a glowing hot mess certain to distract your competitors while playing Super Smash Bros. It’s a great mod, and since [Garrett] kept the board easily solderable, it’s something that can be easily retrofitted into any GameCube controller.

When Are 8 Bits More Than 32?

Whenever we write up a feature on a microcontroller or microcontroller project here on Hackaday, we inevitably get two diametrically opposed opinions in the comments. If the article featured an 8-bit microcontroller, an army of ARMies post that they would do it better, faster, stronger, and using less power on a 32-bit platform. They’re usually right. On the other hand, if the article involved a 32-bit processor or a single-board computer, the 8-bitters come out of the woodwork telling you that they could get the job done with an overclocked ATtiny85 running cycle-counted assembly. And some of you probably can. (We love you all!)

redblue_pillWhen beginners walk into this briar-patch by asking where to get started, it can be a little bewildering. The Arduino recommendation is pretty easy to make, because there’s a tremendous amount of newbie-friendly material available. And Arduino doesn’t necessarily mean AVR, but when it does, that’s not a bad choice due to the relatively flexible current sourcing and sinking of the part. You’re not going to lose your job by recommending Arduino, and it’s pretty hard to get the smoke out of one.

But these days when someone new to microcontrollers asks what path they should take, I’ve started to answer back with a question: how interested are you in learning about microcontrollers themselves versus learning about making projects that happen to use them? It’s like “blue pill or red pill”: the answer to this question sets a path, and I wouldn’t recommend the same thing to people who answered differently.

For people who just want to get stuff done, a library of easy-to-use firmware and a bunch of examples to crib learn from are paramount. My guess is that people who answer “get stuff done” are the 90%. And for these folks, I wouldn’t hesitate at all to recommend an Arduino variant — because the community support is excellent, and someone has written an add-on library for nearly every gizmo you’d want to attach. This is well-trodden ground, and it’s very often plug-and-play.

Continue reading “When Are 8 Bits More Than 32?”

The Flowing Pixels of Time Wait for No Man

The hourglass dramatically depicts the flow of time; gravity pulling grains of sand inevitably downward. So it is with the Bits of Time project by [Frank Andre]. The pixels drop, stopping only when the battery dies. Or, when your eggs are ready. (Pssst, it’s also on

Look, Ma! No GIF!

The project starts with a couple of [Frank’s] PixBlocks. A processor is added to one PixBlock to serve as the controller for both after they are connected via the serial bus. A tilt switch, with a debouncing circuit, is connected to an IO pin. This tells the processor the orientation of the box and therefore which way the pixels should flow.

Two  switches set the duration of the timer in 15 second increments. A third starts the timer. When the box is rotated the pixels start flowing in the opposite direction. With code available on GitHub the system can be programmed for other effects such as changing colors, flickering, or even text display.

You’ll agree this is a bit less intimidating than the MacGyver-ish kitchen timer we covered last year.

Continue reading “The Flowing Pixels of Time Wait for No Man”