Ask Hackaday: Your Very First Microcontroller

baby holding IC chip

Necessity is the mother of invention. It is also true that invention necessitates learning new things. And such was the case on the stormy Tuesday morning our story begins.  Distant echos of thunder reverberated in the small 8 x 16 workshop, drawing my attention to the surge suppressor powering my bench.  With only a few vacation days left, my goal of finishing the hacked dancing Santa Claus toy was far from complete. It was for a Secret Santa gift, and I wanted to impress. The Santa moved from side to side as it sang a song. I wanted to replace the song with a custom MP3 track. In 2008, MP3 players were cheap and ripe for hacking. They could readily be picked up at local thrift shops, and I had picked up a few. It soon became clear, however, that I would need a microcontroller to make it do what I wanted it to do.

 

I had never used a microcontroller before. I knew what they were however, and had several PIC16F84s that I removed from some old scrap boards I acquired from my day job. So I scoured the internet for PIC tutorials until I found what I thought was a good one. It was here where I became instantly set in my ways – If you want me to try out your fancy shmancy microcontroller – you will walk me though setting up the IDE and writing/compiling/uploading code for the blinkenlights. If you can’t do that, keep your microcontroller because I don’t want it.

The tutorial I chose did not do this, which made it virtually useless. But I kept searching until I found a suitable one. I already had MPlab and a programmer setup to load hex files for my job. The tutorial showed me how to use the wizard to setup the IDE for assembly programming of the 16F84. Within an hour or so, I had everything on the breadboard wired up.

My heart was thumping as I applied the 5 volts. Would it work? Had I just programmed my very first microcontroller? Would it all end in tears? Alas, it did not work. It took me about half an hour before I realized I left the master clear floating. With the insertion of one wire, it worked! Light the fireworks!

I probably stared at that blinking red LED for fifteen minutes. I had done this. Not only was this microcontroller doing exactly what I told it to do, I understood how it was doing it. And thus began a lifelong learning process into the world of embedded computing. So next time you’re uploading your 2,000 line program into your 32 bit ARM controller, think back and remember how it all started.

And now it’s your turn. Tell us about your very first microcontroller project.

79 thoughts on “Ask Hackaday: Your Very First Microcontroller

  1. i got my first microcontroller when i was about 13 for a birthday gift. It was a parallax basic stamp 2 board, i quickly broke it… hard lessons in inductive kickback. a couple months later i read about arduinos (when it was the atmega168) and ordered one, i loved how easy it was to use and picked it up quickly. since then i’ve stuck with atmel mainly for convenience, now i tend to use a teensy 3 board.

  2. I think my first microcontroller project involved flashing a xenon strobe in a 2-4 pattern. Sure, it could have been done with logic gates, but the PIC10F200 is so much easier (for me, anyway) and more compact. I say I think because anything between about 1999 and earlier today is somewhat nebulous. The output of the PIC was probably isolated with a 4N35 or some kind of equivalent. It was all breadboards and wires and was eventually taken apart to make room for other projects.

  3. Mine was a 16F84. I must have been ~1998? I was hoping to reproduce Bob Blick’s propeller clock. Building my programmer (via parallel port), I needed 13 volts, so I put a AA battery in series with the 12 volts from the PC. I had found as sample PIC program that played “When The Saints Go Marching In”. When I hooked it up piezo speaker and heard music, I was so amazed!
    Also amazing was I could buy all my parts from a store in Thessaloniki, Greece.
    In the end it just ended up as a LCD clock that beeped on the hours. It is in a jar somewhere around here.

  4. My first microcontroller project was around 1995. The very first one controlled the lights and sirens on ambulances. Next was an animated lion for the Darwin Casino that had been bought by MGM. The guy who made the lion had made the life size elephant that was dropped out of a plane in the Operation Dumbo Drop movie. A very talented guy and great to work with. Don’t remember what chips they were ( 8051s maybe?), but the next project used a PIC ( not my choice) and wasn’t a good experience. Haven’t touched another PIC since.

  5. …was forced to use PIC in college, long after being quite-familiar with AVR… That PIC toolchain… Not cool. One good thing I learned, though… it’s entirely possible to #include a *C* file (it was *necessary* in that toolchain, as it only allowed one C file).
    I spent a lot of time struggling with the deeply-ingrained viewpoint that #including C files is “bad-practice,” but evenually came to terms when it ended up being quite-useful for some circumstances, like trying to make certain inline code is *only* compiled inline.
    (if you didn’t see it above: BasicStamp2, briefly: Blinky -> Text LCD. 8051/89C52, briefly -> LED-character-matrix, IDE/ATA byte-reading. AVR -> Everything thereafter. Boo Arduiners!)

  6. My first – and still most notable – micro work was writing assembly for Motorola 6800 dev boards very similar to this one:

    http://www.old-computers.com/museum/computer.asp?c=504&st=1

    I spent an entire semester of four-day-per-week class/lab time learning opcodes, punching stuff in, and hoping nobody would kill the power overnight and I’d show up the next day and have to key in the whole program all over again. I don’t remember what all we programmed, but I did have couple programs toward the end using dual DACs to output on on O-scope in X-Y mode toward the end. Some days I still wish I had a board like that to play with rather than dealing with all this compile and flash crap of modern micros. :)

    Just for the record, this was just in 2005… had an awesome old prof who was sometimes indecipherable and sleep-inducing in lectures but get him going in the lab and you’d learn a ton. Since there were only six of us in that particular class year we also had a lab project that was basically “tear apart this old video disk player and if you can rig up the laser you can take it home” – after doing divergence and power measurements on it and using it for other labs – so I still have a 1mW He-Ne laser setup in a box somewhere.

  7. My first microcontroller was the Intel 80186, which we only used because my school was donated several $10k 80186 ICE systems. Even thought it was considered a microcontroller, we still had to wire up external ROM and DRAM and write DRAM refresh interrupt routines in assembly.

    My first microcontroller where I picked the micro and designed the circuit myself was a Motorola 68HC11. Man, that was a good chip back in the day. It had EPROM built in! But you had to have a UV eraser to reset it before reprogramming it.

  8. My first ever MSP430 success would not have happened if I had had updated software. I was using the OLPC XO laptop (yes, one of those), because my goal was to get microcontrllers in the hands of kids everywhere, yada yada.
    I set up MSP430 GCC, ran a few lines of code, success.

    However, when replicating in an up-to-date machine, it turns out that the update had introduced a bug that required fine chicked dancing with kitten, instead of the straightforward process I had followed. But by then I was hooked, I had one more proof of the ineptitude of some dear souls that were doing said updates with disregard to what those of us in the field were going through, and eventually got to have much fun and unreasonable amount of recognition in far away places.

    I’m still a firm MSP430 devotee, though I will condescend to ‘duino as that is what most others around me use, and mightily doubt the newfangled stuff that has everything, until it can also do the simple with as little as an XO and an MSP430. Yes, I still do my development in one of those green things. It works, and I really do not need more.
    MY chicken dancing has improved.

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.