Joystick schematic; PWM OUTPUT, Reverse engineered

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
I've spent about 12 hours today reverse engineering this schematic and I think I've got it! But I would really like to test it and see if it works before aI make a new PCB. Awhile back someone was very helpful in testing/debugging a similar schematic on LTSPLICE. I've downloaded it and tried to figure it out, but am not having much luck. The one IC in my schematic is not in LTSPLICE's library, and I've googled and downloaded other symbol libraries, but to no avail. My plea is: Would someone have a little time to draw this up to see how it works in LTSPLICE--I think it should put out a variable voltage or a square wave, to drive a proportional hydraulic valve.
I've tried to make an orderly diagram, but I don't exactly understand what all's happening. I hope it's clear for you. For clarity, I labeled everything well, and then included a chart of the values. It's not a real big circuit.
Thank you so much for taking the time to look at this. I'll include the eagle file schematic that I drew this up in, also.
 

Attachments

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
Thanks. I've been dabbling in LTspice all morning, not not making much progress. It's unfortunate it doesn't have the toolbar in the Mac OS X version.
So the LT1006 would work for the LM2902N?
 

Alec_t

Joined Sep 17, 2013
14,377
So the LT1006 would work for the LM2902N?
Well, the LM2902N is very similar to the LM324. Do you have a good model for that? The LM324 model I have tends to crash the sim if more than one instance of it is used in a schematic, so instead I use the LT1006 model, which behaves ok. Your project doesn't seem to be very demanding on opamp performance, so I think the LT1006 model would be fine.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
Wow, I thought this was going to take days to draw up, but it's coming along. I might need help simulating it. I'll post my project when I get it done.
I'm not seeing a Potentiometer in the symbols library?
 

Alec_t

Joined Sep 17, 2013
14,377
IIRC, the pot isn't a standard component, but models are available from the Yahoo LTspice User Group. Alternatively, just use a couple of resistors in series and play with their values.
Post your asc file if you want help with running the sim.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
I think I got the schematic loaded into LTspice. I couldn't find a POT, but I just added a couple resistors as a temporarily work around. I'm not sure how to see what is happening on the PWM_OUT. I probably have some mistakes. I clicked RUN, but it says "nothing to analyze"
I'll have to read up on what to do next.
Attached is the schematic. It's different than the one in the first post. I renamed the components to make it simpler to read, and added values. Also attached is my LTspice file.
 

Attachments

Alec_t

Joined Sep 17, 2013
14,377
Your sim runs fine on my Windows machine but shows no oscillations. I think your reverse-engineering has missed something.
I've no idea how LTspice runs on a Mac, but on a Windows machine when you left-click 'Run' you get a drop-down box into which you can enter the Stop time in seconds (the default sim is a Transient one). When the sim has run its course, you click on a circuit node and a graph of the voltage at that node is displayed.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
Oh no. :(

I REALLY check each trace when reverse engineering. I Printed out drawings, checked and crossed off every trace. And triple checked again and again. I wonder if it's the LM2902N not working right in the SIM? or the temporary resisters R20 & R21 for the pots that's not working right...
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
WHEW! I think I got it. The error is in transcribing my circuit from Eagle Cad into LTspice. I had an extra NET connecting pin 7 & pin 1 on the LM2902N. Now it's putting out a pulse in the scope area. See if this works for you. It's supposed to be a constant Frequency, about 150hz. But it looks rather slow. That may be due to my lack of POTs. I'll look into the info you mentioned on POTs, now.
 

Attachments

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
I ordered my new PCB for this yesterday.
I wonder if the LTspice would be able to replicate the schematic perfectly. It would be neat to see it in action on my screen.
One note: The manliest has 2 of these joysticks, and the one is good. So I got a DS203 scope to see what was happening with the good, but for several days all I could get out of the good one was a constant voltage. But then I thought about adding a load to the joystick. And when I did that, it oscillated perfectly! right around 150hz just like the manual says, and you could see the ON time vs OFF time change as I move the joystick. Since I don't have access to the machine at present, I just used an old speaker as the load.
It would be really nice to see this in LTspice.
Say, I will try adding a 4ohm resistor to the PWM_OUT on LTspice. (The manual says that the PWM is made to drive a 4ohm coil solenoid).
 

Alec_t

Joined Sep 17, 2013
14,377
Here's a modification of your asc file which now works. I think you had the non-inverting input of U2 connected to the wrong side of C2.
I've changed things around the output of U3, shown R7 and R8 in potentiometer format (so that parameter 'w' sets the wiper position) and added a motor load.
I can't see any obvious purpose for C2, R11, R13, R14 and have shunted them to one side. The sim runs fine without them. They may have been intended to help restrict current surges, in view of th connection to current sense/limit resistor R16 (or they may just be intended to obfuscate the circuit :) )
 

Attachments

Last edited:

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
Thanks a bunch for the update. That's great, the scope readout looks just about like the good joystick I have looks using my scope. I found another mistake in there around C2. I labeled the nets n1,n2. I had them connected wrong, right around C2. I got them set up just like the board finally, (I think). and it runs great.

Do you know why the main power 12VDC coming into the high power transistor goes thru R16 -- a 2 watt, 1 ohm resistor. What would that do? 1 ohm wouldn't do much, so is it some kind of filter?

I'm really glad for how much I've learned about LTspice. It's not nearly as difficult as it looked.
 

Attachments

Alec_t

Joined Sep 17, 2013
14,377
Do you know why the main power 12VDC coming into the high power transistor goes thru R16 -- a 2 watt, 1 ohm resistor. What would that do?
I don't know why. It will drop some voltage. As I mentioned in post #15, it may be intended for current limiting, but I don't see how that would be achieved by the post #13 circuit.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
A question that I’ve been wondering:
I do a lot of work with Arduino, and the Atmega328P chip, but working with these descrete components to make this oscillator is new to me. I’m thinking I could pretty much replace this whole circuit with an Atmega328P driving the PNP transistor?
If this is the case, if I ever run into this again (this is the 2nd manliest joystick I've fixed), I might try that route.
 
Top