How to power Raspberry Pi from within Tesla Wall Charger? - Page 1
Forum section: electronics / general

author: Dragon
author_rank: Contributor
timestamp: November 26, 2017, 10:21:36 pm
content: Hi all,I'm a software guy who dabbles in electronics projects maybe once a year. On theTMC forumI chronicle my journey in reverse-engineering the rs485 protocol used by master Tesla Wall Chargers (TWCs) to control the power output of slave TWCs.Here, I offer some pictures and ask if anyone can tell me if it's safe to run a Raspberry Pi Zero W off the internal power supply within a TWC. Nobody seems to know, so I thought I'd ask the experts here.The LEDs on the front of the TWC use a max of 2.81W from a 14V power pin with all LEDs on. This is much higher than my pi's 0.420W power use, so I left the LEDs unplugged and have been running the pi from their power for a few days.Now, I'd like to figure out if it's safe to run the Pi and the LEDs at the same time. Alternately, I could draw power from a 3.3V pin on the JTAG connector, but I'm waiting on an rs485 chip that runs at 3.3V. What I'm worried about is drawing too many amps from the 14V or 3.3V sources and burning something out. Is that a valid concern or is it standard for a fuse or other limiting component to prevent drawing too much power?I'll post again with some pictures and details of what I've measured but I want to keep my initial question short.

author: Dragon
author_rank: Contributor
timestamp: November 26, 2017, 11:59:11 pm
content: Under cover overview small.jpg(attached) shows the TWC's visible main circuit board though there is another board beneath it. Based on an IR photo, the low voltage power supply seems to be in the upper left.CNA1:White wire connects to black 120VAC main line at 1.2ohm resistance.Blue wire connects to red 120VAC main line at 1.3ohm.This is the only place where power comes in to this board.CNA3:Left two wires (pin 1, 3) are groundRight two wires (pin 2, 4) carry 12.5VDC when huge white relays at the top are closed to charge car. Otherwise they carry 0VDC. In this way, car charging relays automatically close if power is lost.CNA6:4 white wires lead into this 8-pin connector.Top two wires screw directly to red 120VAC line but wires have "overload" resistance on the meter. I checked carefully and even plugged a pin into the female crimp on the wire to see there is no resistance between inside female crimp and back/sides of crimp.Bottom two white wires screw directly to black 120VAC line and also have overload resistance.Right wire in both sets is grounded.I'm guessing this is some sort of safety mechanism. Maybe an overvolt or overheat will break down the resistance in these wires and do something useful.BDA1:DFL1508S bridge rectifier.jpgshows this bridge rectifier that converts two 120V AC lines to +135VDC on the "+" pin and -135VDC on the "-" pin. Top "~" pin connects to black 120VAC power source at 12 ohm resistance (not sure why it's not 1.2ohm resistance like other connections but I triple checked it's 12 ohm). Bottom "~" pin connects to red 120VAC at 1.2ohm resistance.The green capacitor (or maybe not a capacitor since it seems to be labeled starting with an N instead of a C) measures 124VAC on both legs. Maybe a thermistor to limit current when it overheats?InTransformer area.jpgI've got a UV light showing some of the conformal coating edges. The clear, hard coating makes it difficult to test components covered in it, though I can usually find some tiny point that the multimeter probes can make contact. A few components have an extra-thick coating that makes them untestable.At the far left is a FQPF5N90 MOSFET. Its S and G legs both measure -134VDC. D leg measures +144VDC.CYA9 capacitor measures -134VDC on upper leg, CYA10 capacitor is tied to ground on lower leg, and other legs can't easily be reached. Near sunset, voltage dropped to -130VDC so it seems to vary based on the 120VAC house voltage which hits 126V at maximum solar power and 120V near sunset.TA1 is the transformer with yellow tape near the middle. The transformer itself has no identification other than a "4" etched in the black metal to its lower left and "YC" etched in the black metal to its upper left (both visible in the pic but quite blurry).The only test point in the area I can access is to the left of "CA55" and it reads 14VDC.In3.3v area.jpgUA23 is an 8-pin chip labeled 95M01WT K622K. I couldn't find that exact part number butheresomeone asks about a 95M01WT-K430K chip and they decide it's an EPROM. Lower right pin is near an exposed test point that reads 3.3v.Below UA23 is a ZXMP6A13 MOSFET that has no silk-screen label on the PCB. All its pins are inaccessible.Another ZXMP6A13 MOSFET between the CNA3 plug and the white JTAG connector has uncovered pins I could test. S & G read 31.7VDC, D shows 0V.A third ZXMP6A13 MOSFET at the top left of JTAG connector reads S and D 14VDC, G 3.3VDC using test points near the pins.UA3 area.jpghas what looks like another ZXMP6A13 MOSFET but I can't read the chip label through its thick conformal coat and all its pins are well covered.Left side of CA18 reads -14.66V. Remaining legs of these two caps are inaccessible.More components I read inscriptions from with a magnifying glass and bright light, but didn't investigate:LA7:Inscription: G6161 02 ("02" is smaller with line over it)Tiny black SMT (Surface Mount Technology) box. Assume it's an inductor based on LA label.UA15:Inscription: | 2903 SMT ("T" unclear)Label style reminds me of ON semiconductorUA16Inscription: | NCV7356G (on) PXQH19UA21:Inscription: TMS320 F28034PNT G4A-5CACG6W G4Largest SMT chip on front of board, has dozens of tiny pins.XA1:Inscription: H206E4 pin, SMTMetal body has 1.2ohm resistance to ground.

author: Dragon
author_rank: Contributor
timestamp: November 27, 2017, 03:44:47 am
content: I made little hooks out of paperclips to hook on the pins of the TA1 transformer and found points away from the transformer that were linked to the pins. The transformer has 8 pins that I've labeled as follows (EDITED when I found there are 10 pins instead of 8):E KD JC IB HA GLabels are based on the rotation of the transformer in the image in the last post.A pin has 5.2ohm resistance to middle D leg of FQPF5N90 MOSFET. B has 1.0ohm resistance to same leg. D leg reads 144VDC with sun up, 139.8VDC with sun down. A & B are also tied to bottom leg of giant CA10 cap and + pin of BDA1 rectifier.C to E pins have 1.5ohm resistance to heat sink on back of FQPF5N90 MOSFET. This reads -134VDC with sun up, -130VDC with sun down.G, I, J, and K are grounded.H has high resistance to everything I tested all over the board so I tested it directly with a hook on it and careful placement to not touch anything else. It reads 0VDC and 0.034VAC. It reads the same even after power is cut to TWC, suggesting the reading may come from a big cap? EDIT: After looking at the back of the board, it seems H may not be connected to anything.I've realized there's no such thing as a DC to DC transformer so I don't know why there seems to be DC voltage going into the A to D pins. Switching to VAC shows overload on my meter. Maybe it's AC but switching at much higher frequency than the meter is able to read AC? I can try with my oscilloscope if necessary. EDIT: It seems like the only thing this transformer could be doing is converting 144V to -134V at some high frequency AC. But since pins A & B are tied to CA10 cap and + pin of BDA1 rectifier, I don't see how that 144VDC could be oscillating. EDIT2: -134V comes from the - pin on the BDA1 rectifier so scrap that theory. Also verified the ~ pins on the rectifier are tied to red and black mains 120VAC which connect via the blue and white wires of CNA1.Is there anything else on the board large enough to make 14VDC from 144VDC? I guess there could be something hidden on the other side.I also found the CA55 test point is connected to the right pins of the LA2 inductor. The two left pins of the inductor are connected to the left side of CA18.

author: Dragon
author_rank: Contributor
timestamp: November 27, 2017, 07:01:58 am
content: I took the front PCB off to take pictures of its back and the board behind it.Overview.jpgshows the overall back of the front board.Main board overview.jpgshows the board behind the front board.UA14 area.jpgis where control wires that go into the car charger cable connect. Not likely involved in low-voltage power supply.UA6 area.jpgI assume has all the remaining low-voltage power supply components.UA1ON Semiconductor NCP3170A PWM Switching Buck Regulator.This is converting 14VDC to 3.3VDC.UA2ON Semiconductor NCP1207A "PWM Current-Mode Controller for Free Running Quasi-Resonant Operation" which is designed to control a MOSFET (QA1) and transformer (TA1) to convert a high-voltage AC supply into low voltage (14VDC in this case).UA3Inscription: RES ("RE" is unclear) 1712VCan't find spec sheet but this 3-leg component looks like a voltage regulator. Legs labeled I, O, and A probably mean Input voltage, Output voltage, and Adjust (used to pick the Output voltage). Tests show it's converting 14VDC to -14.66VDC from I to O legs.UA4EL1013 optocoupler. 4 legs.UA6Inscription: "630T N02A"Can't find a spec sheet but I, O, and A pins suggest voltage regulator converting -14.26VDC on I pin to -12.21VDC on O pin.UA258 pin SOICTexas Instruments SN65HVD1791 "Fault-Protected RS-485 Transceivers With Extended Common-Mode Range". It sits near the RS485 screw terminals.Can't find spec sheets for components below:FTA3Inscription: "H16MKC".2 legs.FTA2Another H16MKC? (only partially legible).2 legs.Diode1Component not labeled on PCB. Left of FT2AInscription: "RAG RH22"2 legs.Not 100% sure it's a diode because I don't remember if I tested it, but it looks like a diode in photos.Can't find spec sheet.Diode2 left of Diode1Inscription: (Logo)G S21 GP6172 legs.Can't find spec sheet but tested as a diode.Diode3 left of Diode2Inscription: (Logo)G S21 GP6172 legs.Diode4 near top left corner of optocoupler UA4Inscription: | UD22H2 legs

author: Dragon
author_rank: Contributor
timestamp: November 29, 2017, 08:00:26 am
content: After hours of looking at this, I'm reasonably sure the ON Semiconductor NCP1207A labeled UA2 is central in converting 120VAC to 14VDC. It's connected to a number of components that fit the reference circuit diagram in thedata sheet. However, there are some significant differences that I can't even trace fully without scraping off the conformal coating.The key thing I don't understand is why isn't 14V coming off of one of the pins of the TA1 transformer like in the reference circuit. I found thisexample 12VDC power supplydesigned around the NCP1207A which uses additional components and transformers and it isn't clear to me where the 12VDC is actually generated so I may be looking in the wrong place in my real device.EDIT: I finally realized that in the reference circuit, there is a diode between the transformer and Vout. To the left of the diode connects to ground through the coil of the transformer, which only adds a little resistance. To the right of the diode is where you should see Vout. There is such a diode (a little black box) next to the I pin of TA1 and it does read 14VDC on the other side, so I'm pretty sure that's where 14VDC is coming from. I confirmed with diode test mode that the black box is indeed behaving like a diode. There are also diodes on the G and K pins but I didn't note whether there is 14VDC on their other side. I've put the TWC back together and don't feel like taking it apart to check.Anyway, the problem now is that I don't know where the bottleneck is. Looking at it with a FLIROne I see most of the heat is in the transformer, so that's probably what limits how many amps can be drawn. Reading about "flyback" power supplies in general suggests the same thing. Unfortunately, I know nothing about the transformer or its limits.All I know is NCP1207A is meant to be used in supplies of up to 50W. TWC while idle draws 11.95W which spikes to 16.34W when I hit reset and all the LEDs light up. I want to add a load of ~0.5W (3% higher than peak) which strikes me as likely to be safe. I later checked while charging and the front board was drawing 14.7W with the pi connected but LED board unconnected. I need to do a few more tests but I suspect that with the car charging and strobing lights on the LED board it will still be using at least 0.5W less power than with all the LEDs lit. I'm guessing the power supply could handle turning on all LEDs while charging but in practice it should never do so, in which case I can use that power for the pi.I can also run it open and watch with a thermal camera for any places with abnormal heat buildup.Also note that during my investigation, I found the component marked UA1 is an ON Semiconductor NCP3170A PWM Switching Buck Regulator that converts 14VDC to 3.3VDC and likely runs most if not all of the 3.3V components. It has a limit of 3A output so I assume that means 3A*3.3V=9.9W. Might be safe to run the pi from that but it seems safer to use the 14VDC supply which likely has a much higher Watt limit. That does mean some power is wasted converting 14VDC to 5VDC and running the USB interface to the rs485 adapter when I could wire GPIO to a 3.3v MAX3485 instead.

author: leo_r
author_rank: Newbie
timestamp: December 01, 2017, 11:38:16 pm
content: Honestly, putting an extra 3% load on a part like this is probably not going to have much of an effect. There's enough tolerance variation in electronic components that the designer would be pretty foolish to not give any sort of headroom to the power the circuit could deliver.The thing to look at here is current, rather than power. It's current which causes heating in wires and semiconductors, and then the heat which destroys them. The current on the high side of the transformer is going to be pretty low (in the order of a few hundred mA). Adding 3% to that is incredibly unlikely to damage anything. These types of integrated switching converters tend to have a lot of protection built in anyway. It's very hard to actually break them.The easiest way of judging it, short of hunting down specs for every component in the power chain, is to feel their temperature when the device is running. If they're not hot right now, adding 3% won't change that.If you draw your power from the 3.3V rail, it'll be effectively the same as drawing it from the 14V rail. The power still has to move through the 14V converter to reach the 3.3V converter. The only difference would be due to the voltage converter you used - if you used a linear voltage regulator (don't do this) then it would a) get very hot and b) draw 3x the current through the 14V supply than if you powered your board from 3.3V. You should use a buck regulator of some sort.

author: Dragon
author_rank: Contributor
timestamp: December 02, 2017, 08:58:38 am
content: Thanks leo_r.I'm starting to lose faith in my clamp meter because it showed the pi adding 0.344W a few days ago, but today it showed it adding 0.917W! I'm zeroing it near where I take a reading and keeping the orientation the same so I don't see how I got such a wrong reading. I trust the 0.917W more because it makes sense given other readings (0.344W always seemed suspiciously low). EDIT: 0.344W was wrong - I accidentally multiplied 0.065A by 5.29V instead of 14.11V.Anyway, I've now measured the power supply board in the charger using up to 15.84W while charging so adding 0.917W to that is a 5.7% increase.With raspberry pi and LED board connected, I ran it open charging the car for 1.5 hours, 57.7F air temperature at night and the TA1 transformer reached 117.3F (see attachment). QA1 MOSFET is about the same temp as TA1. A row of four resistors above the transformer's left side reached 116.9F. The next hottest point was 94.9F on the UA3 voltage regulator.To convert 14V to 5.28V I'm usingthis DC-DC buck converter. It doesn't get warm.I realize I could use the 3.3V from the UA1 NCP3170A, but the spec sheet says it has 3A limit. 3A * 3.3V = 9.9W so adding something a bit less than 0.917W to that (9.2%) seems more risky.

author: paulca
author_rank: Super Contributor
timestamp: December 02, 2017, 09:07:18 am
content: Quote from: Dragon on December 02, 2017, 08:58:38 amThe PI like any computer draws more or less power depending on a whole raft of things.NoOp's, IDLE or clock skipping instructions at the CPU (when idle or waiting on the memory bus) draws far less power than running complex instructions constantly.The other thing I found with the PI is the HDMI interface is hungry. On a standard 1A mobile phone charger the PI runs fine. Yet when you connect it to a TV it crashes enabling the HDMI output. For reliable HDMI use you need to use a 2A wall wart.You have to then consider any USB devices are attached and what power they are consuming. Hungry things include Wifi dongles. The Ethernet will use power if connected, etc. etc. etc.My main gaming PC idles at around 105W. Yet if I run a modern game that taxes the video card that can jump to 300W+ I haven't checked the peak power draw at power up while the 6 HDs are spinning up and the fans are being cycled to max, but I expect it might even be more than 300W. I has a 650W power supply capable of bursts even higher than that.

author: Dragon
author_rank: Contributor
timestamp: December 02, 2017, 05:37:16 pm
content: Good theories, but I'm running a Raspberry Pi Zero W set up to use as little power as possible. That means running Raspian Lite, no GUI, HDMI port turned off, power and activity LED turned off. I'm running one piece of software to control the TWC and an rs485 USB dongle. Power use is quite constant at 0.065A-0.066A from 14.11V line. Well, at least that's what my clamp meter measured 3 times last night with readings a few minutes apart.EDIT: I looked back at my notes and realized I measured 0.065A a few days ago but thought that was at 5.29V to make 0.344W. In fact, I was measuring on the 14V line so it was using 0.911W a few days ago as well.I guess if I wanted to save a little power using the 3.3V source instead of the 14V source, I could keep an eye on the temperature and make sure the TWC's 3.3V source doesn't get too hot. That probably involves tilting the top PCB out of the charger enough to see the temperature of UA1 on the back of the board, and I'd need to get code working to use the MAX3485 chip at 3.3V and solder it on. I'm not sure it's worth it now that I have the 14V solution all wired and soldered together.EDIT: Transformer hit 134F with case partly closed. I'm now testing with case fully closed.

author: Dragon
author_rank: Contributor
timestamp: December 03, 2017, 01:19:17 am
content: I ran the TWC with the cover on and came up with these temperature readings while charging at 5A:After 2 hours, 15 min: TA1 149.6F, hottest point on case 85.9F, outside 65.4After 1.5 more hours: TA1 147.1F, hottest point on case 89F, outside 64.3Unplugged raspberry pi, continued charging at 5A:After 1.5 hours: TA1 133.9F, hottest point on case 81.5, outside 61.5So it seems the pi adds about 15F to the TA1, resistors, and QA1. That seems a little excessive for 6% additional power use, but what do I know.I have no spec sheet for the transformer, but the spec for the QA1 MOSFET (which runs about the same temp as TA1) shows that at 149F (65C) it can drain about 2.3A. It needs to drain around 1.35A while running pi and charging the car. So, at least from the MOSFET's perspective, I think we're still in the safe zone.

author: jh15
author_rank: Frequent Contributor
timestamp: December 03, 2017, 09:54:10 pm
content: Just noticed your rpi post.Wonder if we should start a Tesla hacking thread. I have a 2017 model S.During a power failure last month, couldn't get the power outlet (cigarette lighter) to run my small inverter more than a few minutes.jh

author: Bratster
author_rank: Frequent Contributor
timestamp: December 04, 2017, 02:44:47 am
content: Quote from: jh15 on December 03, 2017, 09:54:10 pmI don't know about Tesla specifically but how big was the inverter/load you were trying to run?It's very common in newer cars that the cigarette lighter power socket is only allowed 10 amps/120 watts.It's possible that there was an overcurrent protection kicking in.Sent from my Nexus 6 using Tapatalk

author: Dragon
author_rank: Contributor
timestamp: December 05, 2017, 01:42:34 am
content: Quote from: jh15 on December 03, 2017, 09:54:10 pmIf you were using one of those cheap inverters that are roughly 8" square and 2" thick, it may have just gone bad. They get poor reviews and I've had one go bad myself. They don't supply enough power to do much with anyway - even charging a laptop can be too much. It may have also blown a 15A fuse it has hidden in its cig lighter plug (unscrew the tip and it should slide out), or blown the fuse in the frunk. For emergencies, I bought a Xantrex 806-1210 PROwatt 1000 SW Inverter. Out of the cigarette plug, it still can't draw more than 11A (132W) continuously without blowing the15A fuse under the hood of the car, but you can connect it directly to the battery posts in the car nose cone or in the frunk (newer models) and get much more power.Thisthread says the 12V system is run by a 2500W DC-DC inverter from the main battery but that a 50A fuse limits current draw. Overherethey say that fuse is on top of the battery which is not easy to get to so I wouldn't try drawing more than 480W (40A) continuous. I'd put in my own 40A fuse to make sure not to break that limit.Anyway, there are lots of Tesla hacking threads around the web (especially on teslamotorsclub.com and to a lesser extent teslarati.com and even tesla.com) so I don't know if we need another one here, but if there's a topic you want to discuss that isn't already covered, maybe give it a try.

author: jh15
author_rank: Frequent Contributor
timestamp: December 07, 2017, 06:53:11 pm
content: Been away, just an update to the helpful answers.Even with just my phone charger plugged in, it would time out.The day before the storm I had updated the car, which had the camping feature, so that fifn't help.Anyway, I'll explore in the future. If running my astronomy gear off it, I wouldn't want it to time out, or have parking lights on, etc.Thanksjh

author: Dragon
author_rank: Contributor
timestamp: December 09, 2017, 07:08:59 am
content: "it would time out" meaning what, the cig lighter power turns off when you're not sitting in the car? That's just how the car is designed.If you clip an inverter to the battery posts in the nose the power won't turn off. If you'd rather use the cig lighter, there is arelay you can shortto prevent it from turning off.

author: jh15
author_rank: Frequent Contributor
timestamp: December 15, 2017, 06:35:01 am
content: The 2017 does,'t have a nose, more like a Simpsons overbite. I just came in from doing brakes on my Element at 16F.Was wondering where to hook up my amateur radio mobile rig anyway. Be cool to tie a 1500 watt linear amp to the 400v batteryIn warmer weather, I'll lift the panel under the frunk to get familiar with the usual stuff like brake master cylinder reservoir battery, etc. They have a once a year visit for maintenance coming in May.The not needed, but required by american ancient law to have a lead acid battery to run emergency flashers or whatever for so many minutes.(I have no mouth (nose?) and I must scream.)

author: james_s
author_rank: Super Contributor
timestamp: January 04, 2018, 06:49:33 am
content: Your power measurement for the RPi sounds way too low, when I measured one of mine a couple years ago it was around 4W at idle, still not a lot of power but more than 4 times what you measured.You mentioned using a clamp meter, keep in mind these are usually not very accurate at such low currents, especially the type that work with DC.

author: kaz911
author_rank: Super Contributor
timestamp: January 11, 2018, 11:41:56 pm
content: Quote from: Dragon on December 02, 2017, 05:37:16 pmAre you just measuring with a normal DC clamp? If you want more precise figures - do 10 turns of the positive around the clamp (like the wires goes through 10 times) - then you clamp will show 10 times the Amp’s but it will be a lot more precise and stable. 10 turns was just to make it easy (divide by 10 to get the real number) - but if you only have room for 3 or 4 turns - same principle applies.But clamp meters are never super with DC and usually drift over time - so degaussing is needed often.