Arduino Forum

Using Arduino => General Electronics => Topic started by: andrewferguson on Apr 09, 2015, 09:33 am

Title: Problem with Op Amp
Post by: andrewferguson on Apr 09, 2015, 09:33 am
Hello everyone,

I am currently attempting to complete a project in which I am turning an old chart recorder into a plotter, however I have come across an issue involving the Op Amp circuit I am using to amplify a signal from the 5v Arduino to the 15v plotter.

I was initially planning to use the 741 Op Amp, however yesterday I realised that it required a bipolar power supply, which the plotter could not provide. I therefore bought a KIA358P single supply Op Amp from Maplin, which I hoped would solve the problem.

I wired it up today, however it constantly outputs 10.87v no matter whether 5v is inputted into the op amp or not. I looked at the circuit but could not come up with any reason for why it was not working.

Does anyone have any idea why this is not working? I have attached a photo of my circuit diagram to allow you to see what I am trying. One small difference between the circuit diagram and what I am currently trying is that I am currently powering the circuit from an external 12v power supply, rather than the 15v supply from the plotter.

Thanks,
Andrew
Title: Re: Problem with Op Amp
Post by: MarkT on Apr 09, 2015, 10:56 am
What voltage do you see on the chart recorder input with nothing connected?

Do you know the input impedance of the chart recorder?

What was driving it before?

Do you have decoupling on the opamp? 
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 09, 2015, 11:20 am
Hi,

The purpose of the op amp is not to go to the input terminal of the chart recorder. Instead, I am using it to send a pulse to a SAA1027 stepper motor driver IC. I can manually pulse the stepper by tapping a 12/15 v wire against the appropriate pin, however I need to be able to pulse the stepper from the 5v Arduino, hence the need to use an op amp to amplify the voltage. (The SAA1027 requires a minimum of 7.5v to count as a HIGH signal).

I am not using decoupling on the op amp, because right now I do not have the necessary capacitors. However, I don't thinks that the lack of decoupling would cause the output from the op amp to remain at 10.87v.

Right now, the op amp is not connected to the chart recorder. Instead, I have connected it to a standard 12v DC power supply and am checking the output voltages with a multimeter.

One possible thought I had for th source of the problem would be that both the ground from the Arduino and the ground from the plotter / 12v DC supply are connected together. I hope that is is not the source of the problem, because this is necessary for the other circuitry that I am using.

Any ideas?

Thanks for your help,
Andrew
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 09, 2015, 11:30 am
Schematic diagram looks ok.
Opamp amlifies 3times with these resistor values.
What you put in, you get out x3.
With a maximum of 1-1.5volt below the supply voltage.

Try to connect the +input to ground, and see what the output does.
It should be close to 0volt.

Wouldn't this have been easier with one small FET (2N7000) or transistor, with a 1K drain/collector resistor to +15.
Arduino outputs are digital. You don't need an analogue opamp for this.
Leo..
Title: Re: Problem with Op Amp
Post by: MarkT on Apr 09, 2015, 11:38 am
Chart recorders are analog devices, not digital!

My suspicion is that it needs a beefy driver, not a control voltage.
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 09, 2015, 11:39 am
Does the Arduino have an analogue output?
Title: Re: Problem with Op Amp
Post by: MarkT on Apr 09, 2015, 11:44 am
We would assume a RC filtered PWM pin would be driving the opamp...
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 09, 2015, 11:47 am
So connect the +in to ground, and see if the opamp outputs ~0volt.
Then connect the +in to 3.3volt, and see if the opamp outputs 9.9volt.

The purpose of the op amp is not to go to the input terminal of the chart recorder. Instead, I am using it to send a pulse to a SAA1027 stepper motor driver IC.
http://www.thebox.myzen.co.uk/Workshop/Motors_3.html
Bottom of the page.
Here I see two simple digital transistor level shifters on the inputs of the SAA1027.
Leo..
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 09, 2015, 12:25 pm
Hi everyone,

Thanks for the advice!

To Wawa, thank you for the link to the schematic, it looks interesting, however I am unsure how it works because the schematic shows pin 15 of the SAA1027 connected to 12v through a 20k resistor before it links into the transistor, surely that will mean pin 15 will always register as HIGH?

EDIT: After looking at the circuit, I think I now understand this. The 20k resistor is a pullup resistor that connects the pin to 12v, so when the transistor is not saturated the pin is HIGH, and when the transistor is saturated, the pin is connected directly to ground and therefore is LOW. Am I right?

