Quick and Dirty MIDI Interface with USBASP

[Robson Couto] recently found himself in need of MIDI interface for a project he was working on, but didn’t want to buy one just to use it once; we’ve all been there. Being the creative fellow that he is, he decided to come up with something that not only used the parts he had on-hand but could be completed in one afternoon. Truly a hacker after our own hearts.

Searching around online, he found documentation for using an ATtiny microcontroller as a MIDI interface using V-USB. He figured it shouldn’t be too difficult to adapt that project to run on one of the many USBASP programmers he had laying around, and got to work updating the code.

Originally written for the ATtiny2313, [Robson] first had to change around the pin configuration so it would work on the ATmega8 in the USBASP, and also updated the USB-V implementation to the latest version. With the code updated, he programmed one of the USBASP adapters with a second one by connecting them together and putting a jumper on the J2 header.

He had the software sorted, but there was still a bit of hardware work to do. To provide isolation for the MIDI device, he put together a small circuit utilizing a 6N137 optoisolator and a couple of passive components on a piece of perf board. It’s not pretty, but it does fit right into the programming connector on the USBASP. He could have fired up his PCB CNC but thought it was a bit overkill for such a simple board.

[Robson] notes that he hasn’t implemented MIDI output with his adapter, but that the code and the chip are perfectly capable of it if you need it for your project. Finding the schematic to hook up to the programmer’s TX pin is left as an exercise for the reader.

If you don’t have a USBASP in the parts bin, we’ve seen a very similar trick done with an Arduino clone in the past.

Drawing On an OLED with an ATtiny85, No RAM Buffers Allowed

Small I2C OLED displays are common nowadays, and thanks to the work of helpful developers, there are also a variety of graphics libraries for using them. Most of them work by using a RAM buffer, which means that anything one wants to draw gets written to a buffer representing the screen, and the contents of that buffer are copied out to the display whenever it is updated. The drawback is that for some microcontrollers, there simply isn’t enough RAM for this approach to work. For example, a 128×64 monochrome OLED requires a 1024 byte buffer, but that’s bad news if a microcontroller has only 512 bytes of RAM in total like the ATtiny85. [David Johnson-Davies] has two solutions: a Tiny Graphics Library that needs no RAM buffer and an even slimmer Tiny Function Plotter, which we’ll discuss in order.

Tiny Function Plotter works on both SSD1306 and SH1106-based displays.

[David]’s Tiny Graphics Library works by taking advantage of a feature of SH1106 driver-based displays: the ability to read the display over I2C as well as write to it. With the ability to perform read-modify-write on a section at a time, using a large RAM buffer can be avoided. The only catch is that the library only works with OLEDs using the SH1106, but the good news is that these are very common at the usual Chinese resellers. ([David] notes that SH1106 is sometimes misspelled as “SSH1106”, so keep that in mind when searching.)

What about all those other SSD1306-based OLED displays out there? Are they out of luck? Not quite. [David] has one more trick up his sleeve: his Tiny Function Plotter works on the SSD1306 and also requires no RAM buffer. It’s unable to write text, but it can easily handle drawing graphs plotting things like values over time while needing very little overhead.

Another approach we’ve seen for using OLEDs driven by microcontrollers with limited memory is the solution [Michael] used in Tiny Sideways Tetris, which was done in part by realizing the smallest screen element he needed was a 4×4 block, and using that premise as the basis of a simple compression scheme.

I2C Bootloader for ATtiny85 Lets Other Micros Push Firmware Updates

There are a few different ways of getting firmware onto one of AVR’s ATtiny85 microcontrollers, including bootloaders that allow for firmware to be updated without the need to plug the chip into a programmer. However, [casanovg] wasn’t satisfied with those so he sent us a tip letting us know he wrote an I2C bootloader for the ATtiny85 called Timonel. It takes into account a few particulars of the part, such as the fact that it lacks a protected memory area where a bootloader would normally reside, and it doesn’t have a native I2C interface, only the USI (Universal Serial Interface). He’s just released the first functional version for the ATtiny85, but there’s no reason it couldn’t be made to work with the ATtiny45 and ATtiny25 as well.

Timonel is designed for systems where there is a more powerful microcontroller or microprocessor running the show (such as an ESP8266, Arduino, or even a board like a Raspberry Pi.) In designs where the ATtinys are on an I2C bus performing peripheral functions such as running sensors, Timonel allows the firmware for these peripheral MCUs to be updated directly from the I2C bus master. Embedded below is a video demo of [casanovg] sending simple serial commands, showing a successful firmware update of an AVR ATtiny85 over I2C.

Continue reading “I2C Bootloader for ATtiny85 Lets Other Micros Push Firmware Updates”

The Crustacean Battle Bot of your Nightmares

We’ve all seen a movie or TV show that got our imagination going, and the more studious of us might get fired up over a good book (one without pictures, even). You never know were inspiration might come from, which is why it’s so hard to track down in the first place. But one place we don’t often hear about providing many hackers with project ideas is the grocery store. But of course the more we learn about [Michael Kohn], the more we realize he’s got a very unique vision.

On a recent trip to the grocery store, [Michael] saw a two pack of frozen lobsters and thought they would make fine battling robots. You know, as one does. Unfortunately the process of taking a frozen lobster and turning it into a combat droid (which incidentally does include eating the thing at some point in the timeline) ended up being so disgusting that he only finished one of them. Whether that makes this poor fellow the winner or loser though…that’s a question that will require some contemplation.

The first step was cooking and eating the beast, and after that came cleaning the shell of as much remaining meat and innards as possible. He then baked it in a toaster oven for 40 minutes and let it sit for a couple of days to make sure it didn’t have any residual smell. Once he confirmed the shell was clean, he glued it back together and got started on mounting it to his hardware.

A wooden frame under the lobster holds the dual HD-1711MG mini servos that power the karate chop action of the claws, as well as the electronics. [Michael] used a ATtiny85 and NTD4963N MOSFETs to make a basic RC platform which responds to IR from a Syma S107 toy helicopter controller. He tried to power everything with AAA and then AA batteries, but found they just didn’t give him the juice he needed once the bot got going. So the final version utilizes a 5 V regulator and a standard RC 7.2v LiPO battery pack.

If you’re not big on shellfish, never fear. He’s created similar roving contraptions based around sausages and carrots too. One could say he’s truly a man of refined…taste.

Continue reading “The Crustacean Battle Bot of your Nightmares”

DIY Rubber Ducky is as Cheap as its Namesake

The “Rubber Ducky” by Hak5 is a very powerful tool that lets the user perform rapid keystroke injection attacks, which is basically a fancy way of saying the device can type fast. Capable of entering text at over 1000 WPM, Mavis Beacon’s got nothing on this $45 gadget. Within just a few seconds of plugging it in, a properly programmed script can do all sorts of damage. Just think of all the havoc that can be caused by an attacker typing in commands on the local machine, and now image they are also the Flash.

But unless you’re a professional pentester, $45 might be a bit more than you’re looking to spend. Luckily for the budget conscious hackers out there, [Tomas C] has posted a guide on using open source software to create a DIY version of Hak5’s tool for $3 a pop. At that cost, you don’t even have to bother recovering the things when you deploy them; just hold on tight to your balaclava and make a run for it.

The hardware side of this hack is the Attiny85-based Digispark, clones of which can be had for as low as $1.50 USD depending on how long your willing to wait on the shipping from China. Even the official ones are only $8, though as of the time of this writing are not currently available. Encapsulating the thing in black shrink tubing prevents it from shorting out, and as an added bonus, gives it that legit hacker look. Of course, it wouldn’t be much of a hack if you could just buy one of these little guys and install the Rubber Ducky firmware on it.

In an effort to make it easier to use, the official Rubber Ducky runs scripts written in a BASIC-like scripting language. [Tomas C] used a tool called duck2spark by [Marcus Mengs], which lets you take a Rubber Ducky script (which have been released by Hak5 as open source) and compile it into a binary for flashing to the Digispark.

Not quite as convenient as just copying the script to the original Ducky’s microSD card, but what do you want for less than 1/10th the original’s price? Like we’ve seen in previous DIY builds inspired by Hak5 products, the trade-off is often cost for ease of use.

[Thanks to Javier for the tip.]

Less is More: A Micromatrix Display in a Square Inch

In your living room, the big display is what you want. But in an embedded project, often less is more. We think [bobricius] will agree since he submitted a tiny 4×5 LED display into our square inch challenge. The board features an ATtiny CPU and twenty SMD LEDs in a nice grid. You can see them in action, scrolling to some disco music in the video below.

There is plenty of room left in the CPU for bigger text strings — the flash memory is just over 10% full. A little side-mounted header makes it easy to program the chip if you want to change anything.

Continue reading “Less is More: A Micromatrix Display in a Square Inch”

Measure Resistance The Colourful Way

One of the first things anyone with an interest in electronics learns is the resistor colour code. The colour of the first band reveals the first figure, the second the subsequent figure, and the third a power-of-ten multiplier. At first you learn these colours, but eventually you just recognise the values through familiarity. You don’t have to think about multipliers when you see orange-orange-red, you just know that it’s a 3K3 resistor.

[Plusea] has come up with an entertaining interface for an ohmmeter, which instead of displaying the resistance on an LCD or a meter shows it as the colours of the code, via a set of addressable LEDs. The work is done by an ATtiny85 microcontroller, and the whole thing is mounted on a flexible PCB (fabrication of which is itself interesting, placing cut copper traces on a sheet of kapton and covering with a second kapton layer cut to be the solder mask). There is even a clever integration of a CR2032 battery holder from the PCB itself, though they admit that it could be made more compact with the use of SMD components instead of through-hole.

The write-up and associated photo album tells us a lot about the project, but is missing a crucial detail: a shot of it working. We’ll give them the benefit of the doubt on that front though, because we like the idea and its execution.

Strangely, this isn’t the first ohmmeter to use the resistor colour code in this way, we’ve previously brought you one featuring a light-up giant resistor.