0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Raspberry Pi ZeroでADS1115を使う

Posted at

個人的なメモ。

概要

Raspberry Pi ZeroでA/DコンバータのADS1115を使う方法を記す。
使用したのはA/Dコンバータは以下。

配線

以下のように配線する。

V -> 3.3V(1番ピン)
G -> GND(6番ピン)
SDA -> GPIO2/SDA1(3番ピン)
SDL -> GPIO3/SDL1(5番ピン)

設定

/boot/config.txtに以下を追記する。

/boot/config.txt
dtparam=i2c_arm_baudrate=400000
dtoverlay=ads1115
dtparam=cha_enable
dtparam=chb_enable
dtparam=chc_enable
dtparam=chd_enable

以下のパスの各ファイルで電圧を取得できる。

$ls /sys/bus/iio/devices/iio:device0
buffer                                   in_voltage2_raw
current_timestamp_clock                  in_voltage2_sampling_frequency
dev                                      in_voltage2_scale
events                                   in_voltage2-voltage3_raw
in_voltage0_raw                          in_voltage2-voltage3_sampling_frequency
in_voltage0_sampling_frequency           in_voltage2-voltage3_scale
in_voltage0_scale                        in_voltage3_raw
in_voltage0-voltage1_raw                 in_voltage3_sampling_frequency
in_voltage0-voltage1_sampling_frequency  in_voltage3_scale
in_voltage0-voltage1_scale               name
in_voltage0-voltage3_raw                 of_node
in_voltage0-voltage3_sampling_frequency  power
in_voltage0-voltage3_scale               sampling_frequency_available
in_voltage1_raw                          scale_available
in_voltage1_sampling_frequency           scan_elements
in_voltage1_scale                        subsystem
in_voltage1-voltage3_raw                 trigger
in_voltage1-voltage3_sampling_frequency  uevent
in_voltage1-voltage3_scale

このin_voltage<数字>_・・・がA0~A3の入力に対応している模様。

rawの値×scaleの値=電圧値(mV)となる。

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?