Author Topic: Bluefruit LE Micro : USB and Bluetooth on one board  (Read 11405 times)

0 Members and 1 Guest are viewing this topic.

Offline yoobe

  • Thread Starter
  • Posts: 48
  • Location: Rolle, Switzerland
  • Yoobe
Bluefruit LE Micro : USB and Bluetooth on one board
« on: Tue, 18 August 2015, 13:27:32 »
Hi all,

I was wondering if it is possible to replace a teensy 2.0 with this board on a ErgoDox to have Bluetooth LE?

If someone could draw how to cable this?

Link : https://www.adafruit.com/product/2661
I posted a similar post on deskthority: http://deskthority.net/keyboards-f2/adafruit-bluefruit-le-micro-in-a-ergodox-t11351.html

Thanks,

Yoo
« Last Edit: Tue, 18 August 2015, 13:30:18 by yoobe »
Yoobe

ErgoDox - Mx Brown
Filco Minila Air - Mx Red
RedScarfII+ VerC - Gateron White

Offline fknraiden

  • Posts: 496
  • Location: Portland, OR
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #1 on: Tue, 18 August 2015, 13:30:44 »
I think you need to add it along with the teensy. Someone else more versed will chime in.

IBM SSK 87'     ReAlForce 55g Silent 10AE

Offline wlhlm

  • Posts: 700
  • Location: Germany
  • ~
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #2 on: Tue, 18 August 2015, 13:31:07 »
https://www.adafruit.com/product/2661

For anyone wondering. Bluetooth Low Energy + ATmega32u4.

Offline Findecanor

  • Posts: 5035
  • Location: Koriko
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #3 on: Fri, 21 August 2015, 13:55:37 »
If you already have the Teensy 2.0 soldered it in, it might be easier to add a Bluefruit EZ Key and talk serial to it.
The EZ-Key does not only have twelve pins for twelve keys - it also accepts raw keyboard and mouse packets over serial.

This is (should be... knock on wood) the pin assignment of a Teensy on an ErgoDox, USB port at the top.
Code: [Select]
Teensy:
        GND                     Vcc
     c0 PB0                     PF0 r5
     c1 PB1                     PF1 r4
     c2 PB2                     PF4 r3
     c3 PB3 PE6             *   PF5 r2
    LED PB7                     PF6 r1
    SCL PD0                     PF7 r0
    SDA PD1                     PB6 LED
     c4 PD2                     PB5 LED
     c5 PD3                     PB4
     c6 PC6                     PD7
        PC7 PD5 Vcc GND RST PD4 PD6
You can see that there are a couple of pins left. Maybe those could be used for interfacing with the EZ-Key.
« Last Edit: Sat, 22 August 2015, 04:36:52 by Findecanor »

Offline yoobe

  • Thread Starter
  • Posts: 48
  • Location: Rolle, Switzerland
  • Yoobe
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #4 on: Sat, 22 August 2015, 08:57:27 »
If you already have the Teensy 2.0 soldered it in, it might be easier to add a Bluefruit EZ Key and talk serial to it.
The EZ-Key does not only have twelve pins for twelve keys - it also accepts raw keyboard and mouse packets over serial.



Yes this was the first idea I had while searching... But I thought that a for my second keyboard it would be better to change the board itself for 2 reason : the cost and space


I prepare the remapping in the case I move to bluefruit with the ergodox PCB: https://geekhack.org/index.php?topic=22780.msg1843520#msg1843520



Yoobe

ErgoDox - Mx Brown
Filco Minila Air - Mx Red
RedScarfII+ VerC - Gateron White

Offline mrflow3r

  • Posts: 158
  • Location: Vancouver
    • T
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #5 on: Sat, 22 August 2015, 10:58:01 »
While you are at it, you also need to find a room for battery. I am very curious how this mod turns out! Keep us posted.
 

Offline yoobe

  • Thread Starter
  • Posts: 48
  • Location: Rolle, Switzerland
  • Yoobe
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #6 on: Sat, 22 August 2015, 11:55:47 »
I cross post it here the first idea :


109121-0
Yoobe

ErgoDox - Mx Brown
Filco Minila Air - Mx Red
RedScarfII+ VerC - Gateron White

