Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

RGB Ambient Lighting project for Palladium Model S - lets do it

This site may earn commission on affiliate links.
Im not sure if I will be able to accomplish what I envision. I have a raspberry pi already in the car since I use it with teslausb project. The pi has gpio and the elk led lights are so common that there’s already GitHub repos to control them. So my idea is to make the ambient lights somehow a steady input down to 3.3 v and then a simple script that would issue the Bluetooth command to power on/off the strips mimicking the relay (but there would be no relay). This way, when dark you still get a trigger on from the ambient lights turning themselves on. Not sure if it’s worth pursuing but seems like a good way to get myself more involved with hardware and circuits. Will share any updates. I’m with @Proppilot, this is a fulfilling project but it is so much time I doubt I would do it for someone else. I can now understand why this project cost a lot when/if you go to a shop.
 
I made some progress, straight forward there are command lines you can use after you install bluez package in raspberry. I am able to control the lights using Bluetooth, so now I only need to make the interface, make sure I wont fry my pi, make a script that reads the tesla ambient light input (currently triggering the relay) and fires the Bluetooth instruction to power on the leds.
 
Behold Siri Voice controlled RGB lights
tutorial included ;)

Its gonna blur soon and I will rerecord it with no personal info available before I make it public.
This is amazing! I already created the shortcut, along with a few gestures, and I haven't even taken my LEDs out of the box!

I have taken this a tiny step further by having the shortcut wait for 10 seconds, then turn off voice control. This way, there is no need to ask Siri to stop listening:

1712607828908.png
 
  • Love
Reactions: taekua
Im not sure if I will be able to accomplish what I envision. I have a raspberry pi already in the car since I use it with teslausb project. The pi has gpio and the elk led lights are so common that there’s already GitHub repos to control them. So my idea is to make the ambient lights somehow a steady input down to 3.3 v and then a simple script that would issue the Bluetooth command to power on/off the strips mimicking the relay (but there would be no relay). This way, when dark you still get a trigger on from the ambient lights turning themselves on. Not sure if it’s worth pursuing but seems like a good way to get myself more involved with hardware and circuits. Will share any updates. I’m with @Proppilot, this is a fulfilling project but it is so much time I doubt I would do it for someone else. I can now understand why this project cost a lot when/if you go to a shop.
I ordered some voltage sensors (5 for 6 bucks) should be in tomorrow, I should be able to wire one of them to the pi and the OEM ambient light cable. Next, I will write the scripts to read from them and issue the power on command for the lights. Additionally I plan to do a Bluetooth scan every so often and detect if my phone is no longer in range with the pi, and in such event also issue a power off command this way, upon exiting the car you don't even need to worry on powering off. I know this might deviate from the original purpose of the forum but I think its worth sharing. Once I'm all done I will put up a tutorial with all the pieces.
 
I got the sensor working, and tested against the OEM bin light signal (PWM). I needed a A2D converter to go between the sensor and the pi. So no blockers to move forward, I also got a bash script that pings the mac address of my phone (no need to pair the pi with the phone) and when its unreachable, sends a command to the rgb lighs to turn off. everything is set, Im not blocked. TODO:
1.- Make python program executable from the bash
2.- Make the bash script consume the python program OR python program can send the bluetooth commands directly to the rb lights
3.- Soldering and wiring. Need to solder cables to a 4 pin connector that will sit next to the pi.
4.- Secure the sensor and the Analog 2 Digital converter to a box, perhaps one shell of the subcontrollers.
5.- Document everything including a tutorial.

This project (and teslausb (dashcam))hooked me a bit into DIY electronics. I have also ordered an Arduino UNO R4 WiFi ($27) which should be able to also do the voltage sensing and the phone pinging so no Raspberry would be needed at all. I will try this once I complete the current way so I can keep things separate.
 
