oobtim
Posts: 15
Joined: Sun Jul 01, 2012 10:52 am
Location: Chippenham, UK

GPIO Electronics Advice - Voltage Spike Protection

Fri Jan 10, 2014 8:13 pm

Hello,

I am interfacing my Pi via I2C to an analogue to digital IC on the Quick2Wire analogue board (pity Q2W isn't being supported as well as it was but that's another topic for discussion...). I have the board working fine, it all tests OK and detects voltages as it should.

The real issue is what I am connecting it to. I am intending to automate a tennis-ball launcher that works like a potato cannon. In particular I am using a camera flash connected to a car ignition coil pack to produce a spark to ignite the fuel, see:
http://www.spudfiles.com/spud_wiki/inde ... mera_flash
to get an idea of what it is I am doing.

The flash I am using at the moment produces a good spark but what would be good is to be able to detect when the unit is fully charged. Since the unit uses an LED to show when it is charged in its normal use I would like to detect when the voltage across the LED reaches a threshold so that I can tell the Pi that it is ready. Seemed to make sense to me. I found that the voltage is AC (not much use) so I have rectified it to produce a DC voltage that the ADC can detect. The problem is that using my multimeter I found that there is a voltage spike when I trigger the flash to spark. Normally the rectified voltage is about 1.5V when the unit is charged (which is well within the ADC range) but leaps to 100+V when the unit is discharged :shock:

Now obviously I shouldn't attach this rectified voltage to my Pi even with the diode protection on the break-out boards. So... I have tried placing an inductance coil in series with the output of the rectifier to block the spike and also put in a zener diode in parallel to clip the voltage at 3.3v but still to no avail. I can only assume that the diode simply doesn't switch fast enough. Is there any way to make sure I don't get these huge spikes so I don't fry the Pi? The only route I can think of is to ditch the attempt and use an LDR to detect when the LED is fully lit and read off that, or to cut off the connection to the LED using a relay so the voltage spike doesn't reach the ADC at all.

Any help and tips would be gratefully received :D

P.S. I teach physics and like electronics so I do have a good knowledge of circuits but I am by no means an expert! :)

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12400
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: GPIO Electronics Advice - Voltage Spike Protection

Fri Jan 10, 2014 10:15 pm

perhaps using opto-isolators is a part of the solution.

Paul Moir
Posts: 46
Joined: Wed Dec 04, 2013 7:25 pm
Location: Nova Scotia, Canada

Re: GPIO Electronics Advice - Voltage Spike Protection

Fri Jan 10, 2014 10:26 pm

Personally I think optoisolation like you're suggesting is best. It can be wickedly hard to properly suppress spikes like that from ignition circuits since they get induced directly into wires (capacitive or inductive), and you really have to consider the possibility of a coil insulation failure . You can get optocouplers purpose built like that or of course you can roll your own. LED/phototransisitor types are used for regulating switch-mode power supplies for example to communicate the output voltage level back to the high voltage side. If you want something more linear though, you can get photoFET optocouplers for a couple bucks each.

EDIT: Assuming you want to know how bright the LED is. If you merely want to know if it's lit bright enough (digital input) then a phototransistor optocoupler and a simple comparator is the way to go. Note that the common LM339/LM311 is not "rail-to-rail" so it's input needs to be Vcc-1.5v or 2v for proper function. This gives *very* little head room when working with a 3V supply so you may want to run it at 5v. Since the LM339/LM311 is an open collector output, you can interface it with 3.3v logic very easily.

EDIT2: you can probably exploit the GPIO input schmitt trigger function to eliminate the comparator.

boyoh
Posts: 1347
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: GPIO Electronics Advice - Voltage Spike Protection

Fri Jan 10, 2014 11:49 pm

I suggest you use Opto Isolators between your
project, This will totally isolate the Pi from
The voltage levels used and the noise
Generated , If you use two power supply's
you have no need to common the 0v-
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

oobtim
Posts: 15
Joined: Sun Jul 01, 2012 10:52 am
Location: Chippenham, UK

Re: GPIO Electronics Advice - Voltage Spike Protection

Sat Jan 11, 2014 5:37 pm

Many thanks for the replies. An opto-isolator it'll have to be then :D

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: GPIO Electronics Advice - Voltage Spike Protection

Sun Jan 12, 2014 4:19 pm

oobtim wrote:Many thanks for the replies. An opto-isolator it'll have to be then :D
Agreed. Opto-isolators (and solid state relays) have a hefty voltage isolation rating. 2,500 volts isolation is common with SSRs.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