Offline vvp

  • Posts: 886
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #7 on: Sat, 22 August 2015, 13:57:57 »
Looks like Bluefruit is bigger and will not fit the original space designed for Teensy.
That clearly means it is best to make the mapping so that it corresponds most to the original mapping on ATmega32u4. You indicated you did so. Good. Now the bad things:
  • forget about the schematic drawing; do that directly in Kicad or do not draw it all; it is very hard to follow had drawn lines (table is better) and it will not help you when eventually designing PCBs
  • concentrate on the table, it needs to have 5 important columns (you can add more columns but they can be hidden for now)
    • ATmega32u4 pin name (e.g. PB2)
    • Teensy pad name
    • Bluefruit pad name
    • ergodox PCB net name (you need to know what the pin is sued for; is it driving/scanning rows/columns; is it used for communication with the port expander on the left side; ...)
    • comments (e.g. related to the ergodox PCB net functionality if the net name is not clear enough)
  • post the table in a CODE tag so that it is in non-proportional font and at least somewhat readable
  • hope somebody will check it (it will not be me, I do not have ergodox, I have something different)
  • do not try to create a PCB for now; just connect it with wires to the original ergodox PCB; you probably will make a mistake and it is easier to reroute a wire (hoepfully the mistakes will not fry something :) )
  • if you want to make a helper PCB then first take the ergodox kicad sources and:
    • extend the ergodox shematic with the Bluefruit and the related battery components
    • add two compoments representing connectors from the original ergodox PCB pads to the PCB where you would solder Bluefruit
    • go and design the extension Bluefruit PCB for the new schematic
    • you want to do all this in Kicad to be sure your schematic corresponds to the PCB and the PCB does pass Kicad validation

Offline mrflow3r

  • Posts: 158
  • Location: Vancouver
    • T
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #8 on: Sat, 22 August 2015, 14:24:47 »
Looks like Bluefruit is bigger and will not fit the original space designed for Teensy.
That clearly means it is best to make the mapping so that it corresponds most to the original mapping on ATmega32u4. You indicated you did so. Good. Now the bad things:
  • forget about the schematic drawing; do that directly in Kicad or do not draw it all; it is very hard to follow had drawn lines (table is better) and it will not help you when eventually designing PCBs
  • concentrate on the table, it needs to have 5 important columns (you can add more columns but they can be hidden for now)
    • ATmega32u4 pin name (e.g. PB2)
    • Teensy pad name
    • Bluefruit pad name
    • ergodox PCB net name (you need to know what the pin is sued for; is it driving/scanning rows/columns; is it used for communication with the port expander on the left side; ...)
    • comments (e.g. related to the ergodox PCB net functionality if the net name is not clear enough)
  • post the table in a CODE tag so that it is in non-proportional font and at least somewhat readable
  • hope somebody will check it (it will not be me, I do not have ergodox, I have something different)
  • do not try to create a PCB for now; just connect it with wires to the original ergodox PCB; you probably will make a mistake and it is easier to reroute a wire (hoepfully the mistakes will not fry something :) )
  • if you want to make a helper PCB then first take the ergodox kicad sources and:
    • extend the ergodox shematic with the Bluefruit and the related battery components
    • add two compoments representing connectors from the original ergodox PCB pads to the PCB where you would solder Bluefruit
    • go and design the extension Bluefruit PCB for the new schematic
    • you want to do all this in Kicad to be sure your schematic corresponds to the PCB and the PCB does pass Kicad validation

Great pointers. Can someone point me to the Ergodox kicad source? Did a bit of googling, to no avail.
 

Offline yoobe

  • Thread Starter
  • Posts: 48
  • Location: Rolle, Switzerland
  • Yoobe
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #9 on: Sat, 22 August 2015, 15:41:12 »
Looks like Bluefruit is bigger and will not fit the original space designed for Teensy.
That clearly means it is best to make the mapping so that it corresponds most to the original mapping on ATmega32u4. You indicated you did so. Good. Now the bad things:
  • forget about the schematic drawing; do that directly in Kicad or do not draw it all; it is very hard to follow had drawn lines (table is better) and it will not help you when eventually designing PCBs
  • concentrate on the table, it needs to have 5 important columns (you can add more columns but they can be hidden for now)
    • ATmega32u4 pin name (e.g. PB2)
    • Teensy pad name
    • Bluefruit pad name
    • ergodox PCB net name (you need to know what the pin is sued for; is it driving/scanning rows/columns; is it used for communication with the port expander on the left side; ...)
    • comments (e.g. related to the ergodox PCB net functionality if the net name is not clear enough)
  • post the table in a CODE tag so that it is in non-proportional font and at least somewhat readable
  • hope somebody will check it (it will not be me, I do not have ergodox, I have something different)
  • do not try to create a PCB for now; just connect it with wires to the original ergodox PCB; you probably will make a mistake and it is easier to reroute a wire (hoepfully the mistakes will not fry something :) )
  • if you want to make a helper PCB then first take the ergodox kicad sources and:
    • extend the ergodox shematic with the Bluefruit and the related battery components
    • add two compoments representing connectors from the original ergodox PCB pads to the PCB where you would solder Bluefruit
    • go and design the extension Bluefruit PCB for the new schematic
    • you want to do all this in Kicad to be sure your schematic corresponds to the PCB and the PCB does pass Kicad validation


