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

Tesla Wall Connector load sharing protocol

M_VdM

Member
Mar 31, 2016
46
23
Belgium
Have a look at the first page of this old thread HPWC Hacking: wk057 managed to reverse engineer the Front-panel LEDs on the old HPWC ... Don't know if this is still the same on the new TWC ?

On the controller side (SBC), you might consider a "RPi-clone" like an OrangePi Zero (or one of it siblings).
The original OPi Zero supports PoE - but be sure to use optocouplers to properly isolate your RS485 port in that case !
 
  • Helpful
Reactions: Ulmo
Nov 14, 2015
212
281
Southern California
git repository updated.

All JTAG pins are spewing constant 3.3V with no signal I can recognize in my scope. However, I found there's near zero resistance between a particular pin on the JTAG (3rd pin down on the left), pin 2 on the LED cable (top left pin on charger main board), and the blue wire that goes into the charger handle. I couldn't find anyone who says what the charger handle wire colors mean, but this teardown of the UMC handle implies that blue is 3.3V used to power things in the handle. Purple is pilot (12V unplugged from car), orange is maybe antenna (0.028V), and I have no idea what black is (2.27V). None of the wires are ground.

Anyway, I assume those three connected things (two pins and the blue wire) are 3.3V "Vcc" power supplied by the charger and it would be safe to try running the pi off any one of them. Anyone disagree? Any other tests I can do to verify?
 
Nov 14, 2015
212
281
Southern California
Have a look at the first page of this old thread HPWC Hacking: wk057 managed to reverse engineer the Front-panel LEDs on the old HPWC ... Don't know if this is still the same on the new TWC ?

On the controller side (SBC), you might consider a "RPi-clone" like an OrangePi Zero (or one of it siblings).
The original OPi Zero supports PoE - but be sure to use optocouplers to properly isolate your RS485 port in that case !

I've looked through that thread a few times and it appears the HPWC uses a 6-pin connector with 3.3V being the max voltage supplied. TWCs use a 10-pin connector and seem to have 3.3V and 14V power pins.

Cool idea using a PoE pi but I don't want to run ethernet into the TWC if I can avoid it. Pi Zero W has onboard wifi. What's the purpose of optocouplers? Do I need that if I run off 3.3V from the TMC? Or 5V from a wall wart?
 
Nov 14, 2015
212
281
Southern California
Sadly, according to this, the USB doctor I'd been using to measure power use is highly wrong so I'm probably using about 50mA more than it reports.

More sadly, neither of the USB rs485 adapters runs when the pi Zero is running off 3.3v power (I'm not using power from the TWC, just power from a 3.3V wall power supply connected to wires soldered to pi's "3V3" and ground pins). I reinstalled with Raspbian Lite and disabled the HDMI port and power LED to save as much power as possible. Pi is no longer running desktop, just SSH access. After booting, my clamp amp meter shows 0.13A @ 3.23V = 0.4199W = .08A @ 5V with an SSH connection over wifi but that's not running TWCManager since the USB rs485 doesn't have enough power to operate.

So, gotta find an rs485 option that runs at 3.3V and wait for it to be delivered, or give up on the 3.3V dream...
 
Nov 14, 2015
212
281
Southern California
So, I got the pi and USB rs485 running off the 14V pin of the LED board cable. I'm leaving the LED board unplugged for now to make sure I don't overload the 14V supply.

Pi powered off 14V through UBEC.jpg 14V and ground pins.jpg

The wires sticking out of the pi case are soldered to:

Red: 5V pin 2
Black: Ground pin 6
Blue: 3V3 pin 1

Blue isn't used in this case but was used with a 3.3V power supply (in which case, red was unused).

Despite losing the LEDs, I'm very happy to reach this point where I can screw the cover back on completely and not worry about water getting in. Plus I don't have to have an ethernet cable hanging out our window for rs485 communication.

BTW, those orange and clear Wago "lever-nuts" are the best thing ever for connecting wires in a quick, insulated, and reusable way. They work on 12 to 24AWG, solid or stranded wire, up to 32A, 600V. I use them any time I rewire a 120V AC item in the house or work on a low voltage project.

Details:

Here's the pinout of the 10-pin cable that connects to the LED board on the front of the TWC (pin numbers come from silkscreen on LED board and this schematic is based on looking at the end of the cable):
Code:
 ____|---|____
|  1 3 5 7 9  |
|  2 4 6 8 10 |
 -------------
14V: 1
3.3Vcc: 2 (tied to blue wire in charger cable and Vcc pin of TLC59116 16-LED driver chip on the board)
Ground: 6, 8
3.3V: 5 (not tied to chip Vcc so more likely a signalling pin)
0V: 4, 7, 9
0-3.3V variable: 3

Lacking the correct parts, I set up an overly-complicated rig to test how many amps the LEDs on the TWC draw on the 14V pin. I tried to rush to get done before lunch (bad idea) and accidentally got one row of pins offset by 1, so the 14V pin ended up not connected to anything and thank goodness all the other offset pins were 0 to 3.3V feeding into pins intended to take those voltages.

Spider rig.jpg

Reading the datasheet for the Texas Instruments TLC59116 16-LED driver and this discussion, I think (but could easily be wrong) they're connecting 14V to the anode of each LED, then the driver chip varies its internal resistors to allow different amounts of power through each LED, varying its brightness. However it works, the amps flowing on the 14V line definitely seem to vary by number of LEDs lit. When powering up, all LEDs light and I saw my clamp meter on the 14V line hit 0.2A one time and 0.18A another time. With the 1 or 2 LEDs that run when idle, it's only drawing 0.014A at 14.05V. 0.2*14.05=2.81W, way higher than pi's 0.420W I measured on a 3.3V power supply.

So, I felt safe in powering the pi off the 14V pin of the 10-pin cable as long as the LED board is disconnected. I used this step-down (buck) voltage converter. Everything's been running fine for a couple hours. Oddly, the pi + rs485 running TWCManager with an SSH shell connected on wifi use less power than expected: 0.065A @ 5.29V = 0.344W Buck converter is not even warm.

Anyone have any opinion on whether I can leave the pi and the LED board connected at the same time? I'm not sure how I can determine the max power available on that 14V supply short of tracing it back to its source and looking up the specs. But then, I don't know how much power other things are using on the 14V supply so I couldn't be sure if they're pushing it near its limits. Maybe watching for voltage drop when all LEDs light or something?
 
Last edited:
  • Like
  • Informative
Reactions: M_VdM and spottyq
Nov 14, 2015
212
281
Southern California
The pinout of the 10 pin connector, and the wires going to the charging handle are in the EU manual, page 29.

https://www.tesla.com/sites/default...installation-manual-en-EU-v2.pdf?201612081439

What the WHAT?! A manufacturer sharing details of connector pinouts? In 2017?! Fake news!

Good find though.

It verifies stuff I surmised but nothing jumps out as new info useful to this particular project... It hints at the meaning of the 4 colored wires leading to the charger handle (CNA5):
Purple: VEH PILOT (Pilot pin)
Blue: S3V3-UHF (3.3V power)
Black: THERM-VEH-POS (temperature monitor?)
Orange: VEH_PROX (Proximity pin)

Anyway, here's the Pi Zero and JBTek rs485 fit into the TWC (like a boss):

Pi and rs485 fit.jpg


Having the pi touching the high voltage charger cable wires worries me there could be heat problems if you charge a car at 80A. 40A is probably fine (max for my car). I'll report if I have problems with it.

I didn't bother with termination/bias resistors and am not getting any significant rs485 corruption.

Exposed metal on JBTek and its USB to micro USB adapter are covered with white 3/4" heat-shrink tube.

I should protect exposed metal on the 10-pin connector and in the little black connector that bridges wires from the pi to the buck converter, but I didn't want to since this isn't a final solution.

Woke up this morning to find my car started charging with the sun. Hurray!

BTW, I'm pretty sure brkaus is right that low volt power supply is in upper left of main board because that's where all the heat is when a car's not plugged in:

flir_20171119T211811.jpg


I was also thinking that PC computer power supplies are designed so if you try to draw too many amps, they shut down or simply don't supply more than a certain number of amps so you get glitches or crashes but you don't fry wires or components by pulling more amps through them than intended. If the TWC power supply is designed the same way, then it should be safe to just try the LED board + pi at the same time and if it works, it's good. I just don't know if amp-limited power supplies are the norm in all electronics or only in things like PCs where ignorant users will try to plug in as much stuff as possible regardless of power supply rating.
 
