Prism is a smart charging station for your electric vehicle.

Similar projects worth following
Prism is (arguably) the best way to charge your EV. Built with security and safety in mind, it's fully customizable and easy to talk to: it runs Linux, speaks MQTT and has CAN and RS485. But more importantly, it's efficient and it can help saving the planet by charging only when solar power is available, making you 100% independent from the grid and petrol lobbies. You can also connect to services like to throttle your car charging power when the grid is overloaded, to avoid firing up coal power plants. Speaking MQTT, it's easily integrated with OpenEnergyMonitor for control and monitoring.

I will not stress you with the usual catastrophic global warming stuff, you can read plenty about that online. However it's no coincidence that my love for electronics and efficiency drove my career straight into one of the fields that was promising a huge impact on that front: Electric Mobility.

This is the story of a journey that started a few years ago, when I and a friend with this same passion started a company to be part of this revolution, with big ideas for the future and small pockets. 

But you have to start somewhere, so we tackled one of the most annoying problems we had as EV drivers: charging. You can charge your vehicle at home with an EVSE cable, but that's only a temporary solution as the charging rate is very slow (~10km/h) and it's usually not very safe as plugs in Europe are not designed for that kind of continuous load. This solution is also ugly and dumb because you can't control the charging rate and you easily trip the main circuit breaker if you use other loads in the house. Reducing the charging current when other loads are connected is a very basic feature, but at that time the only device offering it was the OpenEVSE (we'll talk about it later). Even today, only a few brands offer this feature, and it's usually a quite expensive optional. 

And while we're at it, why can't we also sync with our solar inverter and charge only when the sun is shining, if we're not in a hurry? Again, only an OpenEVSE connected to an OpenEnergyMonitor can do this.

So we built ourselves an OpenEVSE, and we were happy for a while. But oh, there's so much to improve! It doesn't have ethernet (WiFi in the garage was very flaky), it was only single phase, and it looked (and still looks imho) too much like an hobbyist project.

We also had the chance to test some commercial products, and when one exploded on us we decided it was time to make things right. And the idea of Prism was born.

Other great and unique features that set Prism apart from the competition:

  •  Based on OpenWRT Linux:
    • high security and constant updates
    • easy development in any language (C, LUA, Python, PHP...)
    • WiFi Access Point feature: very important to keep your car connected if your garage is underground
    • Integration with Vehicle API, to customize charging based on vehicle state of charge
  • Open and easily and "modularly" customizable: you can play with any part of it, e.g. if you're not comfortable messing with high voltage stuff, you can just play around with the cover module that still has access to all data and customize the user interface.
  • One single prism can charge one or two vehicles at the same time
  • Advanced energy monitoring can give unique insights into the EV charging system - especially useful for makers playing with this component
  • Extra safety with integrated Ground Fault protection for both AC and DC residual current
  • Oversized contactor for extra safety

Here's the latest image of the prototype in its case:

Status of the project:

  • The electronic modules are going into production
  • We finished the plastic case molding and will manufacture the first batch soon
  • Software is 80% complete - we're missing some refinements but basic features are ready
  • We're testing the test jig and writing testing software
  • The front cover design is not definitive, we're waiting for the latest prototype from the plastic film company
  • We're writing documentation and gradually releasing sources as we write (here and on my blog)

  • POWER!

    Mastro Gippo4 days ago 0 comments

    Supplying power to everything is not as easy as it may seem. We need several voltages to power all the components, here’s the budget:

    • Isolated from mains, negative connected to mains earth
      • ±12V at 14mA per pilot port (0.33W)
      • 5V at max. 360mA for the user interface RGB LED strip + up to 40mA per port for contactor relays (0.6W to 2.2W)
      • 3.3V at max 14mA for the STM32F103 (0.04W)
      • 3.3V at 200mA (with 800mA short peaks) for the Linux module (0.66W – 2.6W peak)
    • Referenced to mains neutral
      • 3.3V at 23mA for the ATM90E36 (0.07W)

    From AC to DC

    So we need a total of about 1.8W in normal operation, up to about 5W peak in the worst case.  At first I started to look at triple output supplies with ±12V and 5V outputs. Unfortunately, looking around I couldn’t find any triple output module in a reasonable size (and price); it was time for plan B.

    The next best thing would have been to have a single 12V or 5V supply and convert that to all the voltages I needed. Since the biggest load is on the 5V line while the 12V one only requires 14mA, it made more sense to get the 5V output module. Initially the idea was to add way more LEDs, so I started testing with the MeanWell IRM-20-5. This 20W AC supply module outputs 5V at up to 4A.

    ±12V Pilot signal supply

    Now, how can we generate a ±12V supply from 5V? Looking around for schematics I didn’t find much; most of the circuits are designed for very low current RS232 communication (there are plenty of ICs for that like the venerable MAX232). I could generate +12V with a simple boost converter, and then invert that; however, the only inverter ICs I could find are rated for 5V. The capacitive inverter TC7660S may work, but it’s too close to its absolute maximum rating and its output impedance is way too high.

    The TPS65130 is a switching boost converter with an integrated inverter at up to 800mA, but it’s very expensive and requires a lot of (expensive) components to work. The LTC3261 would be perfect if it didn’t cost 6€ a piece (plus the boost converter).

    There’s a nice trick to use a Boost converter to generate both a boosted voltage and its negative; unfortunately switching ICs have a feedback only on the positive line so this wouldn’t work with our unbalanced load. However, since on the Pilot signal the big load is normally only on the positive side, there should be a way to make this work. I have a few ideas that I still haven’t managed to fully explore.

    After testing some different solutions, I concluded that the best “compromise” to supply the ±12V rail is to simply drop in a DCDC module like the MeanWell DPU01L-12. They’re cheap, easy to implement and work very well in this application, despite not being regulated.

    Isolated 3.3V for the High Voltage measurements

    The holy grail here is the SiLabs Si88341 IC. This device integrates an isolated DC/DC power supply and four channel logic isolation in a very nice package. I don’t know what it is that makes me appreciate this IC so much, but I think it’s truly gorgeous. Unfortunately, it’s not cheap at 5€ in single quantities, plus the transformer, plus the effort to make it work as designed.

    The Isolation Dream Team!

    The next best thing is a combination of the Si8641 digital isolator for the signal, and a standard 5V DC/DC isolated module like the RFM-0505S. From there, a simple 3.3V LDO will regulate the supply for the power meter. Easy, lazy, works!

    3.3V supply for the Linux module

    Here the requirements are simple: low ripple, about 200mA continuous with 800mA peaks. Normally I’d just paste here my usual supply block that I used in many other projects, based on the MP1584:

    But that design is optimized for a wide input voltage (up to 28V!), while here we have a fixed 5V input and size and efficiency are more important. So I went to one of my favorite online tools, the TI WEBENCH, to find a better part. Here you just have to specify your requirements to get...

    Read more »


    Mastro Gippo08/12/2019 at 14:18 0 comments

    Of course the first thing that comes to the average makers mind when they want to add smart connectivity to something is the venerable Raspberry PI. These boards are great, but almost impossible to find in quantity and definitely impossible to buy at the advertised price if you live outside USA. The only Raspberry I could consider for size and availability is the CM version, but I'd have to add WiFi and Ethernet to the already high price of the board. Finally, they're way overpowered for my purpose. What I'm looking for is the sweet spot between a Raspberry PI and an ESP32 in terms of size, price and features.

    So I started looking around for Linux SBCs. There's plenty of choice around, let's look at the best options I tested:

    • the Beaglebone is ultra-reliable , and there are awesome SIPs with CPU, RAM and FLASH integrated in a single BGA IC. Octavo Systems really made miracles, but prices are still high and you still have to add WiFi

    • Olimex boards are really nice, but while cheaper they have the same drawbacks of the other SBCs based on TI chips.

    • OrangePI boards are incredibly cheap and have multiple connectivity options! I spent *a lot* of time testing and debugging their Allwinner H3 based boards, and while they work great for your average mediacenter or weekend project, they're definitely not reliable enough for long-term, 24/24 use. Too bad - they had the perfect price point, great features and power, maybe even too much...

    • The gorgeous ARIETTA-G25-V is Made in Italy with high quality and reliable components. I used it for a project in the past, and I really liked it. Unfortunately, its price is still a bit over my budget, especially after adding WiFi and Ethernet.

    • Freescale/NXP chips are very cool and the choice I'd make if I had more budget or the time to layout an debug complex multi-layer boards. My favorite one for this project was the i.MX6 UL chip: plenty of peripherals, great Yocto support, plenty of third party modules. Unfortunately modules are still quite expensive, but I was really impressed by the power/performance/price/size ratio of the Digi parts:
    • The GR8 C.H.I.P. was a great choice, but unfortunately the project died. I'll treasure my board as a memento mori.  

    What these boards have in common is that they're way overpowered for the task, and priced accordingly. Trying to find a better option, I missed the most obvious one that was hanging under my nose and I was already using daily:


    I already had a lot of experience with the amazing OpenWRT project. I flashed every single router I've ever owned, built NASes, battery powered drop-boxes to crack WiFi passwords with Reaver, network bridges and more... Routers are great, are very powerful for any application not requiring graphics, are cheap, efficient and very well connected by definition. It's weird I don't see many projects using them around HackADay, kids these days only use those pesky Raspberries... Long gone are the glorious days of the WRT54GL!

    One of the best platform I played with was the GL-MT300N-V2, very reliable and with plenty of CPU power (MIPS24KEc @580MHz), flash (16MB) and RAM (128MB), WiFi, Ethernet, USB host, UARTs, a nice enclosure and certification, for a very low price! It's very well supported by the tiny, rock-solid and security focused OpenWRT Linux distro.

    It's based on Mediatek MT7628, a brother of the  MT7688AN. You may have never heard of them, but they're the chips powering a lot of maker platforms, sometimes combined with a microcontroller, like the Arduino Yun, the ingenious WRTnode2R with an STM32F103, the LinkIt Smart7688 with an optional Atmega32u4, the VoCore2, the Onion Omega2, the WiDora Neo and the ReSpeaker. Here's some stuff I tested:

    What I love even more of this platform is that after prototyping your design with one of the aforementioned boards, there are many cheap module options that you can easily...

    Read more »

  • Measuring power

    Mastro Gippo08/08/2019 at 09:09 0 comments

    The EVSE decides what's the maximum current a car can draw; this is because only the EVSE knows how it's installed. If it's a portable EVSE, the Pilot signal will limit the charge to the AC plug or cable rating. If it's a wallbox, the installer should have configured it according to the mains wiring specifications. The car should comply with that limit, and the EVSE should disconnect the car if it exceeds it, to prevent fires and avoid tripping the circuit breaker.

    Since we already need Current Transformers on each line for this, why stop at measuring current? We can, for example, record power and measure the power factor.

    When I started thinking about how to do this, I knew the basics and the theory. Experimenting with the OpenEnergyMonitor and the OpenEVSE, however, showed me that this topic is way more complex than it seems.

    Luckily I'm lazy, and as Bill Gates says:

    So instead of using a microcontroller and complex software like everybody does, I looked around and I indeed found a great and easy(er) way to accomplish this task: the marvelous Atmel/Microchip ATM90E36A. This chip is a three-phase energy meter, it also comes as a single-phase version and a cheaper version with less features. It's a full-featured metering IC, measuring all parameters like Vrms, Irms, mean active / reactive / apparent power, frequency, power factor, phase angle, Total Harmonic Distortion (THD) and Discrete Fourier Transform (DFT) for the harmonic component. Everything is exposed via SPI, and there are programmable alarms for voltage sag, phase loss, reverse voltage/current phase sequence, reverse flow and more.

    Still following the 5x5cm board module philosophy, I designed three cute boards to experiment with this IC.

    The high voltage input board

    This is simply an interface board with proper conditioning for the current transformer and a voltage divider to measure the AC line voltage. Nothing to see here! Sources here.

    The ATM90E3x breakout board

    This board collects all the passives needed to run the ATM90 IC. It has to be powered from an isolated 5V supply from the top pins; I just used a USB phone charger for this. There's space for two capacitors for the crystal; they're not required as the IC has internal caps, but different crystals may require some adjusting. Sources here.

    The 12 channel isolator

    Looking for options to avoid bulky optocouplers, I stumbled across the great Si844x. These chips have four capacitive isolated digital I/O each, and are great for our SPI application. Adding two more ICs brings the total I/O count to 12, so I can read the other outputs from the ATM90 and reset it. This board will definitely come in handy for a lot of other projects too! And it's breadboard-friendly! Find sources here.

    I'd love to write a long explanation of this three-module  circuit, but there's really not much to say: it's the lazy route, we just have some signal conditioning, basic passives and an isolator. The software part is a bit more complex though.

    Some software

    Atmel made a really nice board to test the ATM90E3x chips, the M90E3x-DB. This board is a design reference for a smart meter. I features a microcontroller connected to the ATM90 IC, with some basic software to drive a display and communicate via the serial port. It's super expensive though, so I requested the sources to Microchip and they kindly provided a copy of all the documentation. That includes a very nice software, ATM90ExxGUI.exe, that helps reading and interpreting all registers, and testing and calibrating the IC: But wait... What's that protocol?? I spent a lot of time analyzing it; luckily there were a lot of screenshots like this one in the documentation so I could at least start to copy requests and answers to emulate parts of the conversation. Reading further in the documentation, I found out that "The GUI adopts user-defined DL/T645-1997 communication protocol." This is an ancient protocol especially designed...

    Read more »

  • First prototype and test hardware

    Mastro Gippo08/06/2019 at 14:47 0 comments

    The basic building blocks of an EVSE are pretty standard. We start, of course, with a power supply for the low voltage circuitry. While this may seem a very simple and straightforward piece to solve, there are a lot of variables to consider: we need ±12V at 12mA for the pilot signal, 5V and 3.3V for the logic, and an isolated 3.3V for the high voltage measurement circuit, with signal isolation too. We will think about this after testing the other components to have a clearer idea of all the requirements.

    Then we have a microcontroller driving the PWM signal to the car and measuring its feedback. We can then drive a contactor or relays to power the car, and that's the bare minimum to start charging.

    Power is transferred through a Type 2 connector (commonly called Mennekes due to the brand that lobbied to make it standard in Europe). This connector has five pins for three-phase up to 63A, although almost no one goes over 32A, and two signal pins for Proximity detection and Control Pilot.

    Trivia: as I wrote earlier, Tesla uses the Pilot pin for single-wire CAN, but that's not the only non-standard way Tesla "hacked" this connector. They are also the only cars to use it for high speed DC charging, by supplying up to 500VDC using N and L3 for the positive terminal and L1 and L2 for the negative. This particular mode is initiated via CAN through a cryptographic exchange, to make sure no other car explodes by trying to charge at this non-standard station.

    The PWM circuit

    J1772 is a very old standard; unfortunately, while the industry could have gone with some nice bidirectional communication protocol like CAN, due to legacy compatibility we're stuck with this crappy PWM signalling method (there's a proposed Power Line Communication standard but no car implements it yet, and IMHO it adds unnecessary costs - I can add it later). How does it work?

    It's very simple. Here's what happens:

    • The EVSE outputs a +12V DC signal on the Pilot pin
    • Inside a car there's a diode D1 and a resistor R2 creating a voltage divider with R1, that brings the Pilot voltage down to about 9V
    • the EVSE measures the Pilot through R4, R5 and R6. These resistors translate the ±12V output to 0~3.3V signals for the microcontroller ADC. As soon as it reads 9V, the microcontroller starts generating a 1kHz PWM signal on the PILOT pin (via the CONTROL output).
    • This PWM signal tells the car how much current she can draw. This can be a number from 6A to 80A. In the range from 6A to 51A, the value is calculated as DutyCycle = Ampere * 0.6
    • The car perpares to charge; when she's ready, she closes the switch to parallel R3 to R2, bringing the high-side of the PWM signal to about +6V (the lower side still goes to -12V due to D1)
    • The EVSE can now close the contactor and supply power to the car.
    • If the car wants to stop charging, she just disconnects R3 and the EVSE will immediately disconnect the contactor.

    After calculating the resistors and simulating everything with LTspice, I designed a PCB to test various components. You can also find the NCV7356 test circuit in here if you want to test Tesla's one-wire CAN.

    At the time, PCB makers were making great offers for 5x5cm PCBs so I split my test boards into smaller parts. This makes the design modular, and makes it easier to test single circuit blocks. Find schematics and PCB here!

    The power board

    This board was built to test relays and current sensors. I designed it with generous tracks, mirrored on top and bottom, and ordered them with 2oz copper layers; I calculated a +10°C worst-case temperature rise with this configuration, and on my tests I measured a maximum of +4°C at full load, probably due to some air flow around my bench.

    Relays are TE T9SV1K15 rated at 35A. There are pads for two types of current transformers: the CSE187L, rated at 30A, and the Pulse PB0027NL, rated at 35A. Both worked well; I prefer the Pulse transformer for its rating and smaller...

    Read more »

  • Design decisions and competition: Tesla, OpenEVSE, [redacted]

    Mastro Gippo08/05/2019 at 09:04 2 comments

    When building a product, it's important to study the other solutions available on the market, to learn from other's good ideas and mistakes. If you can't significantly improve existing designs, why bother?


    This have been the obvious solution for hobbyist in the past. So of course I built one and was very happy with it! However, there are a few things I dislike about it:

    • being designed for the USA market, it's only single-phase; there are a few workarounds to make it 3-phase, but there are many drawbacks
    • the standard box they offer has a very plain look, and the 16x2 display is so 90's
    • it only connects to WiFi, via an ESP8266 - no ethernet and less easy to program if you're not familiar with the platform.

    I liked their pilot signal circuit, so I implemented it in my design. More about that later.


    Looking for a nicer (and 3-phase) wallbox to install at the office, I stumbled upon [redacted]. This company makes beautiful products, with some nice features, but I'm now super pissed at them.

    I used this wallbox for a while, until... it exploded. I should have really followed Dave Jones advice here, because if I had tore it apart before turning it on I would have noticed that these f***ers used 30A rated components for their 32A rated product. I have no idea how they passed certification.

    So this ticking bomb heated up until THE SOLDER ON A RELAY PIN MELTED and shorted another terminal below. Luckily, this triggered the main breaker, but the charger could have caught fire causing a sh*tload of damages.

    Black Smoke Of Death; this is the upper board that received indirect damage Must have been hot in here Who rated this 32A? SERIOUSLY??

    Their new product still uses these kind of relays, but to be fair there now is a 40A version in the same format so I guess (hope) they're using those. I didn't have a chance to disassemble one yet. Their current sensors should still be rated at 30A AFAIK, but that is a linearity rating; the copper should be big enough for more, only the measurement linearity would be worse - easily fixed in software.

    It IS gorgeous. I love their new design.

    At around the same time I was experimenting with a first prototype of my own design, with the 35A version of the same relays.

    One of my first prototypes

    This made me reconsider my choices and look around for better solutions, so I disassembled...

    ...The Tesla HPWC

    This wallbox is what I'd consider state of the art. It is so over-engineered that I'm sure the guys responsible for it are sleeping like koalas. That's the feeling I desire; I want to sleep well knowing that I didn't cut any corner and that if I get a call from a customer with a burned-down garage I would know it wasn't my product's fault.

    Here, enjoy some pornography:

    Look at that HUUUGE contactor! It's all run by a TI DSP Look at those nice voltage dividers with a bunch of resistors in series to increase isolation! What are these? Temperature sensors on each line? Am I dreaming?

    To be fair, the temperature sensors are probably needed because the final installer will have to tighten these screw terminals, and they don't always do the best job. Spring terminals would work way better here. More on that later.

    Those copper wires certainly look THICCCCCC

    To be fair, Tesla's HPWC (High Power Wall Charger) isn't perfect either; you can buy it only if you own a Tesla, and it's not "IoT". It has RS485 though and the protocol has been reverse engineered, a guy even fitted a Raspberry Pi Zero inside it, so if you're crafty and curious you can mod it.

    Bonus Trivia: as you may already know, Teslas are "computers on wheels", always connected and receiving constant updates. This philosophy seem to be missing from the HPWC, as it looks like there's no way to upgrade its firmware. But Tesla is also famous for thinking outside the box: turns out, every Tesla car hosts a copy of the latest HPWC firmware and updates them when you plug in to charge. They do so by starting a non-standard...

    Read more »

  • EV charging basics

    Mastro Gippo08/01/2019 at 10:16 0 comments

    image stolen from Phoenix contact

    Before going any further, there are some basic details you should know. Note that I'm writing about Europe, other regions may differ slightly.

    The "easiest" way to charge an EV is in Mode 2: here you have a special cable that you can plug to any AC outlet and to your car. This usually allows charging at 3kW, or roughly 10km/h and should not be used regularly.

    On the cable, near the AC plug, there's a device called EVSE. This guy has a few functions, according to the  IEC 62196 and J1772 standards:

    • it makes sure that a car is connected before closing the relays to power the plug. This is important because plug terminals are quite easy to touch with a piece of metal
    • it checks that the relays don't get stuck
    • it detects AC residual current to detect Ground faults
    • it tells the car how much current it can draw (usually limited by wire section - but it doesn't know how thick are your house's wires)

    This is not an optimal solution as you may imagine, as house plugs are usually not designed for a constant and very high load, so browsing EV owners forum you can find a lot of burned plugs images:

    To avoid this, to enable charging at faster rates and to improve safety, at home we usually install a Mode 3 charging station, commonly referred to as "wallbox".

    this photo was stolen from the web too

    Wallboxes are just more sturdy EVSEs that are stuck to your wall and connect directly to the mains wiring, through the usual breakers and RCD/GFCIs. Now you can charge up to 22kW (~100km/h) in complete safety!

    You can also choose if you want it with a socket (and you'll have to bring your own male-female cable to connect the car) or you want a dangling cable with a plug. I prefer the second option as it's much easier and faster.

    If you're curious and want to know more technical details, check out OpenEVSE's theory of operation here.

View all 6 project logs

Enjoy this project?



Sophi Kravitz wrote 07/31/2019 at 14:37 point

Yessss great project idea and much needed! Does solar deliver enough power to charge the car in a reasonable amount of time? 

  Are you sure? yes | no

Mastro Gippo wrote 08/01/2019 at 10:20 point

Well, it depends on how big your solar installation is! Usually even the smallest is enough to get 10km/h free charging, or about 50km daily range. Most daily commuting is less than that, and in case of clouds or emergency you still have the grid :)

  Are you sure? yes | no

Mastro Gippo wrote 08/01/2019 at 10:21 point

Also, you probably spend 8 hours a day in an office/factory, that definitely should have solar panels installed!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates