Animated EVSE – [safety update]

Electrical Design


For the LEDs, I figured I’d be using a strip of NeoPixels.  These RGB LEDs are controlled by the WS2812 LED driver.  You might have seen them at virtually every Halloween party in America this year.  Like the ones that I made for a party I helped decorate:

img_6763While the above picture is more of a Christmas light configuration, they more commonly come in flat strips:


The real challenge was finding a way to affix these LED strips to the Tesla charger cable.  I put up a post on reddit asking owners the precise dimensions of the standard cable.  They came back with 18 feet from the inline box to the car’s plug and 9/16″ in diameter.

Adafruit sells Neopixel LED strips in custom lengths, so I wasn’t worried about that.  What concerned me more was the diameter.  I needed some kind of sleeve that would fit around the charge cable and hold on to the LEDs.  My initial thought was some kind of heat shrinking, but then I remembered those plastic wire looms they sell for organizing your office.  They come in white!


Since the LEDs are about 1/8″ tall and the cable is 9/16″ thick, that brings me up to 11/16 or roughly 3/4 inches.  It was actually a little hard to find 3/4 inch wire loom, but I found one from Cableorganizer through Amazon.

I was thinking of trying to glue the LEDs to the inside of the loom to hold everything in place, but then I was worried since the loom can stretch and bend in two dimensions and the LEDs cannot.  I ultimately settled on keeping them separate and optionally adding some velcro wrap around straps every foot or to keep it together.  I obviously have no long-term wear and tear data on how well this solution will perform, but my dad’s a pretty handy guy and can replace the NeoPixel strand if it gets damaged.

Connecting the LEDs to my circuit is done through a JST XH type connector.  I don’t have a legit JST crimper, so I used my generic $50 crimping tool from eBay.jstcrimp

One thing I learned this time around is that if you’re not using the exact right crimping tool, you shouldn’t squeeze down until you bottom out.  This could pinch and tear the conductors.

With some well-applied heat shrink and wire shroud, I had this on one end:


This shrouded wire will stretch from my junction box to past the inline box on the charger cable which is approximately 20 inches. The other end has to connect securely to the LED strip.

I found that heat shrink will slide fairly easily if there isn’t something good to grip on to.  I had to add a drop of hot glue to give the cable a bit of a bulge for the heat shrink to hold:



Looks pretty legit, eh?

Measuring Current

The easiest way to measure the current in a wire is to place a small resistance in series and measure the voltage drop across that resistor.  That can be a little difficult though when you’re space constrained and are dealing with potentially 40A of current.  It also necessarily drops the voltage supplied to the load by a small amount.

Fortunately, with AC current it’s a little easier.  By wrapping your wire around the core of a transformer, you can measure its current by measuring the current in another wire wrapped around the same core.  This is so easy in fact, that there is an entire class of parts called current-sense transformers meant for exactly this!

One such part is the CT-1050 (pictured is 1020 variant):


Though it doesn’t look much like a typical transformer, simply running your test wire through the center of the loop provides enough magnetic coupling to generate a current in the secondary which is connected to two of the solder pins on the bottom.  Measuring this current gives you an idea of how much current is flowing through the primary test wire.

The exact current you measure on the secondary, depends on how much load you’ve applied.  After all, transformers depend on Faraday’s Law of Induction which dictates how a changing magnetic field in a loop of wire will generate an EMF or voltage.  Since the current sense transformer itself will have some internal resistance, its data sheet has a graph that indicates the current/voltage relationship for various values of load resistor taking internal resistance into account:


So with my resistor connected across the terminals of my sense transformer, I’m left with this:


With a voltage waveform across the resistor that looks something like this:


Where the amplitude represents the amount of current in the primary.

At this point, I could have used a fancy ADC that measures the positive and negative swings of this voltage to get my current, but that was a little overkill since I didn’t need to know the exact shape of the waveform or even its phase.  I just wanted a simple value that more or less tracked with the amount of current flowing in the wire.

Instead, I used a simple half-bridge rectifier.  This is a simple design often used in power supplies like the one in the calculator I fixed last year.  The idea is to let the positive peak of the AC waveform charge a capacitor and then use a diode to prevent the negative dip from discharging the cap.  A very small load is included to slowly discharge it should the amplitude of the AC waveform drop.  Assuming this load is small compared to the load resistor, it should have no effect on the measured voltage:


The resulting waveform looks something like this:


The difference in the peak AC voltage and the DC voltage is due to the 0.7V drop of silicon diodes. Though not exact, measuring that DC voltage will provide an idea of the charging current.

Since there are three lines going to a NEMA 14-50 plug, I could have current flowing between any three of them.  Assuming the Tesla draws 240V all the time, placing the sense transformer around either of the two live lines would work.


Most of my projects up to this point are powered from either USB or a battery, but that was going to be a little difficult inside a junction box.  I was going to need to use something powered from high voltage AC.  I didn’t need to use the full 240V; I could draw off the neutral line and one of the phases to give me 120V.

I’m not quite brave enough to start designing small form factor AC/DC power supplies, but I did find a PCB mount AC/DC power supply series that only required a handful of external passive components.  Made by CUI, the VSK series offers a variety of voltage and power outputs. The general tradeoff is that higher power versions take up more space.

The output of this power supply needs to provide 5V with enough current to drive the LEDs.  NeoPixel LEDs draw roughly 15mA per color per LED and there were 170 of them in my strand.  If they were all lit up white, that would require roughly 40W of power.  Looking at my power supply options, 40W was far too much to provide in such a small form factor, so I settled on just 5W assuming that I’d adjust the pattern displayed on the LEDs to make the best use of the power available.



Not a whole lot of surprises here.

The AC/DC power supply is set up with more or less the exact surrounding components recommended on its data sheet.

The microcontroller is an ATTiny24 though I actually ended up stuffing an ATTiny44 to give myself more space for the patterns.  I knew my device would be used in a garage with a variable temperature, and NeoPixel LEDs are controlled by data line pulses of very specific durations. I included a crystal to prevent temperature variances from affecting performance.  I originally stuffed a 4MHz crystal since I had one on hand, but had to bump it up to an 11.0592MHz to give myself enough speed to produce the LED data signal.

I put a resistor divider on the output of the current-sense transformer circuit.  The output of the transformer can approach 10V with high currents flowing, so a simple divider is needed to keep the output voltage within the range of the MCU’s ADC input.

You’ll also note that the current sense transformer is represented by three two-pin connectors. That was due to some size constraints…

Table of Contents

Background and Form Factor

Electrical Design

Size Constraints and Bringup

Firmware, Assembly, and Testing

30 thoughts on “Animated EVSE – [safety update]

  1. Pingback: Animated EV Charge Cable Enlightens Us | Hackaday

  2. Pingback: Lit Up & Animated Tesla Charging Cable Is Coolest Homemade EV Device We've Seen - Video

  3. Have you ever thought of working with a firm like to make this a product? Or of building these for other folks ()I’m about to get a model S and would love to have one). Even if you sold a kit of the parts, with instructions, that would be cool. Or (better yet) sold the assembled unit that plugs in, and let the purchaser assemble the cable, LED strip, and loom part.

  4. Pingback: Hijo regala a Tesla Dad con un impresionante cable de carga brillante para las fiestas |

  5. We provides OEM production services, including PCB, PCBA, from design, procurement, proofing to mass production, etc. to provide a series of complete services to ensure the smooth progress of the project in the production stage!

Leave a Reply

Your email address will not be published. Required fields are marked *