OneDay電子工作しよう。

なるほど、各レジスタに下の計算式が一対一で対応しているのか。
じゃ、これらのレジスタを読み出して、下の計算式を計算して表示すれば、今日のミッションは完了。
ちなみに1kPa=10hPa(ヘクトパスカル)
このセンサの出力は、0で500hPa、1023で1150hPaということになるので、一般的なお天気の気圧配置を調べることが出来るセンサだ。

The pressure compensation for MPL115A2 is based on a 2-dimensional, second order polynomial. The 10-bit compensated pressure output, Pcomp, is calculated as follows:

Pcomp = a0 + (b1 + c11*Padc + c12*Tadc) * Padc + (b2 + c22*Tadc) * Tadc

Where:
Padc is the 10-bit pressure output of the MPL115A2 ADC,
Tadc is the 10-bit temperature output of the MPL115A2 ADC,
a0 is the pressure offset coefficient,
b1 is the pressure sensitivity coefficient,
c11 is the pressure linearity (2nd order) coefficient,
c12 is the coefficient for temperature sensitivity coefficient (TCS),
b2 is the 1st order temperature offset coefficient (TCO),
c22 is the 2nd order temperature offset coefficient.

Ideally, Pcomp will produce a value of 0 with an input pressure of 50 kPa and will produce a full-scale value of 1023 with an input pressure of 115 kPa.

posted : Tuesday, September 22nd, 2009

tags :

OneDay電子工作しよう。

とりあえずLCDがちゃんと表示できることがわかったので、次は圧力センサにアクセスしてみる。
まずは、マニュアルみてコマンドを調べないといけない。
Freescaleの圧力センサMPL115Aのサイトはここ。
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MPL115A
これからコマンド仕様を調べるので、また後ほど。

posted : Tuesday, September 22nd, 2009

tags :

まずは、LCDが動くかテスト。
さすがArduino。ちゃんと以下のSketchで一発動作。
PWMでLCDのコントラストを設定しているので、表示がちょっとチラついているけど。

#include 

LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8);

void setup()
{
  pinMode(9, OUTPUT);
  analogWrite(9, 128);
  lcd.print(“hello, world!”);
}

void loop() {}

まずは、LCDが動くかテスト。
さすがArduino。ちゃんと以下のSketchで一発動作。
PWMでLCDのコントラストを設定しているので、表示がちょっとチラついているけど。

#include

LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8);

void setup()
{
pinMode(9, OUTPUT);
analogWrite(9, 128);
lcd.print(“hello, world!”);
}

void loop() {}

posted : Tuesday, September 22nd, 2009

tags :

とりあえず、ジャンパワイヤすべての配線を完了。圧力センサは非常に省電力なので、VccはDOUTから取ることにした。(Arduinoの5Vピンが1つしかないのでLCDで使ってしまったため。) LCDのVO(輝度調整)はPWMで調整する。
配線は以下の通り。
5VPin:LCD-Vcc
Pin2:LCD-RS
Pin3:LCD-R/W
Pin4:LCD-E
Pin5:LCD-DB4
Pin6:LCD-DB5
Pin7:LCD-DB6
Pin8:LCD-DB7
Pin9:LCD-VO
Pin12:Barometer-Vcc
Ain4:Barometer-SDA
Ain5:Barometer-SCK
GND:LCD-Gnd,Barometer-Gnd

とりあえず、ジャンパワイヤすべての配線を完了。圧力センサは非常に省電力なので、VccはDOUTから取ることにした。(Arduinoの5Vピンが1つしかないのでLCDで使ってしまったため。) LCDのVO(輝度調整)はPWMで調整する。
配線は以下の通り。
5VPin:LCD-Vcc
Pin2:LCD-RS
Pin3:LCD-R/W
Pin4:LCD-E
Pin5:LCD-DB4
Pin6:LCD-DB5
Pin7:LCD-DB6
Pin8:LCD-DB7
Pin9:LCD-VO
Pin12:Barometer-Vcc
Ain4:Barometer-SDA
Ain5:Barometer-SCK
GND:LCD-Gnd,Barometer-Gnd

posted : Tuesday, September 22nd, 2009

tags :

上から、LCD(SC1602BS)、圧力センサ(KITMPL115A2I2C)、ArduinoDuemilanove。

上から、LCD(SC1602BS)、圧力センサ(KITMPL115A2I2C)、ArduinoDuemilanove。

posted : Tuesday, September 22nd, 2009

tags :

LCDモジュールのインターフェース

たぶんArduinoのLyquidCrystalライブラリは、インターフェースデータ長が4bitだと思うので、DB4〜DB7だけつなぐことになる。

posted : Tuesday, September 22nd, 2009

tags :

LCDモジュールSC1602SBのピン配置

ピンNo. 記号 レベル 機能 備考
1 VDD - 電源電圧
2 VSS - GND
3 VO - コントラスト調整電源 VSS で最も濃くなる
4 RS H/L レジスタ選択 H=データ、L=コマンド
5 R/W H/L 読み出し/書き込み選択 H=リード、L=ライト
6 E H,H/L イネーブル Hでストローブ
7 DB0 H/L データバス
8 DB1 H/L データバス
9 DB2 H/L データバス
10 DB3 H/L データバス
11 DB4 H/L データバス
12 DB5 H/L データバス
13 DB6 H/L データバス
14 DB7 H/L データバス

注意: インターフェースデータ長が4ビットの場合は、DB4~DB7 のデータバスを使用します。DB0~DB3 は GND に接続してください。

posted : Tuesday, September 22nd, 2009

tags :

posted : Tuesday, September 22nd, 2009

tags : http_www_google_co_jp_url_sa_t_source_web_ct_res_cd_1_url_http_3a_2f_2fwww_oaks_ele_com_2foaks_board_2foaks16_2fdata_2fdocument_2foaks16_lcd_2fman_sc1602_pdf_ei__ds4spjrhtejkqxupitpcw_usg_afqjcngziwenzgrf9_k1pngmmakrmjv7lq_sig2_rmge7j_gl4ih8s5dypgqaw

ArduinoでOneDay電子工作しよう。

OneDay電子工作しよう。
Arduinoでハンダ付けなしのお気軽電子工作。

posted : Tuesday, September 22nd, 2009

tags :

posted : Monday, September 21st, 2009

tags :