Sine wave 2Hz 4-20mA

so a normal servovalve, you will need a analog card and motion control.
or a simple arduino, and a lm317 transistor together 10 $.
max freq is around 20000 Hz,no minimum.
 
Whoops, my mistake.

Ignore my suggestion for a freq-to-current 4-20mA suggestion; this is the wrong thread, it was meant to go to the Dossimass E&H thread.

Dan
 
Originally posted by mk42:

If this is a safety system,...

The proportional relief valve he emil.wojda is not a safety device. It is the pilot control device for a pilot operated hydraulic regulator. We have used our share of them around here for electronic nip pressure control. We generally don't do anything real dynamic with them. We just send them an analog signal based on the operator's desired nip force, which usually doesn't change much and certainly not very often.

I like shooter's idea of the arduino. You will be hard pressed to beat the price/capability point given what you are trying to do. Reliability? That's another question.

Keith
 
welcome to the forum ...
this is the code from an Add-On Instruction that I use for testing various analog devices ... the output signal could be fed into an analog output module – which (if properly scaled) should give you the 4 to 20 milliamp output that you requested ...
.
Hey Ron
I put that code into a PLC just as you show, but I get an output from -4000 to +12000.
I checked multiple times and I didn't typo anything. Is there a piece missing?
 
Is there a piece missing?

no, the formula that I posted is a direct screen shot of the code that works ...

suggestion: post what you've entered and we'll take a look ...

did you put it into a ControlLogix - or something else? ...
 
Ron, here's what I see. I tried with REALS and DINTS. This is on an L32E.
edit:I also cant use a value below 1776 for Period_MS.
edit:The minimum period_MS I can use changes with that timer.ACC. As it grows larger so does the period_MS
Edit: Making the .PRE = to Period_MS appears to solve this problem but doesn't address the range of output.
SineWave.jpg
 
Last edited:
Double-check your equation. There are quite a few typos as compared to Ron's. Do a copy and paste on this:
((SIN(SinWaveTimer.ACC*(6.283185307/Period_MS)))*((Wave_Max-Wave_Min)/2))+(((Wave_Max-Wave_Min)/2)+Wave_Min)

Good luck
 
Thanks for playing along...:)

I should probably know this cold but I don't. Where does the 6.283185xxx value come into play? 2 x Pi right?

Also, since I am fixated on this... in my quest for answers I took the timer and replaced the long preset with the period_ms value and it appears to work just as well. Am I missing the point of big number in there? One benefit to this method is that when the big number reached its end and resets, the waveform is disturbed. When it matched the period it doesn't distort the waveform on reset at all.
 
Where does the 6.283185xxx value come into play? 2 x Pi right?

right ...

One benefit to this method is that when the big number reached its end and resets, the waveform is disturbed.

well, that sort of disturbance isn't really what I'd call a "benefit" – but since it only comes around once in about 24 days, it doesn't really matter in the types of experiments that I use the function for ...

party on ...
 
The disturbance isn't the benefit, the lack of disturbance when using the period_ms as the timer .PRE was the benefit. But as you say, only noticeable during a long run.

I also changed the TON to an RTO. This lets me stop the wave at any point and it will stay there, restarting from that point when needed.

SinWaveGen.jpg

Might come in handy when looking for oddities that only happen at some value...

party on Garth . . .
 
Last edited:

Similar Topics

Hello Experts, I am trying to create a SINE Wave generator and i cannot seem to make it smoother. I have done this before but i forgot the exact...
Replies
6
Views
330
Hi dear forum, I need to create a test sine wave that so that I could check settling time in bidirectional inverters. Function that needs to run...
Replies
12
Views
1,191
Hi does any one have or know where I can obtain a function to generate a slow sine wave output of 4-20 ma with variable frequency and amplitude...
Replies
3
Views
3,476
Anyone have an examplen on how to generate a sine wave in Structured text. Help much appreciated, thanks in advance!
Replies
10
Views
6,655
Hi, I am trying to produce a sine wave from an omron plc model : CJ1H I want to do it in ST if possible. I am only learning Structured Text...
Replies
4
Views
2,701
Back
Top Bottom