Programming a microcontroller one bit at a time

Imagine you’re stuck on a desert island, hundreds of miles away from the nearest person, and you finally have time to finish that project you’re working on. You have a single microcontroller, but you’re lacking a computer and you need to program an ATtiny13. How do you do it? [androidruberoid] figured out how to manually flash a microcontroller (Russian, surprisingly good translation) using just three switches and a lot of patience.

[androidruberoid]‘s ATtiny13 – like nearly all Atmel microcontrollers – are programmed using an SPI interface. This interface requires four signals: SCK, a data clock, MOSI, the data line from master to slave, MISO, data from slave to master, and RESET. By connecting these data lines to buttons, [androidruberoid] is able to manually key in new firmware one byte at a time.

This technique of manually programming bits relies on the fact that there is no minimum speed for an SPI interface. In the video after the break, you can see [androidruberoid] manually programming an ATtiny13 with a simple program. It only lights up an LED, but with enough patience he could key in a simple ‘blink a LED’ program.

27 thoughts on “Programming a microcontroller one bit at a time

    1. The big chip is what he uses to debounce the buttons, its a SR latch. The tiny chip on the RHS side of the bread board is the ATTiny itslef.

  1. this is fun but it take a lot of time. to use this techniek or you have no live (even more than a WoW,er)or you in deadrow whit all time

  2. Groovy! +1 (Ah, memories of when the Alpha-16 Mini “blew the boot” and 16 words had to be manually loaded via the front panel switches).

    Not to detract from this sweet hack, but might I respectfully suggest that bit-banging the control lines on a parallel or serial port on an old clunker PC could be more practically (and less frustratingly) employed by slightly less isolated hackers?

  3. It’s just a matter of interfacing a uC to interpret those signals and you can use just about any device to program a chip. I mean, send data to a bluetooth enabled arduino from an Android to bit bang those data, and you’ve got a wireless portable programmer of some sort.

  4. Ok so the appropriate upgrade would be a robotic arm that does the bit-banging?
    With appropriate processor, would be an arm for an arm — costing an arm depends on which source one uses :D

  5. I made a similar project to this, but I used one pic to program another pic, it has similar working prensip, I have gave my all codes and schematics in microcip site If there were anyone who wanna see or build may look at this link http://www.microchip.com/forums/f162.aspx and if hackaday wants to publish it in the site I may also added a working video of it.

  6. Would be nice to semi-automate the clock line, have 2 buttons, “0″ and “1″ (made of palm tree leaves), and have the clocking do itself on each keypress. A couple of gates or something could handle that. Then he could put the bits in slightly easier. Tho I suppose it’s not supposed to be easy.

  7. Hi I need someone to program me a microcontroller (looks like ATtiny13) running on this board

    http://dx.com/p/8-mode-p7-led-driver-circuit-board-for-flashlight-dc-2-8-4-2v-106799#.UxomUPl_tsg

    or another board here

    http://www.lightscastle.com/product/17mm-2800ma-5-mode-memory-regulated-led-driver-circuit-board-for-flashlight-dc-3~4.5v-530026

    I want to have kind of pulse mode instead of strobe to use with bike light. The matter is I don’t have time to understand programming these chips etc, just wanted to buld some bike lights. I can supply these boards and chips to you and pay for putting code onto them. Can you help?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s