Hello again,
It has been a while, but I found a suitable relay, and have a smoothing method for the PWM signal so that it can be used to trigger the relay. The whole setup is getting closer and closer.
The relay I selected is an OMRON G3VM-61VY3 , it is a solid state relay, MOSFET based, rated for 60V and 700mA. It's a surface mount chip that will go on the PCB, it's also very small which is great.
Datasheet is here:
https://www.farnell.com/datasheets/2614461.pdf
I couldn't find if it's rated for 700mA in general, or for 700mA at 60v, which would imply it can take more current at lower voltages.
Either way, I won't be exceeding 700mA anyway. Below is a breakdown of current draw in different situations.
Current draw is mostly based on the number and brightness of the LEDs, the more LEDs and the brighter they are, the more current is drawn.
With the strip I am using, 52 LEDs are needed to cover the full length of the door trim panel, so I tested the current draw with 52 LEDs.
brightness 65 (day mode) ----------------------------------------- 110mA
brightness 20 (night mode) --------------------------------------- 95mA
max current at door open/close swipe animation --------------- 115mA
max current at startup animation (brightness up to 200) -------- 245mA momentarily
current at max (brightness 255) ----------------------------------- 315mA
So the whole system draws 315mA at full brightness, (this will never be used as it's just too bright) which is below the limit.
At normal day mode usage it's going to be 110mA at most, and while doing the animations it goes up to 245mA very briefly, so it's still well below the limit
When it comes to smoothing the signal, I saw that simply adding a decoupling capacitor between the signal and ground does the job.
For example if you have a 9V PWM signal at 50% duty cycle, a large enough capacitor will smooth it out and give a linear voltage of roughly half of the input.
You can see an example of this here:
circuit 1 - just decoupling capacitor
And what happened when I put the circuit together:
The issue here is that the signal I want to use to trigger the relay is also driving the inside door handle illumination LED.
It will still work, but this smoothed voltage that is now averaged to about half of its original value, will cause a drop of brightness in that LED, compared to when driven by PWM.
To avoid that, I saw that we can split the signal into two lines and add a diode on one branch, so on the first branch the door handle LED gets the original PWM signal, and whatever is after the diode on the second branch is smoothed out and can be used as relay input.
This circuit is illustrated here:
circuit 2 - diode and capacitor
I find it works quite well and a much smaller capacitor is needed.
Simulations are one thing and real life is another, but they are close. In my testing I used an Arduino board to generate the test PWM signal, however the Arduino is capable of generating PWM of 5V at 490Hz, so a bit different than the 9.3V at 156Hz coming from the car (I was expecting 12V but saw 9.3V on my oscilloscope shown in the last post, so I'm going with it and not questioning it), meaning the real capacitor value will need to be selected while testing on the car itself.
The picture below shows the original input PWM signal in yellow and the smoothed output signal in blue. Output voltage is a bit lower as the voltage drop across the diode is 0.7V
The voltage of the output signal doesn't matter (as long as it's not too low), but an appropriate resistor needs to be selected to drive the relay input at around 5-25mA of current.
I noticed that the button illumination signal is also PWM, so a similar smoothing will be needed, so that the attiny85 can properly sense this signal and switch between day and night mode.
This signal needs to be between 3.5V - 5V, to give a logic 1 to the attiny85, so I might need to have the smoothing circuit followed by a voltage divider to drop it down.
Both PWM signals will have their duty cycle vary with the backlight brightness adjustment. I need to take that into account as well, so that smoothing works throughout the whole range.
The puddle light signal to detect door open/closed is not PWM so the original plan of using a voltage divider will work here
I noticed that the voltage regulator on the attiny85 that I have gets warm when powered with 12V, I looked it up and saw that it is a 78L05 and it's rated for only 100mA.
I ordered a different version of the attiny85 board with a 78M05 regulator rated for 500mA instead. Again that will be a safe margin, as you can see from the picture the regulator is quite a bit different.
I have yet to identify a constant 12V source at the door to use at the other side of the relay, but I have pictures from when i took the door card off, and it's probably going to be one of these: