Micro I2C-Scanner with 0.96" Oled and ATtiny44
A tiny I2C-bus scanner with a nice tiny graphic OLED display and an AVR ATtiny44.
This scanner displays the addresses of all attached I2C devices in a small matrix. The value is shiftet one bit to the left (and is therefore presented as an 8-bit address). The columns show the upper nibble und the rows the lower. As the value is already shiftet, there are only even numbers in the lower nibble.
The device is built with a 0.96" OLED display that plugs into a little PCB with the same size. It is driven with a ATtiny44 with two software I2C ports (one for the display and one scan-port). As the ATtiny44 does not have enough RAM for a screenbuffer and the little boxes are not aligned to the rows of teh display, it uses a simple but nifty algorithm to calculate the screen in realtime.
The device is built with a 0.96" OLED display that plugs into a little PCB with the same size. It is driven with a ATtiny44 with two software I2C ports (one for the display and one scan-port). As the ATtiny44 does not have enough RAM for a screenbuffer and the little boxes are not aligned to the rows of teh display, it uses a simple but nifty algorithm to calculate the screen in realtime.
Project Elements
PC outer side (JPG, 107.47 KB)
The doublesided PCB enables to make nice captitions for the connections
The thing (JPG, 74.97 KB)
Connected (JPG, 112.88 KB)
Here it is connected to a EEprom on a breadboard with variable address input
PCB inner side (JPG, 132.97 KB)
The upperside with the components
Discussion (4 comments)

pao3 8 months ago
It's now able to display properly on the new OLED and is very useful.
Thank you for sharing this wonderful tool.
However, to use it with the Arduino IDE, I need to calculate the address that is displayed.
On this device, the OLED displays "0x7C", but there may be times when you want it to display "0x3E".
I tried to modify the publicly available source code, but it was beyond my ability.
Can someone give me some advice on what I should fix?
Thank you for sharing this wonderful tool.
However, to use it with the Arduino IDE, I need to calculate the address that is displayed.
On this device, the OLED displays "0x7C", but there may be times when you want it to display "0x3E".
I tried to modify the publicly available source code, but it was beyond my ability.
Can someone give me some advice on what I should fix?
Reply

pao3 8 months ago
I was able to resolve the issue described below.
1 I2C Address Translation
I converted the I2C address display to make it easier to use with the Arduino IDE.
For example, convert the OLED address from 0x78 to 0x3C.
2 Screen font fix
The fonts for 3, 8, B, and E were difficult to read, so I fixed them.
3 Fixed OLED display misalignment
Fixed a problem where the screen would shift up by 8 pixels when using recent OLED displays.
4 Fixed a bug that caused the fill display to be poor when connecting components with adjacent I2C addresses.
5 Changes to be compatible with the Linux "i2cdetect" command
In the original, the top row represented the second hexadecimal digit, and the left column represented the first digit.
This has been rewritten to be compatible with the Linux "i2cdetect" command, with the left column representing the second digit and the top row representing the first digit.
For more detailed information, please refer to my blog, which is written in Japanese, using translation software.
https://me-yoh.com/i2c-scanner_pcb_share
1 I2C Address Translation
I converted the I2C address display to make it easier to use with the Arduino IDE.
For example, convert the OLED address from 0x78 to 0x3C.
2 Screen font fix
The fonts for 3, 8, B, and E were difficult to read, so I fixed them.
3 Fixed OLED display misalignment
Fixed a problem where the screen would shift up by 8 pixels when using recent OLED displays.
4 Fixed a bug that caused the fill display to be poor when connecting components with adjacent I2C addresses.
5 Changes to be compatible with the Linux "i2cdetect" command
In the original, the top row represented the second hexadecimal digit, and the left column represented the first digit.
This has been rewritten to be compatible with the Linux "i2cdetect" command, with the left column representing the second digit and the top row representing the first digit.
For more detailed information, please refer to my blog, which is written in Japanese, using translation software.
https://me-yoh.com/i2c-scanner_pcb_share
i25.jpg (48kb)
Reply
Show more
1 Comment(s)

tannenba 1 year ago
I built this and funny thing: the old displays work fine, the new batch has a bar at the bottom and no column headers. New clone displays assembled different? Good thing that I still have a couple of the older ones. I didn't go for tiny, used a board the size of small bread board. Has it won 5v supply and socket for a usbtiny programmer. It does work good. Thank you for doing this.
old-display.jpg (971kb)
new-display.jpg (1085kb)
i2c-scanner.jpg (871kb)
new-display.jpg (1085kb)
i2c-scanner.jpg (871kb)
Reply

