Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 6 of 6
  1. #1

    Standalone buttons

    I thought I'd share a tinkering project I threw together on the weekend: A standalone remote power button.

    I have players all through the house, and use 'the 'group players' addon to run most of the synchronised a lot of the time. So I thought I'd make some simple little on/off buttons to turn them all on/off around the house. I've previously been using 2 hacked Amazon Dash buttons, but as these are no longer available and were always hard to get in NZ, I thought I'd build some.

    The unit is pretty simple, hit the button and it powers up, toggles the players on/off and then powers off again.

    These buttons will be used to make my setup '4 year old friendly' for tuning the music on/off in the house.

    Name:  IMG_20190330_153806.jpg
Views: 564
Size:  93.0 KB

    Parts List
    Small Wooden Box
    Wemos D1 Mini Arduino
    LED Buttons
    PN Mosfet, Transistors and some resistors/diodes.
    Battery from a CX10 Drone

    Assembly
    Putting it all together I followed this circuit diagram for a latching/self collapsing power circuit. I connected the LED of the button to the end power trigger, between the existing diode shown and GPIO pin 2:

    Name:  power-latch-circuit-schematics-esp32-esp8266-arduino-new.png
Views: 543
Size:  8.8 KB.

    I had to sand out the inside of the box slightly to make it big enough for the board to fit flat. From there the power circuit and battery just squeeze in with very little room to spare (although my soldering approach has much to be desired (so I'm sure some of you could minimise things much better).

    Fitting it all in the box is tight:
    Name:  IMG_20190330_153854.jpg
Views: 545
Size:  87.9 KB

    The Result
    Once assembled, a press of the button turns on power to the Arduino. The Arduino runs it's boot up process, connects to the network, and then initiates a web call to turn the squeezebox on/off (url commands here). Following that is waits a second, just to be safe, then turns the GPIO pins to low collapsing all of the power circuit. This approach takes longer to action (as the board has to boot) but it means no electricity is being used when not pressed, so the battery should last ages despite it's small size.

    Name:  IMG_20190330_154100.jpg
Views: 527
Size:  31.9 KB


    Code:
    I'm using the standard ESP8266WiFi.h library and a basic 'get' script as per the examples. I won't post my code here unless there is demand as I've also included a bunch of OTA code update functionality into my script.

  2. #2
    Sorry - I just realised this should have been posted in DIY. Mod's feel free to move. Thanks

  3. #3
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    5,135
    +1!

    If you are in HW mods, I did that a few years ago https://forums.slimdevices.com/showt...nsion-for-Boom.

    All my 5 Booms have been running on it for a few years now. I have some spare equipped board if you want (free)
    Last edited by philippe_44; 2019-03-31 at 22:44.
    LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5

  4. #4
    In a weird twist, my wife has asked me to build some more for very specific usage scenarios.

    My favourite idea so far is to place one in the bathroom for the kids to use at bedtime and set it to automatically a) play a fun 2 minute teeth brushing song for the kids in the bathroom and b) shut of the music in parts of the house where the kids are sleeping.

  5. #5
    Junior Member
    Join Date
    Apr 2019
    Posts
    1
    Awesome project !

    I want to do the same but with a rotary encoder so i can control the volume and turn it on/off by pushing it.
    I have all the hardware but I am a newbie for the programming. Do you think you could share your code so i have a base from which to start ?

  6. #6
    I'm not sure the latching power circuit design I've used here will help you, as fundamentally to get the rotary encoder to work during playing, you'll need to leave the board powered up.

    In saying this, I've added my code below in case it helps. This isn't actually my direct code, rather a slimmed down version removing the extra OTA functionality I put in - I've not tested it, but it should work as it's pretty straight forward.

    Note: the LMS command (IP address, player name and action) are hard coded at the end of the setup() function as it was just easier. You'll need to change your player name

    Code:
    /*********
    Self powering off Squeezebox script. Uses a combination of:
    The latching power circuit and code from 
    https://randomnerdtutorials.com/latching-power-switch-circuit-auto-power-off-circuit-esp32-esp8266-arduino/
    and the standard http functionality in the library ESP8266WiFI.h (as per the examples included in that library)
    https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/ESP8266WiFi.h
    *********/
    
    #include <ESP8266WiFi.h>
    #include <ESP8266HTTPClient.h>
    
    //--------------------VARIABLES TO UPDATE-----------------------------
    
    // Replace with your network credentials
    const char* ssid = "WIFI_SSID";
    const char* password = "PASSWORD";
    
    // Define power latch pin for ESP32 (GPIO 5) / ESP8266 (GPIO 5) / Arduino (Digital 5)
    const int powerLatch = 5;
    
    //---------------------------------------------------------------------------
    
    void setup() {
      // Define pin as an OUTPUT
      pinMode(powerLatch, OUTPUT); 
      
      // Keeps the circuit on
      digitalWrite(powerLatch, HIGH);
    
      // A number of LMS functions can be called by URL, examples are available at http://arduino-projects4u.com/squeezebox/
    
    //-----------UPDATE THIS URL FOR YOUR NEEDS-----------------------
      // URL call to toggle the power status of the relevant player
        callURL("http://192.168.0.1:9000/index.html?player=PLAYERNAME&p0=power");
    //---------------------------------------------------------------------------
    
      // Wait 3 seconds to let URL call complete
        delay(3000);
    
      // Turns the power latch circuit off
      digitalWrite(powerLatch, LOW);
    }
    
    void loop() {
      //This should never run, as the button powers itself off at the end of setup() by turning the powerLatch GPIO to low, collapsing the power circuit.
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •