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. 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?

  2. 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.

  3. 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

  4. 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.

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

    or another board here

    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

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.