How to Program miniMO

This is a reference guide showing you how to program miniMO using the Arduino IDE and an Arduino/Genuino UNO.

miniMO runs on an ATtiny85, a very well documented microcontroller, and programming miniMO is the same as programming the ATtiny. There are many tutorials available online on the topic, and I recommend following this excellent post that explains the process in detail.

What you need:

  • A computer with the Arduino IDE installed, and an Arduino/Genuino UNO, or an ISP (in-system programmer). This guide shows you how to use the Arduino as an ISP programmer
  • Within the Arduino IDE, you need ATtiny cores. The post referenced above explains how to install the cores for the various versions of the Arduino IDE
  • To follow my setup,
    • Install Arduino IDE 1.5.7
    • Get the arduino-tiny cores available here. Unpack the folder, search inside for a file named Prospective Boards.txt, and rename it to Boards.txt
    • Install the cores as per the post linked above
  • A miniMO, either PCB or 3D-printed
  • If you have a 3D printed miniMO, you’ll need 5 male-male jumper wires
  • If you have a PCB miniMO, you’ll need either 5/6 male-male jumper wires (one is optional), or a 5-pin male header and an optional jumper wire. This is the preferred option, and I use an angled header because it makes miniMO rest neatly next to the Arduino when connected

Connections:

  • If you have a PCB miniMO:
    • Get the header, and move the plastic bit back a so that the header will hold to female headers on both sides

      Up: unmodified header. Down: plastic bit moved back –  the metal pins are now long enough to hold to a female header

    • Place the Arduino so that the longest row of female headers is located at its right
    • Locate the pin marked GND in the Arduino in the rightmost header, and insert the male header starting there, from GND to PWM10
    • Place the miniMO with the female header looking to the left.
    • Align the uppermost pin in miniMO with the uppermost pin of the male header, and insert miniMO. miniMO’s lower pin won’t have anything connected
    • If you want to power miniMO from the Arduino, connect a jumper wire from the 3.3v header (5v is also fine, if available), to the free pin, and set the power jumper in miniMO to the leftmost position (external power)

tl;dr – Align GND in miniMO with GND in Arduino, and connect the headers 1-to-1 except for the 6th, which you can use to connect to PWR in Arduino if you want to.

  • If you have a 3D printed miniMO:
    • Place the Arduino so that the longest row of female headers is located at its right
    • Place the miniMO to the left of the Arduino, with its female header looking to the right
    • Locate the pin marked with the number 13 in the Arduino, and use a jumper wire to connect it with the topmost pin in miniMO
    • Connect three more pins one-to-one, going downwards, between miniMO and Arduino (pins 12, 11, and 10). When you finish, the lowermost pin in miniMO won’t have anything connected
    • Connect the lower-most pin in miniMO to any pin marked GND in Arduino. I use the pin located over number 13

Unlike with the PCB model, there’s no simple plug-and-play header or connector that I know of. I built a custom connector using a ribbon cable and male headers; you can just glue the bundle of jumpers together in both ends as a quick workaround.

Programming:

Start with the Arduino on its own, connected to the computer but not yet to miniMO.

  • Open the Arduino IDE, and within the File/Examples menu, select ArduinoISP
  • In the Tools/Board menu, make sure you have your particular model of Arduino selected
  • Click the arrow to compile and upload the program to Arduino
    • From now onwards, Arduino will work as a programmer
  • Connect miniMO to Arduino, as explained above, and turn it on
  • Make sure miniMO has nothing connected to port 4; you can leave any other connections as they are
  • In the IDE, go back to the Tools/Board Menu, and select ATtiny85, 8Mhz, internal oscillator. Regardless of the actual writing, you should see only one option that meets these criteria. In my case, it says ATtiny85@8Mhz (internal oscillator; BOD disabled)
  • Now go to Tools/Programmer, and choose Arduino as ISP
    • If you’ve never programmed miniMO before, select Tools/Burn Bootloader. This will set the microcontroller to work at 8Mhz running on the internal oscillator, as selected above, if it wasn’t already (it doesn’t actually burn a bootloader, as far as I know). Usually you will do this only once in the lifetime of your miniMO
  • Download the programs from the repository, and open any of them with the IDE. I recommend that the first program you try is an Oscillator
  • Click on the arrow to compile and upload the program to miniMO
    • If you uploaded the Oscillator program, run an input calibration: click the button three times, then move the knob to the rightmost and leftmost positions a couple times

After the initial setup, you will only need to repeat the last two steps to send new programs to miniMO.

If sending a program fails, most usually it is due to one of two things: miniMO’s battery is running low, or you left port 4 connected.

  • If the batteries are low, either replace them, or, if you’re using a PCB miniMO, power it from the Arduino
  • If you are using a printed model, also recheck the connections between miniMO and Arduino, and, if that doesn’t help, recheck the circuit, as an internal connection might have gone loose