I got the sensor working, and tested against the OEM bin light signal (PWM). I needed a A2D converter to go between the sensor and the pi. So no blockers to move forward, I also got a bash script that pings the mac address of my phone (no need to pair the pi with the phone) and when its unreachable, sends a command to the rgb lighs to turn off. everything is set, Im not blocked. TODO:
1.- Make python program executable from the bash
2.- Make the bash script consume the python program OR python program can send the bluetooth commands directly to the rb lights
3.- Soldering and wiring. Need to solder cables to a 4 pin connector that will sit next to the pi.
4.- Secure the sensor and the Analog 2 Digital converter to a box, perhaps one shell of the subcontrollers.
5.- Document everything including a tutorial.

This project (and teslausb (dashcam))hooked me a bit into DIY electronics. I have also ordered an Arduino UNO R4 WiFi ($27) which should be able to also do the voltage sensing and the phone pinging so no Raspberry would be needed at all. I will try this once I complete the current way so I can keep things separate.
You have no idea how I wish I understood half of what you said! Well, he looking forward to a final solution that is easily implemented for idiots like me
 
I still have a couple of weeks before I can get down and dirty with this project, but I have started prep, such as soldering barrel connectors onto the controller power cables, etc.

Until such time that @taekua or @Proppilot come up an ingenious solution to use the Ambient controls, as I mentioned in up-thread, I was planning on using the OBD as a power source. The power will go on instantly with door opening, and goes off as soon as I leave the car. That does not solve the issue of controlling the lights while driving, except for from the app. The siri controls that taekua help solve that issue as well, and almost easier to use that navigating the menu. Hey, what a second: is there a voice command in our Teslas to turn on and off ambient lights???

Question: if I have a separate power source already set up for these lights, can I use the hot wire from OBD as a way to activate the relay? Is it okay that it is a 15.1 Watts? I don't think that doing it this say gives me an advantage over just powering straight from the OBD itself, except for that if it comes time to fix it the way we want, all I have to do is swap out the relay (or not).
 
Question: if I have a separate power source already set up for these lights, can I use the hot wire from OBD as a way to activate the relay? Is it okay that it is a 15.1 Watts? I don't think that doing it this say gives me an advantage over just powering straight from the OBD itself, except for that if it comes time to fix it the way we want, all I have to do is swap out the relay (or not).
100%. You can use the ODB hot to trigger the coil on a relay. BE CAREFUL ! as relays are usually 12 and 24 volts so check the range to make sure the 16 volts we have in the car will not burn out the coil

That being said (and I am going to test this today) I purchased a solid state relay that takes 3-32 volts DC IN and can control 5-110 volts on the output. Why a SSR ? I have been reading that they can take the type of signal (PWM) that our existing lighting system outputs and can trigger the output. I have been in Europe for work and just got back so that is the test today. If this works, we will have a < $ 20 solution that will connect to the ambient light circuit and back to PLAN A to control from the touch screen. I will report in a few hours. It works on the bench.
 
  • Like
Reactions: taekua and 4SUPER9
I still have a couple of weeks before I can get down and dirty with this project, but I have started prep, such as soldering barrel connectors onto the controller power cables, etc.

Until such time that @taekua or @Proppilot come up an ingenious solution to use the Ambient controls, as I mentioned in up-thread, I was planning on using the OBD as a power source. The power will go on instantly with door opening, and goes off as soon as I leave the car. That does not solve the issue of controlling the lights while driving, except for from the app. The siri controls that taekua help solve that issue as well, and almost easier to use that navigating the menu. Hey, what a second: is there a voice command in our Teslas to turn on and off ambient lights???

