Bluetooth Connectivity Options for the Shower

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
neodem
 
Posts: 4
Joined: Tue Feb 21, 2023 6:23 pm

Bluetooth Connectivity Options for the Shower

Post by neodem »

Hi.

I'm trying to build out a solution to control my very old Logitech Squeezebox Touch. The touch can be controlled via TCP so my rough plan is as follows:

1) buy/build a waterproof bluetooth controller/transmitter for my shower that has a few buttons on it.
2) put a Rasberry Pi about 20' away in my closet that will receive the bluetooth
3) write code for the Pi to map the bluetooth button presses into the appropriate TCP commands
4) have the TCP commands go to my LAN via wifi/wired connection

I'm stuck on (1). I can't find any controllers (though admittedly I'm a bad googler). I did find an adafruit board that may be able to help me if I choose to build something.

Do you all have thoughts on my plan? I'm open to all ideas. I'm a good coder, ok electronics hacker.

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluetooth Connectivity Options for the Shower

Post by adafruit_support_mike »

If you're already using Wifi, it will be easier (and a bit more effective) to use that for your in-shower control panel.

Protocols from the Bluetooth family are moderately difficult to use. First, they separate devices into 'central' and 'peripheral' categories. Central devices initiate and control all data connections. Peripherals advertise their presence, but otherwise just sit and wait for a central to connect and tell them what to do. There's no concept of central devices talking to each other (though two devices can run as both a central and a peripheral), and peripherals don't even know other peripherals exist.

The protocol now known as Bluetooth Classic is the only one fast enough to transmit real-time audio (though I know that's not what you're trying to do here), and it's openly hostile to third party tinkerers. The hacker-friendly version is Bluetooth Low Energy (BLE), but in most cases you need an app on the central that knows how to look for the peripheral, open a connection to it, locate the data it wants to use, and interpret that data for a user.

There is a somewhat-generic workaround these days though: most wireless keyboards now use BLE, so most devices that can act as centrals (computers, tablets, phones) already know how to interact with a peripheral that acts like a BLE keyboard. As long as having a pseudo-keyboard connected to the central and pumping out character data doesn't interfere with anything, you can use that for a text-based interface.

Another quirk of the BT central/peripheral relationship is that peripherals can't send information to a central when they want to. The central has to poll the peripheral to see if any new information is available, then it has to request the information. That creates some unhappy tradeoffs between responsiveness to the peripheral and the cost of polling an idle connection.

Wifi sidesteps most of that. It assumes peer-to-peer communication, and there are huge amounts of existing code to handle one Wifi device connecting to another and sending a message. Web interfaces tend to be the most common, but there are many other transfer protocols, and you're even free to create your own.

User avatar
neodem
 
Posts: 4
Joined: Tue Feb 21, 2023 6:23 pm

Re: Bluetooth Connectivity Options for the Shower

Post by neodem »

Oh this is super interesting and helpful. I guess I never even considered that bluetooth may be a bit annoying to deal with, but maybe I should have.

Yes, you're correct, I could just use WIFI, I have experience working with TCP/IP so that shouldn't be an issue.

But that brings us back to hardware. Do you, or anyone else, have thoughts on what kind of hardware I could use (construct) to solve this?

I guess some initial requirements would be:

1) WIFI enabled
2) Able to handle 4 button inputs
3) Efficient battery, but also able to charge from time to time
4) ability to program it (mini SD card? upload code via SSH?)
5) Waterproof enclosure

Thank you again for your help!

User avatar
neodem
 
Posts: 4
Joined: Tue Feb 21, 2023 6:23 pm

Re: Bluetooth Connectivity Options for the Shower

Post by neodem »

Also, followup: If I decide to learn about/play with bluetooth for this (or in the future), are there good books/tutorials on how to use it? Your post alone was super informative and taught me a lot. I'm super intrigued.

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluetooth Connectivity Options for the Shower

Post by adafruit_support_mike »

For the enclosure, a membrane keyboard would probably be a good choice.

You can find them in pretty much every calculator and TV remote: the keys you press are all part of a monolithic sheet of elastomer (usually some kind of silicone rubber). Each key sits at the top of a thin-walled cone that collapses when you push the button. In the ones produced at industrial scale, there's a small chunk of conductive plastic embedded in the back of the button, and it connects exposed PCB traces when you press the switch:

https://www.adafruit.com/product/1611
https://www.adafruit.com/product/1616

For one-off builds, you can use tact switches instead:

https://www.adafruit.com/?q=tactile+swi ... =BestMatch

Many devices that use membrane keyboards have a solid faceplate with holes for the keys to stick through, but that isn't mandatory. You can build a functional membrane keyboard with a flat sheet of rubber over the tact switches, but molding a panel with some low, shaped bumps will look and feel better.

The obvious advantage for an in-shower device is that the membrane is an unbroken sheet of waterproof material. In theory you could make the whole outer surface of the enclosure a single piece of molded elastomer, but in practice it will probably be easier to use a plastic box with a bezel that holds the membrane.

Eric Strebel and Robert Tolone have YouTube channels that deal with that kind of thing (especially casting silicone or plastic):

https://www.youtube.com/@EricStrebel
https://www.youtube.com/@RobertTolone

Eric is an industrial designer, so he covers a wider range of techniques and designs. Robert is a mold maker and excels at creating what are known as 'squish molds'.

If you're willing to invest the time and materials, a hard plastic inner shell with an overmolded cover can look very professional:

https://www.youtube.com/watch?v=iTY2ABhtTKg

Build the inner box so it has O-ring gaskets to keep water out of any panels you need to remove later, like to replace or recharge a battery. If you can hide those panels under the overmolded shell, you'll get an extra layer of leak protection.

As a final step, I'd suggest putting some silica gel dessicant inside the enclosure as a final layer of moisture protection. You can bake or microwave silica gel to drive out any water it's absorbed, and it will be ready to soak up humidity again.


In terms of electronics, an ESP32 microcontroller should be able to handle the job easily. I'd suggest using one of the older versions like this:

https://www.adafruit.com/product/3405

because Espressif (the company that makes the ESP8266 and ESP32) has a habit of releasing hardware as a sort of public beta. Some features aren't implemented when a chip first goes on sale, and the firmware API gets tested in the field by early adopters.

That's fine for developers who know they're dealing with a work in progress, but presents a nasty reality check to people who expect a feature-complete product out of the box.

The original ESP32 has been around long enough (since 2016) to be pretty solid:

https://www.adafruit.com/product/3405

The Feather above is designed to work from a LiPo, which gives you a power source.

User avatar
neodem
 
Posts: 4
Joined: Tue Feb 21, 2023 6:23 pm

Re: Bluetooth Connectivity Options for the Shower

Post by neodem »

This is amazing.

Thank you so much for all these ideas! It looks like I've got a bunch of planning/work to do to get this moving but now I have a GIANT headstart.

Thank you again!

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”