<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Light Switch Design</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38082/light-switch-design</link><description>We are working on the BLE Smart Switch. The requirements are pretty generic: 
 
 Low Power consumption 
 To be used by multiple smartphones within the house 
 
 The obvious configuration is to have the smartphone as the Client and the NRF device (i.e</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 13 Sep 2018 08:24:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38082/light-switch-design" /><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/148544?ContentTypeID=1</link><pubDate>Thu, 13 Sep 2018 08:24:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1bcf7fa-ca66-4ab6-9043-3e7b80d3366a</guid><dc:creator>joeyh</dc:creator><description>&lt;p&gt;First, thank you for the insightful explanations and new information about multiple central connection that I didn&amp;#39;t know before.&amp;nbsp; You provided exactly the information that I need.&lt;/p&gt;
&lt;p&gt;In our use case, allowing multiple phones to access our device any time is important.&amp;nbsp; Using the algorithm in the example you gave is helpful, but it will not save any power used by our device because the device needs to keep on advertising in order to allow other Centrals to connect any time.&amp;nbsp; In some cases, it will be probably use more power to maintain the connections of the connected devices.&amp;nbsp; Of course, have Centrals already connected should speed up the time it takes to read or update a characteristic.&lt;/p&gt;
&lt;p&gt;From our tests, follow my original described algorithm that when access the device, the mobile client will first connect &amp;gt; then retrieve the list of services &amp;gt; then read/set the characteristic &amp;gt; then disconnected.&amp;nbsp; The whole process takes anywhere from 1.5 seconds to 5 seconds, depending on range and on interference from other devices.&amp;nbsp; We think that the response time is acceptable.&amp;nbsp; Measuring the power usage of the device using PPK, it averages 55uA while advertising at adv interval of 250m, which is not bad.&lt;/p&gt;
&lt;p&gt;Anyway, we will think about the two approaches a little bit more, before deciding which way to go.&amp;nbsp; Power vs Simplicity vs Response Time.&amp;nbsp; At least, I think I now have all the information for the analysis.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/147155?ContentTypeID=1</link><pubDate>Tue, 04 Sep 2018 11:11:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2edbbcfc-90f2-4ce5-a0bc-9914e79ad72d</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;To make an informed decision I think you should read up on the concept of BLE GAP roles. It is particularly important to understand the roles of the peripheral and central, how they connect, and how your system configuration will affect your current consumption and latency. Here are two relevant articles:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://learn.adafruit.com/introduction-to-bluetooth-low-energy/gap"&gt;Introduction to Bluetooth Low Energy: GAP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://punchthrough.com/products/bean/docs/guides/everything-else/how-gap-and-gatt-work/"&gt;How GAP and GATT Work&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Staying connected will probably cause the device to consume more power than necessary.&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;Probably (but not necessarily).&amp;nbsp;When you are advertising you probably&amp;nbsp;want to send out advertising packets at least a couple of times a second to keep the latency low. These packets (probably) need to include some data bytes to identify the switch. When you are in a connection, the only thing you need to do to stay connected is to exchange empty packets &amp;quot;once in a while&amp;quot;. Probably a couple of times a second as well. Once again it will be a trade off between current consumption and latency. But the packets can be empty which means it will require less energy to transmit them. There are also mechanisms you can use to skip packets altogether (slave latency).&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;How can multiple smartphones connect to the same switch at the same time?&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;It is not true that a peripheral can maintain only one link at the time. It &lt;em&gt;used to be true&lt;/em&gt;, but in the past couple of years we have developed BLE stacks that allow you to run up to 20 concurrent links in any peripheral-central role configuration you want. We even have &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.1.0/ble_sdk_app_multiperipheral.html?cp=4_0_0_4_1_2_25"&gt;dedicated examples in the SDK for this&lt;/a&gt;. You can read more about how it works &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.sds/dita/softdevices/s130/multilink_scheduling/multilink_scheduling.html?cp=2_3_1_0_14"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;EDIT:&lt;br /&gt;More useful blogs:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://devzone.nordicsemi.com/b/blog/posts/bluetooth-smart-and-the-nordics-softdevices-part-1"&gt;https://devzone.nordicsemi.com/b/blog/posts/bluetooth-smart-and-the-nordics-softdevices-part-1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devzone.nordicsemi.com/b/blog/posts/bluetooth-smart-and-the-nordics-softdevices-part-2"&gt;https://devzone.nordicsemi.com/b/blog/posts/bluetooth-smart-and-the-nordics-softdevices-part-2&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/147057?ContentTypeID=1</link><pubDate>Mon, 03 Sep 2018 23:01:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e6ce84a-c671-4603-9698-84c43380156f</guid><dc:creator>brian fleming</dc:creator><description>&lt;p&gt;It al depends on the Rx dBm value, and there does not seem to be a set formula.&amp;nbsp; It could even depend on other unrelated BLE devices within range, but my experience of about -60 dBm, the connect time is from 5-30 seconds.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/147015?ContentTypeID=1</link><pubDate>Mon, 03 Sep 2018 14:49:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f9cb9eb-7512-4dd0-80ef-00d49d294742</guid><dc:creator>joeyh</dc:creator><description>&lt;p&gt;I wonder what the typical and worst-case response time for making a Connection to the BLE device is.&amp;nbsp; Will it add significant delay if the mobile needs to Connect first, before updating the characteristic value?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/146858?ContentTypeID=1</link><pubDate>Sun, 02 Sep 2018 06:55:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19f6a5e0-db02-41a4-b9f6-f27703ac5494</guid><dc:creator>brian fleming</dc:creator><description>&lt;p&gt;Sorry, a mistake, but it is difficult because I do not know exactly what you are doing.&amp;nbsp; If you have several BLE devices in a vicinity which are discoverable and they all have the same device name, you will have problems.&amp;nbsp; All BLE devices within range which you wish to connect to, must have different device names.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/146856?ContentTypeID=1</link><pubDate>Sun, 02 Sep 2018 04:05:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d71bcee-be49-4886-a469-f2d0c288a15b</guid><dc:creator>joeyh</dc:creator><description>&lt;p&gt;Yes, Exactly.&amp;nbsp; &amp;quot;Anyone can access the device, but only one at a time.&amp;nbsp; All your BLE devices probably should have the same &amp;#39;device name&amp;#39; which is programmed in&amp;quot;.&lt;/p&gt;
&lt;p&gt;That&amp;#39;s why I said, we will cannot keep the connection between phone &amp;amp; device forever.&amp;nbsp; It must disconnect from time to time to allow other phone to access the device.&amp;nbsp; Thus, the suggestion to disconnect immediately after every button click.&lt;/p&gt;
&lt;p&gt;I guess we will experiment with the speed of BLE connection, and see if reconnect every button click is acceptable or not.&lt;/p&gt;
&lt;p&gt;Another option I see is that, our Mobile App will try to connect to the BLE device (and keep connected) whenever our Mobile App goes to the foreground.&amp;nbsp; It will disconnect as soon as the Mobile App goes to background, or when the phone is turned off.&amp;nbsp; This means once a phone grabs the connection to the BLE device, another phone will not be able to access that device until the original phone switches to another app or have the phone turned off.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/146851?ContentTypeID=1</link><pubDate>Sat, 01 Sep 2018 15:02:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66965999-c9a1-42b8-bcbd-5ead27030f5a</guid><dc:creator>brian fleming</dc:creator><description>&lt;p&gt;I should have said, anyone can &amp;#39;connect&amp;#39; to the device, but only one at a time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/146850?ContentTypeID=1</link><pubDate>Sat, 01 Sep 2018 14:56:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8a5d9c9-bc1c-47b1-9cb2-1d7a17caf5dd</guid><dc:creator>brian fleming</dc:creator><description>&lt;p&gt;Just a note about Stack Overflow.&amp;nbsp; There are lot of trolls on that forum which will do anything they can to humiliate and degrade you, don&amp;#39;t take it seriously.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/146849?ContentTypeID=1</link><pubDate>Sat, 01 Sep 2018 14:51:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e0f7f4e-a872-4205-925c-0cb63266edf4</guid><dc:creator>brian fleming</dc:creator><description>&lt;p&gt;Paragraph 1, yes, once a connection is made, advertising stops, until the connection is lost, by whatever means.&lt;/p&gt;
&lt;p&gt;Glad you clarified on the power source.&lt;/p&gt;
&lt;p&gt;Anyone can access the device, but only one at a time.&amp;nbsp; All your BLE devices probably should have the same &amp;#39;device name&amp;#39; which is programmed in by you with your firmware so that your app will only search for those devices and not find your BLE keyboard etc.&lt;/p&gt;
&lt;pre style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Courier New&amp;#39;;font-size:9.0pt;"&gt;&lt;i&gt;&lt;span style="color:#008000;"&gt;Creating the code to connect to your BLE device via a smart phone can be a real challenge.  Assuming your app will be for Android, here is link to Stack Overflow which I posted, which is as close to &amp;#39;copy and paste&amp;#39; that you will ever get to paste into your Android app and get it talking to your BLE device.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://stackoverflow.com/questions/41776035/send-about-ten-two-digit-numbers-at-a-time-to-a-bluetooth-device-at-random-inter"&gt;stackoverflow.com/.../send-about-ten-two-digit-numbers-at-a-time-to-a-bluetooth-device-at-random-inter&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/146846?ContentTypeID=1</link><pubDate>Sat, 01 Sep 2018 13:24:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20ee8456-1a93-4471-9e65-00fd57df3be8</guid><dc:creator>joeyh</dc:creator><description>&lt;p&gt;Maybe I hadn&amp;#39;t made myself clear.&lt;/p&gt;
&lt;p&gt;These are &amp;quot;battery&amp;quot; powered switches/lights that are meant to be used by anyone in the house.&amp;nbsp; They need to be controllable by anyone&amp;#39;s phone in the house at any time.&amp;nbsp; As we all understand, if 1 phone stays connected to the device all the time, the device will never advertise, and therefore no other user will be able to access the device.&lt;/p&gt;
&lt;p&gt;Without employing a gateway/hub, how can we make it possible for everyone to access these devices?&amp;nbsp; That&amp;#39;s why I suggested &amp;quot;letting the switches stay unconnected&amp;quot;, and only connect when someone press the button on the mobile app.&lt;/p&gt;
&lt;p&gt;AC wiring does not come into play in our use case scenario.&lt;/p&gt;
&lt;p&gt;Joe&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Light Switch Design</title><link>https://devzone.nordicsemi.com/thread/146844?ContentTypeID=1</link><pubDate>Sat, 01 Sep 2018 11:44:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:729e6fdd-d021-4068-b277-3eca392b4425</guid><dc:creator>brian fleming</dc:creator><description>&lt;p&gt;This is my experience.&amp;nbsp; The BLE device advertises to all masters (&amp;#39;it says hello world, I am ready for a connection&amp;#39;) until it makes a connection either automatically, or by the user making a selection on the master.&amp;nbsp; When it has connected to a master, it stops advertising, and other masters can not &amp;#39;see&amp;#39; it.&amp;nbsp; If it automatically made a connection to a master in the same area, that master would have to move out of range, or the user would have to disconnect if another master wanted to connect.&lt;/p&gt;
&lt;p&gt;Re:&amp;nbsp;&lt;span style="background-color:transparent;color:#11171a;float:none;font-family:&amp;#39;GT Eesti&amp;#39;,&amp;#39;Helvetica&amp;#39;,Arial,sans-serif;font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;How can multiple smartphones connect to the same switch at the same time?&lt;/span&gt;, the BLE device can only connect to one master at a time, otherwise chaos would result, if several masters were connected and tried sending data to the BLE device.&lt;/p&gt;
&lt;p&gt;Also from a usability perspective, when a user initiates a connection, the connection may take several tens of seconds in a worst case scenario.&amp;nbsp; Users might not be happy with that.&lt;/p&gt;
&lt;p&gt;Each &amp;#39;switch&amp;#39; would have to have some sort of identifier programmed into it by the user, like bathroom light, bedroom night stand, dining room light, or the app would have to have those selections programmed into it by the user if one switch were to control several lights which is very possible of course, however, the AC wiring for all lights it controlled would have to be routed to the switch when the building was constructed, this could be a problem.&lt;/p&gt;
&lt;p&gt;I hope this helps!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>