Skip to main content

Arduino I2c Scanner

Arduino I2C Scanner

This article Is trick about serial connection on I2C-Bus in Arduino Board. Because of the time on develop software associated I2C device, the device may not respond. So it can not be said that the problem is that the i2c device or develop a program.

Advantages of I2C Scanner
  • Find the Address of I2C Device.
  • Check responds of I2C device.
* If found I2C Device Address, It can used to program the Arduino board.
* If not found I2C Device Address, Check the jumper cable (if jumper cable are Correct Device may be cracked.)

Example Program
Examples Circuit use Real Time Clock (DS1307) and 16x2 LCD I2C
i2c scanner Program
Referent 
   - https://playground.arduino.cc/Main/I2cScanner

Comments

Popular posts from this blog

Arduino กับการใช้งาน Serial Monitor

Arduino กับการใช้งาน Serial Monitor Serial Monitor คือ ส่วนหนึ่งของโปรแกรม Arduino IDE สามารถใช้งานได้ 2 อย่าง คือ - แสดงผลลัพธ์จากบอร์ด Arduino - ใช้รับข้อมูลจากผู้ใช้ แล้วส่งข้อมูลไปยังบอร์ด Arduino รูปแบบการใช้งาน Serial Monitor เริ่มต้นใช้งาน void setup() {    Serial.begin(9600); } แสดงผลออกทาง Serial Monitor Serial.print("Hello World");       /* แสดงคำว่า Hello World */ Serial.println("Hello World");     /* แสดงคำว่า Hello World และขึ้นบรรทัดใหม่ */   อ่านค่าจาก Serial Monitor Serial.read(); วิธีเปิด Serial Monitor 1. กด Ctrl + Shift + M 2. กด Icon ตัวอย่างการแสดงผลลัพธ์จากบอร์ด Arduino แสดงผลลัพธ์จากบอร์ด Arduino ตัวอย่างการรับค่าจาก Serial Monitor - ส่ง 1 เพื่อ On LED -  ส่ง 0 เพื่อ Off LED แสดงผลลัพธ์การรับค่าจาก Serial Monitor * ถ้าไม่สำเร็จ ตรวจสอบว่าเลือก No line ending และบอดเรทเป็น 9600 เเล้วหรือยัง

ทำไมค่า ADC ของบอร์ด Arduino ถึงมีค่า 0-1023

ทำไมค่า ADC ของบอร์ด Arduino ถึงมีค่า 0-1023 สัญญาณแอนะล็อก ในบทความนี้จะเป็นการอธิบายว่าบอร์ด Arduino เวลาอ่านค่า ADC (ค่าแอนะล็อก 0-5V) ค่าที่ได้คือ 0 - 1023 ดูการใช้งานการอ่านค่าอนาล็อกเพิ่มเติมได้ที่  Arduino กับการอ่านค่าแอนะล็อก    สาเหตุมาจากไอซีของบอร์ด Arduino (Uno, leonardo, Mega2560, อื่นๆ) มีความสามารถในการอ่านค่า ADC ได้ละเอียดสุด 10 บิต หรือ 2^10 = 1024 ระดับ* ทำให้ค่าแอนะล็อกที่บอร์ด Arduino อ่านได้ มีค่า 0 - 1023 (ไม่มีหน่วย) * สำหรับบอร์ด Arduino บางรุ่น เช่น Due, M0, MRK1X00, etc. จะสามารถอ่านค่า ADC (0-3.3V) ได้ละเอียดสุด 12 บิต หรือ 2^12 = 4096 ระดับ (สามารถกำหนดความละเอียดเป็น 8,10,12 บิตได้ ดูเพิ่มเติม ) ADC จากโวลต์มิเตอร์เทียบกับบอร์ด Arduino (10 บิต) ตารางเทียบค่าความต่างศักย์กับค่า ADC (10 บิต) หลังจากเข้าใจการเปรียบเทียบเเล้ว สามารถใช้บอร์ด Arduino อ่านค่า ADC เเล้วเขียนโปรเเกรมเพื่อเปรียบเทียบค่าเเอนะล็อกที่อ่านได้ไปเป็นค่าความต่างศักย์  ดูเพิ่มเติมได้จากบทความ  Arduino กับการอ่านค่าความต่างศักย์   เพื่อประ...