Thanks for the information.. I made the table today.. see here [size=0px]https://geekhack.org/index.php?topic=22780.msg1843520#msg1843520[/size][/color]
table paste : http://pastie.org/10369047
and I started to make a drawing to see the corresponding pads between teensy and bluefruit... quickly made with photoshop..


109146-0


for the kicad stuff, it is not in my competences :( 
I am a software engineer.. never touched PCB design :)







« Last Edit: Sat, 22 August 2015, 15:47:35 by yoobe »
Yoobe

ErgoDox - Mx Brown
Filco Minila Air - Mx Red
RedScarfII+ VerC - Gateron White

Offline yoobe

  • Thread Starter
  • Posts: 48
  • Location: Rolle, Switzerland
  • Yoobe
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #10 on: Sat, 22 August 2015, 15:45:19 »
    • ergodox PCB net name (you need to know what the pin is sued for; is it driving/scanning rows/columns; is it used for communication with the port expander on the left side; ...)
    • comments (e.g. related to the ergodox PCB net functionality if the net name is not clear enough)


Where to find this information? I looked in the forum and ergodox.org but cannot find a clear information :(
I don't have the software to open the PCD file.


Thanks

EDIT:

I installed Kicad.. I can start to check..

« Last Edit: Sun, 23 August 2015, 03:44:51 by yoobe »
Yoobe

ErgoDox - Mx Brown
Filco Minila Air - Mx Red
RedScarfII+ VerC - Gateron White

Offline yoobe

  • Thread Starter
  • Posts: 48
  • Location: Rolle, Switzerland
  • Yoobe
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #11 on: Sun, 23 August 2015, 03:45:57 »
Here is the pads for the teensy and i/o extender with names/functions


109222-0
Yoobe

ErgoDox - Mx Brown
Filco Minila Air - Mx Red
RedScarfII+ VerC - Gateron White

Offline vvp

  • Posts: 886
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #12 on: Sun, 23 August 2015, 03:58:56 »
Yes, I saw your post in the other thread. I responded here since this seems to be a more appropriate place.

Ergodox PCB net names are identifiers like ROW0 - ROW5, COL7 - COL13, SCLM, SDAM, LED_A - LED_C. You will need to know this assignment anyway when you will be deciding about possible changes in the ATmega32u4 pin assignments. These changes may be needed because the Blufruit board will use some pins for communication with the bluetooth module. These need to stay to be assigned to the bluetooth. And if these pins are also currently used by the ergodox PCB then you need to use different ATmega32u4 pins for the ergodox PCB. You cannot assign one pin to two different functionalities without adding some software and often also hardware overhead.

You will find the Ergodox PCB net names in the kicad schematic for Ergodox. Install kicad (it is free (open source)), download the ergodox kicad files e.g. from here (I do not know whether it is the best place to get them, it is just the first place google returned to me), open the project (*.pro) file in kicad and double click the ErgoDOX.sch in the project browser.

You do not need to be a hardware engineer to do this. It is all only digital and low frequency stuff. There is nothing tricky there. The trickier stuff like e.g. power filtering or crystals are solved for you on the Teensy/Bluefruit PCBs. The only thing you need to keep in mind is the same think you need to know to modify firmware. In the case of ATmega34u4, that means knowing how to handle GPIO pins. The point is if some pins are connected in the hardware (this is called that they share the same net (will have the same net name in your table)) then you cannot drive more than one pin in such a group. That means only one of the connected pins can be output and the rest can be only input. Well, there are exception to this like e.g. common emitter like driving of a shared bus (like in I2C) and of course some other options. But except the I2C you should not need it. Since you indicated you can update firmware for this then it means you know these things. After all you will need to work with GPIO pins, and for these pins, it is the software which defines what is input and what is output.

Offline vvp

  • Posts: 886
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #13 on: Sun, 23 August 2015, 04:12:36 »
Right you can find the names also in a pcb designer as the picture you posted indicates. That is a good source too.

Offline yoobe

  • Thread Starter
  • Posts: 48
  • Location: Rolle, Switzerland
  • Yoobe
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #14 on: Sun, 23 August 2015, 07:22:39 »
I continue to read many information everywhere..


I found out that BLE is supported on windows only after windows 8+..
I do have windows 7 at work.. I am again comparing the 2 options:


Option 1:


Keep the teensy and add one Bluefruit EZ-Link + Battery
Pro:
  • Have bluetooth 2.1: Use on Windows Vista and later..  Linux? Mac? probably..
  • Just cable 2 pins of the teensy to the bleufruit's TX/RX
Cons:
  • Need to cable the battery charger for the teensy and bluefruit and find a solution to use 1 usb port to program 2 board and charge the batery??
  • Cost a little bit more.. not so much comparing the to full price for ergodox


Option 2:


The one we discussed in this thread.. Replace teensy by bluefruit LE micro


Pro:
  • One board to program with one USB port
  • Easy to setup battery/charger
  • Same micro controller.. porting existing firmwares
  • Better battery life?
Cons
  • Bluetooth 4.0 not supported on windows before 8.
  • More cabling work


I will continue to search, maybe order one of each an play with them.

Yoobe

ErgoDox - Mx Brown
Filco Minila Air - Mx Red
RedScarfII+ VerC - Gateron White

Offline mrflow3r

  • Posts: 158
  • Location: Vancouver
    • T
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #15 on: Sun, 23 August 2015, 11:58:01 »
I continue to read many information everywhere..


I found out that BLE is supported on windows only after windows 8+..
I do have windows 7 at work.. I am again comparing the 2 options:


Option 1:


Keep the teensy and add one Bluefruit EZ-Link + Battery
Pro:
  • Have bluetooth 2.1: Use on Windows Vista and later..  Linux? Mac? probably..
  • Just cable 2 pins of the teensy to the bleufruit's TX/RX
Cons:
  • Need to cable the battery charger for the teensy and bluefruit and find a solution to use 1 usb port to program 2 board and charge the batery??
  • Cost a little bit more.. not so much comparing the to full price for ergodox


Option 2:


The one we discussed in this thread.. Replace teensy by bluefruit LE micro


Pro:
  • One board to program with one USB port
  • Easy to setup battery/charger
  • Same micro controller.. porting existing firmwares
  • Better battery life?
Cons
  • Bluetooth 4.0 not supported on windows before 8.
  • More cabling work


I will continue to search, maybe order one of each an play with them.



Can you get both Bluefruit LE Micro and Bluefruit EZ-Link? And test both on Windows 7 and 8? I am curious to see how they differ in battery life. Like you mentioned, I suspect Bluefruit LE Micro will last longer too, but can't tell by how long. Anyways, keep up the good work!
 

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #16 on: Sun, 23 August 2015, 13:07:33 »
Keep the teensy and add one Bluefruit EZ-Link + Battery
I think you need EZ-Key and not EZ-Link (which is only bluetooth serial device, you need HID - but maybe Adafruit provides a firmware to change that).

Option 1/Cons
  • Need to cable the battery charger for the teensy and bluefruit and find a solution to use 1 usb port to program 2 board and charge the batery??
You will only need to program one board (the teensy), the bluefruit ez-key will run always the same firmware - it's purpose it just to receive "keypress packets" over serial from teensy and forward them over bluetooth to the PC.

Battery/charging will be exactly the same difficulty for both "LE micro" and "teensy + ez-key", the difference is only that there will be two extra diodes required for the teensy.

Option 2/Pros
  • One board to program with one USB port
Over the USB you can only program the atmega32u4 on LE micro and not the BLE chip, so it's exactly the same as "teensy+EZ-key". (Except that Adafruit has published a way of changing the firmware on the BLE chip over-the-air - but not USB. EZ-key on the other hand does not have changeable firmware, but it could be configured to some extent.)

More comments:
 - the EZ-key consumes a lot of power (25mA continuously), so with the teensy (10-15mA at best for a keyboard-type firmware) together it's a lot of juice!
 - one thing which always consumes power are the voltage regulators, but there is just one for both options (one on the EZ-key and one on bluefruit LE micro; there's none on teensy which can run on 3.7V-5V).
« Last Edit: Sun, 23 August 2015, 13:09:37 by flabbergast »

Offline yoobe

  • Thread Starter
  • Posts: 48
  • Location: Rolle, Switzerland
  • Yoobe
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #17 on: Sun, 23 August 2015, 15:10:08 »
Keep the teensy and add one Bluefruit EZ-Link + Battery
I think you need EZ-Key and not EZ-Link (which is only bluetooth serial device, you need HID - but maybe Adafruit provides a firmware to change that).

Yes good catch, the EZ-Key should be better even the EZ-link looks like to  support the HID functions..

Option 1/Cons
  • Need to cable the battery charger for the teensy and bluefruit and find a solution to use 1 usb port to program 2 board and charge the batery??
You will only need to program one board (the teensy), the bluefruit ez-key will run always the same firmware - it's purpose it just to receive "keypress packets" over serial from teensy and forward them over bluetooth to the PC.

Battery/charging will be exactly the same difficulty for both "LE micro" and "teensy + ez-key", the difference is only that there will be two extra diodes required for the teensy.

In fact the EZ-Key will not be re-programmed..

I am not enough skilled to solve the Battery/USB cabling to have teensy alimented by usb or battery and communicate with the PC with USB (when needed)
With option two, just need solder the boards..

Option 2/Pros
  • One board to program with one USB port
Over the USB you can only program the atmega32u4 on LE micro and not the BLE chip, so it's exactly the same as "teensy+EZ-key". (Except that Adafruit has published a way of changing the firmware on the BLE chip over-the-air - but not USB. EZ-key on the other hand does not have changeable firmware, but it could be configured to some extent.)

More comments:
 - the EZ-key consumes a lot of power (25mA continuously), so with the teensy (10-15mA at best for a keyboard-type firmware) together it's a lot of juice!
 - one thing which always consumes power are the voltage regulators, but there is just one for both options (one on the EZ-key and one on bluefruit LE micro; there's none on teensy which can run on 3.7V-5V).

I started to fill my shopping cart on adafruit website.. I will check tomorrow with a colleague what to buy in addition as cable and breadboard, and maybe a better solder iron, mine look like this :)

I wonder also to buy a new keyboard kit (ergodox or other layout with external teensy) and play with it, I dont want to break my first ergodox :)
Yoobe

ErgoDox - Mx Brown
Filco Minila Air - Mx Red
RedScarfII+ VerC - Gateron White

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #18 on: Sun, 23 August 2015, 16:56:45 »
I am not enough skilled to solve the Battery/USB cabling to have teensy alimented by usb or battery and communicate with the PC with USB (when needed)
With option two, just need solder the boards..
OK, here's a "schematic" how to connect teensy 2.0 + extra board (e.g. EZ-key) with the LiPo charging unit (e.g. Adafruit Lipoly backpack) and diodes, so that
1) if USB is connected, everything runs from the USB's 5V and the battery is charging
2) if USB is disconnected, everything switches automatically to battery

