This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Light Switch Design

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. the switch) as the server.  Because we are still new to BLE technology, we are wondering:

    When a Smartphone is nearby, should the mobile App connect to the devices automatically and stay "Connected" (with the BLE connection)?

The problem with "staying connected" is that:

  • Staying connected will probably cause the device to consume more power than necessary.
  • How can multiple smartphones connect to the same switch at the same time?

I suppose all BLE switches would have these same issues.  So I would assume someone else must have already solved this.

The only solution we can think of is to have the switches stay unconnected, and will only connect when the user clicks "On" or "Off" in the mobile app.  This means the mobile app would have to first connect, then update the specific characteristic.  Wouldn't this cause a longer delay to switch the light on or off?

Any advise would be greatly appreciated!

Joe

Parents
  • This is my experience.  The BLE device advertises to all masters ('it says hello world, I am ready for a connection') until it makes a connection either automatically, or by the user making a selection on the master.  When it has connected to a master, it stops advertising, and other masters can not 'see' it.  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.

    Re: How can multiple smartphones connect to the same switch at the same time?, 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.

    Also from a usability perspective, when a user initiates a connection, the connection may take several tens of seconds in a worst case scenario.  Users might not be happy with that.

    Each 'switch' 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.

    I hope this helps!

Reply
  • This is my experience.  The BLE device advertises to all masters ('it says hello world, I am ready for a connection') until it makes a connection either automatically, or by the user making a selection on the master.  When it has connected to a master, it stops advertising, and other masters can not 'see' it.  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.

    Re: How can multiple smartphones connect to the same switch at the same time?, 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.

    Also from a usability perspective, when a user initiates a connection, the connection may take several tens of seconds in a worst case scenario.  Users might not be happy with that.

    Each 'switch' 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.

    I hope this helps!

Children
  • Maybe I hadn't made myself clear.

    These are "battery" powered switches/lights that are meant to be used by anyone in the house.  They need to be controllable by anyone's phone in the house at any time.  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.

    Without employing a gateway/hub, how can we make it possible for everyone to access these devices?  That's why I suggested "letting the switches stay unconnected", and only connect when someone press the button on the mobile app.

    AC wiring does not come into play in our use case scenario.

    Joe

  • Paragraph 1, yes, once a connection is made, advertising stops, until the connection is lost, by whatever means.

    Glad you clarified on the power source.

    Anyone can access the device, but only one at a time.  All your BLE devices probably should have the same 'device name' 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.

    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 'copy and paste' that you will ever get to paste into your Android app and get it talking to your BLE device.

    stackoverflow.com/.../send-about-ten-two-digit-numbers-at-a-time-to-a-bluetooth-device-at-random-inter
  • Just a note about Stack Overflow.  There are lot of trolls on that forum which will do anything they can to humiliate and degrade you, don't take it seriously.

  • I should have said, anyone can 'connect' to the device, but only one at a time.

  • Yes, Exactly.  "Anyone can access the device, but only one at a time.  All your BLE devices probably should have the same 'device name' which is programmed in".

    That's why I said, we will cannot keep the connection between phone & device forever.  It must disconnect from time to time to allow other phone to access the device.  Thus, the suggestion to disconnect immediately after every button click.

    I guess we will experiment with the speed of BLE connection, and see if reconnect every button click is acceptable or not.

    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.  It will disconnect as soon as the Mobile App goes to background, or when the phone is turned off.  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.

Related