Writing Code for the ATtiny10

I previously wrote about the hardware aspects of getting your code into an ATtiny10 some 7 years ago (wow that was realllyy a long time ago!).

Now, avrdude is at version 6.3 and the TPI bitbang implementation has already been integrated in. The upstream avr-gcc (and avr-libc) also have proper support for ATtiny10s now. These software components are bundled with most distributions, including the Arduino IDE, making it easily accessible for anyone. Previously a fully integrated and working toolchain only came from Atmel and it was behind a registration page.

The price of the ATtiny10 has also dropped by a lot. When I first bought this microcontroller in 2010, element14 carried it for $1.85 in single quantities. Now, they are only $0.56 each.

I thought I’d write up a short post about writing and compiling code for it.

ATtiny10 on a prototyping board

Continue reading

DIY Optical Slave Flash

I found a couple of old disposable cameras in storage that I played around with 15 years ago, shorting the caps to make a loud bang, wiring up the flash trigger to a remote-controlled relay kit I had assembled. I thought I’d do something useful with them.

I decided to turn them into optical slave flashes, since on-camera flashes are not very flexible. I was thinking of a way to detect the camera flash so that the slave could be fired, maybe using an LDR with the ADC to detect an increase in light intensity? It turns out there’s an even easier way to do this – with an infrared sensor. Apparently when flash tubes are fired, they give off infrared which can be detected more reliably than light intensity changes. When I read about this, I tested it out with a simple Arduino sketch and it works as advertised.

Disposable cameras usually have metal contacts that are placed near the shutter mechanism. When the shutter opens, the contacts are closed and if the flash was charged it would fire. To control the flash firing, I replaced the contacts with an SCR.

Continue reading

Reducing power usage on the iCufflinks’ ATtiny4

I came across this very nice article which documents steps taken to reduce the power usage on the ATtiny4 used in the iCufflinks.

The process managed to shave off about 315 μA, which boosts battery life quite a bit:

The overall effect this has on the product is that the 24 hour time between battery changes can be upped to 38 hours. That is a pretty good power savings for the day.

It’d be great if this was incorporated into the products.

I do disagree on one thing though, which is cutting away the data points used for the PWM. Unless the output was measured with an oscilloscope and produces the same breathing pattern, I would very much keep the data since the additional space gained is not used for anything else.

If you don’t know what iCufflinks are, watch the video below.

Programming the ATtiny10

Recently I wanted to use a really tiny, low pin-count microcontroller for a project, so I decided to buy a few Atmel ATtiny10 to experiment with.

To get it working, I would need a compiler and a programmer. I like working with Atmel chips because they have cross-platform development tools. The Arduino IDE that I’ve been using comes with avr-gcc and avrdude, both of which are really awesome open source tools for compiling and uploading code to the microcontrollers. If you just want the tools without the Arduino IDE, you can get the WinAVR package.

However both of these tools do not work with the ATtiny10 yet. I do not expect a C compiler, but even the GNU assembler that comes with avr-gcc still doesn’t support this chip. avrdude recently added support for uploading to the ATtiny10, but only through the STK or AVRISP programmer, which I didn’t want to fork out money to buy.

Continue reading