SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By lukemalpass
#91851
OK I will scrap the current NPN idea (it was idea in head probably not as simple as I described it), and just try the transformer circuit. I will design that up later today and post it before making it.

Also, with regards that PAGE3 ref, perhaps the 20k was for impedence matching of the sensor? Although its typically 500ohms not 20k! So I suspect its not that, it may just be for dampening as you mentioned... meh, its not really important anyway its not going to be used but its just for general interest.

I will also only pulse 5Vpp when using the transformer as if the sensor I am using that I have no specs on is limited to 50V pulses then I dont want to brick one by getting 90V+ from the full 10V drive. I can change it up after if I still don't see enough drive as I have 20 of these sensors to play with. And I now have a Prowave outdoor sensor to compare each circuit with the see the difference in behaviours.


As for the 74HC04 and CD4009 idea, are they really needed as stated before I am already getting a 10Vpp drive as it stands.
By MichaelN
#91895
I really doubt you would "brick" a sensor with 90V p-p. All similar sensors I've seen had much higher voltage ratings (eg 140V p-p), but only for low duty cycle (eg 0.4ms bursts, 10ms interval).
By lukemalpass
#92029
Just had an email back from ProWave regarding the transformer and they say it has nothing to do with driving voltage, but...

"The IFT is an adjustable transformer that is not only for impedance matching purpose but also to tune out the imaginary component of the transducer by the 2nd inductance to obtain the shortest TTL output signal. "

Not sure I understand what they are on about there, but I still can't see why they say it isn't for driving... surely it _could_ be used for a 1:10 gain of voltage even if it wasn't designed for that purpose? Or is there no point me building the circuit?

Here is the data http://www.scribd.com/doc/25959944
By lukemalpass
#92135
They have got back in touch and said they mis-read my question and say yes the transformer will do what I am after.

Here is my new design. I am going for a single drive (driving one leg not both) to begin with to simplify the design and limit it to 50V max just in case the sensor is limited and also if its not needed then no point in doing it.

Can you see any issues? My main concern is I have put the diodes in between the first RC high-pass fitler (R1 & C1) so that the current will be limited before reaching the diodes (I presume thats possibly what the 20k res was for on the other design?), and am unsure as to whether this will effect the operation of the RC?

Image
By MichaelN
#92136
Looks reasonable. R1 is needed, otherwise the diodes would prevent any signal from driving the transducer. It can't be too low, or you'll load the transformer excessively.
By lukemalpass
#92636
Right problem 1. The PIC wouldnt program in circuit using the ICSP. Removed the NPN and it programmed fine. Not sure why but obviously effects programming. Any ideas why?

Secondly, with the board all programmed and functioning as normal, but driving only 1 leg this time (DRIVE1), I first scope the output of the DRIVE1 pin connected to the PIC and the NPN. And even though the code drives the pin to 5V for 13uS, then low for 12uS, then repeats 10 times, on this board compared to the others, the drive is not staying high, and is only 1.2V max... what the?

Image

Any ideas why its doing that as this is a scope directly connected to the PIC output pin which is being driven high for 13uS, yet the scope shows its only staying high for less than 2uS? (by the way the NPN is a BC317 I made sure the frequency was fast enough).

So to confuse it more, here is the scope on the C-E side of the NPN at the JPIN pin.

Image

As you can see once it is then driving what should still be 5V is now only 200mV.

I've no idea why its doing this but what about if I just scrap the transistor and smoothing caps for now and just try driving the transformer directly with a diode in series? As it would still drive at 5V and would still deliver 30mA current?
By riden
#92659
Do you have a resistor from the PIC to the drive (base) of the transistor to limit the base-emitter current? If not, throw in a 1k or so and see how that works.
By jremington
#92688
The design is plausible, but you do need Q1 and a base-current limiting resistor on Q1 of at least 220 ohms. The PIC can't drive a transformer load. Without a current limiting resistor, the transistor base is a diode short on the PIC output, which is probably why you can't program it.

Second, when switched rapidly, the transformer will generate high voltage spikes on the primary side as well as the secondary. Those spikes probably damaged the transistor by exceeding the Vcb breakdown voltage (the specs say Vcb=60V for 2N2222).

The old Polaroid ultrasonic ranging cameras have a special module to drive the electrostatic transducer with 200V pulses, generated from 5V by a similar circuit. They were built around two "mystery chips" but used an external NPN driver transistor with a high Vcb breakdown. The circuit diagram can be seen at

http://www.acroname.com/robotics/parts/R11-6500.html

You can still find these cameras at thrift shops for a couple of $.

Jim
By lukemalpass
#92704
Thats for the posts guys. Doh, forgot the resistor on the pic pin! *slaps forehead*. Will get that soldered on tonight and re-post, certainly explains it though.
By lukemalpass
#92814
That solves that one. Added 1k res and can now program and the drive is all there.

