Last updated on 14 November 2021 by Suffocation
Der I2c oder auch 2 Wire Bus genannt, arbeitet mit zwei Kabeln und theoretisch mit einer Geschwindigkeit von bis zu 5 Mbit/s. Für den Hobbybedarf mit Freiluftverkabelung sind es wahrscheinlich eher weniger.
Der Uno hat den Wire-Anschluss am analogen Ausgang 4 und 5. Zum Testen habe ich ein GY-68 Barometer angeschlossen welches auf Port 0x77 des I2C Busses arbeitet.
Purpose
- Finding the address of a module
- As a first communication test
Circuit

Libraries
I am using the Wire library, which is included by default and only needs to be included via an include statement.
Programme
I cobbled together the following test program from a few examples. It's designed to simply check if the constructed circuit has been wired correctly.
Das Porgram geht alle Adressen des I2C Busses durch und klopft mal beim Empfänger an. Antwortet dieser, wird der Port und am Schluss die Anzahl der gefundenen Teilnehmer angezeigt.
Source code
Output

Problems
The Wire module is not responding
Just swap SDA and SDC.
Sollte das Problem immer noch bestehen, mal veruschen Pullup Widerstände in die Schaltung einzubauen. Der Uno hat allerdings schon Pullups, sollte also eigentlich nicht nötig sein.
Conclusion
When you don't know if a module is working or what its address is, the scanner is very helpful.
Sources
https://de.wikipedia.org/wiki/I%C2%B2C
https://www.mikrocontroller.net/topic/88806
https://playground.arduino.cc/Main/I2cScanner
https://gist.github.com/tfeldmann/5411375
| Date | Change | Author |
|---|---|---|
| 31.03.2018 | Post created | Suffocation |