Geiger counter: Difference between revisions

From air
Jump to navigation Jump to search
No edit summary
No edit summary
Line 18: Line 18:
int val; // Data received from the serial port
int val; // Data received from the serial port
int fg=0;
int fg=0;
int serialPortPos=1;
int serialPortPos=1; // 0 on my PC is the Modem port.


void setup()
void setup()
{
{
size(200, 200);
size(200, 200);
// I know that the first port in the serial list on my mac
// is always my FTDI adaptor, so I open Serial.list()[1].
// On Windows machines, this generally opens COM1.
// Open whatever port is the one you're using.
String portName = Serial.list()[serialPortPos];
String portName = Serial.list()[serialPortPos];
myPort = new Serial(this, portName, 9600);
myPort = new Serial(this, portName, 9600);

Revision as of 14:48, 17 January 2012

Geiger counter


Code Processing pour visualiser les paricules recus.

/**
 * Geiger Counter
 * 
 * Read data from the serial port ("0" "1") from SEN-09848 and change the color
 * of a rectangle when a switch connected to the Geiger Counter
 * SEN-09848 http://www.sparkfun.com/products/9848 .
 */


import processing.serial.*;

Serial myPort;  // Create object from Serial class
int val;      // Data received from the serial port
int fg=0;
int serialPortPos=1; // 0 on my PC is the Modem port.

void setup() 
{
  size(200, 200);
  String portName = Serial.list()[serialPortPos];
  myPort = new Serial(this, portName, 9600);
}

void draw()
{
  if ( myPort.available() > 0) {  // If data is available,
    val = myPort.read();         // read it and store it in val
  background(255);             // Set background to white
  
  if(fg==0) {
    fg=204;
  } else {
    fg=0; 
  }  
  fill(fg);
  }
  
  rect(50, 50, 100, 100);
}


Application

Drone PRI (Prévention des Risques Industriels)

M2m drone 1.jpg


Capture des particules détectés dans la nuit du 23 03 2011 à Grenoble (chaque trait vertical est le nombre de particules par seconde). CaptureGeigerFukushimaFrance20110323.png