218 lines
14 KiB
TeX
218 lines
14 KiB
TeX
\documentclass[12pt]{article}
|
|
%%% Local Variables:
|
|
%%% mode: latex
|
|
%%% TeX-master: t
|
|
%%% End:
|
|
\usepackage[T1]{fontenc}
|
|
\usepackage[utf8]{inputenc}
|
|
\usepackage{color}
|
|
\usepackage{url}
|
|
\usepackage{listings}
|
|
\usepackage{SIunits}
|
|
\usepackage[today]{svninfo}
|
|
%\usepackage{fancyhdr} % already loaded
|
|
\svnInfo$Id$
|
|
\svnKeyword $URL$
|
|
\usepackage[layout={footnote}]{fixme}
|
|
\usepackage[margin=25mm, a4paper]{geometry}
|
|
\setlength{\headheight}{15pt} % to make fancyhdr happy
|
|
\usepackage[final]{graphicx}
|
|
\graphicspath{{graphics//}{Graphics//}{./graphics//}{./Graphics//}}
|
|
\usepackage[final]{hyperref} %% THIS MUST BE LAST PACKAGE
|
|
|
|
\title{Arduino Synchronizer Instructions\\
|
|
Revision~\svnInfoRevision
|
|
}
|
|
\author{Joe Foley $<$foley@ru.is$>$\\+354-661-7658}
|
|
|
|
|
|
\begin{document}
|
|
\lstset{language=C++, breaklines=true, postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}}}
|
|
\pagestyle{fancyplain}\thispagestyle{empty}
|
|
\maketitle{}
|
|
\listoffixmes{}
|
|
|
|
|
|
|
|
\section{Introduction}
|
|
These instructions are meant to accompany an Arduino-based synchronizer.
|
|
The initial design was done for video 3 installations put in place on September 14, 2013 at the Reykjavík Art Museum.\cite{listasafn2013videolist}
|
|
A synchronizer is a device used for synchronizing a set of video playback devices to play at the same time.
|
|
This implementation uses an Arduino connected to an IR LED to provide the service.
|
|
Changing the timing or player codes for a given synchronizer requires reprogramming it with instructions detailed below.
|
|
This code is known to work with players which have {\em true} DVD's in them. Other formats may or may not work.\footnote{See Section~\ref{faq}}
|
|
|
|
\section{What is included}
|
|
You should have been provided with these items:
|
|
\begin{description}
|
|
\item[Synchronizer Hardware:] consisting of a plastic box with rubber feet, inside which is an Arduino and an IR LED.
|
|
\item[USB Cable:] a standard USB A-B cable, suitable for connecting a host computer to a random USB device.
|
|
\item[USB Power Supply:] a 220-240 VAC power supply that converts wall (mains) current into the 5~\volt{} that a USB device needs.
|
|
\item[CD/zip of software and documentation:] Where this documentation, code, and other support files can be found
|
|
\end{description}
|
|
|
|
\subsection{File structure / manifest}
|
|
The zip file/CD should contain this structure:
|
|
|
|
\begin{tabular}{ll}
|
|
\texttt{readme.txt} &very terse information and a suggestion to read this document.\\
|
|
\texttt{doc/} &where this documentation is found.\\
|
|
\texttt{dvd/} &un-customized synchronizer code for the various DVD players\\
|
|
\texttt{installations/} &customized synchronizer code by artwork name\\
|
|
\texttt{libraries/} &required libraries and sample code for them\\
|
|
\texttt{prior-art/} &other existing synchronizer code that this system was inspired by\\
|
|
\texttt{tests/} &code for initial testing of the IR libraries\\
|
|
\texttt{util/} &useful utilities including a general IR decoder\\
|
|
\end{tabular}
|
|
|
|
\section{Video preparation}
|
|
If you can get the artist to put at least 10 seconds of black at the end of the video, then you can use the full duration.
|
|
Otherwise, we will always cut off a few seconds of the video at the end to sure that all players stay synchronized.
|
|
See the {\tt choptime} and {\tt resetdelay} timing parameters in the code for how to adjust how much is cut.
|
|
|
|
In addition, the DVD or BD should have the entire content in one chapter and set to autoplay.
|
|
|
|
\section{How to operate}
|
|
To setup a freshly programmed synchronizer, the procedure is straightforward.\\
|
|
\begin{enumerate}
|
|
\item Unpack the synchronizer and verify all of the parts are present.
|
|
\item {\em Make sure that the installation, play time, and player model on the label match the configuration you are setting up.}
|
|
\item Put a playable DVD in each player. They should be stacked on top of each other with the fronts lined up.
|
|
\item Plug in the USB cable into both the power supply and the synchronizer.
|
|
\item Position the synchronizer approximately 30~\centi\meter{} away from the front(s) of the players. It should be roughly centered and with the front pointed directly at the front of the players\footnote{If you know where the players' sensors are, you can point the LED directly at it.}. The front is the side with a small hole in it and an LED poking through. An easy way to know the front is that if you are reading the label right-side up, then the front is in front of you. Also, the USB cable will be to your right.
|
|
\item Plug the power supply in.
|
|
\item The players should restart and synchronize. If not, unplug the cable from the power supply and plug it back in.
|
|
\end{enumerate}
|
|
If the player fails to synchronize, consult Section~\ref{faq} for hints on how to diagnose.
|
|
|
|
\section{How to reconfigure}
|
|
If you need to change something, you will need to setup the Arduino IDE to change the program and upload it to the synchronizer.
|
|
\subsection{Arduino IDE and libraries}
|
|
You will first need to install the Arduino programming software from \url{http://arduino.cc}.
|
|
At the time of writing, the suggested version is 1.0.5.
|
|
If you are on a windows computer, it is very important to pick the right version (32bit vs. 64bit).
|
|
We do not include a copy of the Arduino software because it is constantly changing and improving.
|
|
|
|
Install the all of the libraries in the {\tt libraries} folder. This usually consists of copying the \texttt{IRRemote} folder into \url{Documents/Arduino/libraries}.
|
|
The newest 1.0+ series of Arduino software has an automated tool for this under ``Sketch'' then ``Import libraries''.
|
|
More details on installing libraries at \cite{arduino:libraries}.
|
|
You may need to install other libraries; consult the top of the arduino code you are using for where to download the latest version.
|
|
Generally, the files in {\tt libraries} are sufficient.
|
|
|
|
\subsection{Setting up code}
|
|
Either copy the installation code\footnote{from \texttt{installations/}} or fresh synchronizer code\footnote{from \texttt{dvd/}} into a new \texttt{installations/} folder with the name and model number. For example, the installation ``dawn'' on a ``Toshiba SD590EKE'' would have the folder name \begin{verbatim}installations/dawn_toshiba_sd590eke/\end{verbatim}.
|
|
{\em Important! Do not use Icelandic characters, or anything other than letters and underscore in the name.}
|
|
|
|
You will need to rename the \texttt{.pde} file to match the folder name, e.g.
|
|
\begin{verbatim}
|
|
installations/dawn_toshiba_sd590eke/dawn_toshiba_sd590eke.pde
|
|
\end{verbatim}.
|
|
|
|
Open the Arduino software and open the \texttt{.pde} file where it says:
|
|
\begin{lstlisting}
|
|
int playtime= 1*60+1; // set here your DVD title playtime in sec leave a little extra
|
|
\end{lstlisting}
|
|
and change it for the running time of your installation minus a second or two. You need to remove those seconds so that the player does not get a chance to re-start on its own. For an installation that is sixty-one minutes long and thirty-six seconds (61:36), a good time would be (61:35). It is also a good idea to leave a comment of the original timing and piece name. This timing would have this code:
|
|
\begin{lstlisting}
|
|
// Artwork: dawn 61:36
|
|
int playtime= 61*60+35; // set here your DVD title playtime in sec leave a little extra
|
|
\end{lstlisting}
|
|
|
|
For testing, you may want to initially use a shorter time to see the system reset more often.
|
|
|
|
\subsection{Testing and uploading program}
|
|
Now run the ``Verify'' command in the Arduino program. You should not see any errors. If there are any, try to fix them. The most common error is to forget a ``;'' at the end of a statement/line or to misspell a variable name.
|
|
|
|
Connect the synchronizer to your computer via the USB cable. On the top menubar lick on the ``Tools" then ``Serial Port'' then whatever serial port the Arduino connected to. In many cases, this will automatically be correct. Click on ``Tools'' then ``Board'' then ``Arduino UNO''.
|
|
|
|
On the ``File'' top menubar run the ``Upload'' command. You should see a little text at the bottom of the window saying it was successful uploading.
|
|
|
|
Update the label on the top of the synchronizer with the new configuration.
|
|
Failure to do so is likely to cause confusion at a later date.
|
|
|
|
|
|
\section{Common problems}\label{faq}
|
|
A very useful procedure to see what the synchronizer is doing:
|
|
\begin{enumerate}
|
|
\item Unplug the USB cord from the power supply and connect it to your computer.
|
|
\item Open the Arduino software and make sure it is connected to that USB port
|
|
\item Start the ``Serial Monitor''\footnote{It is a little spy-glass symbol on the top right of the window; you can also get there through the Tools menu} and set the baud to 15200
|
|
\item You should see some useful information about the version of the software, installation it is configured for, and run time. Then the display should show you which functions are being called and how much time it is waiting between them.
|
|
\end{enumerate}
|
|
\subsection*{Not all of the players are resetting at the same time}
|
|
\begin{itemize}
|
|
\item Is the LED (small hole with a dome in the side) pointed at the front of the player? If not, do so. You can tell where the LED is by the label. It should be near the top of the label in the direction you can read it.
|
|
\item Is there anything in the way between the synchronizer and the players? The cable sometimes falls there.
|
|
\item Is the box less than 10~\centi\meter{} away? If so, move it at least 30~\centi\meter{} away from the front.
|
|
\item Look at the code. It is possible that you need more ``previous'' commands with a pause between them. This sometimes helps. Sometimes there are too many. This requires some testing to figure out how many are correct.
|
|
\end{itemize}
|
|
\subsection*{The players are never resetting}
|
|
{\em Note! Many DVD players can also play USB flash drives and DVDs with DIVX or other file formats. Often these systems do not have an ability to reset via a ``previous'' command. Beware!}
|
|
\begin{itemize}
|
|
\item Make sure that the power supply is plugged in and the cable is plugged into the box and the power supply.
|
|
\item Is the LED (small hole with a dome in the side) pointed at the front of the player? If not, do so. You can tell where the LED is by the label. It should be near the top of the label in the direction you can read it.
|
|
\item Is the box less than 10~\centi\meter{} away? If so, move it at least 30~\centi\meter{} away from the front.
|
|
\item If it is still having problems, open the box and make sure that lights on the Arduino light up when it is plugged in.
|
|
\item Check the LED is working by viewing it through a camera phone (which are generally sensitive to IR).
|
|
You should occasionally see it blink, especially when resetting it.
|
|
\item If the LED is not blinking, it is possible that it came loose or needs to be replaced. Put the longer leg (anode) into pin 4, this pin acts as a convenient ground. The shorter leg (cathode) should go into pin 3. If you are still having trouble, construct the circuit on the right side of Figure~\ref{fig:ir-schematic}.
|
|
\item You might have the wrong player code for the player you are using.
|
|
Use the Arduino Serial Monitor at 115200 baud and see what it says.
|
|
Make sure that the model matches what you are trying to control. This should also match the information on the label of the synchronizer.
|
|
\item If all else fails, re-upload the code to the Arduino after checking that it is the right version for your player.
|
|
\end{itemize}
|
|
|
|
\subsection*{Occasionally a player gets stuck on pause}
|
|
This is usually because the length of the time is set to just a little too long.
|
|
This causes the player to automatically rewind at the same time that it would normally get the ``previous'' command.
|
|
The simplest way to correct this is to reduce the playtime in the code by a few seconds.
|
|
|
|
\appendix
|
|
\section{Programming a new player}
|
|
{\em These instructions are for developers. Do not attempt without some understanding of the Arduino, programming, and electronics.} We recommend reading Ken Shirriff's article first at \cite{shirriff2009multiproto}.
|
|
|
|
\begin{figure}[h]
|
|
\centering
|
|
\includegraphics{ir-schematic}
|
|
\caption{Hardware setup for IR decoder on Arduino. \cite{shirriff2009multiproto}\label{fig:ir-schematic}}
|
|
\end{figure}
|
|
|
|
You will first need to construct the circuit shown in the left side of
|
|
Figure~\ref{fig:ir-schematic}. You can get a 38Khz IR receiver from
|
|
Íhlutir or Miðbær Radio. {\em Note! This is different than an IR
|
|
phototransistor!} We like the TSOP38238 you can buy from Adafruit
|
|
at \url{www.adafruit.com/products/157}. If you use the modified
|
|
IRrecvDump.ino included, you can simply put the left pin (with
|
|
the bump facing you) into pin 10. Some synchronizers may include the
|
|
chip. If so, it will have two holes in the left side of the box.
|
|
|
|
\begin{enumerate}
|
|
\item Copy an existing synchronizer into a new folder in \texttt{dvd/} which indicates the model of the player.
|
|
\item Run the Arduino Program
|
|
\item Install the IRremote library from \texttt{libraries/}\footnote{The latest version can be acquired from \url{https://github.com/shirriff/Arduino-IRremote}}.
|
|
\item Go to \texttt{util} and run the \texttt{IRrecvDump.ino} program.
|
|
\item Open the ``Serial Monitor'' at 9600 baud.
|
|
\item Push the appropriate buttons on the remote: stop, pause, play, previous
|
|
\item Make note of the codes and encoding format
|
|
\item Put the appropriate \texttt{irsend} command in the new synchronizer code. Make sure you match the type, code, and number of bits.
|
|
\end{enumerate}
|
|
|
|
Here are the parameters for the various send function calls taken from Shirriff's \url{IRremote/IRremote.h}
|
|
\begin{lstlisting}
|
|
void sendNEC(unsigned long data, int nbits);
|
|
void sendSony(unsigned long data, int nbits);
|
|
// Neither Sanyo nor Mitsubishi send is implemented yet
|
|
// void sendSanyo(unsigned long data, int nbits);
|
|
// void sendMitsubishi(unsigned long data, int nbits);
|
|
void sendRaw(unsigned int buf[], int len, int hz);
|
|
void sendRC5(unsigned long data, int nbits);
|
|
void sendRC6(unsigned long data, int nbits);
|
|
void sendDISH(unsigned long data, int nbits);
|
|
void sendSharp(unsigned long data, int nbits);
|
|
void sendPanasonic(unsigned int address, unsigned long data);
|
|
void sendJVC(unsigned long data, int nbits, int repeat); // *Note instead of sending the REPEAT constant if you want the JVC repeat signal sent, send the original code value and change the repeat argument from 0 to 1. JVC protocol repeats by skipping the header NOT by sending a separate code value like NEC does.
|
|
\end{lstlisting}
|
|
|
|
\bibliographystyle{IEEEtran}
|
|
\bibliography{references}
|
|
\end{document} |