Home automation, Light dimming

May 15, 2024, 18:15

milekat

Hello, I'm looking for build a light dimming on my house, using a PIZero 2W or a PI4. I searched for dimming modules, I found this product : https://fr.aliexpress.com/item/32802025086.html "Dimmer 8A-400V" look good but I'm a bit afraid as it's a chines product, I wont burn my house <:CH_PepeWizard:704997748461535314> Did someone already tried this module / know another good module to make lights dimming ?

oops.se

Note! Working with live voltage can be deadly! And using such module with Raspberry Pi isn't ideal as the Pi isn't a real time OS and with that module you need to detect the zero crossing and then turn on the load and turn of it after desired time. and this has to be performed with milli second precision. That module is more suitable for a Arduino and not as a beginners project. I would NOT recommend that module as it is a live module. I would recommend https://itead.cc/product/sonoff-mini/ or https://itead.cc/product/sonoff-basicr2/ or similar depending on where you will deploy it. And replace the firmware with tasmota (https://tasmota.github.io/docs/) firmware and then you can control it with a Raspberry Pi via the MQTT protocol.

milekat

Many thanks for your reply, I’ll check all your link this evening, but about the Os I’m looking for use HomeBridge

oops.se

HomeBridge is an application, the OS is "Raspberry Pi OS". And HomeBridge can easily integrate with Tasmota devices among many others.

milekat

Okay thanks

milekat

The 2nd link is just a basic switch (ON/OFF) without dimming ?

oops.se

Sorry, I think both are. My point is to use that type of module instead of the uninsolated module.

oops.se

Those are uninsolated as well.

milekat

They say "24V", but on the board it's written 250VAC/10A

milekat

What do you mean by "uninsolated" ? The primary and secondary can connect ?

oops.se

The PCB is uninsolated

oops.se

VCC: Module supply voltage 5V / 12V / 24V

oops.se

The relay coil is a 24v, but there is 5v available

milekat

Oh that's not a big deal, I will put the board into a safe box

oops.se

Ok if you feel confident

milekat

And Rasbp deliver 5V DC

milekat

So I think it should be good

oops.se

Then I would suggest you use a "Wemos D1 mini" as a controller for the relays

milekat

Since it's selled by an Official Raspberry reseller, I hope it's enough safe to be used

oops.se

The GPIO on the raspberry Pi is 3,3v

milekat

All ?

milekat

I was thinking some are 5 😭

milekat


milekat

I just saw this but currently not tested

oops.se

But some of the relay boards has drivers (transistors) that drives the relay and they can accept 3,3v

oops.se

All GPIO is 3,3v

milekat

Hm

milekat

So my relai will not work 😦 because of VCC: Module supply voltage 5V / 12V / 24V

milekat

I need to find another one with 3,3

oops.se

Or 5volt that can accept 3v on the Input.

milekat

Yes

milekat

What's are the 2 "+5V" GPIO pins ?

milekat

The GPIO 2 and 4

oops.se

+5v is NOT GPIO

oops.se

That is the 5v rail on the Pi

milekat

I think I need to read the whole pins doc, I missed so much points :c

oops.se

And you can't use that to heavily and relays can create nasty votage spikes

oops.se

GPIO = General Purpose In/Out

oops.se

+5v is the 5 volt rail, 3,3 as 5v but 3.3vvolt

milekat

They supply power (Out) or 'read' signal (In)

oops.se

+5 volt is static 5volt

oops.se

and 3,3 the same

milekat

Okay got the point

oops.se

and GND is the common ground

oops.se

And then the GPIO can have special features as I2C, Serial, SPI

milekat

PWM also is a "special features" ?

oops.se

And as I have suggested use a "Arduino" to control the power module, relay or TRIAC (dimmer)

oops.se

Yes, as the special features demand more precise timing and such, than the OS cant make, aka Real time

milekat

As Arduino is not a computer, I can't use it directly with my HomeBridge, but maybe I can 'control' an Arduino using the Raspb ?

oops.se

Arduino can have a firmware that can communicate over WiFi with HomeBridge

oops.se

And the protocol is often MQTT

milekat

You recommand Wifi over cable ? (If I go for an Arduino, they will be in the same box)

oops.se

So what I suggest is: Raspberry Pi (HomeBridge) <-> WiFi <-> Wemos D1 with Tasmota - Relay/Dimmer

oops.se

If you go with Arduino/Tasmota you can separate the HomeBridge and control many Arduino/Tasmota devices over WiFi scattered around the apartment/house

milekat

Hm I prefer your first suggestion I think

oops.se

That is how I have built the automation in the apartment. The advantage is that you separate the "live voltage" devices, the system is modular and eatch arduino/Tasmota device has a web page that you can control each device separately.

oops.se

And I can say that there is a high probability that your Pi will crash.

milekat

What’s happen if the Raspb crash with Homebridge running on it ? The Arduino cards will change their states ?

oops.se

No they are autonomous devices.

milekat

Hm that’s sounds good 🤔

milekat

Well more « safety »

milekat

Many thanks for all your tips regarding my requests

oops.se

Example of the UI on a Tasmota/Arduino device. And there you can se the "Toggle" function.

milekat

Oh you have W consumption ?

oops.se

Yes some of the "SonOff" devices has that feature

milekat

Not bad, for bulbs it’s not really useful as W consumption is very low for bulbs but it’s a nice to have

oops.se

It is a "Nice to have" and it wasn't so much higher price.

milekat

For this example ? Do you have any references to advise for the Relay/Dimmer ?

milekat

I do not need a 10A switch, I'm using low consumption led bulds (Max 3 per Relay/Dimmer), I think a 1A should be good 🙂

oops.se

10A is kind of standard.

milekat

Okay

milekat

Do you have any refs ?

oops.se

Ref for what?

milekat

Relais / Dimmer

oops.se

I don't understand?!

milekat

I mean good product references

oops.se

I read the product datasheet when I buy stuff. So the answer is no!

milekat

okay 🙂

oops.se

eBay and Aliexpress and similar has seller that come and go and sometimes they sell other products with same part no.

oops.se

And for ready made products as sonoff, I buy products where the firmware can be changed to opensource based firmware as ex. Tasmota.

oops.se

I dislike vendor lock in firmware.