Track My Order
Frequently Asked Questions
International Shipping Info
Mon-Fri, 9am to 12pm and
1pm to 5pm U.S. Mountain Time:
Chat With Us
October 3, 2007
Tutorial - SX1509 I/O Expander Breakout Hookup Guide
about 3 months ago
Hi, Late reply, but in case anyone is still wondering: I have successfully ported the library to use on the Raspberry Pi. If anyone is interested, you can find my updated code here. Here is a rough outline of what I have done:
There are a lot of 'byte' types in the source, which I replaced with 'unsigned char' types.
There are a few defines that are taken from the Arduino libraries that need to be replaced in 'SparkFunSX1509.h'. If you are using 'wiringPi.h' you do not need to define some of these.
#define INPUT 0x00 //in wiringPi.h
#define OUTPUT 0x01 //in wiringPi.h
#define INPUT_PULLUP 0x02
#define ANALOG_OUTPUT 0x03 //To set a pin mode for PWM output
#define HIGH 0x01 //in wiringPi.h
#define LOW 0x00 //in wiringPi.h
#define RISING 0x01
#define FALLING 0x02
#define CHANGE 0x03
The Arduino function 'constrain' needs to be replaced. I wrote a very simple one as shown below. Note: this function will probably not work as intended for negative constraints, so I need to fix it when I get a chance. I put this in the top of 'SparkFunSX1509.c'
int constrain(int ValueToConstrain, int LowerLimit, int UpperLimit)
if(ValueToConstrain < LowerLimit)
else if(ValueToConstrain > UpperLimit)
The six I2C read and write functions at the bottom of 'SparkFunSX1509.c' (readByte, readWord, readBytes, writeByte, writeWord, writeBytes) need to be changed to use the wiringPi library. Note that there is an endianness issue with the wiringPi 'WriteReg16' and 'ReadReg16'. I used two 8-bit writes instead.
In case anyone is interested, I made a 3D printed case that will let you mount this relay inline in a power cord. You can find the details here.
about 7 years ago
I too would be interested in solder suggestions for this sensor. I have successfully soldered the part using a heat gun (not recommended according to the data sheet). The returned pressure is a bit lower than I would have expected, but not completely unreasonable. I also used flux (before soldering) and 99% isopropyl to wash the board (after soldering). I attempted to avoid completely submerging the part in the isopropyl, but I am unsure if this could cause problems. Do you guys have any thoughts on that?
about 9 years ago
I may have missed it, but I cant seem to find anywhere what the driving voltage for the LED backlight is. Pins 15 and 16, labeled LED+ and LED-. Is it also 3.3 volts?
News - SparkFun Gets a Cease and…
about 10 years ago
This is pretty dumb. You have my support, FWIW.
No public wish lists :(
Forgot your password?
No account? Register one!