Question: if I have a separate power source already set up for these lights, can I use the hot wire from OBD as a way to activate the relay? Is it okay that it is a 15.1 Watts? I don't think that doing it this say gives me an advantage over just powering straight from the OBD itself, except for that if it comes time to fix it the way we want, all I have to do is swap out the relay (or not).
I’ll dig into this approach, in arduino(27 bucks) I already have voltage sensor (1 dollar) working for the OEM ambient lights, I guess I could do one more voltage sensor to the obd port. When obd looses power, issue rgb power off command with arduino, and upon getting power on the obd power them on. Ambient lights would also on and off issue the commands. The potential advantage on this is that this works like a virtual relay, however, in the scenario when you walk in into your car, lights turns on, close the door oem ambient light signal goes off, rbf goes off. There has to be some logic applied as of when to act on those signals, the last thing you want is getting on into your car then rgb goes off. One other advantage of this setup is that (like in my case) despite of ambient lights not turning on until it’s gets dark enough, I can still override with my phone.
 
Tesla put a LOT of engineering into controlling those lights. There are multiple modes to those lights.

- door open / on full / ambient light button does nothing
- door closed / on full / ambient light button works
- car in drive or reverse / lights dim based on daylight / ambient light button works

I am testing with a SSR (solid state relay) that activates at 3 volts and it worked perfectly in all cases EXCEPT when the lights dim. The 'trigger' light on the SSR illuminates dimly but it is not enough to power the circuit.

The final trick I am going to try and then I am waiving off of this approach and going with ODB power is to add a simple LC filter on the input to the SSR with a 10k resistor in series with the signal from the lighting circuit and a 0.1 uF capacitor across the +/- terminals of the SSR on the input side. This little circuit will charge up by the PWM signal from the lighting circuit and I am hoping it is JUST enough to trigger the SSR. If this works, it is a < $ 20 in parts and is a hardware solution.

I checked out what @taekua is doing with the Arduino and the voltage sensor and that is a slick way to control this as well albeit for the more tech savvy so I am hoping we have two solutions for on/off from the 'ambient light' button plus we have a solution here using the ODB port to power the controllers and we have two ways to control the lighting scenes. From IOS in the Lotus app directly and via SIRI voice control.

I am really hoping for the hardware control via the screen to work and will definitely set up the SIRI voice commands. I do something similar at home using Alexa and my Z-Wave VERA home automation system for setting ambient lighting scenes around the home.

I apologize for only being able to go at this in fits and spurts. Between work travel and some personal things that have come up, time is weekends only.
 
Tesla put a LOT of engineering into controlling those lights. There are multiple modes to those lights.

- door open / on full / ambient light button does nothing
- door closed / on full / ambient light button works
- car in drive or reverse / lights dim based on daylight / ambient light button works

I am testing with a SSR (solid state relay) that activates at 3 volts and it worked perfectly in all cases EXCEPT when the lights dim. The 'trigger' light on the SSR illuminates dimly but it is not enough to power the circuit.

The final trick I am going to try and then I am waiving off of this approach and going with ODB power is to add a simple LC filter on the input to the SSR with a 10k resistor in series with the signal from the lighting circuit and a 0.1 uF capacitor across the +/- terminals of the SSR on the input side. This little circuit will charge up by the PWM signal from the lighting circuit and I am hoping it is JUST enough to trigger the SSR. If this works, it is a < $ 20 in parts and is a hardware solution.

I checked out what @taekua is doing with the Arduino and the voltage sensor and that is a slick way to control this as well albeit for the more tech savvy so I am hoping we have two solutions for on/off from the 'ambient light' button plus we have a solution here using the ODB port to power the controllers and we have two ways to control the lighting scenes. From IOS in the Lotus app directly and via SIRI voice control.

I am really hoping for the hardware control via the screen to work and will definitely set up the SIRI voice commands. I do something similar at home using Alexa and my Z-Wave VERA home automation system for setting ambient lighting scenes around the home.

I apologize for only being able to go at this in fits and spurts. Between work travel and some personal things that have come up, time is weekends only.
Definitely no need to apologize! This is strong work. Every bit that you do here is really appreciated. Besides, we all get it: we have lives besides Tesla, hence why I have 3 days set aside for this project when my wife is away.

