Interface and Application Programming

"An application programming interface (API) is a way for two or more computer programs to communicate with each other." -Wikipedia

Individual Assignment

1. I wrote an application that interfaces with an output device to run a motor.

This week I wanted to use the opportunity in making the device I would connect my application to something that would be useful for my final project. Therefore, I decided to create a working PCB to control a DC motor using a MOSFET and diode, as I attempted unsuccesfully in Week 10. I first created the circuit diagram for a simple output device of a button with a connector that would allow me to connect a motor (Fig. 1A). I next made the PCB layout based on the diagram (Fig. 1B).

Fig. 1A. Circuit diagram for simple output device.

Fig. 1B. PCB layout for a simple output device.

The past several weeks I had milled and soldered PCBs so I was pretty comfortable with the process at this point. After milling the PCB for my simple output device, I gathered the components to be soldered (Fig. 1C).

Fig. 1C. PCB and components.

After soldering the components and testing the circuit, I was disappointed to see it not work. However, I realized this was due to a simple routing problem. I had routed the wrong header on the switch button to the microcontroller pin. Luckily, there was a spare header on the push button that allowed me to solder an extra connector to it to fix the wiring (Fig. 1D).

Fig. 1D. Fixed wiring issue.

I wrote an Arduino code that was uploaded to the microcontroller connected to the output device. This allowed me to control the motor using the button on the PCB (Fig. 1E). The .ino Arduino code can be downloaded here.

Fig. 1E. Running the motor via a physical button.

After learning how to use the graphical library and integrated development environment Processing, I wrote a code to connect to the Arduino IDE via serial communication, similar to the networking used in Week 11. The .pde Processing code can be downloaded here. I referenced a helpful online tutorial from Sparkfun which allowed me to establish the serial communication and create a digital button in Processing that could run the motor in my circuit (Fig. 1F).

Fig. 1F. Running the motor via a digital button.

Finally, knowing the serial communication worked, I made the digital button animate when clicked, allowing for visual feedback that signal had been sent to the microcontroller to run the motor (Fig. 1E).

Fig. 1G. Improved the digital button.

As predicted, the networking and communications skills I learned in Week 11 helped me create this interactive application. It was also great that I was able to make a working PCB to redeem my earlier attempt in Week 10 and help solidify my final circuit design.

Group Assignment

2. I compared interface and application programming tool options with my group.

This week, students in the Architecture section used different platforms to create applications. I read about Mateo's Three.js, Danny's openFrameworks, and Simon's Rhino Grasshopper applications. I compared these with my use of Processing. My conclusion was that Three.js was best for making dynamic and interactive visualizations, openFrameworks seemed to be good for video processing applications, and Rhino Grasshopper seemed to be useful for making environments without having to write code. I hope to explore these programs more in the future and see if these initial observations hold true.