Author Topic: A couple of Teensy noob questions  (Read 2170 times)

0 Members and 1 Guest are viewing this topic.

Offline jeffgran

  • Thread Starter
  • Posts: 126
  • Location: Denver
A couple of Teensy noob questions
« on: Mon, 27 October 2014, 22:39:20 »
The teensy 2.0 says it has:

25 I/O pins
12 Analog inputs
7 "PWM"

I count 29 pins, but I can't figure out how the numbers 25, 12, and 7 overlap to make 29.My questions:

1. What is "PWM"?
2. Can the "analog inputs" be used as digital inputs also? (related side question, can you use the analog inputs on an Arduino board as digital I/O pins?)
3. Most importantly, can you use 25 digital inputs for making a keyboard matrix? If not, how many do I get? I'm trying to figure out whether I need the ++ version or not for my project.

Thanks in advance for help.

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: A couple of Teensy noob questions
« Reply #1 on: Mon, 27 October 2014, 22:47:39 »
The teensy 2.0 says it has:

25 I/O pins
12 Analog inputs
7 "PWM"

I count 29 pins, but I can't figure out how the numbers 25, 12, and 7 overlap to make 29.My questions:

1. What is "PWM"?
2. Can the "analog inputs" be used as digital inputs also? (related side question, can you use the analog inputs on an Arduino board as digital I/O pins?)
3. Most importantly, can you use 25 digital inputs for making a keyboard matrix? If not, how many do I get? I'm trying to figure out whether I need the ++ version or not for my project.

Thanks in advance for help.

some of the pins are for VCC (just the 5V from USB), GND and for the reset button. They aren't available for IO use. You can check the teensy pinout.

1. PWM is pulse width modulation, If you imagine a square wave, PWM sets the width of each pulse (or duty cycle %). It's a good way to control brightness on LEDs and is also used for speed control of some fans.
2. I believe so, yes. In both cases.
3. You bet! the phantom keyboard PCB uses a teensy, and I believe almost all of the pins.

If you let me know more about your project, I can help you determine if you shoudl get the ++. Without any more info I'll say this: It'll likely make it a little easier, but with some more info I could give a better answer for sure.

Offline jeffgran

  • Thread Starter
  • Posts: 126
  • Location: Denver
Re: A couple of Teensy noob questions
« Reply #2 on: Mon, 27 October 2014, 23:14:05 »
Cool, thanks man! The design I'm working with only has 48 keys. It's a sorta split design, but all one piece for now... think Kinesis Advantage-ish. Sounds weird but the natural sort of grid would be a 3x8 on each side or I guess a 3x16, although the wiring might get weird with the controller being in the middle between the two halves of the grid.

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: A couple of Teensy noob questions
« Reply #3 on: Mon, 27 October 2014, 23:46:43 »
Cool, thanks man! The design I'm working with only has 48 keys. It's a sorta split design, but all one piece for now... think Kinesis Advantage-ish. Sounds weird but the natural sort of grid would be a 3x8 on each side or I guess a 3x16, although the wiring might get weird with the controller being in the middle between the two halves of the grid.

Sounds pretty cool!

So to make a keyboard matrix for that, you need at minimum 2*(48^0.5) pins, which is 14 (7 by 7 matrix will have 49 possible positions) but if you are hand-wiring this it will be pretty tough.

A lot easier would be to wire it up as two 8*3 matricies, or one 8*6. This would require 8 + 6 = 14 pins, plenty on the teensy for that. You'll have to have 6 or 7 wires across the gap in the middle though. This would be significantly easier to hand wire.

So another option is to wire it up as a 16*3 matrix. You'd only have 3 or 4 wires across the gap in the middle, and it would require 16 + 3 = 19 pins. again enough on the teensy. This would be just about as easy to wire as the above, and might save you some trouble when coming up with a cable for the split halves. This is probably your best option, but it's a lot less efficient than either of the above. (less pins available on the teensy for things like LEDs and stuff)

If it's all in one piece for now either of the last 2 options are about the same, but the last would be easier to make fully split.

In any of these cases a teensy++ is not required.

Let me know if you need any more info. I can draw out a wiring diagram if you need. I'm a visual learner so things like that help me out a lot.

Offline jeffgran

  • Thread Starter
  • Posts: 126
  • Location: Denver
