Barometer units

1 atmosphere => 29.92 in Hg /760 mm Hg => 1.01325 bar => 1013.25 mb => 101.325 kPa => 1013.25 hPa

1 mb = 100 Pa = 0.1 kPa = 1 hPa = 0.0295 inches Hg = 0.75 mm Hg.


Howto: Safari cookies – Session only

If you want to block Safari from remembering your cookies (and you should if you care about your privacy) you can force Safari from writing cookies to file with following steps:

1) Quit Safari
2) Remove the Cookies-file from /Users/[yourusername]/Library/Cookies. The file is called Cookies.plist
3) Open Safari and visit some random page that uses Cookies
4) Now you should have the Cookies.plist file again in the folder
5) Open the Cookies.plist in Finder “Get Info” and choose “Locked”

Working: XBee 2.5

Communicating between two XBee 2.5’s quick instructions:

– XBee is very versatile radio modem which works trough serial connection. It’s really simple when you get it working; everything you send to the XBee Serial port is coming out of other XBee serial port. That’s it. And it works on 2.4 gig frequency. It’s very very the same as old modems that were used trough telephones. Here, just replace the telephone line with built-in 2.4 GHz support.
– However you have to configure the 2.5 version first to get things right. It doesn’t work out of the box!
– You *NEED* to use the X-CTU and configure other as ZNET 2.5 COORDINATOR AT (“master”)and the other as ZNET 2.5 ROUTER/END DEVICE AT (node).
– Make sure XBee answers to +++ command. If it doesn’t work your communication is not working, probably your COM speed is incorrect.
– You *MUST* dial from the master to node with the ATDN command. Otherwise it’s in broadcast mode and it’s unreliable. However the communcation works in broadcast but in broadcast you might also loose the connection quite easily. If the master is rebooted it might not connect automatically to node in broadcast.
– PAN ID is your network ID, this must be the same between all devices that communicate together
– Arduino Fio cannot be programmed when XBee is connected (same Serial line)
– You can use the SparkFun XBee shield together with FTDI adapter to program the XBee with X-CTU. Just connect Serial (3.3V level!!) and VCC (3.3!!) and GND. XBee doesn’t need anything else. Of course disconnect the Arduino board from the shield so that you don’t connect the two serial lines together :)

These instructions really helped me:

Thanks to SparkFun again for great products and support.

Some links:

What does “Barometric pressure inches” mean at Weather Undeground API and

