Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: Question about Teensy

  1. #1
    Junior Member
    Join Date
    Nov 2017
    Posts
    6

    Question about Teensy

    I’m considering making a USB emergency boot controller for my Mac to use when during the rare times I have to do diagnostics and my bluetooth keyboard isn’t connecting. I’d rather not have to store a wired keyboard somewhere.

    I’m thinking of a small hand held 5 button trigger designed like the Wii Nunchuck that can be plugged in during troubleshooting. I know I’ll have to figure out the programming for this and I’ve found some good guides online for it but I am writing to ask about the Teensy controller. Would that be the device I would need to just create a device that each button can combine certain keyboard presses? Example: Button 1 (Flash PRAM) = Option+CMD+P+R. Or does the Teensy require all the individual keys to exist separately? If the Teensy would work for this and it is just a matter of programming would it be able to accept signals from a controller circuit like the one in the Wii Nunchuck and just translate each key press into the needed combination of keyboard signals? Any advice you could provide would be appreciated.

    Click image for larger version. 

Name:	Wii Nunchuck.jpg 
Views:	20 
Size:	66.1 KB 
ID:	12079
    Last edited by RicharSedai; 11-22-2017 at 12:16 AM.

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,153
    You might use one single button to trigger a combination of keys or even key sequences. That's only a question of your software engineering.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,257
    Quote Originally Posted by RicharSedai View Post
    Example: Button 1 (Flash PRAM) = Option+CMD+P+R. Or does the Teensy require all the individual keys to exist separately?
    There are 2 ways you can send keystrokes. The simple Keyboard.print() generally sends 1 key at a time, as if you were (very rapidly) typing ordinary text. To send special combinations, you would use Keyboard.press() and Keyboard.release(). That's more code, but you can precisely control the order. Details here:

    https://www.pjrc.com/teensy/td_keyboard.html


    If the Teensy would work for this and it is just a matter of programming would the it be able to accept signals from a controller circuit like the one in the Wii Nunchuck and just translated each key press into the needed combination of keyboard signals?
    Several people have connected WII Nunchucks. It's done using the I2C pins.

  4. #4
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    Thanks PaulStroffregen Would the Teensy 2.0 be sufficient for something like this? I assume the I2C pins you are referring to are on the Wii Nunchuck circuit board? I don't see any of the Teensy boards listed with pins labeled I2C.

  5. #5
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,579
    i2c is an interface that most micro controllers support

    https://www.sparkfun.com/news/2366
    or more complete
    https://en.wikipedia.org/wiki/I%C2%B2C

    In the Teensy case look for Serial Clock (SCL) and serial Data(SDA), colour coded purple on the newer Teensyies (which may have more than one+alternates so find SCL0/SDA0 in black.

    You can do this on a Teensy 2.0, but be aware it's a fairly old device so you may find current examples which will not work. Also if shopping online a fair number of Teensy2 and Teensy 2++ are counterfeit, some work, some don't and many of them come with exciting features buried in the bootloader that make them easy to brick. If this is your first go at Arduino suggest paying the extra to buy from a known reseller.

  6. #6
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    Thanks for the heads up on the counterfeit ones. I figured I would order it from this site's store or Amazon since they sell there too. I'll take measurements and see if the Teensy 3.2 will fit in the Wii Nunchuck handle and order that one if it does.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    16,257
    Teensy LC ought to work too. It's the least expensive one.

  8. #8
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    Thanks, I'll try the LC since it is the same size as the 2.0 and should fit fine. I assume that the USB should provide any necessary power and the pins shown in this diagram are just optional?

    Click image for larger version. 

Name:	card7b_rev1.png 
Views:	13 
Size:	270.6 KB 
ID:	12080

  9. #9
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,573
    Note, if you are doing i2c on Teensy 3.x or LC, you may need to add pull-up resistors between each of the SCL and SDA pins and 3.3v. If your device has pull-up resistors, you don't need to add extra ones in the Teensy. For normal Teensy i2c buses, you would want 2.2K resistors.

  10. #10
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    Thanks for the heads up, MichaelMeisser. I assume that it doesn't matter which 3V pin I use since there 2? They both serve the same function right?

  11. #11
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    5,179
    Yes, the pins labeled 3.3V in both spots are the same regulated down from the 5V that comes in over the USB cable (or VIN).
    Last edited by defragster; 11-22-2017 at 02:47 AM.

  12. #12
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    Thanks that helps, there isn't much documentation on these that I've seen detailing all the pin functions. All the diagrams seem designed for people who already know what they are doing. Novices like me just are winging it..

  13. #13
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    5,179
    There is a world of details and documentation - be careful of phrasing somebody will point you to the thousands of pages of chip manuals and the schematic on PJRC.com.

    The forum has helpful folks and info - if you know how and where to look { Bing or Google are best to search the Forum } or ask good questions. The Teensy ( other than being 3.3V and using a different 32 bit ARM processor versus 8 bit AVR ) is very compatible with any info and details following general Arduino library and pin usage.

  14. #14
    Senior Member pictographer's Avatar
    Join Date
    May 2013
    Location
    San Jose, CA
    Posts
    602
    Very compatible if you stick to libraries. Arduino folks often write code that accesses hardware registers with short cryptic names in all caps. This stuff differs between processors and is a bit tricky anyhow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •