Tuesday, May 14, 2013

More with the PCF8574N

Here is my second project for the parts I got
This time I thought I'd try talking to two PCF8574N at at the same time.

This is the setup I ended up with:

*Note, I should have added a resistor to the LED hooked up to the PCF, 330 ohm should be fine.


The code for this project was simple. With this setup, I can just send the byte I receive from the PCF hooked to the button straight to the PCF hooked up to the LED.

Here is the result:

This project has a lot more going on with it then it seems. The LED and button are neither connected to each other or the Arduino directly; They are each hooked to their own PCF chip. So this is really a project about getting three devices to talk aver I2C, one master (the Arduino), and two slaves (the PCF chips). This really shows off how nice the PCF's are, since they all talk to the Arduino though the same two wires.

Here is my code:

Saturday, May 11, 2013

Expanding The Arduino

I got some new parts in that let me expand the Arduino in different ways, as well as a couple extra Atmegas, as I killed one of mine messing with its fuses.
After installing the new atmega into my Bare-Bones Board and loading the bootstrap, I decided to just hook up the new chips, and try to get them to work.

First I hooked up the TLC, and loaded this library into the Arduino IDE. Loading up the basic use sketch, I made sure everything was working right.

After that, I hooked up the PCF, and followed some of this tutorial to get it working.

This is the setup I ended up with:


*Note, I should have added a resistor to each of the LED's hooked up to the PCF, 330 ohm should be fine.


My next step was to write some code to show off the functions of these chips. So i decided to have the TLC do a Knight Rider effect, and the PCF just do some patterns.

Here is the result:

One of the huge advantages of the TLC is that it has twice the resolution of the internal PWM's, and doesn't need a resistor on each LED, just the one reference resistor. You can also daisy chain multiple TLCs together without using more pins on the Arduino, allowing for up to 4096 PWM channels.

The PCF is nice as you can hook them together in parallel on the same two wires. It can also read the pins, not just do output.

The one interesting thing about both of these chips, is you use them as current sinks. This means you hook the LED anode to VCC, and the cathode to the chip. You set the pin to HIGH to turn the LED off, and to LOW to turn the LED on.

With this, I can now build more projects, without worrying about running out of pins. 

Here is my code and the library for the TLC: