Author Topic: I Bluetoothed a Model M with an Arduino and a Bluefruit  (Read 11260 times)

0 Members and 1 Guest are viewing this topic.

Offline bcg

  • Thread Starter
  • Posts: 112
I Bluetoothed a Model M with an Arduino and a Bluefruit
« on: Wed, 07 May 2014, 21:46:33 »
I started messing with Adafruit's Bluefruit controller a while back, and found some success making a host implementation for it in hasu's TMK firmware.  I've been extremely busy over the past few months so this took a lot longer to create that I originally intended... but the awesome folks over at Adafruit were nice enough to post a tutorial that I wrote on how to do it:

https://learn.adafruit.com/convert-your-model-m-keyboard-to-bluetooth-with-bluefruit-ez-key-hid

In the process of completing the project I also ended up porting TMK to the Arduino platform... well maybe porting isn't the right word, more like slobbishly hacking together... so that you can sort of use TMK and load it onto an Arduino from right within the Arduino IDE with having to use Makefiles:

https://github.com/bgould/arduino_tmk_keyboard

I say sort of, because more of the features of TMK don't work yet, like USB  :p   I plan to double back on that part of the project later, at the very least I want to clean some things up in there so I can send hasu a pull request for some small stuff I added.  If there's interest in this approach I'll do more work to port more features of TMK into Arduino.

As far as the actual Model M project goes, I'm really happy with the way it came out... there are definitely some improvements I'd love to make but all in it is a success in my mind.  And if you're a success in your own mind, it doesn't matter what anyone else thinks, right???  Right?!?!?  ;)

Here's a video of my project, let me know what you guys think... also I put a lot of work into the tutorial so hopefully it has all of the details you might need to complete this yourself if you feel so inclined.  I'm considering putting together a GB for parts if enough people show interest.  Bluefruit is FCC certified so its definitely good to go if you're in the US but I'm not sure about legalities or certifications in other countries so do your own due diligence if you care to.

« Last Edit: Thu, 08 May 2014, 13:49:00 by bcg »
:wq!

Offline CPTBadAss

  • Woke up like this
  • Posts: 14363
    • Tactile Zine
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #1 on: Fri, 09 May 2014, 07:32:43 »
I'm definitely adding that video to the Geekhackers YouTube channel...once I figure out how to do it. That's awesome. It's blowing my mind you can type on your phone using the M.

Offline BlueBär

  • Posts: 2231
  • Location: Germany, SB
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #2 on: Fri, 09 May 2014, 07:54:45 »
It's added to the playlist now :thumb:
Very nice project!

Offline sth

  • 2 girls 1 cuprubber
  • Posts: 3438
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #3 on: Fri, 09 May 2014, 07:55:29 »
cool!!! i am linking to this on my blog.
11:48 -!- SmallFry [~SmallFry@unaffiliated/smallfry] has quit [Ping timeout: 245 seconds] ... rest in peace

Offline didjamatic

  • Posts: 1352
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #4 on: Thu, 15 May 2014, 22:10:26 »
This is very impressive and the kind of thing that drove me to GH originally - vintage goodness and modifications to work with modern computer systems.

Well done!
IBM F :: IBM M :: Northgate :: Cherry G80 :: Realforce :: DAS 4

Offline berserkfan

  • Posts: 2135
  • Location: Not CONUS Not CONUS Not CONUS Not CONUS
  • changing diapers is more fun than model f assembly
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #5 on: Thu, 22 May 2014, 15:00:48 »
beg pardon, but is it really practical in a realistic setting?

I find that I get plenty of delays with pairing bluetooth devices. sometimes I don't use them for some time, or put computer on standby, and come back and find it takes 30seconds to 2 minutes to get recognized again. That's an unacceptably long delay for an essential like a keyboard, where you can't do anything until they recognize.
Most of the modding can be done on your own once you break through the psychological barriers.

Offline bcg

  • Thread Starter
  • Posts: 112
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #6 on: Thu, 22 May 2014, 20:13:46 »
beg pardon, but is it really practical in a realistic setting?

I find that I get plenty of delays with pairing bluetooth devices. sometimes I don't use them for some time, or put computer on standby, and come back and find it takes 30seconds to 2 minutes to get recognized again. That's an unacceptably long delay for an essential like a keyboard, where you can't do anything until they recognize.

I guess maybe this project isn't for everybody... but FWIW I've not experienced any of the problems that you're describing.  The bluefruit module stores its pairing information and reconnects almost immediately after being turned on or after being disconnected.
:wq!