I brought myself a new better quality X10 probe so I could also measure the final drive. Here is the result from the pic pin and the sensor leg:

Image

A is X10 so thats a good 80-90V drive there, and B is the drive going into the transistor.

So that means the sensor is being driven at much higher voltage now.

However, when I put my probe over the POUT pin coming out of the amp it is always full rail-to-rail all the time, even over 1 second, so its never going away. I presume this is because I am now driving the sensor a lot harder, and yet still amplifying 7,500x. However, even with the sensor disconnected the amp is always rail-to-rail. Do you think that is still due to just the residual noise even without a sensor connected, and its all due to the high amplification?

If so, I think I will make the next circuit all exactly the same but lower the amplification down to 1,500, what do you think?
By jremington
#92836
What do you mean by the op amp is "rail to rail". Is it oscillating? If so, at what frequency?

If not, is it stuck at one rail? Offset null may be a problem. 1 mV x 7500 = 7.5 volts.

What is the power supply voltage and what op amp are you using?
By lukemalpass
#92841
Oh sorry I just noticed I only did the 1,500x amplification on this board not the 7,500 one, its the 38x per stage setup.

OK spent some more time figuring this out. All the circuit seems fine for driving the sensor as shown, however the amp is always rail to rail. So I started to look into it and started off by removing all PIC code, so the PIC does nothing, just receives power. And the rail-to-rail is still there, with no sensor connected, with it connected, makes no difference.

Here are some scopes with just power connected and a blank PIC. All the noise is 45kHz and nothing to do with any driving at 40kHz as the PIC is not doing anything and the sensor is not connected. All lights, TV, amps, fires and everything but my fish tank are turned off also, with or without the laptop plugged in, and with the scope and board 2 meters away from the laptop screened with tin foil:

First one at JPIN (connected to high side of Primary 1 of transformer as shown in schematic above):

Image

This noise happens over and over.

Then this is the scope on the Secondary 1 of the transformer (so should give x10 of anything on the input... however the noise goes down?

Image

So that noise will be effectively at the sensor leg that is usually driven at 80-90V and would be fed through the 10.5k resistor and 390pF cap into the amps first stage, but this is with no code running.

Let's take a look at what is coming out of the first stage, so it should be this noise amplified almost 38x as its close to the 40kHz bandpass:

Image

Now this is definately the same frequency noise and it is much higher, now up to 230mV P-P, however this noise is a constant noise, whereas prior to this the only noise picked up was in bursts every 30 or so ms, so I don't think this is the same thing some how.

And so due to this, the second and final stage of the amp (POUT) that goes into the comparator is now the full rail-to-rail I see:

Image

This scope is at x10 on the probe so that is the full approx 3.5V rail (5V supply minus the rail limit). The frequency again is still 45kHz (45.11kHz precisely on the measurement).

Out of curiousity I also put the probe over the MCLR pin, and got this noise:

Image

Now I don't know whether this is just due to the fact that this trace runs very close to the final amp output (0.5mm away), so is probably just picking up on the noise?


The amp is the Microchip MCP6L94T (10Mhz quad amp http://www.farnell.com/datasheets/387983.pdf). It is supplied with 5V and offset by 2.5V (as shown in schematic above).

Any ideas why the amp is railing with nothing running at all? This doesn't happen on my previous board that is identical except without the transformer, transistor and BAV99, and successfully drives indoor sensors without the transformer, but doesn't drive these outdoor sensors, so I suspect its possibly due to the transformer, although may be nothing to do with it.
By jremington
#92854
This is a very high gain circuit and it is oscillating. You probably have insufficient power supply decoupling. Put a capacitor (0.1 uF) right across the power pins on the op am IC(s) and try C9=100 uF, C2=10 uF. Use high quality capacitors if you have them.

Jim
By riden
#92857
A couple of things to look at...

1) I don't see an external pull-up on MCLR

2) If you are seeing noise at JPIN and Q1 isn't being driven, that noise is probably coming in on VDD. So you might want to look at VDD as well.

3) Try bringing MCLR down to VSS (low) and see if the noise changes or goes away.

4) The circuit looks okay to me, but your amplifier may oscillating or is border line unstable. Try taking TR1 out of the picture and see if things improve.
By lukemalpass
#92916
I'm using MCLR as internal pullup so would I still need to try pulling it low?

I've added another 0.1uF and 10uF cap directly over the PIC, and a 0.1uF and 100uF cap directly over the amp, and the 100uF for C9, and the noise is exactly the same.

This got me thinking, so I put the probe on ground and this is on the ground plane:

Image

Firstly, shoudl this noise be on ground as thats where it gets filtered? If not, this makes me think that all the noise is not getting away and could this possibly be due to a tiny short to ground by some pin or trace somewhere? I've extensively looked at the board and tested for continuity and there seems no problems but it may not detect hair line joints, as I can't see it being much else?