Introduction: Arduino Uno I2C Master
This is the other end of the ATTiny84 I2C Slave instructable.
The purpose of this circuit is to provide a pared down ATMega328P-PU I2C Master board that will control connected I2C Slave devices. In the example that I am using, the slave device is a circuit with three ATTiny84 microprocessors, but it could just as easily be anything else that works as an I2C slave.
The circuit has a connection for a USB Serial module (I'm using the Freetronics USB Serial Adaptor).
For this circuit, you will need:
- 1 x ATMEGA328P (I've got some PU that I'm using)
- 1 x 28 pin DIP socket
- 1 x 16 Mhz crystal
- 2 x 22pF capacitors
- 1 x 10k ohm resistor
- 2 x 0.1uF electrolytic capacitor
- 1 x LM7805 voltage regulator (5V)
- 1 x barrel jack socket
- 3 x 0 ohm resistor (or just use jumper wire)
Step 1: Board Design
The layout is fairly simple as I am not including any break-out headers for any of the ATMEGA328 pins other than those needed for USB Serial and I2C connection.
The arrangement of the board follows a pretty conventional layout with the components situated as close to the ATMEGA328 output pins as possible and so that the output connections are easily accessible (close to the edge of the board).
I've used a 90 degree pin header for the USB Serial connection so that when I connect the USB Serial and plug a USB cable into it, it doesn't topple or put too much strain on the cable or connector. Feel free to use whatever connector that you like for your own (very good) reason(s).
With the USB Serial pin header arranged in this way, I've also had to reverse the connection. This means that the USB Serial module connects upside-down on the board ... it's not a hassle, but it may upset your aesthetic sensibilities.
I have included my Fritzing design file for your use ... again, feel free to use this design however you like.
Step 2: Solder It
You'll probably notice that I have stuck a printed silk screen layer onto the top of the board. I do this for two reasons,
- I like the look of the final product and I don't have a silk screen, and
- A silk screen helps you to place the components on the board.
The way that I usually approach populating a PCB is to start with the smallest/shortest parts first. That means that I start by soldering in the resistors first, then the crystal followed by the ceramic capacitors
The 90 degree pin header was soldered in next followed by the electrolytic capacitors and the female pin block.
The next target was the 28 pin DIP socket, then the barrel jack and finally, the LM7805.
The main reason that I go from shortest to tallest in my soldering is that, with the circuit resting on a flat surface, the components don't move around while I'm soldering them. Some people use sticky tape to hold the components in place or even Plasticine ... I've tried sticky tape and it turned out to be more trouble than it was worth. I ended up with sticky crap on my components.
Step 3: Use It!
The female pin header on the I2C Master board is used to connect the board to your I2C Slave.
From left to right:
The attached Arduino sketch is adapted from The Wandering Engineer's example. As I have mentioned on the ATTiny84 I2C Slave instructable, the main difference between The Wandering Engineer's sketch and the one here, is that I am controlling 3 slaves instead of just one.
Anyway, I hope that this instructable has been helpful for you and I hope that you have been able to make your own I2C Master.
If you liked this instructable, please feel free to vote ;)
Participated in the
7 years ago
Very useful. Thank you for posting.
Reply 7 years ago
Thanks D6equj5 :)
7 years ago on Step 3
Reply 7 years ago on Step 3
Thanks marc.deloor.5. It's a pretty easy build and fits into my other projects nicely.
Reply 7 years ago on Introduction
7 years ago on Introduction
Last night I connected the I2C Master, ATTiny84 I2C Slave and the VB.NET Serial Comms projects and was able to send and receive data with the PC and ATTiny84 chips. This required no changes to the VB.NET application or the ATTiny84 I2C Slave sketch, but did require a "merging" of the Arduino Serial and I2C Master sketches. Once the new version of the I2C Master sketch was loaded up on the Arduino Uno I2C Master, the messages were flying thick and fast (well as fast as you can expect with a Delay(500);), so I am quite satisfied with the projects progress.
7 years ago
This is really freakin cool! Great idea, great share!
Reply 7 years ago on Introduction