Intro: PCA9555 SMD Recycle
While wandering around the Reuseum in Boise, Idaho I ran across several PCB boards with a few LEDs and a SMD chips. The chip (PCA9555 from NXP Semiconductors) turned out to be a 16 bit i2c I/O port with an interrupt pin. The board had two of these chips. I wired it up to raspberry pi using the the silk screened pin header and tried the i2cdetect command. I got nothing from the board.
Step 1: Chip Research and Testing With Raspberry Pi I2cdetect
I reviewed the reference sheet for the chip, ran some continuity tests and realized that the PCB was mis-labeled. (Probably the reason why these boards were discarded.) I adjusted the wiring harness based on the data sheet and was able to get them working as expected through raspberry pi.
Here is the datasheet for the PCA9555.
From raspberry pi, here is an example of the i2cdetect command running:
brucelowther@raspberrypi ~ $ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- 22 23 -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- —
From raspberry pi, I was able to get some action out of the LEDs just using some i2cput commands with a little experimentation:
i2cset -y 1 0x22 0x06 0x03
Which reads: for address 0x22 register 0x06, set the value to 0x03
Step 2: SMD De-solder & Re-solder
My real goal was to mount these chips on a breakout board and connect to them with an ATMEGA. The raspberry pi approach would work, but I wanted to go a little lower level. Now that I know that the original boards are working, I removed the PCA9555 chips form the PCB and mount them on a breakout board.
Removing the SMDs
This is my first time attempting to work on a SMD chip. Up until now, I have been working with through hole parts. The picture above shows my final result. I added the penny to help get a sense of the scale. The PCA9555 chip is a SSOP24 size device which is roughly 8mm x 6mm. I thought this was a good opportunity to try it out and get access to an interesting chip at the same time. I purchased a a hot air SMD rework station from Amazon and read up a little on the technique.
One suggestion I would share on removing these parts is to wait until the part really is just about to slide off the PCB. This will reduce the chance that, while pulling the part off, one or more of the leads will bend. The leads on these parts are so small that it can be very difficult to adjust them back into alignment. If all the pins are not in alignment, it might cause problems getting solder where it should be and nowhere else.
Attaching the SMDs to breakout board
I read several approaches to attaching the SMD part, the technique that worked best for me was to add a little solder to one lead and keep it hot, then slide the SMD part into place and try to align it as much as possible before removing the heat. Then you can inspect the part at different angles when it is fixed in place to confirm that all the leads are lined up with the pads. I have a very nice LED magnifier, but I had some challenges getting the magnifier setup where I could see the part and still have enough room to apply heat with the soldering iron. In the end, I just had to eyeball it a bit and inspect after.
In the future, I will try a head magnifier. Hopefully that will make things a bit easier to coordinate my need for vision and enough room to apply heat with a soldering iron.
I tried to add only enough solder to connect the leads, but there were a few cases where I realized that there was too much solder. Too much solder will cause jumpers between one or more leads. A bit of googling presented me with a simple method to wick away the excess solder. Using copper solder wick. Heating up the leads through solder wick will pull excess solder out from between the leads.
I performed a few continuity tests to verify that I had everything connected and not jumpered. I used a DMM on continuity mode and checked between the SMD part lead and each breakout pin. If I didn’t get a continuity buzz from the DMM then I knew I had missed some solder on a pin. Next I checked for continuity between each subsequent pair of breakout pins. This check will help identify cases where there was too much solder that was causing a bridge between leads. If there was, I would have to come back with the copper solder wick again to see if I could get it removed. After getting successful results from both tests, I proceeded to wiring.
Step 3: Wire Up for Connection It ATMEGA
The chip has two banks of 8 input or output pins. The configuration of the chip is all done through i2c SDA & SDL pins.
The device also has several address pins that will set the address for the i2c device. This enables you to use this device along with other i2c devices at the same time as long as they do not share the same address.
Here is a quick schematic I setup on a prototype board. (This was drawn with my least favorite cad tool.)
This schematic shows the PCA9555 chip wiring. I connected this to a ATMEGA 328p. The interrupt line connected to pin 4 labeled PD2 (INT0) on the ATMEGA. The SCL line connected to pin 28 PC5 and SDA line connected to pin 27 PC4.
Step 4: Code
I’ve built my code upon the work done in the book:
I would recommend it to anyone that is interested in moving past the capabilities of the ATMEGA exposed through Arduino into the wild west of micro controller programming. The book provides many interesting example as well as a Makefile framework that enables you to use a template to start new development work very quickly.
AVR Programming github
My code for this PCA9555 board example
The main starts off by opening up a USART serial connection for diagnostics.
Then initializes I2C. NOTE: you may need to adjust the timing in the initI2C function depending on your clock rate.
After reporting the initial state of the addressed PCA555 device, it will configure Port 0 for input. The two buttons are wired to Port 0 pin 0 and pin 1.
Then it will configure Port 1 for output. Port 1 has the array of 8 LEDs. There is also a interrupt configured to check periodically if the interrupt line has transitioned — either high or low. The interrupt handler checks periodically for the transition. When it does detect a transition it marks the isIOTriggered variable which is handled within the main while loop. When isIOTriggered is 1, then the main while loop will write a different value to the Port 1 registered using the I2cWriteData command.