Uncategorised ideas

Ideas and projects that don’t fit in the other categories

  • ATtiny85 as mode memory for switching light bulbs

    I have a few light bulbs with mode memory, that can switch to different scenes (bright/medium/dim) using the wall switch. I like this, because there’s no fiddling with remotes or wireless setups, it just always works.

    I want to install red LED lights in my room and switch to those at night. However, there are no light bulbs with mode memory that can switch between white and red – those only exist as “smart” bulbs and usually with RGB. I don’t want “smart”.

    My large light fixture has space for many light bulbs. I’m thinking about making my own E27 splitter/socket with mode memory, so I can install a regular white bulb and a regular red bulb and switch between them from the wall switch.

    Idea: use an ATtiny85 microcontroller, a two channel SSR board for switching the E27 sockets, and a little 5V power supply. Maybe use a capacitor to measure on startup how long ago the thing was switch off, and decide whether to alternate output or stick with mode memory based off that.

    Could even add an RTC and switch automatically at set times. But at that point, I might as well use an ESP32. And then use 2ch triac dimmer module so I can automatically dim, too.

    To be continued.

  • Automatic power off circuit for active speaker

    Thinking about ways to automatically turn off the PSU of an active speaker. I have two options on my mind:

    1. Locally switching PSU, with a floating input detection circuit
    2. Remotely switching PSU, with a power signal line from audio source

    Option 1 has the advantage that if it’s not connected to anything, the speaker will turn itself off. Also, no remote power signal is needed, so it can be connected with just a mono jack. However, to switch it off remotely, the source has to disconnect its output. An audio signal detection circuit would prevent the need for that, but I don’t like to turn off the amplifier when there is no signal e.g. between songs. This option needs a little battery to keep the detection circuit powered.

    Option 2 has the advantage of being a little simpler, especially on the amplifier side. There is also no need for a battery. It does however need a stereo jack. Disconnecting input turns on the PSU, but I guess a simple “on/remote/off” power switch next to the jack could solve that.

    1. Locally switching PSU, with a floating input detection circuit

    Idea is to inject a miniscule DC sense signal (e.g. 4V through a 1MΩ inject resistor) onto the amplifier input, and use a comparator to measure impedance. If impedance is very high (input is floating so voltage is high, especially if amplifier has a coupling capacitor), keep PSU off, if impedance is lower (input connected so voltage is low), turn on PSU.

    To prevent audio signals turning off the PSU, filter out the AC at the comparator (e.g. low pass using 1MΩ sense resistor plus 1µF capacitor). I doubt 4V DC at ~4µA would do anything to the source output so I don’t think I need coupling capacitors there.

    Comparator would power an SSR that turns on/off the PSU. To power the sense signal and comparator as well as SSR, use a small Li-Ion battery. Float the battery from PSU using an isolated buck converter when powered on. Preferably use a protected battery. If I stay under 100µA, a 2000mAh 18650 could last over 2 years without power. Unfortunately, the most widely available comparator (LM393) draws closer to 400µA which brings battery life down a bit. Could run it with a timer and latch circuit to bring down average current to maybe 100µA, but that seems like a lot of work. Either get a lower power comparator, or just use a protected cell and accept that once every couple of months the amplifier needs to be turned on.

    Would have to figure out how to drive the SSR module directly from the comparator without much current draw in off state.

    To remotely switch off from the source, the source would need to lift its outputs. Putting anything in the signal path introduces noise, but something like a TS5A23157 analogue switch module with relatively low R_on and very low distortion should be inaudible.

    Parts list:

    • 18650 protected cell
    • isolated buck converter set to battery float voltage + output diode
    • LM393 comparator module (plus SSR drive circuit)
    • SSR module
    • 1MΩ Resistors and 1µF capacitor
    • TS5A23157 module for source

    2. Remotely switching PSU, with a power signal line from audio source

    Use a stereo jack cable; TRS with control signal on the ring. 5V turns the active speaker off, 0V turns it on. In active speaker, use 5V NC SSR board in two modes:

    1. Off / Control = 5 V:
      Power the SSR board directly from the 5 V signal line. Current draw is negligible (few µA or less, just leakage).
    2. On / Control = 0 V:
      Signal line can’t supply 5 V any more. Instead, power the board from a small 42 V→5 V DC converter.

    Buck converter must be isolated to prevent ground loop, and use Schottky diodes to prevent backfeeding into the control signal line. Use a capacitor by the SSR large enough to bridge the gap between powering on PSU and buck converter giving 5V.

    There should never be 5V and signal at the same time through the wire, so no added noise expected as long as 0V is really 0V. I guess I can use an optocoupler, another isolated 5V buck converter and a pulldown resistor to audio gnd, to prevent injecting noise onto 0V. To prevent damage from DC with wrong connection, limit 5V output to just enough current to keep the SSR board powered.

    Alternatively, directly inject 5V DC control signal onto audio signal. This allows using a mono jack cable instead, and again, audio and 5V should never be on the line at the same time. However, this would require filtering out AC at the SSR, and DC at both the amplifier and the source, and might be more difficult to prevent ground loops and noise. Also, higher chance of damage if connecting a different amplifier. Separate wire seems like a much better idea.

    Reflection, issues

    Option 1 seems elegant but very sensitive, e.g. to floating ground and false triggering. Switching module at source will likely add pops/noise when turning off amp.

    Option 2 seems more robust, but need to think about wiring. For instance, can the source handle connecting a mono cable, shorting the 5V to gnd? I guess with good current limiting, that shouldn’t be a problem.

    Ultimately, both options seem like a lot of work and can potentially introduce noise, without solving any real problems. Is it really so bad to have to get up and control a physical on/off switch, instead of a software one?