As far as the ambient circuit goes, I am trying to translate your plan into simple language: you are going to dumb-down the source from the OBD, and combine it with the Ambient light source, and combine them to activate the trigger when the ambient source is too weak. Did I get that right?

This got me wondering. Please forgive me, but I have seen buck converters that do the reverse of what we did with our cars, and boost voltage up. Is that something that can be done with the Ambient source, maybe with a diode so that no power gets pushed back (I don't think it would anyway). If the SSR allows for a wide range of inputs, then up-converting the signal would still be within tolerance when not dimmed.

BTW, I already had an OBD splitter built for powering my radar (which I really don't need anymore as I get older, but still is fun to have), but just bought this one which should make for an even cleaner install. I have to retest it, as I have not used it in a couple of years, but I believe orange is switch power, and purple is ground. I will confirm later.
 
Definitely no need to apologize! This is strong work. Every bit that you do here is really appreciated. Besides, we all get it: we have lives besides Tesla, hence why I have 3 days set aside for this project when my wife is away.

As far as the ambient circuit goes, I am trying to translate your plan into simple language: you are going to dumb-down the source from the OBD, and combine it with the Ambient light source, and combine them to activate the trigger when the ambient source is too weak. Did I get that right?

This got me wondering. Please forgive me, but I have seen buck converters that do the reverse of what we did with our cars, and boost voltage up. Is that something that can be done with the Ambient source, maybe with a diode so that no power gets pushed back (I don't think it would anyway). If the SSR allows for a wide range of inputs, then up-converting the signal would still be within tolerance when not dimmed.

BTW, I already had an OBD splitter built for powering my radar (which I really don't need anymore as I get older, but still is fun to have), but just bought this one which should make for an even cleaner install. I have to retest it, as I have not used it in a couple of years, but I believe orange is switch power, and purple is ground. I will confirm later.
The problem with these links as they take you to an overall page. Is it the true 'splitter' product that would plug in to the ODB port and then a tech could plug a reader into one 'pigtail' and you would take power from the other ?

So my testing is only related to tapping power off the existing ambient light circuit. A super easy access point is pulling off the lower back cover on the console and there is a little round light buried in there. When the lights are dim the voltage is too low to trigger my SSR so I am going to put a couple of components on the input to the SSR that 'smoothen out' the waveform going to the light to give a higher voltage and hoping that will trigger the SSR. If it does...we are golden... If it is a BUST then I am going your route with the ODB splitter.

I don't think the BUCK will work as the voltage is just so low. Tech Tutorial. The way Tesla is dimming the lights is by chopping up the voltage at a high rate and having the power OFF more times than it is ON (but at about 160 times per second). This is called PWM or Pulse Width Modulation. They are not actually lowering the voltage level, at a high rate they are switching the voltage on and off 168 times per second. At full brightness, it would be ON 100% of the time. At 50% brightness it would switch between ON and OFF 168 times per second and the 'average' voltage would be half of that of full brightness.

The idea of the resistor and capacitor is that they form a circuit that will charge up to a higher voltage than exists as the capacitor is like a bucket that you can fill quickly and empties slowly. While in operation the capacitor is filling up more and more so the voltage that will go to the SSR will be higher than without the circuit.

HA ! so much for simplifying but hope it brings SOME clarity. I may even be able to test this on Wednesday or Thursday this week as it is a very simple procedure.
 
  • Love
Reactions: 4SUPER9
Because I’m new to microcontrollers, I have put a lot of work including learning curve for arduino and raspberry pi, tutorials help but only to some degree and despite of what theory says, having open source hardware, there are sometimes bugs that slow you down until you find a way around them. @Proppilot a cheap arduino board can help you convert from the pwm using a voltage sensor, you can then trigger a HIGH on an arduino connect this to trigger the relay (flip to low signal trigger).
With what I have learned over the past days this is very doable. I can help with the coding piece of the microcontroller. You could also add a button to toggle manually.
this chip + voltage sensor should be under 15 bucks both.

Myself I am very deep into a rabbit hole, but enjoying the trip and the learning process.
For my setup, I been able to use the arduino to read the voltage on the OEM ambient lights, arduino then creates a BLE (bluetooth low energy ) service that offers this data on demand. My pie will poll the state and combined with my phone signal control when to power the RGBs. I know this is a very complex solution, I am trying to simplify it to the use of arduino only so I can have a solution for everyone else. It would be of help if I could understand how the subcontrollers pull information from the main one.

I will keep exploring until I get a simple clean nice solution.
 
  • Like
Reactions: 4SUPER9
The problem with these links as they take you to an overall page. Is it the true 'splitter' product that would plug in to the ODB port and then a tech could plug a reader into one 'pigtail' and you would take power from the other ?

So my testing is only related to tapping power off the existing ambient light circuit. A super easy access point is pulling off the lower back cover on the console and there is a little round light buried in there. When the lights are dim the voltage is too low to trigger my SSR so I am going to put a couple of components on the input to the SSR that 'smoothen out' the waveform going to the light to give a higher voltage and hoping that will trigger the SSR. If it does...we are golden... If it is a BUST then I am going your route with the ODB splitter.

I don't think the BUCK will work as the voltage is just so low. Tech Tutorial. The way Tesla is dimming the lights is by chopping up the voltage at a high rate and having the power OFF more times than it is ON (but at about 160 times per second). This is called PWM or Pulse Width Modulation. They are not actually lowering the voltage level, at a high rate they are switching the voltage on and off 168 times per second. At full brightness, it would be ON 100% of the time. At 50% brightness it would switch between ON and OFF 168 times per second and the 'average' voltage would be half of that of full brightness.

The idea of the resistor and capacitor is that they form a circuit that will charge up to a higher voltage than exists as the capacitor is like a bucket that you can fill quickly and empties slowly. While in operation the capacitor is filling up more and more so the voltage that will go to the SSR will be higher than without the circuit.

HA ! so much for simplifying but hope it brings SOME clarity. I may even be able to test this on Wednesday or Thursday this week as it is a very simple procedure.
Excellent explanation and much appreciated. I really hope your ideas pan out. @taekua solution looks promising, but definitely more complex. Hopefully, if he gets it working smoothly, he can dumb-down the solution for others like me.

Sorry the links are not working. I just tested it and they are working for me, even if I log out of Amazon. It may be because I am using the US version of Amazon, and you are on the Canadian one. The name of the splitter is

bbfly-A9 OBD II OBD2 16 Pin Splitter Extension​

and the link is: https://www.amazon.com/dp/B0711LGRGQ?tag=tmc064-20&th=1

Yes, the OBD splitter works just like it should, so a tech should theoretically be able to plug in and do what they do, while you snip off the connector at the other end to grab power (and ground). I say theoretically, because Tesla does not use the OBD port, not ever I believe. Besides, the beauty of using the OBD is that it takes a quick second to unplug it if needed. The only reason why I stopped using it was because I used it to power my radar, and every time I opened and shut a door or the trunk, it would power off then back on and go through it's 15 second startup sequence. There was zero delay. If it stayed on for even 15 seconds, I would have kept using it.
 
  • Like
Reactions: Proppilot
Update: the wiring on my the OBD splitter listed above does not match the standard OBD colors. I attempted to tear apart the end that I snipped off to match colors with pins, but it is molded together and it does not seem possible. I think I may have figured it out, but seemed to have tripped the eFuse at the last second and I am done for the evening. I will try again later when I have more time.
 
Good news! after several hours because of some poor documentation, I am able to power ON/OFF the rgb lights using exclusively arduino via BLE command.
This approach leaves out pinging phone's bluetooth, meaning I would not rely on my phone's bluetooth for the rgbs to go on.

With arduino and one voltage sensor from the OEM ambient lights we can turn the PWM signal into an input to the arduino then we can decide to act on it or ignore it.

the behavior with the ambient lights would be, when the voltage senses OEM are on, issue the command to turn the rgb on and when they get off we can issue the command to go off.

I believe ambient lights go on as soon as you open your door and turn off eventually (assuming they are not on the screen).

In my case, where OEM ambient lights seem photosensitve, the rgb going off is not too much of a problem as I can override with the voice control and despite of being sunny I would be able to turn them on.

For you this can work as a virtual relay, you would get control on the screen and auto off when you exit your car as the lights will eventually go off.
I need to work on the program to ensure its flexible in case you have a slightly different model or controllers that doesn't work with the same parameter as mines.

I'm eager to complete this project, but this week and next are going to be crazy at work. I will try to complete over the weekend.
I like this more simplistic approach. its almost 3am!!!

so TLDR
no relay needed,
an arduino board with BLE (bluetooth low energy) support ~$27 (you might find a cheaper alternative but I'm unsure if my code would run in it)
a voltage sensor ~$6
3 female to male dupont wire ~$6

The amount of tabs I had to open to get to this point is ......
1713261025940.png
 
Good news! after several hours because of some poor documentation, I am able to power ON/OFF the rgb lights using exclusively arduino via BLE command.
This approach leaves out pinging phone's bluetooth, meaning I would not rely on my phone's bluetooth for the rgbs to go on.

With arduino and one voltage sensor from the OEM ambient lights we can turn the PWM signal into an input to the arduino then we can decide to act on it or ignore it.

the behavior with the ambient lights would be, when the voltage senses OEM are on, issue the command to turn the rgb on and when they get off we can issue the command to go off.

I believe ambient lights go on as soon as you open your door and turn off eventually (assuming they are not on the screen).

In my case, where OEM ambient lights seem photosensitve, the rgb going off is not too much of a problem as I can override with the voice control and despite of being sunny I would be able to turn them on.

For you this can work as a virtual relay, you would get control on the screen and auto off when you exit your car as the lights will eventually go off.
I need to work on the program to ensure its flexible in case you have a slightly different model or controllers that doesn't work with the same parameter as mines.

I'm eager to complete this project, but this week and next are going to be crazy at work. I will try to complete over the weekend.
I like this more simplistic approach. its almost 3am!!!

so TLDR
no relay needed,
an arduino board with BLE (bluetooth low energy) support ~$27 (you might find a cheaper alternative but I'm unsure if my code would run in it)
a voltage sensor ~$6
3 female to male dupont wire ~$6

The amount of tabs I had to open to get to this point is ......
View attachment 1038932
I love the project. I used one of these boards a few years ago to add Z-wave compatibility to a Raspberry Pi I use for supervisory/control of my home generator. So easy to program. Once you finalize your code would you share ? This is not that complex to do and we may even be able to put a few units together to send out to the people here that may be interested. In my own search, I stumbled across the voltage sensor board you are using and noted it worked with an Arduino board. At first I thought....too complicated....but the more it is refining, it is not bad. Now I am thinking that if my SSR / filter hardware approach does not work I am going to pull my Arduino board out of my 'dead projects' basket as I removed it a year ago when I changed my home automation infrastructure.
 
  • Like
Reactions: taekua
Update: the wiring on my the OBD splitter listed above does not match the standard OBD colors. I attempted to tear apart the end that I snipped off to match colors with pins, but it is molded together and it does not seem possible. I think I may have figured it out, but seemed to have tripped the eFuse at the last second and I am done for the evening. I will try again later when I have more time.
Do you have a volt/ohm meter that you can use to ohm out (continuity checker) between the pins and the wires ? I think you know what pins you need. You just have to map it to the wire colors being used on the connector. Like the RGB wiring colors we are working around with these various lighting products we are connecting. You would THINK they would use red, green, blue and black wires !!!! In most cases they DO but the red wire does not map to the red signal :-(