# Overweight

Overall we want to measure when a rotating platform (10 cm height, 5 cm diameter) stops rotating.

We are using a QRD1114 that is a combination IR emitter & photodiode, and an arduino duemilanov, connected to a PC that would respond.

The actual circuit is taken directly from bildr:

Arduino is running just the example Analog reader (from pin 0, matching the diagram):

```/*
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

This example code is in the public domain.
*/

// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
// print out the value you read:
Serial.println(sensorValue);
delay(1);        // delay in between reads for stability
}
```

PC is running the following just to show the measurements:

```#!/usr/bin/python

import pylab
import matplotlib.pyplot as plt
import serial
from pylab import array

s = serial.Serial('/dev/ttyUSB1', baudrate=9600)

def get_line(s, count=10):
ret = []
for i in xrange(count):
try:
f = float(l.strip())
except:
print "bad value %r" % l
f = 0.0
ret.append(f)
return ret

dat=[0,1]
fig = plt.figure()
Ln, = ax.plot(dat, '.')
ax.set_xlim([0,20])
ax.set_ylim([0,1100])
plt.ion()
plt.show()

while True:
dat = get_line(s)
a = array(dat)
dat = array([sum(a) / len(a), 0, 0] + dat)
#print ", ".join(map(str, dat))
Ln.set_ydata(dat)
Ln.set_xdata(range(len(dat)))
plt.pause(0.01)
```

# Installing on windows, playing back movies in response to motion stopping

```* http://gstreamer.freedesktop.org/data/pkg/windows/1.0.7/gstreamer-1.0-x86_64-1.0.7.msi
* http://gstreamer.freedesktop.org/data/pkg/windows/1.0.7/gstreamer-1.0-devel-x86_64-1.0.7.msi
```

From Ipython installation site:

```* http://continuum.io/downloads.html
```

cmd

1. pip install pyserial

install latest vlc

vlc -f file://c:/..

install arduino

had to reinstall driver twice (windows 7 64 bit?)