Ask Hackaday: Your Very First Microcontroller

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. First I ever looked at for a commercial project was the MK3870 back around 1978-79. Only 64 bytes of RAM and 1 – 4K of ROM. But the integration compared to many alternatives made it a very attractive solution for quite a few design.

  2. My first Microcontroller project was a little tracked robot. It didn’t do much, just controlled the two tracks, monitored an IR range finder (which would cause it to turn left or right depending on the last bit it returned) and displayed feedback on what the tracks where doing with an 8 segment display. Used a few breadboards, a Tamiya gearbox and an ATMega something that was programmed with an STK500.

    Standard babies first robot stuff.

  3. My first real microcontroller project was when I made a converter to take an IBM Model D keyboard from an IBM 3278 terminal, and convert its scan codes to AT keyboard ones. I struggle to think when it was, except it was an 8751 (EPROM variant of an 8051, in a ceramic package with a quartz window for erasing) which we used at work in about 1984 – I ‘liberated’ a few samples. The board had a 7414 on it, the 8751, a huge 25 pin D shell and a crystal oscillator. I spent some time getting the separate power supply together, since the model D keyboard needed +5v, +8.5v and -2.2v supplies! Developing the code involved running an 8051 assembler on a VM/370 machine at work, blowing the 8751, taking it home, firing it up and scoping it (with a Hartley 13A scope at the time), and it took a little while to get going properly. In those days, building a PC at home involved a lot of liberating of hardware from work. I got the motherboard from the local technicians when I did a deal with them; they gave me ten faulty boards, and I got to keep one if I repaired nine. It was so expensive to buy a clone case for an AT board, I ended up going to Home Depot and making a wooden one.

    If you think an IBM Model M keyboard is good, trust me – the old beam spring keyboards were even better.

    1. Beamsprings are certainly fantastic. I use a 3727 as my daily driver at work, and a 3278 (sans numpad) at home.

      I designed a USB controller for them (and the capacitive Model Fs) which has proved very popular. Controller details here: http://deskthority.net/for-sale-f55/xwhatsit-s-grand-unified-ibm-capsense-usb-controller-thread-t7993.html and technical info here: http://downloads.cornall.co/ibm-capsense-usb-web/ibm-capsense-usb.html .

      Some people have gone to great lengths during their restoration of these old beasts, installing the new controllers. There’s some really nice examples in this thread: http://deskthority.net/photos-f62/it-s-alive-post-your-xwhatsit-resurrected-beamspring-kishy-here-t8788.html

  4. First real one? Don’t laugh – 8051 used to control a 18-dof walking robot, you know – one of those spiders with 6 legs, 3 analog servo for each one, all of them controlled using one poor 8051, that also took care of rs232 communication with a PC. Calculating how to properly drive 18 PWMs was a real pain, but during one week spent on that one I learned more about assembly than ever. Worth it.

  5. The first micro controller I used was a PIC18F for a personnal project, it was a light with RGB leds which blinked on MSN events. I keep a very good souvenir (sorry for my english, I’m french).

  6. I run a review website (basically inactive nowadays as I have other things on my mind), and I was contacted – or I contacted them, I forget – by the nerdkits people for a review of their first microcontroller kit. I’d been looking at playing with MCUs for a while, so a deal was arranged and I soon got my kit. I wrote the review and played around with it some more, but I quickly found out I lack the mathematical mindset to be any good at programming. Modifying other people’s work I can kinda-sorta do, but coming up with anything myself is a complete non-starter. It currently sits in a small box, waiting for my hacking mood to come back – perhaps I’ll find some way to make it useful someday.

  7. My first microcontroller was a Micromint 80C52-Basic chip back in the early ’90s for which I built the development board using point-to-point wiring. Learned a lot about interfacing hardware with that board and I still have it packed away in a drawer.

    From there it was on to the 8051/8052 assembly language (for which I also build the development board) and PICs. Lots of good times playing with those chips.

    1. The 8052 BASIC chip was the first wirewrap board I’d ever built (but not my first uC). That was a nice environment to work in. For folks who are wondering why it was nice, this was at a time of when Assembly was king for uC (microcontrollers).

  8. It was engineering class in high school, the basic stamp, it was like the arduino of things before arduino was what it is today. I don’t think I will count the Lego robotics invention system considering when I used it I wasn’t smart enough to use anything but the drag and drop block code that came with it. It was still fun as hell though.

  9. My first microcontroller project used a Microchip PIC16F628A. It was an (almost) autonomous monitoring and actuation system, with four sensors and 4 relays, which linked to a remote computer through a GSM modem (well, a SonyEricsson K310 with the serial pins wired to the board). It featured a small Turing Machine to deal with the cellphone modem…

    Full work here: http://sare.anhanguera.com/index.php/anuic/article/view/1374/923

  10. PIC16F84 long before the advent of the AVRs :) In an assembler coded “german phonecard” powered doorlock. You could save several phonecards to use. There was a “master card” wich activated the programming mode…

    good times :)

  11. 2007: I’d been tasked by my sister and brother-in-law with developing a StepMania cabinet. (It’s been on and off ever since—and right now it’s still on.) I decided that what would set this project apart from other builds would be developing the I/O hardware from scratch. For input, there would be an MCU-based circuit in place of a cannibalized existing game controller. And there would be light outputs in the form of large numbers of independently-controlled LEDs.

    After covering some of the more basic principles of electronics (including finally figuring out how to use a transistor for switching, successfully piecing together a break-beam sensor, incorporating the cargo-cult magic of using 100nF caps to DECOUPLE ALL THE ICs, and learning that, despite being newer tech, 74ABT logic is just not a suitable substitute for 74HC when it comes to breadboarding), I got to the microcontroller bits. At that point Arduino was yet under my radar, so I prepared to start with a then-current hobbyist stand-by: The PIC16F88. In fact, all of the web’s useful information about PICs was for the PIC16F84 except this one site (don’t recall which) extolling the virtues of the ’88 as my generation’s ’84, being largely pin-compatible and with additional peripheral options and a built-in oscillator.

    I built an RCD Programmer and, much to my frustration, found that I didn’t yet have the chops to determine why it wasn’t working. Rather than continuing with such futile effort, I decided to bite and paid for a PICkit 2 programmer. At that time my computers had all been Windows-free for about a year (because Ubuntu had just gotten good enough), but a guy by the name of Jeff Post had managed a port of a command-line tool that would work in Linux after downgrading the firmware and abusing sudo. After fumbling through some ’88-specific configuration (and I do mean fumbling), I got some samples working. Then, I properly learned PIC asm (my background had been Perl, PHP, C, and C++ up to that point, plus one semester of SPARC) and got the USART part running through a MAX232.

    After getting a couple of samples working, I embarked on something a little bigger. I got a hold of 100 LEDs from some murky east Asian source via eBay and bought a bunch of the 74HC595s I’d just discovered (after having already bought some 74HC164 and 74HC240 to pair together). It was time to breadboard the “qlb” (backronymed to “quizzical light buffer”, I think; name was chosen for having radial symmetry) to control eight or nine ‘595s from a serial port. After implementing a circular buffer in asm, then supporting it with surprisingly little Perl code, this thing was shimmering (if a little glitchy—I believe I added a little error detection later on). I gave a rundown of my setup to DCLUG (the Washington DC Linux User Group) in November 2007 (evidence: http://dclug.tux.org/dclug_bytes2007.html https://www.youtube.com/watch?v=rB5ZvIebdXA).

    The barrier to entry is a lot lower these days, but at least I got to figure out for myself that the heavy abstraction layer provided by e.g. Arduino is totally optional.

  12. a real KIM-1 was my first. Learning computers by hand is something that I still believe they should do for all CS majors in college. Make them program in assembler then hand compile and enter on a numeric keypad.

  13. My first micro controller was a Basic Stamp clone, I never done nothing more than a blink, even becuase I wasn’t really able to find example for make it works (I din’t know anything about programming and electronics..,) the second one was an arduino diecimila (before it was cool B) ) my last one is an LPC!769, and I love it.

  14. I had messed with salvaged transistors and 555s, looking longingly at all the projects tagged ‘arduino’ on the net. Then I walked into a Maplin (uk electronics shop) on a bagpipe tour and all my money dissapeared. Got home, ran through some basic tutorials on blinking lights, IR signals and sound output. Then jumped into my first biggie – electronic bagpipes doing the sound synthesis on the arduino and using capacitive sensing on little screws for the note input. Worked really well, and may be turned into a business if I ever get free time again :P Good times! Amazing how easy stuff like this has become, especially for someone with a programming background and/or copy-pasting skills…

  15. Don’t recall the model, just remember it was the 80’s and it was a microcontroller programming project for a computer science course, assembly language. 4 – 7 segment displays, write code to get it to count from 1 to 1000 and display the results. Extra points for code that was streamlined and top score to the guy who could get it running the fastest.

    Fun times.

  16. Summer 2012, my first Arduino Uno.
    Blink sketch. I don’t know really what made me start with a microcontroller as a new hobby – but within half a year I was making my own PCB’s and building my own little cheap Arduino-clones. And I started occupying my fathers workshop and my very own desktop for my little projects.

  17. STK500 here, using the little cable to hook PORTA up to the switches and PORTC to the LEDS. you can fade some LEDS quite nicely in assembly, in C it was a little more flickery at the low brightnesses.

    We made a little PCB with a HD4470 LCD and an atmega128. The M103C fuse which puts the chip in atmega103 compatibility MODE and is set from factory had me stumped for ages…

  18. My first was a BS2. Didn’t take me long to find out that platform runs way too slow. I moved on to ATtiny13 using a DAPA cable. After “bricking” the six I ordered over a 3-4 month period by burning bad fuse settings o ordered a Dragon to salvage them and moved into the megas.

    This was before Arduino, but unlike some of the 8051 (etc.) stories on this thread it was recent enough to have internet resources like AVRfreaks (and a bit later hackaday) which were paramount for getting past roadblocks.

    1. Heh, pretty much the same story, we musta started ’round the same time. BS2 first -> text LCD (while standing-guard for a friend’s art-installation at an event with 100,000+ people, heh). Then 89c52 in assembly for a (very) short-stint… I was reading printed-out ASM charts for days on end… Then straight to the pin-compatible AT90S8515, the “gccTest” code, and “PonyProg”… Arduino was *just* beginning to come into the picture about three years later; much too late for me to relearn a new environment ;)

    2. Likewise, mine was a Basic Stamp. Unlikewise, it took me a long time to figure out how slow that thing was because I was a complete newby to micros and electronics. :-)

      I moved on to picaxe, and then the MSP430s and just recently added a Trinket to the mix. It has all been fun.

  19. Probably the thing that came with that real robots magazine’s cybot platform. Not that you could actually do anything with it. It is a wonder that the experience didn’t put me off of electronics and micro’s entirely, that’s how bad it was.

    The first platform with which I actually could do some real world stuff was Lego Mindstorms. That and robot-C started me on the track of learning the ins and outs of coding for real world interacting projects.

    After that, the usual suspects, pics, atmegas, arm based boards of all shapes and sizes.

  20. My first microcontroller was a 16f628a. I slogged through 2004 pic resources until I had built a parallel programmer and programed my blinkin lights that same day, a week later I had MY first circuit and program up and ready when I applied power the pic released it’s magic blue smoke and I didn’t have confidence to go back to microcontrollers for 10 years till the arduino ecosystem was well and truly mature.

  21. My first microcontroller-project was a ATmega8 I’ve used to build receiver for an RC-car which I would control with my smartphone (yeah, it was only 4 years ago) via bluetooth.
    The electronics part is completed, but I still don’t have a car for it :D

    Before using a microcontroller I wanted to use an old laptop with a parallel port and a custom kernel.

    1. Good call remembering the difference between uProcessor and uController, I was just about to chip (groan) in with the 8031 but it had no on board flash and I required an 8755 I/O Flash expander.

    2. First microprocessor I used was a 6809 in 1982. Very elegant machine. Moved to Z80s and 68000s all programmed in assembly. Did some 8086 work in Turbo Pascal.

      First microcontroller was AVR before it turned into Arduino. Moved onto Zilog eZ8s now.

  22. My first micro was a Basic Stamp, quickly followed by PIC16F84’s.

    Never really got past a menu that displayed on a serial backpack’ed LCD (then without the serial backpack), but that was because I hit the ‘analog wall’, and I didn’t know how to interface my project to a phone (it was supposed to be a dialer).

  23. I worked a summer job out of high school at a company that exclusively used Motorola 68HC11s. They had the fancy Nohau ICE and a high-end compiler which I cut my teeth on. But the owner was nice enough to give me the HC11 eval board (the older EVB with the 2 ROM sockets and HC24 PRU of $68.11 promotion fame, not the newer EVBU). I cut my teeth on this using the onboard BUFFALO monitor and banging in assembly with the Pink Book in hand. I had upgraded the SRAM to a Dallas battery-backed module so I didn’t have to keep reloading my work after a power cycle.

    I never built any personal projects using these, but for the company I used one to build a prototype of a field programmer for field firmware updates of the HC11s using the serial bootstrap.

    The HC11 was unique at the time because it had a serial bootloader ROM to program the on-chip EPROM or EEPROM with only a UART. This was appealing since you could build it into a project without an offboard EPROM or expensive programmer, just a few discretes and some way to connect your PC to the serial port.

    1. If we’re saying “microcontroller”, then, yes, 68HC11 was also my first one. IIRC, there were several variants, some having on-board EEPROM, a 68HC711 which had EPROM (UV erase), and a model with only the ROM which had to be run in data/address bus mode with external program storage (Ax suffix, I think?).

      But, before that, I’d been hacking away on various microprocessors (8086 and 6502 mostly).

      1. Sounds right. I worked with most of the varieties, the EEPROM flavor being my favorite by far for the convenience of programming via the bootloader. But some of the products used the Ax flavor, and I ran an eraser and burner at my desk with a chip tube as a FIFO for code/compile/test cycles.

        What really made the platform great was the documentation. I raided our local Moto sales office’s stock of pink books for the complete set of docs for all the variants, including the pocket ISA reference. I had previously learned the basics of assembly in high school on x86 (DOS debug represent) but the connection to machine code and the hardware architecture didn’t click ’til I spent time in these books.

  24. My first microcontroller was an MC68HC11A8. It had 512 bytes of EEPROM and 256 bytes of RAM. It also contained a monitor called BUFFALO (Bit User Fast Friendly Aid to Logical Operation) in its ROM, which allowed simple memory operations and assembly programming over a serial connection with just a 4 MHz crystal and a TTL-to-232 converter. I remember many nights converting assembly to machine code and counting bytes and cycle counts to fit in 512 bytes of EEPROM.

  25. My first uC was the Mototrola 6802 which was used in a communication translator for news wire. It converted the various speeds (28.8 baud through 9600) and encoding (hi and lo speed tts, baudot, etc.) to 9600 and ASCII so the minicomputers could store them for later work. Or to accept stories from the news wire and hook it up to older equipment. Really interesting stuff.

    Since then I’ve worked with tons of uCs. It’s amazing what you can do when you need conserve all your resources such as with a uC environment.

  26. Good old PIC 16F84 programmed through an actual laptops serial port to a PIC/EEPROM programmer.

    Nice little binary clock (which did not keep time very well).
    4 green LEDs provided 12 hour time and 6 red LEDs provided minutes plus one LED to blink seconds.

    Brings back memories.

  27. My first “start from scratch” and “just for fun” micro project was a digital chess clock. I started my Senior college year working after-hours at my co-op job. Two LCDs, two controllers, one National Semiconductor COP8 micro (remember those?), all in assembly.

    After months of work (I had already graduated, worked full-time), I finally decided it was good enough to bring home and use. Hold it in one hand, I opened the car door with the other and immediately felt the ZAP of a static discharge! Sure enough, at least one chip had died before I even brought it home.

    Luckily I had put the chips on sockets (which if I recall cost a lot more than the chips), so after some replacements, things were working.

    That was the one and only time anything I’ve worked on got damaged with ESD (that I know of!)

  28. Basic stamp, then on to the AVR. Started by building simple little “don’t hit things” robots. Now enjoying the Stellaris Launchpad… I still have yet to try an Ardunio. I should probably see what the fuss is about.

  29. My first microcontroller was a basic stamp 2 that I bought after reading an issue of Nuts & Volts in 2007. I played with it on and off for a couple of years, and my first project was for a 1999 Chevy truck that I had. The tape deck had quit so I wired up the output cable for the dash mount of my Garmin QueM5 to the switch for the tape deck and the audio to the radio input so that I could listen to books on tape and use the gps.

  30. My very first uC was a 8052 though more of an embedded computer as it was in a development board that contained basic and 32K SRAM.
    I then went on to the PIC 16F84 programming them in ASM and PICC.

  31. TI Launchpad with Capacitive Touch Shield, just played with the basic tutorials, with the goal of creating in-wall touch controllers for AV and HA. Decided it made more sense to stick a tablet on the wall, but this got me started with microcontrollers.

  32. motorola 6502 here, but with a catch, we used boards (donated by a big card manufacturer firm) with a bootloader and 7 segment displays plus keyboard and I/O lines, it was awesome, although I never quite got it right, then moved to atmels, never tasted the pics (oops), but the 6502 and 8051 were the ones which put me in the right direction, a passion for life, mechatronics. building drones and 3dprinters now, just for fun, of course, it was year 1993, last year of secondary school northside of argentina country. its been a long way since then.

  33. My first microcontroller was a 8048. I tried around with 16×2 LCD and build a DCF77 clock programmed in assembler. After a few months programming and erasing lots of EPROM’s, I bought a EPROM simulator which was plugged into the Centronics port. I still have the clock and somewhere the emulator. Today it is pure luxury to program via USB an Arduino or ARM Cortex-M :)

  34. My very first microcontroller project actually got featured on Hackaday way back in 2007: Wireless NES/SNES controllers for the Wii. I’d played around a bit before that with blinking LEDs and reading NMEA strings from a GPS module etc but this was my first proper “project” per se. Sadly the HAD pages from that era no longer exist but the links from all the other sites that got it from them do: http://goo.gl/4NEQCw.

    TD;DR: a 16F84A in the controller streams button state packets to an ASK transmitter module while another on the receiving end decrypts the packet and pretends to be a Gamecube controller so that it works with an unmodified Wii.

  35. i started with an arduino and moved on to stand alone avrs. i didnt start with the usual ‘lets blink some lights’ projects that a lot of arduino users seem to do, i was more interested in playing with rf modules and controlling servos. it wasnt long before i was driving diy remote control vehicles.

  36. I used an 8051 based microcontroller when I was learning asm at uni.

    The first useful thing I made was a GPS / accelerometer / gyroscope datalogger that wrote to a SD card. It started off being Arduino based Then I got annoyed with the Arduino IDE and the libraries weren’t efficient enough to write the amount of data I wanted so I just started writing code for the atmega and attiny chips.

    People knock the Arduino but as a first step it’s a pretty inexpensive and easy to use. It’s also relatively easy to go from Arduino to just using avg-gcc.

    For hobby stuff having an apt-getable tool chain that works out of the box and cheap programmers is great. I keep meaning to look at some of the ARM based stuff but it’s hard to justify the time.

    I used to work as a Linux C++ software developer on x86 servers. The microcontroller programming I did as a hobby got me a job writing and debugging code for embedded stuff running a variety of RTOS on a few different architectures. (The Linux C++ job I got without knowing C++ after reverse engineering a game and fixing some bugs in it . . .)

  37. My first was PIC18 and I was in the middle of high school. A friend suggested I sample a bunch of chips from Microchip and I took him up on it. I got various PIC18 based chips and tried to build a serial port programmer for them. Etched a PCB and everything but I couldn’t get it to work. I broke down and bought a pickit2 and didn’t look back.

    Used those things in a few places, switching relays and lights, drove a character LCD but it never really caught on with me.

    I used some atmel and feescale devices in college and after graduating I picked up some MSP430G chips and a teensy2 and haven’t looked back since.

  38. MOTOROLA MC68HC05B6 – that would be the first one, since it was on the c-control unit from conrad electronics which my dad bought, but I helped with the programs (his typing technic is like an eagle hunting its prey) and I loved working on the logic of those projects with him. I then went to AVRs – Atmega8 to be precise and attiny85s.

  39. My first true microcontroller was the PIC16C84 (the EEPROM-based precursor to the ‘F84). My guide on my adventure was the great (and humourously titled) book “Easy PIC’n”. Learning to use that chip helped land me a summer job during my EE undergrad :) Before that, though I had cut my software-based control teeth with the Commodore 64’s “User port”, and making DIY I/O ISA cards for IBM PCs. Fun stuff.

Leave a Reply

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