概要

  • VEML6075 を買ってみたので動確したときのメモ
  • 買ったのはこれ $3.65
  • Strawberry Linux だと UVA のみのVEML6070しかない
  • Datasheet はここ

Raspbery Pi 3 で動確

  • Raspbery Pi 3 と接続
  • i2cdetect でデバイスアドレスが 0x10 であることを確認

    pi@raspberrypi:~ $ i2cdetect -y 1
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: 10 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                         
    
  • Datasheet からは 16bit で read/write する必要あり

    Each of the registers in the VEML6075 are 16 bit wide, so 16 bit should be written when a write command is sent, and 16 bit should be read when a read command is sent.

  • 0x00 bit0 が 0 = power on, 1 = shut down なので、power on する
    write 側は -y 付けずに確認してみた

    pi@raspberrypi:~ $ i2cget -y 1 0x10 0x00 w
    0x0001
        
    pi@raspberrypi:~ $ i2cset 1 0x10 0x00 0x00 w
    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will write to device file /dev/i2c-1, chip address 0x10, data address
    0x00, data 0x00, mode word.
    Continue? [Y/n] y
        
    pi@raspberrypi:~ $ i2cget -y 1 0x10 0x00 w
    0x0000
    
  • 0x07 UVA_DATA, 0x09 UVB_DATA, 0x0a UVCOMP1_DATA, 0x0b UVCOMP2_DATA を読んでみる
    通常時は 0x00 だが、紫外線LEDを当てると値が増えることを確認した
    でも、UVCOMP2_DATA だけは常に 0x00 だった。infrared noise らしいので、赤外LEDあてて確認すべきだったか

    pi@raspberrypi:~ $ i2cget -y 1 0x10 0x07 w
    0x0000
    pi@raspberrypi:~ $ i2cget -y 1 0x10 0x07 w
    0x0105
        
    pi@raspberrypi:~ $ i2cget -y 1 0x10 0x09 w
    0x0000
    pi@raspberrypi:~ $ i2cget -y 1 0x10 0x09 w
    0x007d
        
    pi@raspberrypi:~ $ i2cget -y 1 0x10 0x0a w
    0x0000
    pi@raspberrypi:~ $ i2cget -y 1 0x10 0x0a w
    0x001a
        
    pi@raspberrypi:~ $ i2cget -y 1 0x10 0x0b w
    0x0000
    pi@raspberrypi:~ $ i2cget -y 1 0x10 0x0b w
    0x0000
        
    
  • あとは、COMP1, 2 を使って、Application Note の P.6 に書かれている式で補正する必要あり