Standalone I2C with ATmega328P

Hi folks,

I’ve recently started playing around with I2C communication between arduinos and things were going great as long as I stuck to the arduino boards.

Whenever I test my code (someone else’s code really, but a good proof of concept in my opinion to test out I2C communication) on the arduino boards (I’m using a mega 2560 as master and an uno as slave), everything works fine, but when I take the uno’s atmega328p chip out and put it on a breadboard everything stops working.

I have:
10k resistor on reset pin 1 to V+
16 MHz crystal on 9-10 with 22nF caps on each going to ground
Pin 8 is my output pin for testing, it goes to a red LED, through a 560 ohm resistor then ground
All three of the 5V and both ground pins hooked up to the power strips on the breadboard, which is powered by the mega 2560 and shares the common ground with it.
Pins A4 and A5 connected to the SDA and SCL lines respectively, with two 4.7k pullups connected to V+.

I know the standalone arduino circuit I have works fine for other projects, I checked it by uploading blink program with the digital output on pin 8 using this same circuit and it works fine.
I have to assume the problem is specific to the SDA and SCL lines on pins A4 and A5, but after adding the pullups (and trying 10k pullups as well) I cannot see what might be missing to get this simple enough proof-of-concept I2C code to work with my standalone atmega328p.

Does anyone see what I am missing? or have any suggestions on a path forward to troubleshoot this?

Thanks

Slave_test.ino (403 Bytes)

Master_test.ino (453 Bytes)

Your standalone Arduino requires decoupling caps. Do you have the proper types and values installed in the correct places? Gammon Forum : Electronics : Microprocessors : How to make an Arduino-compatible minimal board

I've got two decoupling caps of 22 nF each on pins 9 and 10 going to ground. The 16 MHz crystal is between 9 and 10 too. Is that not the way to do it? I was following this from Great Scott!

Again, this configuration for my standalone arduino has worked on several other projects, so I am not sure why it's failing for the I2C thing?

The crystal needs two load capacitors, typically 22 pF (not nF). You need 100 nF decoupling capacitors in various places, as described in the linked tutorial.

sg1_fan:
I've got two decoupling caps of 22 nF each on pins 9 and 10 going to ground. The 16 MHz crystal is between 9 and 10 too. Is that not the way to do it? I was following this from Great Scott!
Electronic Basics #6: Standalone Arduino Circuit - YouTube

I doubt it.

Watch the video again.