Embedded Programming

Embedded programming sounds scary to me. I have never been on good terms with electronics engineering-ish things, and the trauma that electronics subjects inflict on humble mechanical engineers through engineering school is considerable.

Over the past few years though, the Arduino has been a refreshing and surprisingly easy workflow to grasp. I recognize that it a prototyping board, and it's big and chunky and expensive at times, but man! does it work simply.

So when Neil said that this week's session is intended to make us get past using the Arduino and making one ourselves, use the microcontrollers directly and have everything work at a fraction of the expense, I was all for it.

Choice of Chips

I decided to play a little safe and work with the raw versions of MCUs that I was already familiar with as boards.

So my primary choice was the Atmega 320P, which is at the heart of the Arduino as well. My second familiar chip was the ESP-8266, since I had used NodeMCUs at some point in the past, and they have the benefit of built-in Wifi+BT. Neil in his talk heartily recommended the RP2040, so I added that to my list. Lastly, I was curious about the ATtiny85, which was a tiny little thing but supposed to work with the Arduino IDE as well.

I trawled through the net for How-Tos and other instructions and have a sizeable list of possibilities that I will continue to explore. Once I had understood the lay of the land and figured out a few essential basics, I decided on what options I will be exploring.

The lab didn't stock anything apart from a few Arduino Unos, when I asked for what MCUs we had. So I went to Robu.in, the Indian version of Radioshack or what-have-you to see what they had in stock and what they said about it, to get a reality check on what's available and prices. I also followed that up with calls and a trip to Lamington road, the street market for all things electronic in Bombay.

These are the few directions I want to really explore :

  1. Using the Atmega328P without the rest of the Arduino. There's a few Instructables for giving it an external clock and using it directly, by using an Arduino dev-board or ejecting the chip from an Arduino to use the rest as a bootloader. There's also a How-to on making an Arduino on a breadboard, but I am not too keen on that.

  2. Use the RP2040 Not sure what to do with this except blink it for now, but Hey, who knows. It's supposed to be very powerful, so we'll take it for a spin.

  3. Use ESP8266 The wifi functionality is an obvious plus, so if I can use the bare chip, that would be nice.

  4. Use the ATtiny85 Being a tiny little thing, I am rather enthusiastic for using this in any of it's available forms. I've discovered how to bootload the bare chip using the Arduino, but there's USB and microUSB versions as well that are directly usable. Looking forward to playing with this too.

Weekly Assignment

Most of the tools and chips I need are still shipping since I ordered them at some point after the class, after doing some reading up and figuring. However, I have a couple of ATtiny85s lying around that a friend had dropped off and while I knew in theory that it was an Arduino-IDE compatible protoboard that would do this-that-and-more, I have never actually used it. So while I waited for my chips and dips to arrive, the ATtiny85 was a go.

Round 1 : The ATtiny85

I followed the instructions on the page below and added the board source to the Arduino IDE, then got to programming the ATtiny85.

Using the ATtiny USB devboard

The funny part with the ATtiny85 is that you code and compile first, then only plug it in when the IDE asks for it. That bit is likely to throw you off if you forget it.

I had 2 versions, the USB devboard as well as the micro-USB devboard, and I tried both.

ATtiny01 ATtiny02

ATtiny03

ATtiny04

Anyway, I only managed to successfully plug in the ATtiny and get the onboard LED to blink, and given that anything beyond that didn't work, I am unsure of that as well.

Beyond that, the ATtiny85 has been extremely quirky and un-cooperative. Although I have a collection of resources that I hope to use to resolve this, but I decided to wait until the RP2040 was available in some form.

Other ATtiny85 links :

Programming the ATtiny85 chip using the Arduino