Monthly Archives: August 2007

MicroChemical Systems

MicroChemical makes CO and NOx gas sensors. Thanks to Brooke Singer for the link.
Continue reading

Posted in circuits | Comments Off

Citytech

Citytech makes a wide range of gas sensors. Thanks to Brooke Singer for the link.
Continue reading

Posted in circuits | Comments Off

Net connection between Processing and Max/MSP

The following Max/MSP patch uses the netsend object to send data over a TCP socket. It sends three values.
Continue reading

Posted in Max/MSP, Processing | Comments Off

XBee Radio Received Signal Strength Graphing Program

This Processing program takes a string of values in the serial port. It assumes the string is the API string from a Maxstream XBee radio.
Continue reading

Posted in Processing, XBee | Comments Off

Xbee Radio Received Signal Strength and Data Graphing Program

The packet should be 22 bytes long. It should be made up of the following: byte 1: 0x7E, the start byte value byte 2-3: packet size, a 2-byte value (not used here) byte 4: API identifier value, a code that says what this response is (not used here) byte 5-6: Sender’s address byte 7: RSSI, Received Signal Strength Indicator (not used here) byte 8: Broadcast options (not used here) byte 9: Number of samples to follow byte 10-11: Active channels indicator (not used here) byte 12-21: 5 10-bit values, each ADC samples from the sender Created 20 Mar. 2007 by Tom Igoe */ import processing.serial.*; Serial xbee; // input serial port from the Xbee Radio int[] packet = new int[22]; // with 5 samples, the Xbee packet is 22 bytes long int byteCounter; // keeps track of where you are in the packet int fontSize = 18; // size of the text on the screen int lastReading = 0; // value of the previous incoming byte int rssi = 0; // received signal strength int address = 0; // sender’s address int average = 0; // average of the sensor data int firstRectPos = 25; // horizontal pos of the first graph bar void setup () { size(400, 300); // window size // create a font with the second font available to the system: PFont myFont = createFont(PFont.list()[2], fontSize); textFont(myFont); // get a list of the serial ports: println(Serial.list()); // open the serial port attached to your Xbee radio: xbee = new Serial(this, Serial.list()[0], 9600); } void draw() { // set the background: background(0); // if you have new data and it’s valid (>0), graph it: // write the numbers: text(“Xbee Radio Signal Strength test”, 10, 20); text(“From: ” + hex(address), 10, 40); text (“RSSI: -” + rssi + ” dB”, 10, 60); text(“Sensor avg:” + average, 10, 80); // note that these graph bars aren’t proportional, they just show change. // RSSI should range from 0 to -92 dBm drawBar(92 – rssi, 50, 0); // average should range from 0 – 1023, so divide by 4 to keep it // in the vertical space of the window: drawBar(average/4, 50, 1); } void drawBar(int rectHeight, int rectWidth, int rectNum ) { if (rectHeight > 0 ) { // draw the rect: stroke(23, 127, 255); fill (23, 127, 255); int rectPos = firstRectPos + (rectNum * 75); text(rectNum, rectPos, 30); rect(rectPos, height-rectHeight, rectWidth, height); } } void serialEvent(Serial xbee) { // read a byte from the port: int thisByte = xbee.read(); // if the byte = 0x7E, the value of a start byte, you have a new packet: if (thisByte == 0x7E) { // start byte // parse the previous packet if there’s data: if (packet[2] > 0) { parseData(packet); } // reset the byte counter: byteCounter = 0; } // put the current byte into the packet at the current position: packet[byteCounter] = thisByte; // increment the byte counter: byteCounter++; } /* Once you’ve got a packet, you need to extract the useful data.
Continue reading

Posted in Processing, XBee | Comments Off