How To Make Almost Anything Neil Gershenfeld

JACKSON HOWELL

MIT Center For Bits And Atoms


PROGRAMMING

Fab labs share an evolving inventory of core capabilities to make (almost) anything, allowing people and projects to be shared. These are my projects.

Embedded Programming -
Blink.ino
Button.ino + Button.c
Mario.ino

10.17.18

This week our individual assignment was: read a microcontroller data sheet, and program your board to do something, with as many different programming languages and programming environments as possible.

I sucessfully ran four programs: Blink.ino, Button.ino, Button.c, and a modified version of Mario.ino I uploaded my programs via the Arduino IDE. At first I attempted to upload from my brand new Dell in a windows environment; however, I kept getting an error about my board not being found. I tried using some boards in shop that were known to be working, but they did not program successfully either. This made me think it must be a problem with my Windows environment as opposed to my board. So I tried again using one of the computers in the shop, this time in a Linux environment, and the program uploaded successfully on the very first try. If you find yourself in a similar scenario, it could be a poorly soldered connection, but try a different machine first.

After running the out of the box arduino examples for Blink and Button, I decided to try re-writing Button in C using Niel's echo.c program as a template and a helpful walkthrough from 2017's Lilly Gabaree. Additionally, this semester I have been learning C in CS50, so I could orient myself a bit. The resulting C file was a lot more verbose than the Arduino one, but that's simply because Arduino has more going on behind the scenes. The C program compiled and uploaded much faster than the Arduino one.

Over the summer, I purchased an arduino UNO and was able to play the Mario theme using a Piezo buzzer. I wanted to see if I could do the same using my Tiny44, so I jerry rigged a Piezo buzzer to my board via some wires, connecting a 1K ohm resistor to the ground wire. After editing the Mario file to reflect my board's ports, I went to verify my code before upload (the check button in Arduino IDE). Much to my surprise, the simple theme song program required over 300% of the memory available on the humble Tiny44, which has only 256 bytes. I removed a substantial amount of the program, including the Underworld Theme and all of the unused notes. When this was still not enough, I had to resort to trimming the Mario theme itself. I was left with about one third of the original theme, using less than one third of the original memory required. After all the trouble, it actually worked. I couldn't believe it!

Download Files

Fig.1 Tiny44 data sheet

Fig.2 My C program, modified Niel's file for echo.c

Fig.3 FTDI cables seem to disappear, leave 'em in the lab

Fig.4 My Board connected to the computer via FTDI and connected to my progarmmer

Fig.5 Holding down the button on my board, triggering the light after uploading button.c

Fig.6 Piezo buzzer

Fig.7 Soldered wires to buzzer

Fig.8 Observe the resistor twisted with pliers around the ground wire

Fig.9 Successfully uploaded one third of the Mario theme