Offline esko997

  • Posts: 160
  • Location: CT, USA
  • Linux Lover
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #7 on: Thu, 22 May 2014, 20:38:46 »
Very cool project mate, well done!
Daily Drivers:  Unicomp Customizer (BS -- Linux Layout) | Vortex Race 3 (Clears)
Other Boards: CM Quickfire Stealth (Greens) | Poker II (Blues) | PLU-ML 87 (Ergo Clears)  | JD40 (Browns) | Leopold FC660C (Topre) | IBM Model M | ErgoDox (Clears) | Sentraq s60x DIY (Blacks) | Anne Pro 2 (Blues) | Cherry G80-11900 (Blacks) | Kira (99 Key) (Hako True)

Offline bcg

  • Thread Starter
  • Posts: 112
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #8 on: Thu, 22 May 2014, 20:52:37 »
Thanks guys for your great feedback  :thumb:
:wq!

Offline berserkfan

  • Posts: 2135
  • Location: Not CONUS Not CONUS Not CONUS Not CONUS
  • changing diapers is more fun than model f assembly
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #9 on: Thu, 22 May 2014, 20:57:20 »
beg pardon, but is it really practical in a realistic setting?

I find that I get plenty of delays with pairing bluetooth devices. sometimes I don't use them for some time, or put computer on standby, and come back and find it takes 30seconds to 2 minutes to get recognized again. That's an unacceptably long delay for an essential like a keyboard, where you can't do anything until they recognize.

I guess maybe this project isn't for everybody... but FWIW I've not experienced any of the problems that you're describing.  The bluefruit module stores its pairing information and reconnects almost immediately after being turned on or after being disconnected.

'almost immediately'?

Is it because you have a superior/ better quality device? How can I do the same for my bluetooth devices, which simply don't seem to function the same way.
Most of the modding can be done on your own once you break through the psychological barriers.

Offline lightsout714

  • * Elevated Elder
  • Posts: 1754
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #10 on: Thu, 22 May 2014, 21:06:25 »
It's added to the playlist now :thumb:
Very nice project!

Can you guys link me to the youtube channel?

Is this what you mean?
https://www.youtube.com/channel/UCilWPjW1SHDT4_elCiu-zfw/feed

Offline Smasher816

  • HHKB Master
  • Posts: 538
  • Location: return STATE_MISSOURI;


Offline Tranquilite

  • Posts: 144
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #13 on: Sun, 25 May 2014, 02:43:16 »
beg pardon, but is it really practical in a realistic setting?

I find that I get plenty of delays with pairing bluetooth devices. sometimes I don't use them for some time, or put computer on standby, and come back and find it takes 30seconds to 2 minutes to get recognized again. That's an unacceptably long delay for an essential like a keyboard, where you can't do anything until they recognize.

I guess maybe this project isn't for everybody... but FWIW I've not experienced any of the problems that you're describing.  The bluefruit module stores its pairing information and reconnects almost immediately after being turned on or after being disconnected.

'almost immediately'?

Is it because you have a superior/ better quality device? How can I do the same for my bluetooth devices, which simply don't seem to function the same way.

While I don't have an answer for getting better reconnect times for your particular bluetooth devices, I find that after a bluefruit ez-key has been paired, it can consistently go from a powered down state to being reconnected and sending keypresses in 3-5 seconds.

Offline Nickelbawker

  • Posts: 12
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #14 on: Fri, 05 September 2014, 21:10:30 »
Hey guys thinking about building one of these soon for a Poker II let me know any updates

Offline Smasher816

  • HHKB Master
  • Posts: 538
  • Location: return STATE_MISSOURI;
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #15 on: Sat, 06 September 2014, 10:54:15 »
You can click notify at the bottom of the page and you will get an email anytime someone posts a reply.

Offline Pulsefone

  • Posts: 4
  • Location: NH
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #16 on: Mon, 24 August 2015, 10:32:06 »
Hi! Not sure if anyone's still watching this thread, but I tried implementing this project on an 84 key ssk model m, but I can't seem to get the PS2 Matrix to initialize without the arduino plugged into my computer and the serial monitor running. Is this something I can do through the arduino IDE, or am I looking at a more complex (to me) problem? Sorry for the amateur question. I'm not much of a coder. 

Offline bcg

  • Thread Starter
  • Posts: 112
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #17 on: Mon, 24 August 2015, 10:59:11 »
IIRC, if you have the DEBUG option set, it will wait for the Serial Monitor to initialize before starting up the keyboard.

Try disabling DEBUG option in your config and upload the code... it may work then.  If you still have issues with it let me know and I will try to help you figure it out.
:wq!