Last edited:
  • Love
  • Helpful
Reactions: robertvg and M_VdM
Nov 14, 2015
212
281
Southern California
I charged the car at 40A for an hour and the cable (77F) was barely warmer than the air (66F). This is unlike the travel charger which gets pretty hot at 40A. TMC obviously has thicker wires intended to tolerate 80A that don't heat much at 40A. The warmest part of the charger was deep in the charger handle cubby at 110F. The left side of the handle cubby runs right next to the charger wires and it wasn't showing a heat spot.

flir_20171120T113058.jpg


So I'm pretty sure the pi is fine at least at 40A.
 
  • Like
Reactions: widodh and spottyq

widodh

Model S 85 and 100D
Jan 23, 2011
6,853
2,805
Venlo, NL
My EU HPWC will be arriving this week. I'll use a regular Pi with a USB <> RS485 dongle and start to write some code in Python. Using TMCManager I'll re-write the code to Python (3).

Looking forward to it!
 
  • Like
Reactions: M_VdM and spottyq

M_VdM

Member
Mar 31, 2016
46
23
Belgium
Can anyone provide a clear picture of the new TWC "Front LED PCB" (both sides if possible), please ?
Looking at the partial image provided by @CDragon (Spider rig.jpg), the backside looks awfully crowded ...

@widodh: Very curious 'bout your Python code. Spannend !
Did you get any reassurance from Tesla that this new TWC would work with your upcoming TM3 ?​
 

widodh

Model S 85 and 100D
Jan 23, 2011
6,853
2,805
Venlo, NL
Did you get any reassurance from Tesla that this new TWC would work with your upcoming TM3 ?
The Wall Connector talks the J1772 protocol as any EV out there speaks. The EU version at least can charge not only a Tesla, but many other non-Tesla vehicles.

Model 3 will also talk the same protocol and charge just fine of the Wall Connector.
 
  • Like
Reactions: spottyq
Nov 14, 2015
212
281
Southern California
Can anyone provide a clear picture of the new TWC "Front LED PCB" (both sides if possible), please ?
Looking at the partial image provided by @CDragon (Spider rig.jpg), the backside looks awfully crowded ...

Here's a pic of the back I took with UV light to show off the conformal coating:
Conformal coating.jpg

From what I've read, the coating protects things from humidity and other outdoor conditions and also allows components to be placed closer together.

I didn't take any good full shots of the back under normal light but here's a closeup of the area around the TLC59116 LED controller:
TLC59116 area closeup.jpg 3.3v to TLC59116 LED controller.jpg

In the second image I'm pointing out which pin on the TLC59116 the 3.3Vcc pin of the cable is tied to. Despite the conformal coating I was able to hear a continuity beep at a tiny point. As expected, that pin is 3.3Vcc according to the data sheet.

Here I was trying to read the part number on the QB3 component:
QB3.jpg

Sadly, no angle gave me any view through the conformal coat. I also tried a magnifying glass and strong light with no luck. I'm interested in QB3 because its leg labeled "I" connects to the 14V pin of the cable.

I don't really want to take off the LED board and risk breaking anything or voiding the warranty because the marks on the screws get altered. Why do you want a picture of the other side?
 
Last edited:
Nov 14, 2015
212
281
Southern California
My EU HPWC will be arriving this week. I'll use a regular Pi with a USB <> RS485 dongle and start to write some code in Python. Using TMCManager I'll re-write the code to Python (3).

Looking forward to it!

Python! It's everywhere I look! You'd think dragons would code in Python, but then again, dragons do have a fondness for Pearls...

I apologize for not writing the original code in Python since it seems to have become the new standard in scripting languages and is more readable. Unfortunately, I grew up with Perl and have only glanced at Python once or twice.
 

brkaus

Well-Known Member
Jul 8, 2014
8,081
6,644
Austin, TX
Python! It's everywhere I look! You'd think dragons would code in Python, but then again, dragons do have a fondness for Pearls...

I apologize for not writing the original code in Python since it seems to have become the new standard in scripting languages and is more readable. Unfortunately, I grew up with Perl and have only glanced at Python once or twice.
And I thank you for writing it in PERL!
 

widodh

Model S 85 and 100D
Jan 23, 2011
6,853
2,805
Venlo, NL
Python! It's everywhere I look! You'd think dragons would code in Python, but then again, dragons do have a fondness for Pearls...

I apologize for not writing the original code in Python since it seems to have become the new standard in scripting languages and is more readable. Unfortunately, I grew up with Perl and have only glanced at Python once or twice.
No problem! Thanks a lot for your research. Give me a few weeks as I am busy with a lot of things.
 
  • Like
Reactions: spottyq

M_VdM

Member
Mar 31, 2016
46
23
Belgium
I'm interested in QB3 because its leg labeled "I" connects to the 14V pin of the cable.
That component QB3 is almost certainly some sort of Linear Regulator (à la LM317 et co.) !
Anyway, thanks (!) a lot for those photos. I perfectly understand you don't want to disassemble that PCB.
I was just curious. Can't help but feel there are more components on that PCB then needed ...
I apologize for not writing the original code in Python since it seems to have become the new standard in scripting languages and is more readable. Unfortunately, I grew up with Perl and have only glanced at Python once or twice.
Absolutely no need to apologize. You did an excellent job !
Like we say (time to brush up your Dutch - although this one might prove difficult to properly translate): "Ieder vogeltje zingt zoals het gebekt is." ;)
 
Nov 14, 2015
212
281
Southern California
Like we say (time to brush up your Dutch - although this one might prove difficult to properly translate): "Ieder vogeltje zingt zoals het gebekt is." ;)

Translation: "Every little bird sings as it is conceived." I suspect that refers to my growing up singing Perl so I still sing Perl. Or it could mean it doesn't matter if TWCManager is Perl or Python, it still sings nicely. I like it either way.

I posted additional details of my investigation of the 14VDC and 3.3VDC power supplies over on an electronics forum where I thought I'd get more answers... but, of course, nobody is replying. Maybe I should have tried the beginners sub-forum instead of the renewable energy sub-forum. I posted pics of the back of the largest visible board in the TWC and the "main board" behind it.

Also, I used a mirror to look under the LED board but didn't see any components not hidden by the LED light diffuser.

Diffuser from side:
Light spreader.jpg

Under end with mirror:
Silkscreen label on left.jpg
 
Last edited:
  • Like
Reactions: M_VdM and robertvg
Nov 14, 2015
212
281
Southern California
Alright, so after way too much time spent understanding the power supply, I'm running the pi and the LEDs at the same time. To do this, you need to use as little power as possible, which means:
  • Use a Raspberry Pi Zero W. Older Pis use significantly more power and even a Pi Zero (non-W) with a wifi dongle is going to use more power.
  • Reduce pi's power use by installing Raspian Stretch Lite. Leave desktop mode disabled and access only via SSH and SCP.
  • Follow this guide to disable HDMI port and status LED.
To run TWCManager.pl on each boot, place TWCManager.pl in ~/TWC then install 'screen':
Code:
sudo apt-get update
sudo apt-get install screen

Then
Code:
sudo nano /etc/rc.local

At the end of rc.local, add:
Code:
su - pi -c "screen -dm -S TWCManager ~/TWC/TWCManager.pl"

Reboot, and if you need to see what TWCManager is doing, make an SSH connection and run
Code:
screen -r

You can find guides online for how to use screen but the most important command is Ctrl-a then d to 'detach'. This gets you back to a command prompt but leaves TWCManager running in the background.

If any of the above confuses you, I'll create a more detailed guide at some point.

Git repository
has been updated with a simple web interface for changing charging amps and monitoring the amount of amps being sent to each slave TWC. Here's how it looks on my phone:

Phone UI.jpg

I recommend placing the index.php file in / var / www / html (without spaces) and installing lighttpd with these commands:

Code:
sudo apt-get update
sudo apt-get install lighttpd
sudo apt-get install php7.0-cgi
sudo lighty-enable-mod fastcgi-php
sudo service lighttpd force-reload

lighttpd is the lowest CPU (which means lowest power) web server available when serving one or two users at a time.

Now, about the pi's power use:

Details are in the other thread but basically the pi consistently uses 0.911W of power which makes the TWC power supply about 5.7% more current than the TWC would use under normal operation. The TWC uses the most power when the car is charging and the TWC's LED lights are streaming.

The parts of the power supply that get hottest are a series of resistors, a transformer labeled TA1, and a MOSFET labeled QA1 (or HA1 on its other side). Running the pi adds about 15F to the temperature of all three of those components with the case closed, leaving them about 150F (65.5C) when it's 65F (18.3C) outside.

Resistors top left, MOSFET middle, transformer bottom:

flir_20171202T140034.jpg

The MOSFET spec sheet says that's fine because at 149F (65C) it can drain about 2.3A. It needs to drain around 1.35A when max power is called for. The problem is I have no information on the temperature limits of the TA1 transformer. Also, I don't know what will happen on a 100F day in the summer which may drive internal components up to 184F (84C). I'm not sure if +35F outside temp would actually mean +35F in the hottest internal components but I think it's likely based on what I've seen monitoring the temp of an overheating security camera. Even at that temperature, the MOSFET could still drain 2.0A so it's probably fine and we'll have to hope the transformer and resistors have similar performance.

Most likely there is some form of overheating protection that will shut things down before anything is damaged, but I lack the knowledge to identify what sort of protection there is. Worst case, I think one of the hottest components would burn out and need to be replaced. There is definitely overvolt protection which means it will shut down if something gets so hot it melts insulation and shorts. Unfortunately, if it's the TA1 transformer that burns, the only replacement is likely to come from another TWC because transformers tend to be made custom and have no markings that indicate their properties in any standardized way. Someone smart enough in electronics might be able to source something equivalent or better that works, but that someone's not me.

I've got to create a PDF guide or something with more details to put with the git project, but I wanted to let people know the bare bones of how to get this done.

I created a short extension cable to get 14VDC power from the LED board cable without modifying it:

LED tap cable.jpg

The yellow wire is the 14VDC line and I made it long so I could fit the clamps of my clampmeter over it to measure power use of the LED board. Most people building this cable will just want to use ribbon cable for all the wires instead of adding this extra longer wire. You'll still need to leave the ends of ribbon cables 1 and 6 longer to solder the thicker wires of the UBEC buck converter onto like you see at the right of the picture.

Connectors need to be pressed onto the ribbon cables with cable wires carefully aligned into the barbs of the connectors. Connectors must be squeezed with equal pressure at all four corners using something like a vise. If not, you may miss getting the barb around the tiny wires inside. When done, check carefully that each pin at one end connects to the same pin on the other end and that no pin connects to more than one other pin. Make sure to align connectors the same way you see in the picture. I recommend making the cable itself and the dangling ends that solder to UBEC maybe 50% longer than I made them because it allows more room for things to wiggle into an open space. Mine almost doesn't fit right.

10-pin IDC (Insulation Displacement Connector) cable parts are from Digikey:
  • Male connector
  • Female connector
    • The black connector in the cable I made is not this grey connector - I bought mine at a local store.
  • 10-wire ribbon cable
    • Minimum order is 5 feet. If you have old IDE hard drive cables you can tear off 10 of their wires and use that. Make sure wires are labeled 28AWG or 26AWG and are 0.1" apart. I've seen IDE cables in thick and thin styles and if your IDE cables look thinner than what's in the picture I don't think they'll work.
    • The existing ribbon cable in the TWC is labeled as 28AWG which matches this cable.
Note that it's possible to run a MAX3485 chip at 3.3v to avoid some power wasted running a USB RS485 dongle and you should also be able to omit the UBEC buck converter to save more power (but you'd need to watch the temperature of the UA1 component that converts 14VDC to 3.3VDC on the back of the TWC board). I don't have time to pursue it but if anyone wants to try it I can post details.
 
Last edited:
Nov 14, 2015
212
281
Southern California
Has anyone used TWCManager with a TWC purchased in the last six months? If so, does it display any "UNKNOWN MESSAGE" errors? I'm really curious if car battery state is reported in an additional message in newer firmware TWCs or if maybe there's some secret message to enable battery state reporting in all firmware. If newer TWCs aren't reporting battery state I'll try some things to find the secret message.
 
  • Love
Reactions: spottyq

Products we're discussing on TMC...

About Us

Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.

Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


SUPPORT TMC
Top