mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
Merge branch 'master' of https://github.com/m5stack/m5-docs
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
## Description
|
||||
|
||||
**<mark>DAC</mark>** is a unit can convert digital signal to analog signal like voltage waveform, audio waveform and so on. It integrates a 12-bit high resolution DAC chip named **MCP4725** which integrates a on-board non-volatile memory (EEPROM). The unit comunicates with M5Core with I2C. The DAC input and configuration data can be programmed to the EEPROM.
|
||||
**<mark>DAC</mark>** is a unit can convert digital signal to analog signal like voltage waveform, audio waveform and so on. It integrates a 12-bit high resolution DAC chip named **MCP4725** which integrates a on-board non-volatile memory (EEPROM). The unit comunicates with M5Core with I2C. The DAC input and configuration data can be programmed to the EEPROM. I2C address is 0x60.
|
||||
|
||||
## Feature
|
||||
|
||||
|
||||
+66
-46
@@ -4,59 +4,26 @@
|
||||
|
||||
***
|
||||
|
||||
:memo:**[概要](#概要)** :octocat:**[サンプルコード](#サンプルコード)** :electric_plug:**[回路図](#回路図)** 🛒**[購入リンク](#購入リンク)**
|
||||
:memo:**[概要](#概要)** :octocat:**[サンプルコード](#サンプルコード)** :electric_plug:**[回路図](#回路図)** 🛒**[購入リンク](https://www.aliexpress.com/item/M5Stack-Official-Mini-Angle-Unit-Potentiometer-Inside-Resistance-Adjustable-GPIO-GROVE-Co-n-nec-to-r/32931834705.html)**
|
||||
|
||||
## 概要
|
||||
|
||||
**<mark>ANGLE</mark>**ユニットは可変抵抗器です。回転角度検出や音量調節などに利用できます。
|
||||
**<mark>ANGLE</mark>**ユニットはは10Kポテンショメータと呼ばれる抵抗器を搭載したユニットです。ポテンショメータは3端子の抵抗素子で、つまみを回すことで抵抗値を調整できます。ポテンショメータが回転すると、出力電圧値(Uo)が変化します。モーター速度、LEDの明るさなどの調整に使用できます。抵抗値の変化を下図に示します。
|
||||
|
||||
<img src="assets/img/product_pics/unit/angle/unit_angle_03.png">
|
||||
|
||||
M5CoreのGROVE Bインターフェースに接続して、利用可能です。
|
||||
|
||||
## 特徴
|
||||
|
||||
- サポート[UIFlow](http://flow.m5stack.com)プログラミング, [Arduino](http://www.arduino.cc)プログラミング
|
||||
- 出力電圧範囲: 0 ~ 2500mV
|
||||
- [UIFlow](http://flow.m5stack.com)、[Arduino](http://www.arduino.cc)プログラミングサポート
|
||||
- LEGO 互換ホール
|
||||
|
||||
## サンプルコード
|
||||
## パッケージ内容
|
||||
|
||||
### 1. Arduino IDE
|
||||
|
||||
*以下のコードは不完全です(説明のためだけに). 完全なコードが必要な場合は、ここをクリックしてください[サンプルコード](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/Arduino).*
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
|
||||
// select the input pin for the potentiometer
|
||||
#define sensorPin 36
|
||||
|
||||
// declaration
|
||||
int cur_sensorValue = 0;
|
||||
|
||||
// initialization
|
||||
M5.begin();
|
||||
pinMode(sensorPin, INPUT);
|
||||
|
||||
// read data
|
||||
cur_sensorValue = analogRead(sensorPin);
|
||||
```
|
||||
|
||||
<img src="assets/img/product_pics/unit/unit_example/ANGLE/example_unit_angle_04.png">
|
||||
|
||||
### 2. UIFlow
|
||||
|
||||
*特定のルーチンについてはここをクリックしてください[サンプルコード](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/UIFlow).*
|
||||
|
||||
<img src="assets/img/product_pics/unit/unit_example/ANGLE/example_unit_angle_03.png">
|
||||
|
||||
## 回路図
|
||||
|
||||
<img src="assets/img/product_pics/unit/angle_sch.png">
|
||||
|
||||
### ピンマッピング
|
||||
|
||||
<table>
|
||||
<table>
|
||||
<tr><td>M5Core(GROVEインターフェースB)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
|
||||
<tr><td>角度センサーUnit</td><td>センサーピン</td><td> </td><td>5V</td><td>GND</td></tr>
|
||||
</table>
|
||||
- 1x ANGLEユニット
|
||||
- 1x Groveケーブル
|
||||
|
||||
## 関連リンク
|
||||
|
||||
@@ -64,6 +31,59 @@ cur_sensorValue = analogRead(sensorPin);
|
||||
|
||||
- **[フォーラム](http://forum.m5stack.com/)**
|
||||
|
||||
## 関連情報
|
||||
## サンプルコード
|
||||
|
||||
- [ANGLE ユニット 購入(AliExpress)](https://www.aliexpress.com/store/product/M5Stack-GPIO-Co-n-nec-to-r/3226069_32931834705.html)
|
||||
### 1. Arduino IDE
|
||||
|
||||
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/Arduino)。*
|
||||
|
||||
画面にユニット出力電圧値に対応するデジタル値を表示します。 範囲は0~4095です。
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
// select the input pin for the potentiometer
|
||||
int sensorPin = 36;
|
||||
// last variable to store the value coming from the sensor
|
||||
int last_sensorValue = 0;
|
||||
// current variable to store the value coming from the sensor
|
||||
int cur_sensorValue = 0;
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
pinMode(sensorPin, INPUT);
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.print("the value of ANGLE: ");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// read the value from the sensor:
|
||||
cur_sensorValue = analogRead(sensorPin);
|
||||
M5.Lcd.setCursor(0, 25);
|
||||
if(abs(cur_sensorValue - last_sensorValue) > 10){//debaunce
|
||||
M5.Lcd.fillRect(0, 25, 100, 25, BLACK);
|
||||
M5.Lcd.print(cur_sensorValue);
|
||||
last_sensorValue = cur_sensorValue;
|
||||
}
|
||||
delay(50);
|
||||
}
|
||||
```
|
||||
|
||||
<img src="assets/img/product_pics/unit/unit_example/ANGLE/example_unit_angle_04.png">
|
||||
|
||||
### 2. UIFlow
|
||||
|
||||
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/UIFlow)。*
|
||||
|
||||
<img src="assets/img/product_pics/unit/unit_example/ANGLE/example_unit_angle_03.png">
|
||||
|
||||
## 回路図
|
||||
|
||||
<img src="assets/img/product_pics/unit/angle_sch.png">
|
||||
|
||||
### ピンマップ
|
||||
|
||||
<table>
|
||||
<tr><td>M5Core(GROVE B)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
|
||||
<tr><td>ANGLE Unit</td><td>Sensor Pin</td><td> </td><td>5V</td><td>GND</td></tr>
|
||||
</table>
|
||||
|
||||
+31
-31
@@ -8,69 +8,69 @@
|
||||
|
||||
## 概要
|
||||
|
||||
**<mark>DAC</mark>**ユニットは電圧や音などのデジタル信号をアナログ信号に変換する機能を提供します。12 bitの分解能を持つMCP4725チップを採用しており、入力値やコンフィグレーションデータは内蔵する不揮発性メモリ(EEPROM)に書き込む事が可能です。
|
||||
**<mark>DAC</mark>**ユニットはデジタル信号を電圧波形、音声波形などのアナログ信号に変換することができます。 MCP4725という12ビットの高分解能DACチップを内蔵しています。このチップには不揮発性メモリ(EEPROM)が内蔵されており、DAC入力や設定データをEEPROMに書き込むことができます。このユニットはI2Cで制御することができます。I2Cアドレスは**0x60**です。
|
||||
|
||||
## 特徴
|
||||
|
||||
- 最大12bit 分解能
|
||||
- 出力電圧 0 ~ 3.3V
|
||||
- LEGO 互換ホール
|
||||
- EEPROM
|
||||
- EEPROM内蔵
|
||||
|
||||
## パッケージ内容
|
||||
|
||||
- 1x DACユニット
|
||||
- 1x Groveケーブル
|
||||
|
||||
## アプリケーション
|
||||
|
||||
- MP3 オーディオプレイヤー
|
||||
- MP3オーディオプレイヤー
|
||||
- ミニオシロスコープ
|
||||
|
||||
## ドキュメント
|
||||
## 関連リンク
|
||||
|
||||
- **GitHub**
|
||||
- [Arduino](https://github.com/m5stack/M5Stack/tree/master/examples/Unit/DAC_MCP4725)
|
||||
- **[公式ビデオ](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)**
|
||||
|
||||
- **データシート**
|
||||
- **[フォーラム](http://forum.m5stack.com/)**
|
||||
|
||||
- **データシート**
|
||||
- [MCP4725](http://pdf1.alldatasheet.com/datasheet-pdf/view/233449/MICROCHIP/MCP4725.html)
|
||||
|
||||
## サンプルコード
|
||||
|
||||
### 1. Arduino IDE
|
||||
|
||||
*以下のコードは不完全です(説明のためだけに). 完全なコードが必要な場合は、ここをクリックしてください[サンプルコード](https://github.com/m5stack/M5Stack/tree/master/examples/Unit/ADC_ADS1100).*
|
||||
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/DAC/Arduino)。*
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
/*
|
||||
hardware : m5stack uint dac
|
||||
please install adafruit MCP4725 lib
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include "ADS1100.h"
|
||||
#include <Adafruit_MCP4725.h>
|
||||
|
||||
// declaration
|
||||
byte error;
|
||||
int8_t address;
|
||||
|
||||
//new a object
|
||||
ADS1100 ads;
|
||||
// new a object
|
||||
Adafruit_MCP4725 dac;
|
||||
|
||||
// initialization
|
||||
M5.begin(true, false, false);
|
||||
ads.getAddr_ADS1100(ADS1100_DEFAULT_ADDRESS);// 0x48, 1001 000 (ADDR = GND)
|
||||
ads.setGain(GAIN_ONE); // 1x gain(default)
|
||||
ads.setMode(MODE_CONTIN); // Continuous conversion mode (default)
|
||||
ads.setRate(RATE_8); // 8SPS (default)
|
||||
ads.setOSMode(OSMODE_SINGLE); // Set to start a single-conversion
|
||||
ads.begin();
|
||||
dac.begin(0x60);
|
||||
dac.setVoltage(2048, false);
|
||||
|
||||
// read data
|
||||
address = ads.ads_i2cAddress;
|
||||
Wire.beginTransmission(address);
|
||||
Wire.endTransmission();
|
||||
ads.Measure_Differential();
|
||||
// 12bit value , false mean not write EEPROM
|
||||
dac.setVoltage(1024, false);// input digital value "1024" to unit
|
||||
delay(1000);
|
||||
dac.setVoltage(2048, false);// input digital value "2048" to unit
|
||||
delay(1000);
|
||||
```
|
||||
|
||||
## 回路図
|
||||
|
||||
<img src="assets/img/product_pics/unit/adc_sch.JPG">
|
||||
<img src="assets/img/product_pics/unit/dac_sch.JPG">
|
||||
|
||||
### ピンマッピング
|
||||
|
||||
<table>
|
||||
<tr><td>M5Core(GROVEインターフェースA)</td><td>GPIO22</td><td>GPIO21</td><td>5V</td><td>GND</td></tr>
|
||||
<tr><td>M5Core(GROVE A)</td><td>GPIO22</td><td>GPIO21</td><td>5V</td><td>GND</td></tr>
|
||||
<tr><td>DAC Unit</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
## 描述
|
||||
|
||||
**<mark>DAC</mark>** 是一款集成数字信号转模拟信号芯片的Unit,能够实现输出模拟信号,如电压、声音等,内置的DAC芯片型号是**MCP4725**,并且不带EEPROM。
|
||||
**<mark>DAC</mark>** 是一款集成数字信号转模拟信号芯片的Unit,能够实现输出模拟信号,如电压、声音等,内置的DAC芯片型号是**MCP4725**,并且不带EEPROM。(I2C地址为0x60)
|
||||
|
||||
## 特性
|
||||
|
||||
|
||||
Reference in New Issue
Block a user