Using SX1509 I/O Expander Board with FED3

40 views
Skip to first unread message

Kyle O'Berry

unread,
Jul 15, 2024, 3:40:03 PM (12 days ago) Jul 15
to FEDforum
Hey, I am trying to utilize the I2C expander ports on the FED3 to add an expander board. My hope is to incorporate a capacitive touch sensor so mice have to first touch the sensor before pokes to the FED will yield a reward. But I am unsure of how to modify the FED library so that it can read inputs from the SX1509 expander board. Any help would be greatly appreciated. Thank you!

王策群

unread,
Jul 16, 2024, 8:39:15 AM (11 days ago) Jul 16
to Kyle O'Berry, FEDforum
Hi  Kyle,

I tried the SX1509 before,  you can learn the code from the Sparkfun here.
image.png

1. you have to install the lib: SparkFun SX1509
2. 
I put this into the FED3.h :   #include <SparkFunSX1509.h>
and the example code like this:
image.png

Best,
Jon



Kyle O'Berry <kob...@andrew.cmu.edu> 于2024年7月16日周二 03:40写道:
Hey, I am trying to utilize the I2C expander ports on the FED3 to add an expander board. My hope is to incorporate a capacitive touch sensor so mice have to first touch the sensor before pokes to the FED will yield a reward. But I am unsure of how to modify the FED library so that it can read inputs from the SX1509 expander board. Any help would be greatly appreciated. Thank you!

--
You received this message because you are subscribed to the Google Groups "FEDforum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedforum+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fedforum/0fb7c9dd-75e5-465c-a660-ef82dddbaa86n%40googlegroups.com.

Alex Legaria

unread,
Jul 16, 2024, 1:59:11 PM (11 days ago) Jul 16
to FEDforum
Hi Kyle,

Another possibility is to use the BNC pins as an input and then just read the pin without any additional modifications using digitalRead(). To do this, you can connect the capacitive touch sensor to A0, 3v, and ground (pink, red and green on the picture below). 

fed_mod_071624.png

So the code (or pseudo-code), would go like this:

fed_mod_code_071624.png

Hope this helps.

Best,

Alex Legaria

Kyle O'Berry

unread,
Jul 16, 2024, 2:49:30 PM (11 days ago) Jul 16
to FEDforum
Thank you so much Jon that worked perfectly. The capacitive touch sensor is now able to interact with the FED!

Kyle O'Berry

unread,
Jul 16, 2024, 2:52:56 PM (11 days ago) Jul 16
to FEDforum
Hey Alex thank you so much for the suggestion! That was my original idea but I also need to use the BNC as an output to interface with my fiber photometry system so they are unfortunately not available to use an input at least I think. I am very new to this sort of thing so apologies if that is incorrect but thank you again for your suggestion!
Reply all
Reply to author
Forward
0 new messages