Teensy 3.2 + WIZ820io & Micro SD + 4 position DIP switch

Status
Not open for further replies.

grymoire

Member
I want to add a 4-position DIP switch to a Teensy w/ an SD Card. I have a Teensy 3.2 and the WIZ820io & Micro SD adaptor.
I have not added the WIZ820io to the board.

I was wondering how I could connect the DIP switch to this setup?

My goal is to have 16-different choices corresponding to different files on the SD card.
 
Connect the Dip switches to 4 digital pins of the Teensy and ground. In your code, configure these 4 pins as input with pull-up and attach a single ISR to these which in case of a state change reads all 4 pins and writes the reconstituted number from 0 to 15 to a global volatile int variable. The latter might then checked for change in the loop() and a corresponding action be taken.
 
That's definitely the obvious and easiest solution.

If you're short of pins, you could use a resistive ladder into one analog input. Requires a few external resistors though. With a restive ladder, you can comfortably go up to about 9 to 10 switches, still using only one pin on the micro.
 
Connect the Dip switches to 4 digital pins of the Teensy and ground.

Looking at the reference page https://www.pjrc.com/store/wiz820_sd_adaptor.html, I shouldn't use any pin that the SD card uses, and to allow for the future addition of the Ethernet interface, I should also avoid the pins the WIZ820io uses. That means I shouldn't use 4,8,9,10,11,12 and 13, right?

I could theoretically add a second 4-position DIP switch if I get crazy.

Given that, I'm trying to determine the most convenient set of pins to use, how to fasten them to the Teensy. I have some perfboard I can use.

So pins 13,14,15,16 and perhaps 17,18,19,20 are a good choice?
So I could socket the Teensy board and use extra long header pins and fasten the switches on the underside.
Or perhaps try to fasten them above the adapter board somehow?
 
Status
Not open for further replies.
Back
Top