ArduiPod Box

ArduiPod Box: A low-cost and open-source Skinner Box using an iPod Touch and an Arduino microcontroller

What’s the ArduiPod Box?

The ArduiPod Box is an operant chamber or Skinner box, built with two main components: an iPod Touch and an Arduino microcontroller. This device was developed with two goals in mind: keeping it affordable and making it open source. The idea behind this project was to provide animal behavior researchers and teachers with an alternative to the more sophisticated (but costly) standard operant chambers. In spite of its limited functionality (at least, in its current state of development), this box will be suitable for running simple experiments in operant conditioning, which might be of great use to provide animal behavior students with a hands-on learning experience.

How much will it cost?

Building this box won’t be expensive. Assuming that you devote some time to find the cheapest prices (e.g., buy a used or refurbished iPod Touch), you should be able to purchase all necessary materials for less than $300. Building your box might take some time (especially if you don’t have all necessary tools), but all in all it shouldn’t take more than 3-4 hours.

Materials necessary to build your own ArduiPod box:
  • iPod Touch (4th gen) or iPhone 4/4S (*).
  • Arduino Uno microcontroller (**).
  • Redpark serial cable (***).
  • Plastic cage for rodents.
  • Small plastic bottle (for food dispenser).
  • Servo motor.

(*) The newer iPod Touch (5th gen) and the iPhone 5 will work perfectly as well, but the iOS app run by the device (Shaping) has been optimized for the 3.5-inch display of the older devices and might require minor adjustments for use with the 4-inch display of the last-generation devices.

(**) The Arduino Uno is the most popular (and affordable) microcontroller made by Arduino. However, other official models (e.g., Due, Mega 2560, or Nano) as well as home-made microcontrollers (e.g., Bareduino 328) might work as well.

(***) Necessary to connect the iPod Touch to the Arduino Uno.

Download the software:

You will need to download two programs in order to run your ArduiPod Box:

First, you need to download the Shaping app. The source code of this app is available in the Download Center. You are free to modify it (*) and use it for your own purposes (**).

Second, you need to download the sketch to be run in the Arduino, also available in the Download Center.

(*) Apple’s IDE (Xcode) is free to use. However, in order to export your app to your iPod Touch you will need to be enrolled in Apple’s iOS developer program.

(**) Please acknowledge the source of this software: Pineño, O. (2013). ArduiPod: A Low-Cost and Open-Source Skinner Box Using an iPod Touch and an Arduino Microcontroller (Version [v.#]). [Computer software]. Hempstead, NY: Hofstra University. Retrieved [date]. Available from http:www.opineno.com

Wire it up:

There are thousands of ways of building your own ArduiPod Box (and most certainly you should feel free to be creative!), but there’s only one way of wiring things up to make it work (unless, that is, you make changes in the sketch run by the Arduino). Follow these steps to get your Arduino to talk to your iPod Touch.

  • LED connected to Arduino Pin 13 from the anode (+, long leg on the LED) and GND from the cathode (-, short leg). Although not strictly necessary (it will depend on the color of the LED, since they have different forward voltages), it is recommended that you use a resistor with low impedance/resistance (200 ohms, approx.).
  • Push button connected to GND and Arduino Pin 12. That pin will is set in the sketch to work as an input. When the button is pushed, the Arduino detects a drop in voltage from 5V to 0V (GND). Pressing this button will trigger the action in the servo (exactly as if the screen of the iPod Touch had been touched in the presence of an S+), something useful for manual shaping.
  • Servo motor connected to VCC (5V) and GND (red and black cables, respectively). Third cable connected to Arduino Pin 11 (Arduino-servo pulse).
  • Redpark Serial Cable connected to iPod Touch and to Arduino. While the connection to the iPod Touch is self-evident, the connection to the Arduino requires a little explanation. You will have to connect the following pins (cable-Arduino): 5V-5V (*), GND-GND, TX-RX, RX-TX.

(*) Newer revisions of the Redpark Serial Cable no longer require the 5V-5V connection.

You might want to use this breadboard schematic as a reference (click here for a copy of this schematic with higher resolution). Please note that the connections to the Redpark Serial Cable are not depicted in this schematic.

Here’s what the final product looks like, after connecting all the elements:

Finally, these pics show how the iPod Touch would have to be installed on the plastic wall in order to match the size and position of the colored button presented in the Shaping app (i.e., the discriminative stimulus) with the opening on the wall:

ArduiPodChart, a perfect complement for your ArduiPod Box:

The latest versions of the Shaping app (v. 1.1 and newer) come with P2P connectivity! If you have another iOS device lying around, you might want to install the ArduiPodChart app in it. The ArduiPodChart app connects wirelessly to the Shaping app (assuming that they are both connected to the same Wi-Fi network) and receives a real-time feed of the data being collected by the Shaping app. The data is automatically plotted on the screen of your iOS device, right as it is collected by the ArduiPod box. (How cool is that?)

The source code of the ArduiPodChart app is available in the Download Center as well. This app is also available for download from the iTunes App Store. As with the Shaping app, you are free to modify it and use it for your own purposes (*).

ACKNOWLEDGMENTS: For this app, I made use of the AsyncSocket library, developed by Dustin Voss; and the MTMessage and MTMessageBroker classes, developed by Drew McCormack.

(*) Please acknowledge the source of this software: Pineño, O. (2013). ArduiPod: A Low-Cost and Open-Source Skinner Box Using an iPod Touch and an Arduino Microcontroller (Version [v.#]). [Computer software]. Hempstead, NY: Hofstra University. Retrieved [date]. Available from http:www.opineno.com.

 

Download Center
Paper

Pineño, O. (2014). ArduiPod Box: A low-cost and open-source Skinner box using an iPod Touch and an Arduino microcontroller. Behavior Research Methods. [Download]

Shaping app (iOS and Arduino)
  • v. 1.0.0 – The ArduiPod Box is born.
  • v. 1.1.0 – Adds network capability: now Shaping app shares info over a Wi-Fi hotspot with another iOS device running ArduiPodChart (v. 1.0.0).
  • v. 1.1.1 – Shares current trial number with ArduiPodChart (v. 1.0.1). Shows smiley face on screen to graphically represent delivery of reinforcer.
  • v. 1.1.2 – Presents a white asterisk on screen during un-signaled trials (option “0”) to maximize chance of a touch (target response) during shaping procedure. Arduino now stops “listening” to iPod Touch during delivery of reinforcer (necessary in order to prevent responses performed during reinforcement from yielding additional reinforcers). Adds second Arduino sketch for devices using water as reinforcer.
  • v 1.1.3 – Updated to operate with iOS 12.
ArduiPodChart (iOS only)
  • v. 1.0.0 – Connected!!
  • v. 1.0.1 – Receives current trial number from the Shaping app (v. 1.1.1).
  • v. 1.0.2 – App now prevents iOS device from turning off, allowing uninterrupted monitoring for duration of experimental session.

You are WELCOME to download and use the programs in this page for teaching and/or research purposes. However, DO NOT forward this material, or make any copies or distribute these programs to other people.

COPYRIGHT © 2013 Oskar Pineño