Weather Undeground wants the pressure in their API ( as “barometric pressure inches” which is the same as “inches of mercur” or inHg or just hg. Notice that it changes based on temperature.

Millibars aka hPa (the one’s around 1000) can be converted to Hg by multiplying with 0.02953 when tempeature is 32 fahrenheit (= 0 celcius, the water freezing point).

So: barometric pressure inches/inches of mercury/inHg = millibars/hPa * 0.02953

More here:

BMP085 with Arduino (tested & working)

I tested & corrected and this code really works.

// BMP08 with Arduino

// DANGER: The BMP08 accepts 1.8 to 3.6 Volts – so no chance to connect it directly to 5 Volts.

// Connect VCC to VCC and GND to GND, SCL goes to analogue pin 5, SDA to analogue pin4.
// Notice! Sparkfun breakoutboard contains already 4.7K pull ups,
// If not using pre-built pull-ups:
// --> Add some pull up resistors (1K to 20K, most often something like 4.7K) between SDA, SCL and VCC finishes the setup.

// References: and
// Specification:
// SparkFun breakout board:

#include "Wire.h"

#define I2C_ADDRESS 0x77

const unsigned char oversampling_setting = 3; //oversamplig for measurement
const unsigned char pressure_waittime[4] = { 5, 8, 14, 26 };

//just taken from the BMP085 datasheet
int ac1;
int ac2;
int ac3;
unsigned int ac4;
unsigned int ac5;
unsigned int ac6;
int b1;
int b2;
int mb;
int mc;
int md;

void setup()
Serial.begin(9600); // start serial for output
Serial.println("Setting up BMP085");
void bmp085_read_temperature_and_pressure(int& temperature, long& pressure);
void loop()
int temperature = 0;
long pressure = 0;

Serial.print(" ");

void bmp085_read_temperature_and_pressure(int* temperature, long* pressure) {
int ut= bmp085_read_ut();
long up = bmp085_read_up();
long x1, x2, x3, b3, b5, b6, p;
unsigned long b4, b7;

//calculate the temperature
x1 = ((long)ut - ac6) * ac5 >> 15;
x2 = ((long) mc << 11) / (x1 + md);
b5 = x1 + x2;
*temperature = (b5 + 8) >> 4;

//calculate the pressure
b6 = b5 - 4000;
x1 = (b2 * (b6 * b6 >> 12)) >> 11;
x2 = ac2 * b6 >> 11;
x3 = x1 + x2;

//b3 = (((int32_t) ac1 * 4 + x3)<> 2;

if (oversampling_setting == 3) b3 = ((int32_t) ac1 * 4 + x3 + 2) << 1;
if (oversampling_setting == 2) b3 = ((int32_t) ac1 * 4 + x3 + 2);
if (oversampling_setting == 1) b3 = ((int32_t) ac1 * 4 + x3 + 2) >> 1;
if (oversampling_setting == 0) b3 = ((int32_t) ac1 * 4 + x3 + 2) >> 2;

x1 = ac3 * b6 >> 13;
x2 = (b1 * (b6 * b6 >> 12)) >> 16;
x3 = ((x1 + x2) + 2) >> 2;
b4 = (ac4 * (uint32_t) (x3 + 32768)) >> 15;
b7 = ((uint32_t) up - b3) * (50000 >> oversampling_setting);
p = b7 < 0x80000000 ? (b7 * 2) / b4 : (b7 / b4) * 2;

x1 = (p >> 8) * (p >> 8);
x1 = (x1 * 3038) >> 16;
x2 = (-7357 * p) >> 16;
*pressure = p + ((x1 + x2 + 3791) >> 4);


unsigned int bmp085_read_ut() {
delay(5); //longer than 4.5 ms
return read_int_register(0xf6);

void bmp085_get_cal_data() {
Serial.println("Reading Calibration Data");
ac1 = read_int_register(0xAA);
Serial.print("AC1: ");
ac2 = read_int_register(0xAC);
Serial.print("AC2: ");
ac3 = read_int_register(0xAE);
Serial.print("AC3: ");
ac4 = read_int_register(0xB0);
Serial.print("AC4: ");
ac5 = read_int_register(0xB2);
Serial.print("AC5: ");
ac6 = read_int_register(0xB4);
Serial.print("AC6: ");
b1 = read_int_register(0xB6);
Serial.print("B1: ");
b2 = read_int_register(0xB8);
Serial.print("B2: ");
mb = read_int_register(0xBA);
Serial.print("MB: ");
mc = read_int_register(0xBC);
Serial.print("MC: ");
md = read_int_register(0xBE);
Serial.print("MD: ");

long bmp085_read_up() {

unsigned char msb, lsb, xlsb;
Wire.send(0xf6); // register to read

Wire.requestFrom(I2C_ADDRESS, 3); // read a byte
while(!Wire.available()) {
// waiting
msb = Wire.receive();
while(!Wire.available()) {
// waiting
lsb |= Wire.receive();
while(!Wire.available()) {
// waiting
xlsb |= Wire.receive();
return (((long)msb<<16) | ((long)lsb<<8) | ((long)xlsb)) >>(8-oversampling_setting);

void write_register(unsigned char r, unsigned char v)

char read_register(unsigned char r)
unsigned char v;
Wire.send(r); // register to read

Wire.requestFrom(I2C_ADDRESS, 1); // read a byte
while(!Wire.available()) {
// waiting
v = Wire.receive();
return v;

int read_int_register(unsigned char r)
unsigned char msb, lsb;
Wire.send(r); // register to read

Wire.requestFrom(I2C_ADDRESS, 2); // read a byte
while(!Wire.available()) {
// waiting
msb = Wire.receive();
while(!Wire.available()) {
// waiting
lsb = Wire.receive();
return (((int)msb<<8) | ((int)lsb));


OS X application tips

Struggling with applications that open certain extension files? For example opening mp3-files causes iTunes to open them default and copy the files to it’s own library.. Get RCDefaultApp

Fast, simple mp3-player: Cog

LineIn is a simple application for OS X to enable the soft playthru of audio from input devices. In simpler terms, you can use LineIn to play sound coming in through a microphone or any other device plugged in to your Sound In port, just as was once available with OS 9’s “Play input through output device” option.

Text editor Smultron

Easy and simple DVD/CD burner

Remember that OS X internal Preview can do lot’s of stuff for images, no need to find any application for basic image manipulation.

BOSS RC-50 Loop pedal

Some snippets from BOSS RC-50 Loop Pedal:

– At software version 1.0 the MIDI sync is quite useless and it’s not working as promised. See following discussions/links:


– MIDI CC (Control Change) command can be used to control the pedal in some ways. Setting tempo is quite bizarre, the value (0..127) is not linear to tempo.  Some measurements (first value is the third byte aka second CC value, where CC#1 consists of bytes 176+1+BPMvalue and CC#80 is 176+80+127 where 127 is constant since RC-50 doesn’t take any values in CC#80 messages) :

  • 127 = 250.1 BPM
  • 115 = 230.1 BPM
  • 80 = 172.2 BPM
  • 40 = 106.1 BPM
  • 10 = 56.5 BPM

– Touching the wheel selector changes your patch and you will loose all phrases without warning. This is quite nasty. This happends even you set the patch range to 1..1. When you touch the selector wheel the patch doesn’t change but it resets the patch to what you haved saved before.

Sparkfun Button Pad SPI with Arduino

Some pitfalls and thought on SparkFun’s Button Pad SPI. I’m using it with Arduino Duemilanova.

The Button Pad SPI is NOT standard SPI. You cannot use it with Arduino’s (Atmega’s) built-in SPI. You have to write your own code to handle the communications.

  • Yes, it’s possible to hook multiple boards and read all buttons statuses with only one “SPI” line. This however might be bad idea, see below.
  • The manual confuses you with the feedback-line. That’s actually MOSI from the last board. So hook that to input pin on Arduino and read the button statuses from that.
  • You cannot hook the boards parallel to the SPI line (using separate CS lines) since the boards don’t respect the CS. They will receive data even if the CS line is down.
  • If you want to control the boards separately you must have separate CS and SCK lines. MISO can be common.
  • The boards can loose their multi-board configuration setting and think they are in one-board-environment. This sucks. Hard. You have to reprogram the boards separately, the configuration works only for the board where the “SPI” is connected to. Of course this isn’t SparkFun’s problem: you’re causing this by for example when your Arduino boots or there’s some other clitches on the “SPI”-line. I think it should be more difficult to change the setting, for example only when some dip-switch or something is connected/unconnected..
  • You cannot press more than 2 buttons on a column. However, in rows you can press and receive all 4 buttons.
  • You cannot align the boards in 2*2 shape with all having same orientation (column/row).
  • It’s not 24-bit color scheme, or at least the color values are not linear to what you see. The color value has exponential-like effect to the actual led brightness.
  • It’s still a great product for the price.
  • It looks very very sweet. In dark it looks like a candy!
  • On user inteface side these boards work just like they are supposed to work. Unlimited possibilities in the software that you write for them. Be creative, be fun!

Technology snippets