Renesas Community
Renesas Community
  • User
    Join or sign in
  • Site
  • Search Community
  • User
  • Renesas Engineering Community
  • FAQ
  • HELP
  • More
  • Cancel
がじぇっとるねさすコミュニティ
がじぇっとるねさすコミュニティ
GR-ADZUKI GR-ADZUKIにオムロンの非接触温度センサをつなげてみた
  • Forums
  • Files
  • がじぇっとるねさす ゆーざー会 - Wiki
  • Tags
  • More
  • Cancel
  • New

 

 GR-SAKURA

 GR-KURUMI

 GR-COTTON

 GR-CITRUS

 GR-PEACH

 GR-KAEDE

 GR-ADZUKI

 GR-LYCHEE

 GR-ROSE

 GR-MANGO(*)

 SNShield

 Web Compiler

 IDE for GR

 TOPPERS関連

 女子美コラボ

 その他

 ※プロデューサミーティング中

 作り方使い方資料

 イベント関連

 作品記事

 体験記事

 その他

 

 ライブラリ

 ツール

 その他・過去ファイル

  • Replies 1 reply
  • Subscribers 429 subscribers
  • Views 3300 views
  • Users 0 members are here
Options
  • Share
  • More
  • Cancel
Related Tags
  • auzuki
  • azuki
  • BASIC
  • GR-ADZUKI
  • GR-ADZUKI Node.js Johnny-Five
  • GR-ADZUKI S4A モーター
  • GR-ADZUKI USB
  • WDT
  • デジタルコンパス
  • リセット
  • 省電力
Related

GR-ADZUKIにオムロンの非接触温度センサをつなげてみた

鈴木
鈴木 over 3 years ago

プログラムです。IDE for GRを使ってください。

D6T_8L_09.txt
// D6T-8L-09 8ch  非接触温度センサ プログラム
// GND, VCC(5V), SDA(8), SCL(7)
// D6T-8L-09のデータ長は19byte
// PTAT センサ内部の参照温度データ 2byte
// P0 ~ P7 8ch分の温度データ 8x2byte
// PEC(Packet error check code) 2byte : プログラム内では未使用
// ---------------------------------------
// PTAT 16bit符号付き整数 LOW, HIGHの並び
// P0 ~ P7 8ch分の温度データ 8x2byte LOW, HIGHの並び

#include <Arduino.h>
#include <Wire.h>
 
#define D6T8L09_ADRS  0x0A
#define D6T8L09_CMD   0x4C
#define D6T8L09_MAX   19    // PTAT(2) + P0-P7(16) + STOP(1)
#define D6T8L09_DATA  16    // P0-P7(16)
 
void D6T8L09_OutputData( void );

int rbuf[ D6T8L09_MAX ];
float tdata[ D6T8L09_DATA ];
float tPTAT;
char msg[128];
  
void setup()
{
    Wire.begin();
    Serial.begin( 9600 );
}
 
void loop()
{
    int i, count;
 
    Wire.beginTransmission( D6T8L09_ADRS );
    Wire.write( D6T8L09_CMD );
    Wire.endTransmission();

    count = Wire.requestFrom( D6T8L09_ADRS, D6T8L09_MAX );
    if ( count >= 0 )
    {
        for ( i = 0; i < D6T8L09_MAX; i++ ) 
        {
            rbuf[ i ] = Wire.read();
        }
        Wire.endTransmission();
 
        tPTAT = ( rbuf[ 0 ] + (rbuf[ 1 ]*256) ) * 0.1;
        for ( i = 0; i < D6T8L09_DATA; i++) 
        {
            tdata[ i ] = ( rbuf[ (i*2)+2 ] + ( rbuf[(i*2)+3]*256 ) ) * 0.1 - tPTAT;
        }
        D6T8L09_OutputData();
    }     
    delay(5000);
}
 
void D6T8L09_OutputData() 
{
    int i;
    sprintf( msg, "[PTAT:%3.1f]  ", tPTAT );
    Serial.print( msg );
    for ( i = 0; i < 7; i++) 
    {
        sprintf( msg, "%3.1f, ", tdata[i] );
        Serial.print( msg );
    }
    sprintf( msg, "%3.1f ", tdata[7] );
    Serial.println( msg );
}


このプログラムでは5秒ごとに温度を計測します

カラーLCDと組み合わせて表示させると面白いと思います。

  • Reply
  • Cancel
  • Cancel
Parents
  • 鈴木
    鈴木 over 3 years ago

    取得した温度データをテープLEDに表示してみました

    Click here to play this video

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
Reply
  • 鈴木
    鈴木 over 3 years ago

    取得した温度データをテープLEDに表示してみました

    Click here to play this video

    • Cancel
    • Up 0 Down
    • Reply
    • Cancel
Children
No Data
サイト使用条件
プライバシーポリシー
お問い合わせ
© 2010-2022 Renesas Electronics Corporation. All rights reserved.