Cosm with Max

update 6/2014: Cosm is now Xively. Have not re-tested examples below. There is a working Twitter example at internet sensors projects: https://reactivemusic.net/?p=5859

original post

notes

Today I was finally able to get this working. Reading a Cosm (Pachube) feed from curl and from Max. Here is an example that works in curl: (replace API-KEY with actual key)

curl http://api.cosm.com/v2/feeds/76490/datastreams/Power.xml?key=API-KEY

You can get JSON responses by leaving off the .xml extension or replacing it with .json

Its critical to use “key=…” not “X-ApiKey=…” like in the cosm documentation, or you will get permission errors from curl and Max.

I was also able to get the Max project called “pachube report” from Nicholas Marechal to work (requires jasch and cnmat externals)

http://cycling74.com/toolbox/pachube-tools/

This patch uses the typical jit.uldl and jit.textfile objects and some regexp parsing tricks.

Next trick will be creating a feed and sending it to Cosm.

 

 

Other ideas for Arduino electric eye

notes

5/2014 – check out musical stairs project for eventual solution: https://reactivemusic.net/?p=12300

original post

Infrared reflectance sensor – no idea whether this can be focused to a beam

http://www.ebay.com/itm/Infrared-Reflectance-Sensor-Sensor-Shield-Arduino-compatible-/170842956075?pt=LH_DefaultDomain_0&hash=item27c708a12b

IR detector emitter data

http://www.me.umn.edu/courses/me2011/arduino/technotes/irbeam/irbeam.html

Tachometer circuit

http://www.pyroelectro.com/tutorials/tachometer_rpm_arduino/

Long range beam

http://pcbheaven.com/circuitpages/Long_Range_IR_Beam_Break_Detector/

 

 

Detecting an IR Beam Break using the Arduino IR Library

A simple electric eye circuit

By Ken Shirriff

http://www.arcfn.com/2010/03/detecting-ir-beam-break-with-arduino-ir.html

update 5/2014 – For current information, see the musical stairs project – using this IR library with sensors from Adafruilt: https://reactivemusic.net/?p=12300

original post

I was able to build a version of this using some ir receivers from radio shack. The receivers were different – one received a relatively narrow angle beam, while the other one seemed to pick up everything in the room. So, although this method works, it will require some hardware tweaking.

Here’s my Arduino code for this… Note that the code runs 2 beams but the photos and videos only show one in the circuit.

#include <IRremote.h>
// tz 12/26/2012
/* This works with the basic IR beam layout of an
IR emitter and IR receiver from radio shack - when you break the 
beam, like with your hand the LED on D13 lights up.

*/
#define PIN_IR 3
#define PIN_DETECT 2
#define PIN_STATUS 13

#define PIN_DETECT_B 7
#define PIN_STATUS_B 8

int counter = 0;
int stat = 0;
int stat_B = 0;

IRsend irsend;
void setup()
{
   Serial.begin(9600); // open the serial port
  pinMode(PIN_DETECT, INPUT);
  pinMode(PIN_STATUS, OUTPUT);

    pinMode(PIN_DETECT_B, INPUT);
  pinMode(PIN_STATUS_B, OUTPUT);
  irsend.enableIROut(38);
  irsend.mark(0);
}

void loop() {
//  digitalWrite(PIN_STATUS, !digitalRead(PIN_DETECT));
irsend.space(0);
delay(1);
irsend.mark(0);
stat = digitalRead(PIN_DETECT);
digitalWrite(PIN_STATUS, stat);

stat_B = !digitalRead(PIN_DETECT_B);
digitalWrite(PIN_STATUS_B, stat_B);
delay(1);

counter++;
if(counter > 1000) {
  Serial.print("A: ");
  Serial.print(stat);
  Serial.print(" B: ");
  Serial.print(stat_B);
  Serial.println();
  counter = 0;
}
}