RPI audio - remote power control

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hi there.

Even though I've been running RPIs and (HAT) DACs for years, I wasn't happy with
my powering setup. The handling of it to be exact.

I've still been pulling plugs all the time for that purpose. No remote control.

Things around the handling got worse with the introduction of Allo Shanti.
The Shanti supply is quite a nice PS.
However. It IMO comes with several downsides.

Pretty much all of them I could resolve by introducing below solution. :D

And here it comes:

I finally built myself a Wifi controlled powering solution based on a Mikrocontroller ESP8266. :D

You'll get these controller boards and related relay boards for a couple of bucks
over at Amazon and elsewhere.
As power supply any 5V supply will do. There'll be no (dirt) impact on the audio power rails. These are gonna be 100% separated.

Once you have it all wired up, you then need to flash the firmware (via USB) of the ESP8266 microcontroller board.
"Tasmota" IMO is the firmware of choice.
Then there's a bit of configuration work. Luckily the Tasmota firmware offers a micro webserver for that task. You'll find a lot of HowTos on the net. That microcontroller
is well known. It's usually also part of these $10 mains socket solutions. That's actually
where it all started on my side. Flashing one of these to get my coffee machine and lights under (remote) control without being forced to use some whatever cloud solutions. ;)

There are apps providing the remote front-end on your smart-phone. Every web-browser will also do.
It took me some hours to get it all working.
Once you know how it's done, it becomes a piece of cake to build another one.

Having such a great solution at hand can solve and solves me a lot of weak spots and issues on my RPI/DAC solutions.

Such as:

1. Wifi remote power control
2. RPI on/off switch
3. DAC on/off switch
4. on/off timing (e.g. DAC first - there have been discussion around that ;) )

For Allo Shanti users:

5. Decoupling/separating Allo Shanti outputs
6. No turn on/off issues (thumps, stress on parts etc.)
7. No discharging of supercaps over sink (DAC/RPI etc.)


Of course. There's more. Once you get this ESP8266/Tasmota management under control, you'll quickly realize how much fun it is to add this or that (DIY) home automation project to the list.

DIY at its core. :D

Enjoy.
 
"Alexa, turn on the tubes" and all of my audio gear comes on, including a RPi with Boss HAT. I use a TP-Link wifi enabled outlet, as I use their products for my lights too. I can also work it with their phone app but the Echo is plugged into the adjoining outlet. I guess if Amazon wants to know when I turn things on and off the can look.
 
If you really want to use Alexa you can also do that with Tasmota flashed devices.
Alexa is just another frontend option.

What's IMO most important:

* Tasmota is opensource. You know what you get. ;)
* With Tasmota you don't need any device controller/management in the net (local network or cloud)


BUT. If you really want to run your very own solution, you could also program these ESP8266 yourself. There are plenty of HowTos out there.


Just to mention it. I use the Python based "esptool.py" to flash my devices with the Tasmota binaries.

These firmware binaries you could (should) also build yourself, if you want to make sure to be on the save side. There are also HowTos on the net.

The whole stuff is very well documented. These are IMO really fun projects.

Enjoy.
 
I'm still in the process of optimizing though.
OK. "Still" !?!?. That's actually a permanent situation since decades. ;)

The actual relays are a challenge on its own.

First is the overall quality and the quality of contacts in particular.
Some Qs come to mind.

What's the contact impedance/resistance (change over time) ?
What's the contact durability?
Is there any contact bouncing?
What's the active state current consumption? (Usually that's too high on the cheap boards)

That led to my current challenges in that area:

* finding a relay (board) with high quality contacts (3A minimum)
* getting the active state power consumption down (dual-coil or latch)

If anybody's been down that road. Advise is highly appreciated.

Enjoy.
 
There's nothing outdated.

* the ESP8266 is still used in most current basic IoT products/projects out there.
* it's ususally around 30% cheaper
* and it's much better supported and documented

For just switching a couple of relays that device is IMO more then sufficient.
What matters much more then the actual MCU feature list, IMO is the quality of its implementation.
And don't forget. People need to get the projects done easily. That's much better accomplished with mature products.

It's not that I hadn't looked at these ESP32 devices btw.

****

I did also have a look at solid state relays. These do seem to add all kind of non-linearities.
However. If you have a nice solution (board or product @ 3A ) in conjunction with the ESP at hand
or in mind -- shoot, I am all ears.
 
Last edited:
Did you look at the Sonoff stuff?
They have a few versions of SSR's with ESPs, widely used by diy home automation types.
I think most, if not all have ul certification. Maybe cemark too, I look for ul being in the us. Some of the cheaper chinese stuff may not have these certs, would stay away from those.