Offline Pulsefone

  • Posts: 4
  • Location: NH
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #18 on: Mon, 24 August 2015, 12:46:16 »
I tried that originally, cause I figured that was the issue, but no dice. Even with debug commented out in config.h and in terminal_bluefruit_converter I can't seem to get the keyboard to work. It works fine, however, (with the exception of the shift keys, which are a little wonky and seem to be adding an extra keystroke, different for both, but this one seems to be the more pressing issue) when the serial monitor is turned on and debug is set to true. Really great tutorial, btw. Thanks a lot for your hard work on this. I'm excited to get it working, and I'm learning quite a bit about this platform. :)

Offline rowdy

  • HHKB Hapster
  • * Erudite Elder
  • Posts: 21175
  • Location: melbourne.vic.au
  • Missed another sale.
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #19 on: Mon, 24 August 2015, 17:07:49 »
Hi! Not sure if anyone's still watching this thread, but I tried implementing this project on an 84 key ssk model m, but I can't seem to get the PS2 Matrix to initialize without the arduino plugged into my computer and the serial monitor running. Is this something I can do through the arduino IDE, or am I looking at a more complex (to me) problem? Sorry for the amateur question. I'm not much of a coder. 

Welcome to Geekhack!

A valid question, and one that has bumped this thread to the top of "making stuff together".  If you can't get it working, you're welcome to (lightly) bump this thread, or even make a new thread of your own detailing (with pictures) what you have done, as I'm sure people would be interested to see :)
"Because keyboards are accessories to PC makers, they focus on minimizing the manufacturing costs. But that’s incorrect. It’s in HHKB’s slogan, but when America’s cowboys were in the middle of a trip and their horse died, they would leave the horse there. But even if they were in the middle of a desert, they would take their saddle with them. The horse was a consumable good, but the saddle was an interface that their bodies had gotten used to. In the same vein, PCs are consumable goods, while keyboards are important interfaces." - Eiiti Wada

NEC APC-H4100E | Ducky DK9008 Shine MX blue LED red | Ducky DK9008 Shine MX blue LED green | Link 900243-08 | CM QFR MX black | KeyCool 87 white MX reds | HHKB 2 Pro | Model M 02-Mar-1993 | Model M 29-Nov-1995 | CM Trigger (broken) | CM QFS MX green | Ducky DK9087 Shine 3 TKL Yellow Edition MX black | Lexmark SSK 21-Apr-1994 | IBM SSK 13-Oct-1987 | CODE TKL MX clear | Model M 122 01-Jun-1988

Ị̸͚̯̲́ͤ̃͑̇̑ͯ̊̂͟ͅs̞͚̩͉̝̪̲͗͊ͪ̽̚̚ ̭̦͖͕̑́͌ͬͩ͟t̷̻͔̙̑͟h̹̠̼͋ͤ͋i̤̜̣̦̱̫͈͔̞ͭ͑ͥ̌̔s̬͔͎̍̈ͥͫ̐̾ͣ̔̇͘ͅ ̩̘̼͆̐̕e̞̰͓̲̺̎͐̏ͬ̓̅̾͠͝ͅv̶̰͕̱̞̥̍ͣ̄̕e͕͙͖̬̜͓͎̤̊ͭ͐͝ṇ̰͎̱̤̟̭ͫ͌̌͢͠ͅ ̳̥̦ͮ̐ͤ̎̊ͣ͡͡n̤̜̙̺̪̒͜e̶̻̦̿ͮ̂̀c̝̘̝͖̠̖͐ͨͪ̈̐͌ͩ̀e̷̥͇̋ͦs̢̡̤ͤͤͯ͜s͈̠̉̑͘a̱͕̗͖̳̥̺ͬͦͧ͆̌̑͡r̶̟̖̈͘ỷ̮̦̩͙͔ͫ̾ͬ̔ͬͮ̌?̵̘͇͔͙ͥͪ͞ͅ

Offline Hypersphere

  • Posts: 1886
  • Location: USA
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #20 on: Mon, 24 August 2015, 17:19:30 »
Thanks for sharing this project! Nice work!

Offline Pulsefone

  • Posts: 4
  • Location: NH
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #21 on: Wed, 26 August 2015, 13:56:30 »
IIRC, if you have the DEBUG option set, it will wait for the Serial Monitor to initialize before starting up the keyboard.

Try disabling DEBUG option in your config and upload the code... it may work then.  If you still have issues with it let me know and I will try to help you figure it out.

Even when I disable the option (by commenting out, and by setting the value to false) neither way seems to stop the keyboard from hanging. Is it possible I need to disable it elsewhere, as well? I'm not sure where to begin. I've been looking at the gluecode.h file, and I'm wondering if that is still running debug_enable, even though it's not being called for in the .ino file? I'm just spitballing, here, though, cause I am truly clueless. Any ideas you can offer would be greatly appreciated. I can play with it, I'm just not sure where I should start.
-Ed

