Arduino PF575 I²C I/O port expander blink example

I got some TI PCF8575 I²C I/O expander devices some years ago and never gave them a try. Yesterday I did... In the title they are named PF575, this is because this is what is printed on the device.

I wrote code for making a LED blink using the I/O expander as simple as possible.

Here you see my setup on a breadboard. On the left is the LED connected via a PNP transistor for voltage control.

pcf8575 arduino breadboard

I only had 24-SSOP packages so I needed to solder the PCF8575 to a DIP adapter for making it breadboard friendly.


My code:

#include <Wire.h>

 *  Arduino PF575/PCF8575 I2C I/O port exapander LED blink example
 *  Setup:
 *  1. Connect A0, A1 and A2 to GND to set the address to 0x20.
 *  2. Connect SDL and SCL to the Arduino's I2C bus.
 *  3. Connect a LED to the P0 port of the I2C exapander.
 *     In my setup I am using a PNP Transistor connected to 5V unsing 
 *     an resistor, the LED and the Arduino to make sure the LED gets
 *     a current from Vcc and not from the I2C exapander port.
 *  This code is trying to explain how it works as simple as possible.
 *  More detailed examples are found on the web. Search for pcf8575 and
 *  you will find what you want.

// Set I2C address
int address = 0x20;

void setup(){ 
  // Set all ports as output

void loop(){
  // Set port P0 on
  // Set port P0 off

// Function for writing two Bytes to the I2C expander device
void pf575_write(uint16_t data) {

Some links:

Website refactored!

I refactored this website last night. Please do not wonder why things are different. Some features are gone, some will come back... I need some time for it but for now I am very excited about the result.

I will update this post from time to time in the next days...

Encryption everywhere!

Yesterday I disabled most insecure and outdated ciphers on my Jabber/XMPP server. Server to server and client to server communication is possible using encryption only. Forward secrecy is supported too. Currently I have only one cipher enabled, that does not support forward secrecy. That's because Pidgin seems not to support the other enabled ciphers. I will switch the XMPP client and will then disable this cipher too. You can see the result off a server check here: score

This website forces HTTPS encryption from now on. All HTTP traffic will be redirected to HTTPS. I do this because I think every website should only be accessible via encypted data protocols.

Some time ago I thought about a concept for providing my public PGP key in a way, that makes it hard to compromise it. I decided to create a GitHub repository only for storing keys. I provide one key there and the same key also locally at You just can compare both keys and if they are the same it is very realistic that these keys are really mine. Take a look at the contact page to get my PGP key.

If you notice any problems, please contact me.

Happy Privacy!

Gentoo Zsh prompt with Git features

Some years ago I posted the Gentoo Zsh prompt to make it available to every Zsh user, not only Gentoo users. Some days ago I wanted some Git features in my shell. I saw some nice prompt features in the last years when using Git so I wanted that too. I didn't found a nice prompt so I decided to write my own. I installed oh-my-zsh and created my own theme. It is based on the original Gentoo Zsh prompt and the Kolo oh-my-zsh theme.

Below you see an example session interacting with a Git repository:


Nice, isn't it?

I love minimal prompts with all the information I need. Since I am using xterm it is compatible to it. I love colors... ;)

You can see here that the [master*] part is not shown when not in a Git managed directory. My $HOME is managed by Git so I always have the repository information available, but not as root.

The code is found in my fork of the oh-my-ssh repository. Take a look under themes/, there is a file named hanez.zsh-theme. You can add this file to any oh-my-zsh installation from the upstream repositories or just add the content of the file to your .zshrc file. I use this fork only for providing my theme.

All of my custom Zsh stuff is found in my $HOME repository at GitHub.

Update: I replaced the dots which are showing the Git status with some asterisk to make the prompt become compatible to more terminal emulators. Some bugs are fixed too.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18