Drawn schematic picture

The stuff that needs to be added to the existing boards is in red. You'll need to cut a trace on the bottom of the teensy (to disconnect USB's 5V from teensy's VCC), just as described here. One wire from the teensy will go from the "5V" = "topmost" pad on the bottom of the teensy, and the other one from the normal VCC pad on the side.

The point is that the diodes only allow current in one direction. So if USB is connected:
 a) teensy's VCC and EZ-key's VIN are at 5V level from USB
 b) the diode between "BAT" and VCC/VIN prevents the current from flowing back to the battery
 c) the charging unit's 5V is also connected to USB, so the battery is charging.
If USB is disconnected:
 a) teensy's VCC and EZ-key's VIN are powered from "BAT"
 b) the other diode prevents the battery output from going back to 5V on the charger

It may be a good idea to throw in a couple of 10uF caps to make the voltage changes smoother, in case connecting and/or disconnecting the USB cause some trouble with the teensy or EZ-key, like resets.

By the way, this is exactly how is it done on Bluefruit LE Micro, Adafruit Trinkets, etc... I just looked at their schematics and they exactly just use two Schottky diodes like this. The only extra step that's needed is cutting that trace on the teensy.

Offline joric

  • Posts: 136
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #19 on: Mon, 11 April 2016, 18:48:39 »
Did you work with nrf51822? I'm about to order it I like the idea about a single controller.

Firmware: https://github.com/I0x0I/DIY-A-BLE-Keyboard
Flashing: http://www.rogerclark.net/arduino-on-the-nrf51822-bluetooth-low-energy-microcontroller/

Offline Phenix

  • Posts: 591
  • Location: Germany
Re: Bluefruit LE Micro : USB and Bluetooth on one board
« Reply #20 on: Fri, 22 April 2016, 16:25:49 »
So did you (or someone) do it? Really nice idea, would like to get it working (so I can use it as PC and Android phone keyboard)
Winter is coming.