Hi All,
This is probably a common project idea, but needless to say I'm trying to do it my way.
Background:
The vehicle already has ambient lighting led's in the footwells and the center console but warm white only. My initial testing shows it is dimmed via PWM in steps that I've not been able to acertain, but they're visible steps. My DMM isn't great, but has TrueRMS and has a frequency measurement mode, which shows the PWM being at a low 200Hz - the spec sheet says it can measure up to 10Khz so I'd say more or less this should be close enough for information needed. I'm starting with the footwells and the content below surrounds this part.
Goals:
- Utilise existing lamp housings
- Do not use any additional wiring where possible
- Add RGB control
- Retain brightness control
- Utilise existing controls in the car by capturing the CAN bus data
What I've done so far:
I've sourced parts so far that should more or less be complete but I'm struggling on a few areas which I will detail below. I've laid out a PCB to make sure everything will fit and needless to say, it's tight! The original PCB measures at just 26mm x 12mm. Looking at the plastic housing in a bit more detail has allowed me to design my own PCB with some 1.5mm 'wings' in places. See attached for the incomplete layout thus far. Height is where I have a little more space, so the wireless transceiver actually sits atop the micro. The micro I have specified as an Atmel ATMEGA328P. It originally was going to be an ATTINY85.
Parts Specified:
- MCU: ATMEGA328P
- LED: WS2812B 2020
- 5V Regulator: ST LDL1117S50R
- 3.3V Regulator: ST LDL1117S33R
- Transceiver: XY-WB 2.4G (This is a chinese knock-off type thing of the nRF24 series)
- Smoothing Caps: 2x 33uF 16V Tants
Assumptions / Design choices:
- The 328P will use an Arduino loader, with fuses set to internal osc @ 8Mhz, 5V.
- I've used an Arduino compatible MCU as it's something I know very well.
- The XY-WB was the smallest solution I could find for wireless comms in a broadcast fashion.
- I figured I could try and measure the PWM input and apply the dimming level to the output.
Questions:
- Is the WS2812B a good option, or should I be looking to drive a normal RGB LED from the pins of the MCU?
- Will the two caps I have be enough to provide enough charge to the circuit? My estimates suggest the circuit should only draw around 10 to 15mA from the regulators, and MCU. The LED is around 60mA total at full white, however this would be limited so probably around 30mA in total for the whole circuit.
On the last question (and this has been my main sticking point), I'm trying to calculate if from the PWM signal I can gain enough charge to run the circuit no matter what the dimming level is. Without an oscilloscope I am going to struggle - I understand this. I did some testing with a single 33uF cap and managed to successfully measure a DC voltage of around 7V at 'full' brightness (I'll explain more shortly), and around 3V at the lowest level before off. I only had a single cap to hand at the time and 33uF seems to be the largest I can get in a TAJ-B casing. The vehicle only outputs actual full brightness when the doors are opened or the courtesy lighting comes on after engine stop.
From this I have the following questions:
- Will a linear voltage regulator be happy with a partially smoothed DC, or will it freak out?
- Are my measurements actually correct? I saw the LED on the existing PCB basically stay at full brightness throughout the whole dimming curve with the exception when it plummeted from (my measured) 7V to 3V.
- Am I going about this the right way, is there a better way to smooth a PWM signal and attempt to achieve or store close to the peak voltage (rather than average) based on my maximum current requirements?
I've not even got to the TX side yet, however I don't perceive any issues with that element as it will be a custom module I attach and hide somewhere.
Thanks for reading, and any advice would be much appreciated!