Quote
So connect the +in to ground, and see if the opamp outputs ~0volt.
Then connect the +in to 3.3volt, and see if the opamp outputs 9.9volt.
I have tried that, and no matter what +in is connected to, the opamp outputs 10.87v. However, if I remove the ground from the Arduino, it works as expected. I am not sure why this is, but unfortunately the ground of the Arduino is connected to the ground of the chart recorder in another circuit, so that part cannot be altered.

Thanks,
Andrew
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 09, 2015, 01:03 pm
I am unsure how it works because the schematic shows pin 15 of the SAA1027 connected to 12v through a 20k resistor before it links into the transistor, surely that will mean pin 15 will always register as HIGH?
Yes, it's known as a level shifter.
R3 pulls the pin up (to the SAA1027's supply rail). And T2 pulls the pin to ground.
If R4 is left unconnected, or is grounded, SAA pin 15 will be high.
R4 can directly be connected to Arduino's 5volt pins.
A high on the Arduino pin is a low on the SAA1027 pin.
Inverted logic means that you might have to change your code.

Don't know what's wrong with the opamp. Check your wiring again.
The opamp only looks at the voltage between it's +in and it's own ground.
Leo..

P.S. Looks like that article is written by Grumpy_Mike.
He is also on this forum...

 
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 09, 2015, 01:09 pm
Hi,

Thanks for that. I now understand. I may alter the circuit slightly, because the SAA1027 is already connected in the chart recorder and the pin is LOW when there is no pulse, and therefore my transistor will need to send a HIGH signal to pin 15 to get the stepper motor to function.

Thanks,
Andrew
Title: Re: Problem with Op Amp
Post by: Paul__B on Apr 09, 2015, 01:49 pm
I think many people have failed to discern that you do not want to "amplify" an analog signal (which the Arduino dies not in any case provide) but simply to drive a 15V control input.

This is not a job for an "Op-Amp" at all!  Do not even attempt to use one.  Use Mike's circuit.  You can adjust your code to account for whether you need to drive the SAA1027 input high or low at any given moment.

Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 09, 2015, 06:58 pm
Hi all,

After experimenting with this for a while, I am still unable to get it to work. To clarify the goal of this: I want to be able to use the PWM Frequency Library to drive the pulse input for the SAA1027 stepper motor driver IC. I have succeeded in getting the PWM Frequency Library to generate the pulse, but it it 5v, and the SAA1027 requires a minimum of 7.5v to count as a HIGH signal.

I wired up Mike's circuit, however it did not work - the motor did not move at all. I think this is because the SAA1027 is already wired into the circuitry of the chart recorder, resulting in pin 15 already being  connected to ground. (The chart recorder uses pulses from 0v to 15v, unlike Mike's circuit which uses pulses from 15v to 0v).

I have managed to successfully make the stepper move by manually tapping a wire taken from the chart recorder's own 15v DC supply against pin 15.

What I basically need is a relay-type transistor circuit, so whenever the circuit receives a 5v pulse from the Arduino, it connects the 15v supply of the chart recorder to pin 15 of the SAA1027. Does anyone know how I can do this with minimal components?

Thanks,
Andrew
Title: Re: Problem with Op Amp
Post by: MarkT on Apr 09, 2015, 07:17 pm
It would have been useful to know about the SAA1027 from the start - we can't mind read!

opto couplers or level shifter using NPN transistor are the obvious approaches.  opto coupler
is more robust.
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 09, 2015, 07:53 pm
Hi MarkT,

Thank you for your advice. I have looked for opto couplers on the Maplin website (I can easily get parts from Maplin), and found a few, however the do not give the specific model number of the opto coupler, or say its maximum speed. Would you be able to help?

The maximum speed I would need is around 250Hz. Would any of these:
http://www.maplin.co.uk/p/low-current-opto-coupler-cy94c
http://www.maplin.co.uk/p/phototransistor-quad-opto-isolator-yy63t
be any good?

Also, are there any external components required when using opto couplers?

Thanks,
Andrew
Title: Re: Problem with Op Amp
Post by: MorganS on Apr 09, 2015, 08:29 pm
Yes, an optocoupler requires a resistor on the input side - it's just an LED, like any other.

Note that optocouplers have very wimpy output transistors. If the circuit won't work with the 2n70000 then it probably won't with the bare optocoupler and you would need to amplify its output with a bigger transistor.

How much current does the thing draw when you connect the input to 15V? Please measure it. I suspect that it requires more current than the pullup resistor was supplying. You can use a lower value resistor, so long as it's within the power capacity of the transistor.

Title: Re: Problem with Op Amp
Post by: Paul__B on Apr 09, 2015, 08:36 pm
Still wasting time until the actual circuit of the device being controlled is determined and detailed here.
Title: Re: Problem with Op Amp
Post by: polymorph on Apr 09, 2015, 08:59 pm
FYI: Unless you are using optocouplers, the grounds -must- be shared.

All unused Op Amp and comparator sections MUST BE PROPERLY TERMINATED. If not, it may latch up or burst into oscillation and spoil the operation of the other sections through the common substrate.

DO NOT SIMPLY GROUND EVERY PIN NOT USED!

Do this:
(http://www.electronicproducts.com/images2/facn_TI3_nov2012.gif)

More information, but please note that Figure 2 is how NOT to do this:
http://www.electronicproducts.com/Analog_Mixed_Signal_ICs/Amplifiers/Properly_terminating_an_unused_op_amp.aspx (http://www.electronicproducts.com/Analog_Mixed_Signal_ICs/Amplifiers/Properly_terminating_an_unused_op_amp.aspx)
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 09, 2015, 10:46 pm
Hi polymorph,

Thank you very much. I did not realise that you had to terminate the other outputs on the op amp. Once I had done this I could get the op amp to take the voltage from the Arduino and amplify it up to 12.99v.

However, for some reason, I cannot get this voltage to control the SAA1027.

I have connected the ground of the Arduino / Op Amp to the ground of the chart recorder, and manually tapped the wire with the 12.99v output from the Op Amp onto pin 15 of the SAA1027 IC, expecting to hear the stepper motor pulse. Unfortunately, nothing happened. I have previously managed to get the stepper to pulse by tapping a wire from the 15v of the chart recorder onto pin 15, and also by tapping a wire from an external 12v power supply. The fact that it worked with 15v and 12v makes me think that it is not too picky about voltages - and therefore should not mind the 12.99v from the Op Amp.

Does anyone know why the output from the Op Amp is not driving the stepper, but the chart recorder's own 15v supply and an external power supply are?

To Paul__B, it is unfortunately not possible (or not easy) to post a circuit diagram for the chart recorder. It is an old (1982) electronic chart recorder manufactured by Philip Harris, and I cannot find any information about it online. If there is any specific information you would need, let me know and I will do my best.

Thank you,
Andrew

Title: Re: Problem with Op Amp
Post by: polymorph on Apr 09, 2015, 11:08 pm
What exactly is the signal that the chart recorder is looking for on that pin? A 15V pulse? Of what width?
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 09, 2015, 11:30 pm
It's all explaned in the SAA1027 datasheet (http://baec.tripod.com/datasheets/SAA1027_philips.pdf).
Pin15 is a count input, with 4.5volt and 7.5volt switch points.
Counting (motor movement) is done if pin15 changes from low to high.
Mode input (pin3) is motor direction.
There is also a reset input.
Leo..
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 09, 2015, 11:35 pm
Upon further inspection, I have found that the problem definitely lies with the Op Amp circuitry. To prove this I connected up the 12v external power adapter as the supply for the op amp, and it did not work. Does anyone know why the op amp circuitry is not working with the SAA1027, when a "regular" power supply is? The details of the SAA1027 can be found here: http://serge.bertorello.free.fr/compsnts/saa1027.pdf

To polymorph: the SAA1027 chip is looking for a pulse that is above 7.5v for HIGH, and below 4.5v for LOW. The delay between the pulses determines the speed of the stepper motor. For example, to get the chart recorder to move the paper at 10mm per second, the delay between the pulses would need to be 10 milliseconds, for 20mm per second the delay would need to be 20mm per second, and so on.

Thanks,
Andrew

EDIT: Just seen Wawa's post. His explanation is correct (and probably better then mine).
Title: Re: Problem with Op Amp
Post by: Paul__B on Apr 10, 2015, 12:52 am
To Paul__B, it is unfortunately not possible (or not easy) to post a circuit diagram for the chart recorder. It is an old (1982) electronic chart recorder manufactured by Philip Harris, and I cannot find any information about it online. If there is any specific information you would need, let me know and I will do my best.
I would be rather surprised if you could find a schematic for the chart recorder.

The problem is however, that you clearly do not seem to know to what it is that you are connecting.  You must fully trace out the input circuit  to the SAA1027 so that you know how to control it, and if you want assistance here, you need to post your diagram of that part of the circuit here.

Using an op-amp for this function is simply foolish - it is not something an op-amp is intended to do.  You need to connect some ordinary transistors to perform the function, but until and unless you know - and can explain - to what it is you are connecting, it will be futile.
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 11:02 am
Hi Paul__B,

I have now traced the circuit for the SAA1027 in the chart recorder. I have attached a photo of the circuit in the hope that it will help you to help me create a circuit / modify my existing Op Amp circuit so that I can get a 5v Arduino signal to control the stepper by pulsing pin 15 of the SAA1027.

Hopefully this will make everything more clear.

Thank you,
Andrew
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 10, 2015, 11:51 am
Just connect a 10k resistor between Arduino pin and the base of that 2N3704 transistor and you're done.
That transistor is already a level shifter.
No opamps needed.
And ofcourse connect Vee (SAA1027 ground, pin5) to Arduino ground.

I took the liberty of re-drawing the input part of your schematic.

If that 555timer input is not used, you can use that to connect to the Arduino output pin.

I see that pin 3 of the IC is not used.
Is the stepper motor only going one direction?

You can test the stepper motor with a 9volt battery.
Connect the + to the 10k resistor/in, and - to ground/Vee.
The moment you REMOVE the battery, it should step.
So it should only steps on NEGATIVE going pulses, as on my drawing.
Leo..
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 12:38 pm
Hi Wawa,

Thank you very much for the advice and the circuit. I will put the chart recorder back together again (I took it apart to trace the schematic), test your circuit, and get back to you.

Regarding pin 3, the stepper motor was only designed to go in one direction, however I will be making it go in two directions. I looked at using pin 3 to reverse the direction, but I did not think that it would be possible to control because it was connected directly to Vcc. Instead, I am using a DPDT to reverse the output wires of the SAA1027, which reverses the stepper direction.

Thank you again for your help and the circuit.
Andrew
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 10, 2015, 12:49 pm
You can duplicate the pin-15 circuit.
Almost any NPN transistor and diode will do, like the BC547 and 1N4148.
And connect that circuit to pin 3.
Then you can reverse the motor with a second port of the Arduino.
If you then DON'T connect the input of that circuit, the IC pin will be high, same as it was before.
Leo..
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 02:23 pm
Hi Leo,

I am not sure that I understand. I see what you mean by making another circuit like the one for pin 15, but I fail to see how it will work because pin 3 is wired to Vcc without any resistor, so when the circuit receives an input it will effectively short Vcc to Ground. Will I need ti cut the trace on the chart recorder's PCB?

Thanks,
Andrew
Title: Re: Problem with Op Amp
Post by: Paul__B on Apr 10, 2015, 02:33 pm
Clearly.

That's the sort of thing you do to hack hardware.  ;)

And I do presume you have similarly disconnected the connection from the 555 to the 2N3704 so that it does not interfere with how you want to control it.

My job here is done! :smiley-lol:
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 03:10 pm
I have not disconnected the 555 from the 2N3704 because one of the goals of this project is to have the chart recorder work with the Arduino, but also to preserve its original functionality. Do you foresee any problems with leaving the 555 connected to the 2N3704? (There will be no output from the 555 at that time.)

What value for the resistor between Vcc and pin 3 do you recommend? The one the chart recorder uses for pin 15 is 2k2, the closest I have are 1k or 3k3. Would any of them be suitable? (Vcc is around 15v, the SAA1027 registers HIGH at >7.5v, LOW at <4.5v)

Thanks,
Andrew
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 05:39 pm
Hi everyone,

An update to what has happened so far. I have tried tapping the 5v of the Arduino against the 10k resistor, however for some reason it is not making the stepper pulse. I checked to make sure the grounds of the chart recorder and arduino are connected (they are), but I still cannot get it to work. Using a multimeter I measured the voltage between the 10k resistor and Ground whilst the chart recorder was pulsing the stepper by itself, it displayed 5.6v, so I assume that the Arduino can control it. The voltage coming out of the 10k resistor and into the base of the transistor is 0.7v as expected.

Does anyone know why this is not working? Could it be because I have left the OUT of the 555 timer connected to the 10k resistor whilst testing?

Thank you,
Andrew
Title: Re: Problem with Op Amp
Post by: polymorph on Apr 10, 2015, 06:37 pm
Schematic?
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 06:56 pm
The schematic is the one provided by Leo (Wawa) in an earlier post - 2N3704.jpg . For convenience I have attached it to this post.

Andrew
Title: Re: Problem with Op Amp
Post by: Anders53 on Apr 10, 2015, 07:01 pm
Funny thing is, that op-amps do not really need a dual power supply.
But that is the principal way to explain it.

Its the input signal you will have to control, to be symmetrical around half the supply voltage.
That way the op-amp thinks the input signal is around the ground level.

Its done very easy in AC signal applications, where a resistor divider sets the midpoint to bias the op-amp input.
A signal capacitor is then used as a DC level shifter on the signal input.

In cases with non critical signal applications, like digital signals, you can use the op-amp as a simple signal comparator, where you only control the gain, to prevent the op-amp from oscillating.

Set one opamp input to half the signal supply voltage of the signal sourcing supply, and then amplify as usual.
The op-amp will output a steady low level, until the input signal exceeds half the signal supply voltage.
Then the op-amp output swings high to its local power supply level.
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 07:22 pm
Hi,

Anders53, thanks for the information. I am sure that it will be very useful when I am using Op Amps in other projects.

I have now eliminated the problem of too low current in Leo's circuit, by using a PC Power Supply with 5v. It can supply a large current, but again, nothing happened when 5v was tapped against the wire going into the 10k resistor.

Can anyone help me resolve this frustrating issue?

Thank you,
Andrew
Title: Re: Problem with Op Amp
Post by: polymorph on Apr 10, 2015, 08:19 pm
Quote
...nothing happened when 5v was tapped against the wire going into the 10k resistor.
Where? If directly to the transistor base, it'll burn it out. Do you mean you have a freehanging 10k resistor with one side on the transistor base, the other side to nothing, and tap it to 5V?
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 08:59 pm
Not quite. The 5v is connected to one side of the 10k resistor, the other side being connected to the base of the transistor. In addition to the 5v being connected to the first leg of the 10k resistor, the output of the 555 timer is also connected.

Andrew
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 10:24 pm
Hi everyone,

Just a quick update to say that I have now measured the Vcc of the 555 timer and have determined it to be around 6v. I then used a voltage divider to half the voltage on my 12v power supply in case it would be triggered by 6v rather than 5v, but no success.

Does anyone have any suggestions for what I can try next?

Thank you,
Andrew
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 10, 2015, 10:26 pm
I have not disconnected the 555 from the 2N3704 because one of the goals of this project is to have the chart recorder work with the Arduino, but also to preserve its original functionality. Do you foresee any problems with leaving the 555 connected to the 2N3704? (There will be no output from the 555 at that time.)
Yes. If the 555 outputs a "high", even a few volts, the transistor will always be "on".
The Arduino resistor can only turn the transistor 'on", not off.
It is sort of an "OR" port. If 555 OR Arduino inputs a voltage, the transistor is "on".
If the timer would output a constant "low" there would be no problem.


What value for the resistor between Vcc and pin 3 do you recommend? The one the chart recorder uses for pin 15 is 2k2, the closest I have are 1k or 3k3. Would any of them be suitable? (Vcc is around 15v, the SAA1027 registers HIGH at >7.5v, LOW at <4.5v)
3k3 is fine.
Leo..
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 10:34 pm
Hi Leo,

Thank you very much for your suggestion. I have just checked on the chart recorder, and yes the 555 timer is always high (5v)! This is almost definitely the source of the problems I have been having. Aside from cutting the connection from the 555 timer, do you know of a way round this (I really would like to keep the original functionality of the chart recorder).

Thank you,
Andrew
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 10, 2015, 10:42 pm
I think the only way around that is to use a switch.
You could also use some sort of switching socket (headphone socket).
So you can connect/disconnect the Arduino with a jack plug.
As soon as you plug that in, it switches the 555 off.
You can use a 3.5mm or 6.25mm TRS jack plug for that.
Leo..
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 10:56 pm
Hi Leo,

Would it be possible to use a logic inverter to invert the HIGH to a LOW? (see attached photo).

IN would be connected to the output from the 555 timer, V+ to 5v, and OUT would go to the 10k base resistor. Would the HIGH signal from this circuit (when the transistor is off) be enough to turn the other transistor on, with its 10k base resistor? And is there any other problems you can spot with this idea?

Thank you,
Andrew
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 10, 2015, 11:05 pm
If you are sure the timer will always be "high", there is another way.
You can use a transistor to turn the transistor off.
Give me 10 minutes, I'll draw up the diagram.
Leo..

Here it is.
Note: logic is inverted, so adapt your code. A low to high signal will step.
edit: this circuit is not affecting the original function of the plotter.
If you remove the Arduino, that transistor is always "off".
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 10, 2015, 11:44 pm
Hi Leo,

Thanks for that circuit, I will try it and let you know how it goes.

I have one question, you say 'If you are sure the timer will always be "high"', do you mean that the timer must always be HIGH when the extra transistor in your circuit is switched on? And if so, how bad would the consequences be of switching on the transistor when the timer was LOW? Would it break the chart recorder, or just not work?

Thank you for your help,
Andrew
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 11, 2015, 12:13 am
Nothing will go wrong if the timer output is "low".

The Arduino input just won't work anymore.
The supply for the first transistor comes from the timer....

Timer "low" = base Tr2 always "low" = SAA pin 15 always "high".
Leo..
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 11, 2015, 10:28 pm
Hi Leo,

I have now tested the circuits you provided - thank you very much, they work brilliantly! I am nearly finished this project (just need to finish the code, and solder everything together), hopefully it will go smoothly from now on.

One other question that I had, in your first diagram (2N3704.jpg) you include a diode. In the diagram you have labelled it as "negative pulse protection". Is this simply to prevent damage to the chart recorder if the voltage into the base of the transistor dropped below 0v? Do I need it for the circuit for pin 3 (direction) if it will never drop below 0v? (I don't mind including it - I probably will just to be sure- but I am curious)

Thanks again,
Andrew
Title: Re: Problem with Op Amp
Post by: Paul__B on Apr 12, 2015, 12:14 am
One other question that I had, in your first diagram (2N3704.jpg) you include a diode. In the diagram you have labelled it as "negative pulse protection". Is this simply to prevent damage to the chart recorder if the voltage into the base of the transistor dropped below 0v? Do I need it for the circuit for pin 3 (direction) if it will never drop below 0v? (I don't mind including it - I probably will just to be sure- but I am curious)
The reason that diode is there is only because you had it in your diagram of the chart recorder.  His notation of its purpose is correct, but we really have no idea why it is in the chart recorder - it would appear to be quite unnecessary unless some part of the circuit is likely to generate a negative voltage, such as a capacitor coupling from the 555 or the 555 is operating from a different negative supply.

As long as the "ground" from the Arduino is the same as the "ground" of the circuit you illustrate, it would not be necessary for the second interface circuit.
Title: Re: Problem with Op Amp
Post by: Wawa on Apr 12, 2015, 11:05 pm
^ correct.
Just a protection in case there could be a negative voltage put on the base.
Maybe wise to add a 1N4148 to that first transistor if you don't wire it up permanently to the Arduino.
Leo..
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 14, 2015, 10:44 pm
Hi Leo,

I have unfortunately run into some more trouble with this project. I connected up the circuit to make the pulse on pin 15, and that worked well, however I am unable to make the circuit that reverses the direction of the stepper motor work.

I wired the circuit as show in your diagram (2N3704.jpg) however the stepper always moved backwards, no matter if the transistor was on or off. I then removed the base resistor and connection with the Arduino, leaving only with transistor with its collector connected to 2K2 resistor and pin 3, and the emitter connected to ground. To my surprise the stepper motor still moved backwards, despite the transistor not being linked into the Arduino at all. When the wire linking the transistor and the 2k2 resistor / pin 3 was removed from the collector of the transistor, the direction of the stepper motor returned to normal.

I have attached a photo of the schematic which should help explain the problem better.

Do you have any ideas about this problem?

Thank you,
Andrew
Title: Re: Problem with Op Amp
Post by: MorganS on Apr 15, 2015, 06:08 am
Maybe the transistor is faulty? Measure it with your multimeter (on the diode setting, if it doesn't have a transistor setting.) The transistor collector and emitter should not pass current in either direction when the base is not connected.
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 15, 2015, 09:06 am
Hi,

I have checked the transistor and it does not allow current to pass through when the base is not connected. I have also tried swapping the transistor with another, and the same problem occurred.

I am now considering using a relay to allow me to use the Arduino to connect pin 3 to ground, or perhaps an optocoupler. I know that the relay should work, does anyone know if the optocoupler will work?

Thanks,
Andrew
Title: Re: Problem with Op Amp
Post by: andrewferguson on Apr 15, 2015, 10:16 am
I have now solved this problem. I switched around the transistor used for the pulse and the one used for the direction, and everything now works. I am not sure why the direction circuit did not work with its original transistor and two others I had, but it seems to work well with the transistor I used for the pulse circuit, and the pulse circuit works with the one originally used in the direction circuit.

Strange, but it works.

Andrew