Re: A couple of Teensy noob questions
« Reply #4 on: Tue, 28 October 2014, 22:30:57 »
Wow, thanks @dorkvader. That does help. Sounds like no matter which way I go the basic teensy will work for me. I'm currently working on the case design and I am just trying to figure out which microcontroller and how I'm going to mount it... then I'll get to the actual wiring, and yes I may ask for more help when I get there, but I'm the type that wants to try it myself first and then ask when I get stuck. :)

For mounting the teensy in there I'm thinking of getting the one with the "header" pins and soldering it to something like this: http://www.ebay.com/itm/10-Pcs-Single-Side-Solderable-Prototype-Universal-PCB-Circuit-Board-5cm-x-5cm-/231275000224?_trksid=p2054897.l4275 just so I have some mounting holes that I can screw or bolt it into/onto the case somehow.

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: A couple of Teensy noob questions
« Reply #5 on: Tue, 28 October 2014, 22:56:54 »
Wow, thanks @dorkvader. That does help. Sounds like no matter which way I go the basic teensy will work for me. I'm currently working on the case design and I am just trying to figure out which microcontroller and how I'm going to mount it... then I'll get to the actual wiring, and yes I may ask for more help when I get there, but I'm the type that wants to try it myself first and then ask when I get stuck. :)

For mounting the teensy in there I'm thinking of getting the one with the "header" pins and soldering it to something like this: http://www.ebay.com/itm/10-Pcs-Single-Side-Solderable-Prototype-Universal-PCB-Circuit-Board-5cm-x-5cm-/231275000224?_trksid=p2054897.l4275 just so I have some mounting holes that I can screw or bolt it into/onto the case somehow.

Yep, that'll work. I don't think you'll need 10 of them though :p

You can also use it to make it a little easier to wire up the switch matrix. If you got some pin headers you could just plug them in.

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: A couple of Teensy noob questions
« Reply #6 on: Tue, 28 October 2014, 23:17:37 »
Wow, thanks @dorkvader. That does help. Sounds like no matter which way I go the basic teensy will work for me. I'm currently working on the case design and I am just trying to figure out which microcontroller and how I'm going to mount it... then I'll get to the actual wiring, and yes I may ask for more help when I get there, but I'm the type that wants to try it myself first and then ask when I get stuck. :)

For mounting the teensy in there I'm thinking of getting the one with the "header" pins and soldering it to something like this: http://www.ebay.com/itm/10-Pcs-Single-Side-Solderable-Prototype-Universal-PCB-Circuit-Board-5cm-x-5cm-/231275000224?_trksid=p2054897.l4275 just so I have some mounting holes that I can screw or bolt it into/onto the case somehow.

http://geekhack.org/index.php?topic=45587.msg955666#msg955666
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline jeffgran

  • Thread Starter
  • Posts: 126
  • Location: Denver
Re: A couple of Teensy noob questions
« Reply #7 on: Wed, 29 October 2014, 15:06:48 »
Brilliant!

Wow, thanks @dorkvader. That does help. Sounds like no matter which way I go the basic teensy will work for me. I'm currently working on the case design and I am just trying to figure out which microcontroller and how I'm going to mount it... then I'll get to the actual wiring, and yes I may ask for more help when I get there, but I'm the type that wants to try it myself first and then ask when I get stuck. :)

For mounting the teensy in there I'm thinking of getting the one with the "header" pins and soldering it to something like this: http://www.ebay.com/itm/10-Pcs-Single-Side-Solderable-Prototype-Universal-PCB-Circuit-Board-5cm-x-5cm-/231275000224?_trksid=p2054897.l4275 just so I have some mounting holes that I can screw or bolt it into/onto the case somehow.


http://geekhack.org/index.php?topic=45587.msg955666#msg955666

Offline jackalope

  • Posts: 165
  • Location: Chicago
  • Now with 20% more soul.
Re: A couple of Teensy noob questions
« Reply #8 on: Sat, 01 November 2014, 04:22:55 »
This answered some questions about wiring up a teensy for the matrix.
eh o well

Offline OldDataHands

  • Posts: 280
  • Location: Michigan
Re: A couple of Teensy noob questions
« Reply #9 on: Sat, 01 November 2014, 09:47:09 »
Melvang linked to the first version.
there was also this version:

 http://geekhack.org/index.php?topic=45587.msg1233204#msg1233204