I have home automation using Home Assistant on a pi3 as the main piece, but I also have Node Red running on another pi3 (faster then when on same pi3). Then I have ESPs around the house for various purposes. I have some ESPs where I bought a ESP board, connected the gpio's to a SSR board, and control things like sprinklers. Most of my ESPs are running espeasy with a MQTT interface to the pi3's.
I also have some switches I bought, to turn on and off power to ac plugs. I want to put tasmota on these but haven't got around to it.
Via node red, I can control all of my esp's via alexa. Unfortunately, that and the ac plugs interface through the cloud. Everything else is local.

Randy
 
ESP8266 has definitely enough power for the switching task, no doubt. If it is not planned to be used for more purposes, why not. New designs do recommend ESP32, but it will not make a difference here.

You asked about the relays, I hinted to SSRs. Their non-linear distortion will have no effect for power supply lines. Not for signal paths, I mentioned that.
 
Did you look at the Sonoff stuff?

Yep I did. Tasmota used to be called Sonoff-Tasmota not long ago.
That's where my journey started.
I bought some power plugs (SP111) from GOSUND, because these were much smaller and cheaper then the Sonoffs, and flashed these.
The related flash process usually requires direct cabling (4 wires) to the boards to do the initial Tasmota flash though. That's a bit annoying. These do a great job in the house though.


These tiny USB modules are IMO more convenient to handle in my audio projects. Flashing straight via USB is a huge advantage.


I left MQTT alone for the time being. I didn't want to have another server hanging around.
 
What you could do, is use a normal relay and an ssr next to eachother.
First switch on the ssr, then (after a short delay) switch on the regular relay.
Then allow some time for contact bounces and then switch off the ssr.
This prevents arcs and also avoids the ssr from getting hot.
When you want to switch off, use the ssr again to protect the relay contacts.
If you're not using fakes, then the above might be unnecessary :D
 
IMO for this use case the ESP family is the perfect fit. Simple installation, trivial wifi configuration, read-only flash storage (huge advantage for IoT application, no shutdown sequence, no corrupted filesystem requiring fsck, etc), trivial setup (unlike linux which requires quite some configuration to handle unattended reliable operation). Plus several times cheaper (RPi Zero + decent SD card).
 
@phofman

You still owe me a nice example for an SSR (that you've been suggesting). ;)
I now spent some time on it. Most of them I found are AC types.
Since you hinted to these as a good alternative, I guess you
had a specific solution in mind.

Keep in mind. I look for

* a DC output type. (AC-out SSRs can't handle DC-out)
* one that can handle 3A and
* won't become an auxiliary heater.



THX
 
DC SSDs (MOSFET based) are still more expensive than regular relays. An example being e.g. G3VM-101HR2 Omron Electronics | Mouser Deutschland Yes, a classical relay still makes more sense for DC (unless zero switching noise is required which is not in this case).

BTW you do not need 3A continuous current, just capable of peak current How much power does the Pi4B use? Power Measurements – RasPi.TV

On the other hand - did you consider the option of switching the AC to the chain power adapter/s so that they are not powered at all?

Also, do you have the RPi shutdown sequence resolved?
 
Another drawback to the pi zero is you can only buy one at a time (at least those are the rules from adafruit).

What version of the esp are you using?
I would stay away from the esp01's. While cheap, with only two gpio pins you can hardly do anything useful with them.
I mostly use the mini d1 or mini di pro (better antenna for better wifi connections when far from router). They are other cards that you can plug into them, and they sell bases that you can plug them into. The bases make a mini motherboard, makes it easier to wire up for more complicated uses.

Randy
 
Thx for the OMRON link.
You obviously also realized by now that my suggested solution is not the worst approach to begin with. ;)

I do have ESP based AC switches around. Looking at AC switching was not the challenge.

****

However. I did have issues with turn-on thumps and cap-sucker noise on the supercap charged DC rails.
On top of that this supercap-charged supply was discharging its supercaps
over the attached devices after being turned off (via AC).
Some devices simply start acting strange if driven into the grey-zone.

That's been covered now.

****

I actually was facing a challenge on the power-up sequence.
It popped up when learning that the DAC should better be started prior to the RPi.
(At least in some cases.)
That obviously is now addressed by having two separate relays on the DC rails and the ESP to control it.

Powerdown is IMO not an issue. I'm running my RPi on Raspbian in overlay-mode. (see raspi-config). That's a read-only mode for the root partition.
The risk to get anything grilled at hard-powerdown is pretty low now. And even without this overlay-mode it used to be very low in recent years.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.