Page 1 of 1

On BLE, power consumption and cost.

Posted: 20 Mar 2018, 04:34
by DMA
I spent some time researching BLE (because I semi-promised Muirium a BT model F controller), and since I don't really have any place to write this up so that the next person who'll want to research this has it a bit easier - let it be here.

So, BLE. Huge post from some guy making the energy-harvesting BLE bike speed sensor.
TL;DR: use lowest voltage supported by the hardware, provide that voltage using a buck converter (not LDO - because LDO will just convert all that extra voltage into heat - so for 5V->1.7V that's 2/3 of your battery energy wasted right there), spend most of your time with transmiter AND RECEIVER switched off because those things are super power-hungry.

Some interesting nuances:
1) Internal oscillators use less energy than external crystals, but take longer to start.
1a) You'll need watch crystal. More stable it is - more energy savings you'll get, because you won't have to spend less time with receiver on, waiting for the central to call you. You can just wake up closer to the time you'll be called. WCO will be active _at_all_times_.
1b) The crystal for the processor clock is optional. In fact, if you only wake up for really short periods of time, it may be more energy-efficient to use internal oscillator because you'll spend less time waking up that way.
2) Since you'll spend lots of time sleeping - selection of processor clock frequency is not as straightforward as it seems. Higher frequency may lead to less power consumption because you'll be done with calculations sooner and can get back to sleep faster.

I also tested altering the HID descriptor to allow for 20 bytes - 1 for mods, 1 reserved, and 18 for keys, and only providing boot mode. It actually works, so 18 KRO is achievable on BT4.0. Note: you really want to keep your data packets shorter - because max. L2CAP MTU for BT4.0 is 23 bytes - that leaves 20 bytes for payload. Not only that - the longer your packets are, the longer transmitter runs and the more heat it generates. I've read about problems with chip overheating and losing stability when sending large packets.

I also tested proximity sensor on the BLE module - looks like it is possible to wake up the keyboard when you put your fingers near it and quickly shutdown when you no longer sense those. That should save some juice too. Need to think how to hide the sensor wire in the case though - or if it possible to use the keyboard assembly itself as a sensor.

Since all of the above can't be bought as a prototype kit (It is possible to frankenstein together 2 kits - but even then you'll need power supply/battery charger (LTC3558-based, for example) - so total for parts will be like $50 and it won't look pretty) - I decided not to make this.
Although if enough interest is there - like, for example, something like model MF suddenly resurfaces - I will consider making a custom device. Won't be cheap though :( Probably cheaper than mind_prepared's (though he doesn't make _that_ much money off his) - but not dramatically cheaper.

Posted: 20 Mar 2018, 08:09
by matt3o
I'm trying to work on that since forever. BT is one of the most frustrating protocols there is and even if you get it working on one system, you try it on another and it doesn't work anymore. I need a wireless Whitefox!

Posted: 20 Mar 2018, 14:18
by pfoff
With a little help it should be possible to get tmk running on chibios on a dirt cheap nrf51822. I have a working Apple IIc board converter build on top of their sdk example. But I had no success when trying to compile tmk with the patched chibios on it. Another route maybe to build tmk via the mbed framework. Had no time yet to test it!-(

Posted: 21 Mar 2018, 02:21
by DMA
matt3o wrote: I need a wireless Whitefox!
How would you solve the BT antenna placement in that aluminum case? Where you'll put the battery?
What would you do with those LEDs when on battery power?

Posted: 21 Mar 2018, 13:45
by pfoff
I don't have a whitefox, but for sure that may be solved. The nrf chip is very small, maybe one can mount it with the antenna outside the case. How many LEDs are we talking about? Think I should have another look at the whitefox, to see what would have to be done there. The ble chips use very few power so the battery can be realy small. Cellular phone batteries are really thin, so there should be a place.
I will have a look at the white fox this night. Matt3os designs are always great, so I could end up building one!?-)

Posted: 21 Mar 2018, 20:31
by matt3o
they mount antennas in 100% aluminum laptops/tablets/phones, I don't think that will be a problem. Maybe you need a small plastic trapdoor somewhere on the bottom or the back. That won't be a problem. The case would probably need to be taller to host a battery though.

Regarding LEDs... no LED is the best LED :D