pao3 10 months ago
The OLED display was off by a few dots, but I was able to correct the display on the new OLED.
I will explain how to do that.
Rewrite line 87 of "oled.cpp".
oled_com(0); → oled_com(1);
Build the program and write it to ATTiny.
For more information, please see this blog (in Japanese).
https://me-yoh.com/making_i2c_scanner2
I will explain how to do that.
Rewrite line 87 of "oled.cpp".
oled_com(0); → oled_com(1);
Build the program and write it to ATTiny.
For more information, please see this blog (in Japanese).
https://me-yoh.com/making_i2c_scanner2
i40.jpg (57kb)
Reply

pao3 10 months ago
I also tried writing i2cscanner.hex in the publicly available i2cscanner.zip to Attiny44.
Then the OLED display became the same.
From what I can see, it looks like it's shifted a few dots to the left.
(I'm using Google Translate.)
Then the OLED display became the same.
From what I can see, it looks like it's shifted a few dots to the left.
(I'm using Google Translate.)
01.jpg (81kb)
Reply
Show more
3 Attachment(s)
2 Comment(s)

HaSch 7 years ago
I built the I2C scanner using a ATtiny44 in PDIP not in SOIC package. I took a piece of protoboard instead of the printed circuit board (see photos).
It was a challenge to place all the components on the tiny PCB and succeeded only by soldering the 5 resistors (I took 1/8W) and the 100nF capacitor into the IC socket. At least there was room for a regular ISP header ;-)
Next, I will place the scanner in a tiny module housing (Hammond 1551M BK).
Hans
It was a challenge to place all the components on the tiny PCB and succeeded only by soldering the 5 resistors (I took 1/8W) and the 100nF capacitor into the IC socket. At least there was room for a regular ISP header ;-)
Next, I will place the scanner in a tiny module housing (Hammond 1551M BK).
Hans
img-0460.JPG (1174kb)
img-0461.JPG (1069kb)
img-0462.JPG (1234kb)
img-0461.JPG (1069kb)
img-0462.JPG (1234kb)
Reply

HaSch 7 years ago
Finished! Another picture of the I2C scanner in the small Hammond box. Nice, isn't it?
Hans
Hans
img-0464-kopie.jpg (47kb)
Reply
Show more
3 Attachment(s)
5 Comment(s)

ClemensValens 8 years ago
Can you please provide more information? I do not understand what the display shows. 0x98, 0xA0? What does that mean? I2C addresses of connected devices?
There is no schematic and there is no software, how are we supposed to make anything of this?
There is no schematic and there is no software, how are we supposed to make anything of this?
Reply

Nickelgrass 7 years ago
@Hans: its basicaly irrelevant. The Tiny44 and Tiny84 are very similar. See the datasheet. With minor tweaks to the code almost any AVR can be used. My schematic editor only contained the Tiny84 as SMD but I only had a 44 at home. So I used the tiny44.
@Stefan: there are a lot of different I2C scanners with different methods out there.
@Stefan: there are a lot of different I2C scanners with different methods out there.
Reply

Stefan Brüns 7 years ago
On Linux, there is a nice little program, part of the i2c-tools package, called i2cdetect. I don't know if this scanner is inspired by it or similarities are just coincidence.
The Linux i2cdetect can use different I2C command sequences to detect a chip. The simplest is probably "I2C START - Address READ - I2C STOP", an attached device likely answers with an ACK bit.
This is probably just a hardware implementation of the same. It will work for many devices, although a busy device may chose to ignore the READ.
The Linux i2cdetect can use different I2C command sequences to detect a chip. The simplest is probably "I2C START - Address READ - I2C STOP", an attached device likely answers with an ACK bit.
This is probably just a hardware implementation of the same. It will work for many devices, although a busy device may chose to ignore the READ.
Reply

Nickelgrass 8 years ago
Hi, thanks for the comment. As the title says it is an I2C bus scanner. It displays all deviceaddresses connected to the I2C bus. The values are addresses of two devices connected to the bus. In order to show all connected devices at the same time (maximum 127) the matrix is displayed. Each filled square means a device is attached at the address made of column and row.
It is intended as a tiny tool. Schematic and software will follow shortly.
Best regards
It is intended as a tiny tool. Schematic and software will follow shortly.
Best regards
Reply
Show more
6 Comment(s)
Updates from the author
Nickelgrass 7 years ago
Nickelgrass 8 years ago
avaldebe 7 years ago
Nickelgrass 7 years ago
Denis Köllner 7 years ago
In the next few days i Check the source Code and try to change it for the 45/85's (if possible)
Best regards
Denis köllner
avaldebe 7 years ago
I had some problems porting the this project to an tiny85, so I re-implemted it using external libraries.
I wrote 2 versions, the tinyFont branch is exaclty as this project. On the master branch I removed the text headers, which I plan to print on a sticker...
The code is available at https://github.com/avaldebe/TinyI2CScanner
I plan to add more info and pictures as I go along with this project
Nickelgrass 7 years ago