grahamed
Posts: 277
Joined: Mon Jan 30, 2012 7:01 pm

Re: GPIO Electronics Advice - Voltage Spike Protection

Sun Jan 12, 2014 4:25 pm

Hi

IMHO you must not have any connection across the barrier, not even 0V.

Regards

oobtim
Posts: 15
Joined: Sun Jul 01, 2012 10:52 am
Location: Chippenham, UK

Re: GPIO Electronics Advice - Voltage Spike Protection

Thu Jan 16, 2014 5:55 pm

Argh!

Got an opto-isolator (the 4n25 to be precise) and set it up so that the output of my LED (mentioned above) is rectified, smoothed and put across the opto's input. When I tested it with a 4.5v supply for the output it works well and I see the output climb in line with the input up to the Vmax as it should. However a couple of times I have seen it still produce a voltage spike! :x Not much this time (from about 6 to 50v).

One of the times I did it connected to the Pi's 3.3v supply :o And the Pi froze :shock: Thankfully I reset and the Pi seems un-harmed. But why is this still happening, I thought the opto-isolator should have done just that; isolated!? Why am I still getting the spike? There is no way that the voltage is coming anywhere apart from the camera flash/coils unit!

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: GPIO Electronics Advice - Voltage Spike Protection

Thu Jan 16, 2014 10:14 pm

Look up MOV (Metal Oxide Varistor)
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

grahamed
Posts: 277
Joined: Mon Jan 30, 2012 7:01 pm

Re: GPIO Electronics Advice - Voltage Spike Protection

Fri Jan 17, 2014 5:42 pm

Hi

Now you have the opto in circuit - with no connection from one side to the other, not power supply, not ground, nothing - where exactly are you measuring these spikes?

The opto provides galvanic isolation; there is no d.c. connection through it. There can still be connection though, round it as it were, when the spike occurs in the high voltage circuit electrons accelerate causing radiation -this is basically a very broadly tuned radio transmitter. Do you hear clicks on nearby radios? Or could be capacitive coupling.

What is actually causing the spike? Is something breaking down? Is it due to a fault? Prevention is always best.

If you can't stop the spike at source then you must suppress its effects - connecting resistors, capacitors, inductors, Zeners or Varistors can all work but where to connect them? difficult to say without seeing the situation.

If you can see it on meter the spike is not so fast.

oobtim
Posts: 15
Joined: Sun Jul 01, 2012 10:52 am
Location: Chippenham, UK

Re: GPIO Electronics Advice - Voltage Spike Protection

Fri Jan 17, 2014 5:44 pm

Thanks I'll give it a go and let you know how I get on, I think I've few I ripped out of an old TV that might work. :)

oobtim
Posts: 15
Joined: Sun Jul 01, 2012 10:52 am
Location: Chippenham, UK

Re: GPIO Electronics Advice - Voltage Spike Protection

Sun Jan 19, 2014 7:45 pm

Hurrah! :D

I made my own opto-isolator from a LED (with current limiting resistor) and a LDR. When I attached this directly to where I needed to measure the PD I still got the voltage jump (albeit smaller). However when I used a length of co-axial and placed the unit about a metre away I could consistently fire the unit without any jumps (the largest I got was about 0.02 V). I assume then that the unit was producing a lot of RF and inducing a voltage in the wires.

Thanks for all the advice guys! :D

Paul Moir
Posts: 46
Joined: Wed Dec 04, 2013 7:25 pm
Location: Nova Scotia, Canada

Re: GPIO Electronics Advice - Voltage Spike Protection

Tue Jan 21, 2014 6:05 am

The RFI you're producing can be effectively suppressed by using a modest resistance (~2k) in your high voltage line. You can use resistance or inductive type spark plugs, or normal automotive ignition wire which has a high resistance. That stuff is made with a carbon conductor rather than a metal one. This will reduce the peak current flow after the arc forms and the resistance across your electrodes drops.

However, if you're arc is exposed (not shielded by metal) that will be a big source too.

oobtim
Posts: 15
Joined: Sun Jul 01, 2012 10:52 am
Location: Chippenham, UK

Re: GPIO Electronics Advice - Voltage Spike Protection

Tue Jan 21, 2014 5:55 pm

Hello Paul,

Thanks for the heads-up about suppressing the RF :) . I don't see it as a serious problem any more though as I only register about 5mV spike of PD now I have the opto-isolator. The unit will be a metre or two away from the Pi so any RF effects should be minimal.

However if I decide to put any other electronics near it in the future I'll certainly be considering it and remember what you suggested ;)

Return to “Interfacing (DSI, CSI, I2C, etc.)”