Offline Pulsefone

  • Posts: 4
  • Location: NH
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #22 on: Wed, 26 August 2015, 17:12:31 »
Got it working!! So flippin' excited.  :D I just added this little while statement to the runTask loop:
Code: [Select]
    // this the main hook into the tmk firmware that handles all the heavy lifting
    while (!Serial){
      KeyboardFirmware.runTask();
    }
and things are functioning normally. Thanks again, Ben, for this really awesome mod. I'll post some pics when I button the keyboard back up.

-Ed

Offline rowdy

  • HHKB Hapster
  • * Erudite Elder
  • Posts: 21175
  • Location: melbourne.vic.au
  • Missed another sale.
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #23 on: Wed, 26 August 2015, 21:35:19 »
Well done for resolving it, and thank you for posting the solution :)
"Because keyboards are accessories to PC makers, they focus on minimizing the manufacturing costs. But that’s incorrect. It’s in HHKB’s slogan, but when America’s cowboys were in the middle of a trip and their horse died, they would leave the horse there. But even if they were in the middle of a desert, they would take their saddle with them. The horse was a consumable good, but the saddle was an interface that their bodies had gotten used to. In the same vein, PCs are consumable goods, while keyboards are important interfaces." - Eiiti Wada

NEC APC-H4100E | Ducky DK9008 Shine MX blue LED red | Ducky DK9008 Shine MX blue LED green | Link 900243-08 | CM QFR MX black | KeyCool 87 white MX reds | HHKB 2 Pro | Model M 02-Mar-1993 | Model M 29-Nov-1995 | CM Trigger (broken) | CM QFS MX green | Ducky DK9087 Shine 3 TKL Yellow Edition MX black | Lexmark SSK 21-Apr-1994 | IBM SSK 13-Oct-1987 | CODE TKL MX clear | Model M 122 01-Jun-1988

Ị̸͚̯̲́ͤ̃͑̇̑ͯ̊̂͟ͅs̞͚̩͉̝̪̲͗͊ͪ̽̚̚ ̭̦͖͕̑́͌ͬͩ͟t̷̻͔̙̑͟h̹̠̼͋ͤ͋i̤̜̣̦̱̫͈͔̞ͭ͑ͥ̌̔s̬͔͎̍̈ͥͫ̐̾ͣ̔̇͘ͅ ̩̘̼͆̐̕e̞̰͓̲̺̎͐̏ͬ̓̅̾͠͝ͅv̶̰͕̱̞̥̍ͣ̄̕e͕͙͖̬̜͓͎̤̊ͭ͐͝ṇ̰͎̱̤̟̭ͫ͌̌͢͠ͅ ̳̥̦ͮ̐ͤ̎̊ͣ͡͡n̤̜̙̺̪̒͜e̶̻̦̿ͮ̂̀c̝̘̝͖̠̖͐ͨͪ̈̐͌ͩ̀e̷̥͇̋ͦs̢̡̤ͤͤͯ͜s͈̠̉̑͘a̱͕̗͖̳̥̺ͬͦͧ͆̌̑͡r̶̟̖̈͘ỷ̮̦̩͙͔ͫ̾ͬ̔ͬͮ̌?̵̘͇͔͙ͥͪ͞ͅ

Offline Phosphatide

  • Posts: 4
  • Location: California, USA
Re: I Bluetoothed a Model M with an Arduino and a Bluefruit
« Reply #24 on: Mon, 31 August 2015, 21:24:17 »
Forgive me for reviving this thread yet again, though I suppose I'm glad I won't be doing it after too long of a time since the last revival. I'm rather new to the world of electronics on a more hands-on tinkering level, so hopefully I can clearly describe my question and I can walk away enlightened instead of leaving us all a bit confused.

The keyboard I rescued from being recycled away is a 101-key "President Micro Systems" branded keyboard that uses a 5-pin DIN connector, which I believe (based on the research section of the Adafruit article) means this is an AT keyboard with scan code set 2. I understand that the Arduino sketch from your project utilizes scan code set 3, or at least that's what I got from reading the article and skimming through the code itself. If necessary, how would I be rewriting the sketch to accommodate scan code set 2? I've only just recently started proper research of what scan codes are, so I'm a tad confused on what it means for a keyboard to use one set over another.

I can at least say the keyboard works fine when I use a converter to use the keyboard with PS/2, if that helps in some way.

Sorry for the trouble if any!