New User Get $30 User Coupons https://jlcpcb.com/CYT
Other Users Get SMT Coupons via Contacting JLCPCB Facebook
More on my EVSE project
Subscribed to my 2nd channel? Watch all my 3 minute videos on Julian's Shorts: https://www.youtube.com/channel/UCeewzdnwcY5Q6gcbnZKIY8g
Interested in my new garden workshop? Follow the entire build on Julian's Shednanigans:
https://www.youtube.com/channel/UCXfDjPehpC7B7lW2JFxeS4w
Join me on Odysee/LBRY: https://lbry.tv/$/invite/ @julian256:d
Octopus Energy referral link: share.octopus.energy/aqua-birch-918
(We each get £50)
#EasyEVSE
#ElectronicsCreators

Good afternoon all so i've built the little opto isolated driver that i'm going to use to drive the cp line on my evse car charger. But it's just occurred to me that this driver inverts, so that if you put a high on the out here, you'll be driving. This bottom led on, and this one of course will be off and that will attach the cp line to -12 volts. So, there's an inversion from input to output, so what i've done is i've pulled the wires out of here and the resistors and rearrange them all and effectively.

I've put five volts in here through a resistor into this, led five volts, put zero volts again through a resistor to the cathode of that led zero volts. So that's no longer there that's no longer there broken all this and linked the top of this around to the bottom of this and to the out. So in effect, these two have just been swapped over, so there should now not be an inversion. So what i need to do now is connect the opto isolator driver to here now.

Fortunately, we have a plus 12 volts there, which goes to this up upper opto, a minus 12 volts here, which goes to the lower one and then the center point, but where these two resistors meet, which is this point here - will connect through to cp and then All i need to do is cut the 1k resistor that came from my previous um line driver for the cp line, which was these two transistors working as emitter followers in a sort of um push pull arrangement. So i'll just cut that resistor solder. This new driver onto this board now the circuitry for the relays turning these two relays on will still consist of the comparators looking at the upper and lower levels of the cp pulse. Because although we drive from this driver, we drive cp to plus 12 volts and minus 12 volts, the car can put an additional resistance on this line to bring it down to either nine volts six volts or three volts uh on the top half on the bottom.

Half it just, i think the diode in the car means that this shouldn't drop from minus 12 volts, and you can check that to see whether you're genuinely connected to a car or whether you're connected to a human being and you're electrocuting them. So i just need to put a piece of wire on there attach this piece of arrow board i'll, probably put a couple of long pins on there, so that it's fairly rigidly attached to here link it all up, and then i've got to test it and see. If it works so solder, a piece of wire to the output of this driver like that trim that piece of wire down okay. So that's the output piece of wire.

Now i need a couple of long pins to sit in these two holes and come up onto this little board. So a while ago i bought this double row. Long pin header actually can't remember why. Now it doesn't really matter.

Let's pull a couple of pins out of there and they can be the pins. I used to sit the vera board on top of this board. It's just gon na sort of sit to the side and then the wire just soldered in will go into this cp point here. So that's how it's going to sit on two pins coming up from plus 12 and minus 12 and then the output going across to this cp line.
I've just got to solder those pins in now. So i will do that and now i want to cut the 1k resistor coming out to cp here and just lift that up a bit. So no longer will the old 1k oscillator be driving the cp line through these two transistors. But now the arduino will drive it through these two opto isolators.

So i'm going to connect the arduino up now and scope the cp line and see what it looks like right. So i now need to power up the arduino. Now we're not really going to see it do anything, because there are no visible elements on this board, but that presumably is now driving these uh optos. Now, of course, the optos produce a completely isolated electrical system here, so i need to put 12 volts onto here in lieu of this mains down to 12 volt uh trans uh, not transformer little power supply.

Well, i'll use the stack of 10 eneloops and i'll get my red and black crop clips, and i can put them on these 12 volts and 0 volts that should power up all this circuitry. Okay, that's powered up now the relays won't pull in because they only pull in if the cp line, the top part part of it is pulled down to either three or six volts, which i can simulate with this 1k resistor with a diode, and if i put That across cp and ground, the relays pull in, they feel a little bit weak, but that's probably because of the battery pack, but certainly that works. What we're looking for, though, on the scope is a plus 12 to minus 12 volt signal one kilohertz with variable pulse width on the cp line, so get: let's get the scope set up and there it is that's the 25 percent pulse width. If i bring the pot down it takes it down to the 10 pulse width.

Now the rise and fall times look a little bit grim um. Let's take a look at that expanded out. So yes, not wonderful! Is it, but it is a plus 12 to minus 12 square wave there's the zero volt marker. So it goes up to plus 12., in fact slightly above that, because the vpp is 24.7 and that i think, is because under no load these little dc to dc converters uh can give a little bit of a high output voltage.

But it's not excessive um. So yeah that is working, so i suppose the next thing is to mount all this on a piece of wood get mains coming in here from the big power bank mains going out here to the car, get everything mounted, so it doesn't all fly around the 12 Volts will then be supplied by this dc ac to dc switch mode power supply, and i can separately power the arduino uh just from a five volt power bank temporarily just to see if this works for charging the car. So let's get started on that and if you want to see how the waveform is affected by connecting this diode and resistor on here, the correct way around, it pulls the voltage of the top part of the signal down. Now this is a 1k.

So it's a identical to the 1k on here, so it pulls it down to 6 volts a simple split on a potential divider to half the voltage 6 volts. The contacts are a bit bad. If i turn it the other way around, it will actually pull up the minus 12 volts to minus 6 volts because these reloads only come in when it sees the top part of the waveform, come down to 6 volts or six volts or three volts. So that doesn't trigger it that would um well that wouldn't occur in in reality, i mean, if you put a single resistance across there, you'd bring both halves down and you can check for that and not pull the relays in.
If you see that this circuit doesn't do it at the moment, but i can get the relays to cut in by putting what the car will effectively put across there um when it starts seeing the one killer square wave. So right, i'm gon na go and find a piece of wood to mount all this on and just one other thing to note. If i reboot the arduino, this line goes to zero volts. Now, that's because the uh output, that's driving the two leds here - becomes an input and therefore these two leds both come on.

So both the optos come on. So we get the 12 milliamps going down through here and of course, this point uh is either side or is in the middle of two 1k resistors, and so it's approximately shows a little bit higher than zero volts. Actually, but it's approximately midway between plus 12 and minus 12, possibly the plus 12 is slightly higher from this power supply here than the minus 12 from the little dc to dc converter there, but yeah we're getting that zero volts. Now what the car will think of that? I can't remember - and i don't know so - it's all mounted on this piece of wood uh incoming mains here - that provides 12 volts via this power supply and the little 12 to 12 dc converter down here provides the minus 12.

um. That's going to come from this commander: that'll come from the big power bank, so i'm still not using house mains, i'm using a battery pack essentially uh. This output here goes to the car, so it's just live neutral earth and this control pilot line and, of course, on the other end of that wire, we have a type 2 connector that goes into the car's charge. Port and i've tried this on the car and, yes, it all works.

The potentiometer can be turned to vary the pulse width and therefore the amount of power - or in fact it's current, because this defines the current that the car pulls from the main supply. So by turning this pot, i can vary the power draw that the car's battery charger actually pulls from the mains. Now, of course, i can't go over about 200 kilowatts, because the blue etti power bank can't supply any more than that. It does have a little bit of a margin for going over um, but it will eventually complain and shut down.

The important thing, though, is that the car is quite happy with the rather curved square wave. I mean it is only just the top of the rise and the bottom of the fall are slightly curved off now there um created by the simply the switching time of these optos, i presume when you shine light on the opto base. It takes a little while to get rid of that electrons or something i don't quite know how it works takes a while for those to be dissipated equally at the the other end, it takes a while for them to build up now i did actually feed the Output of this uh driver - which is this thing here, um directly to cp, but then i took it out and fed it into the little emitter follower stage just to see if it's squared up the signal from these. But of course it doesn't because these are simply voltage followers minus 0.6 volts.
So the signal is slightly smaller now, so it doesn't really make any difference, but equally it doesn't do any harm, so i'll just leave it that, like that, for the time being but yeah, certainly the opto drivers thing works and that's the most important thing. But i have been thinking, do i need now the relays? Could i simplify this actually get rid of this board and just have the arduino uh and a little vero board, with the opto driver on it and just link the main straight through and do some tests related to if the car gets mains first and then the Square wave or if the car gets the square wave first and then the mains, in other words, what's the sequencing and will it get crossed if it's done in the wrong sequence. Those sorts of things i'd like to try but uh for this video. I'm happy that this all works, that my driver is going to be fine for driving the car's cp signal input this wire here, and so i'm going to leave it there for the moment.

So cheerio.

By Julian

Youtuber, shed dweller, solar charge controller aficionado

13 thoughts on “Arduino to charge an ev”
  1. Avataaar/Circle Created with python_avatars jlucasound says:

    Julian, I really do find your videos fascinating. I hope one day I will be able to totally understand what is going on. Keep up the good work and, "Duh, Duh, Duh, Dut…. Duh, Duh!! Charge It!! (That is supposed to be a Bugle and the battle cry). 🙂

  2. Avataaar/Circle Created with python_avatars David _1 says:

    YAY

  3. Avataaar/Circle Created with python_avatars smitcher says:

    Nice project Julian. It is 2022 though so you should probably ditch that Arduino and use a esp8266 or an esp32 and then you can give it wifi capability and put up a webpage to control it remotely from your phone or a computer and/or feedback useful information like temperature of the live relay…

  4. Avataaar/Circle Created with python_avatars Ali Bro says:

    I love this series but can't for the life of me remember why you're doing it. 😕

  5. Avataaar/Circle Created with python_avatars The Embedded Hobbyist says:

    I found that opto-relays are very slow, but then they are design to mimic relays. other opto-couplers are a lot faster. i tried to put a rs232 signal through the opto-relays and it just did not work at all.
    more swings than roundabouts 🙂

  6. Avataaar/Circle Created with python_avatars Dr.xxx says:

    super videi

  7. Avataaar/Circle Created with python_avatars TheMockTv says:

    You can use it to charge your car from a house connection/power bank, but is it also possible to charge your power bank from a charging station because something like this would be interesting for many people who are out and about with their e-bikes, e-scooters, etc. in order to then charge them again be able

  8. Avataaar/Circle Created with python_avatars barrybpl says:

    Can you change the charge current while it's charging or do you have to stop and start it?

  9. Avataaar/Circle Created with python_avatars Christoph Laimer says:

    Very honorable practice: Fixing the HW-Bugs at the source, and keep the SW as intended. Many companies behave differently – they develop faulty HW, and later fix that by SW! 😉

  10. Avataaar/Circle Created with python_avatars Steve Fox says:

    Ev are an interesting new take on motoring but i worry about the day im forced into one because of my love of audio 🙁

  11. Avataaar/Circle Created with python_avatars Ecospider5 says:

    What model of scope is that. The size is great for the type of things I would use a scope for.

  12. Avataaar/Circle Created with python_avatars T Mike says:

    👍

  13. Avataaar/Circle Created with python_avatars T Komoski says:

    Pure Magic in the title

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.