Generating a ramp voltage with a repitition rate of 24 hours or more

Hi. I'm a hobbyist. I know practically nothing of microcontrollers, and just a little about electronics in general.

I have the need to generate a precision ramp voltage with a repitition rate of 24 hours or more. This is to produce, in effect, a timebase for an X-Y plotter. The X plot is to be 72cm long and the motor for the X plot is a DC brushed motor, not a stepper.

I have been told that using a microcontroller is the proper way to deal with my problem.

I'm actually modifying an HP7035B X-Y plotter:

http://128.238.9.201/~kurt/manuals/manuals/HP%20Agilent/HP%207035B%20Operation%20Only.pdf

Can anyone please state the general principles of how I might begin to create the desired ramp voltage using a microcontroller. Thank you. Rich

In order to get a feel for feasibilty, let me add some more data:

There are 5 sensitivity ranges to the X-Plot: 0.4mV/Cm - 4mV/Cm - 40mV/Cm - 400mV/Cm and 4V/Cm.

The X-plot has to travel 72Cm in a day.

The voltage range needed to be covered depends on the Range chosen: And the required voltage ranges are:

Range # 1 0.4mV/Cm: 0- 28.8mV
Range # 2 4mV/Cm: 0-288mV
Range # 3 40mV/Cm: 0-2.88V
Range # 4 400mV/Cm: 0-28.8V
Range # 5 4V/Cm: 0-288V

The distance slew rates in Cm or mm are: 72Cm/day - 3Cm/hour - 0.5mmCm/minute - 0.0083333..mm/second.

The voltage slew rates in volts or mV are:

Range # 1: 28.8mV/day - 1.2mV/hour - 0.02mV/min - 0.0003333...mV/sec

Range # 2: 288mV/day - 12mV/hour - 0.2mV/min - 0.003333...mV/sec

Range # 3: 2.88V/day - 120mV/hour - 2mV/min - 0.03333...mV/sec

Range # 4: 28.8V/day - 1.2V/hour - 20mV/min - 0.3333...mV/sec

Range # 5: 288V/day - 12V/hour - 200mV/min - 3.3333...mV/sec

Input resistances are 1M on all ranges, except Range 2 when it is 100K and Range 1 (says "Potentiometric essentially infinity at null").

Maximum allowable source resistances is 20K on Range 1, 10K on all other Ranges.

There is an OFFSET control.

I wonder what this above data says about feasiblity, design and specifications.

What "modification" are you doing? The way you list the specs of the plotter I think you are not accessing motors or anything like that directly. The way I read your question is that you want to generate the slow ramp which you input to the plotter (which will then do the positioning with all the feedback circuits it has).

Either way, the PWM output of the Arduino, with a simple RC circuit and voltage divider to make the 2.8V scale, but it is limited to 512 255 steps, which translates to approx 1,5 3mm. Is that enough?

Otherwise, it is a "go" from here :slight_smile:

(Edit: Corrected PWM output limit)

Hi Richard,

You can generate the voltage ramp you required from an Arduino and a D to A converter, but the precise details will depend on the resolution and accuracy you require. The 0 to 2.88v range will be the easiest to generate.

Say you want 0.5mm resolution, then that's 1 part in 1440. So you need at least an 11 bit DAC. You could choose the Analog Devices DAC8512, which is a 12 bit DAC with an output range of 0 to 4.095v. The output resolution is 1mv which corresponds to 0.25mm at 40mv/cm. If you need better resolution than this, you'll need to go for a more expensive DAC with 13 or 14 bit resolution.

There are lots of other 12-bit DACs available, for example the Texas Instruments TLV5616. That one requires an external voltage reference. You could use the 3.3v supply from the Arduino and a voltage divider to produce 1.44v for that, which means the output range would be 0 to 2.88v and the resolution therefore slightly better.

If you use the Arduino clock to provide the timing reference, then the timing accuracy you can achieve will be +/- 0.5% if you are using one that has a ceramic resonator, or a little better if it has a crystal. If you want better timing accuracy than this, you'll need some sort of external clock.

Msquare:
What "modification" are you doing? The way you list the specs of the plotter I think you are not accessing motors or anything like that directly. The way I read your question is that you want to generate the slow ramp which you input to the plotter (which will then do the positioning with all the feedback circuits it has).

Either way, the PWM output of the Arduino, with a simple RC circuit and voltage divider to make the 2.8V scale, but it is limited to 512 steps, which translates to approx 1,5mm. Is that enough?

Otherwise, it is a "go" from here :slight_smile:

Yes. The ramp voltage is not fed directly to a motor. The plotter has a servomechanism for both X and Y plots. Of course, I want too use the X plot as a timebase.

I'm just now studying the operation of the servomechanism for the X plot (same as Y plot actually).

The sevo-mechanism works as follows: The input to the X plot (which I want to be a long-period ramp voltage) is fed to an attenuator, and the output of this goes to a balance circuit, where it is cancelled by an internally supplied opposing voltage. Under "balanced" conditions, there is no error signal output from the balance circuit and the servo system is at null. When the input signal changes value, an unbalanced condition exists. The resulting error signal is applied to a photochopper which converts the dc to a 50Hz ac form which is amplified and applied to the servomotor. Because the motor and rebalance potentiometer are mechanically coupled, the balance voltage changes value untill the input signal is cancelled. If the input data is constantly varying at rates within the capabilities of the instrument, this rebalancing action is continuous, and the rebalance potentiometer and the pens are always in a position directly proportional to the amplitude of the signals at the respective input terminals.

So, first thing is to understand how the servo mechanism works and to figure out it's capabilities or parameters. I may have to do experiments to get the data required, I muse.

Msquare has provided a nice simple alternative to an external DAC. If you wanted higher resoltion than 8 bits, you could use two PWM pins feeding the same capacitor through resistors whose values are in the ratio 1:256. This theoretically gives you 16-bit resolution, however in practice it won't be anything like as good as that - but you may manage to get 14-bit resolution.

As the input resistance of the plotter is 1M, and resistors higher than 10M are hard to find, I suggest resistors of 39K and 10M. The capacitor needs to have low leakage and be large enough to reduce the ripple to a low enough level for the plotter not to notice it. I suggest 100uF tantalum if you are using the default PWM frequency, alternatively use a lower value non-electrolytic capacitor and increase the PWM frequency.

[EDIT: I'm not sure why Msquare thinks you can get 512 steps from a single PWM pin, I think it is 256 steps.]

So, first thing is to understand how the servo mechanism works and to figure out it's capabilities or parameters.

No, unless you are going to hack into the internal servos it is totally irrelevant to you how they work.

What you have to concentrate on is what sort of resolution you need on the voltage. I think your only realistic option is using an external D/A. Even then you don't say what sort of X resolution you need with a 16 bit D/A giving you 65536 steps over 24 hours you only get a step about every 1.32 seconds.

dc42:
you could use two PWM pins

If you are going to use smoothed PWM, then maybe rapidly varying the PWM duty cycle between two values might work. Especially if you read back the generated voltage via A2D and used a servo feedback mechanism to adjust to the required voltage.

Although the Arduino library doesn't expose it, the AVR has a 16 bit timer that could do higher resolution and phase corrected PWM.

You can also just do PWM in software, if you don't need to do anything else.

I think I need to take a certain approach and that is to rely on the programability afforded by the application of a microcontroller in order to adjust the voltage steps making up the ramp voltage sent to the X plot of my HP7035B plotter.

That programmability will allow me to discover what produces the best plot result.

Now, the ramp voltage can be made, (I suppose), to have a repitition rate from seconds to hours according to a program.

Let's say that I want to plot outside ambient temperature over a period of a day. That is a repitition rate of 24 hours. The X plot has to move 72Cm during that time. That movement can be produced by 72 steps in the ramp voltage, each of 0.04V (If range is chosen as 0-2.88V). In this case each step would be 1Cm. That is too big a step. Now I suspect that the best way to go about it is to practically discover the optimum ramp voltage step. Of course, at some point the voltage step might be so small that we come up against a problem. There may be no point in trying to calculate or estimate that point. Although someone might know on a Hewlett Packard Yahoo group.

Of course, it's not really the repitition rate that sets the voltage steps chosen. It's what resolution is required, or is found to be best.

It might be good to make an educated guess at what step voltage might be in the ballpark. That might turn on what time interval might be in the ballpark. For outside temperature, you might be okay with a time interval of say 5 minutes. There are 1440 minutes in 24 hours. If the step was every 5 minutes, there would be 288 voltage steps required to produce the ramp voltage. Each voltage step would therefore be 10mV.

I'm not dealing with a 1.8 degree stepper motor, the servo motor in the HP7035B is a simple brushed DC motor mechanically coupled to a slidewire potentiometer. So, I'm not sure just how small the voltage step increments can be before we hit a snag. In the end I suppose it's when does the plot itself look okay. Well, it might look okay before the step voltage becomes too small for the servo to work properly.

Any thoughts on this - anybody?

Of course, the voltage steps to the servo motor in the plotter is a potential issue (no pun intended). Not the voltage into the X plot terminals. At some point, the voltage steps to the servo motor would become so small, that the motor would not move. But may move (say) after 5 steps in voltage. But, maybe in fact would not represent a problem, as long as the plot looks okay.

P.S. I have an idea, to ask somone on the HP Yahoo group, to input voltage steps to a working HP7035B, and to note just how small those steps can be on a certain range, before the X plot fails to move. If someone there can do that test, the results might be usefull.

Any thoughts on this - anybody?

Yes you are musing on things that we already comprehend but sadly is tying you in knots. It is likely that the resolution of your plotter is less than the thickness of the pen. So what you need to do is just get some form of D/A converter onto your arduino, that is it, that is all you have to do.

Your choice is to decide on the number of bits this has (resolution) and how you are going to implement it.
If there is anything else you don't understand about - "get a 16 bit D/A" then please ask, but don't go rabbiting on about things that are patently obvious and asking for comments.

Grumpy_Mike:

Any thoughts on this - anybody?

Yes you are musing on things that we already comprehend but sadly is tying you in knots. It is likely that the resolution of your plotter is less than the thickness of the pen. So what you need to do is just get some form of D/A converter onto your arduino, that is it, that is all you have to do.

Your choice is to decide on the number of bits this has (resolution) and how you are going to implement it.
If there is anything else you don't understand about - "get a 16 bit D/A" then please ask, but don't go rabbiting on about things that are patently obvious and asking for comments.

FWIW, I'm not tied in knots. Keep these thoughts to youself. Thank you.

I'm not tied in knots.

You are

Keep these thoughts to youself.

and I could say the same thing to you.

Grumpy_Mike:

I'm not tied in knots.

You are

Keep these thoughts to youself.

and I could say the same thing to you.

Perhaps then I should implement the project with some other microcontroller. I guess that might not bother you.

I gather you want to chart the temperature outside with the Arduino and chart recorder. In that situation, the only decision to make is how many steps you want from your DAC. I personally would be happy with 1 step/Fahrenheit however, if you want 100ths of F. then you might want 100000 steps or more. I believe you will have far more precision than you can use.

You will just have to give the chart recorder a go and see how good or badly it operates. It may not respond to every little voltage step but, as long as voltage keeps changing it should keep moving. You can consider theory and logic of operation but, in the end you just need to run it.

Why not go straight from the Arduino and run the recorder up and down and see how it looks.

Hi richard2765

You have a nice piece of old and proven hardware there, which effectivly converts voltage to a paperposition. I, too, am interested in how it works inside, but it is irrelevant to the question and purpose: How to generate a slow voltage ramp, making a time-based plot of some other measurement (temperature being taken as an example). Unless you intend (at some later stage) to modify the plotter or wire the Arduino directly to its innards, it does not matter if it is a DC motor or small gerbils in wheels which move it. All that matters is the specification of what voltage moves to which paperposition.

The spec says accuracy/linearity is 0.2% or 0.1%. I intrpret that to mean on a good day you can control 1000 steps across the 72 cm which means about 1 mm precision. Anything finer is getting lost in noise. (Note it does not matter which voltage range)

The simplest voltage ramp is just a resistor and capacitor from one Arduino PWM and dc42 has given some suggest values. Questions in this sub-forum (Project Guidance) is on feasability, and there is no reason why this should not work. The discussion is whether the resolution/stability is good enough.

A quick experiment with ramping the PWM (look at LED Fade for inspiration) will tell you if the plotter is functioning well, for starters. This will be in 72cm/255 steps (=3mm approx). You can check if switching between -say- 88 and 89 as the PWM values will reliably move the X axis to and fro.

When that has been verified, you can invest in a more complex D/A circuit or we can help to program the Arduino with a waveform that will enable 1000 steps resolution.

If the input on the Y-axis is on continously, then the Y pen may jiggle up&down a bit while the X stands still, and then you get a "thick" line, effectivly showing max/min values

I suggest you try using 2 PWM pins and an RC network (see my earlier post) first because it is simple and cheap. Also connect an analog input pin to the output, so that you can monitor the voltage, in particular to let it settle to near zero at the start. Use a sketch something like this:

const int msbPwmPin = 5;
const int lsbPwmPin = 6;
const int analogMonitorPin = 0;

const unsigned int hoursPerScan = 24;

unsigned long startTime;
unsigned int currentOutput;
float millisPerScan;

void setup()
{
  // Set the output to 0
  analogWrite(msbPwmPin, 0);
  analogWrite(lsbPwmPin, 0);
  
  // Wait for the output to settle. It would be better if we had a pin controlling a mosfet to discharge the capacitor.
  while (analogRead(analogMonitorPin) != 0)
  {
    delay(100);    // wait for the output to settle near zero (we only have 0-bit ADC resolution, so we can't tell exactly)
  }
  
  currentOutput = 0;
  millisPerScan = (float)hoursPerScan * (60.0 * 60.0 * 1000.0);
  startTime = millis();
  
  // debug
  Serial.begin(9600);
}

void loop()
{
  unsigned long now = millis();
  unsigned int requiredOutput = (unsigned int)((2.88/5.0) * 65536 * (now - startTime)/millisPerScan);
  
  if (requiredOutput != currentOutput)
  {
    currentOutput = requiredOutput;
    analogWrite(msbPwmPin, currentOutput >> 8);
    analogWrite(lsbPwmPin, currentOutput & 0x00FF);
  
    // debug
    Serial.println(currentOutput);  
  }
}

[NB- this code doesn't actually stop when it reaches 2.88v - I leave that for you to add.]

If that works sufficiently well, then you'll want to add at least a reset button, and probably a small mosfet and resistor to discharge the capacitor and reset the voltage to 0 more quickly. Maybe also a rotary encoder and LED or LCD display to set the scan time.

If using pwm pins and an RC network doesn't perform well enough, then buy a 12-bit (or higher) DAC.

Msquare:
Hi richard2765

The spec says accuracy/linearity is 0.2% or 0.1%. I intrpret that to mean on a good day you can control 1000 steps across the 72 cm which means about 1 mm precision. Anything finer is getting lost in noise. (Note it does not matter which voltage range)

The simplest voltage ramp is just a resistor and capacitor from one Arduino PWM and dc42 has given some suggest values. Questions in this sub-forum (Project Guidance) is on feasability, and there is no reason why this should not work. The discussion is whether the resolution/stability is good enough.

A quick experiment with ramping the PWM (look at LED Fade for inspiration) will tell you if the plotter is functioning well, for starters. This will be in 72cm/255 steps (=3mm approx). You can check if switching between -say- 88 and 89 as the PWM values will reliably move the X axis to and fro.

When that has been verified, you can invest in a more complex D/A circuit or we can help to program the Arduino with a waveform that will enable 1000 steps resolution.

If the input on the Y-axis is on continously, then the Y pen may jiggle up&down a bit while the X stands still, and then you get a "thick" line, effectivly showing max/min values

Yes, I think folks are right - don't bother too much to figure out the resolution - discover it by experimentation. Also, another good point made, just start out with something simple, see what results I get, then go for finer steps if it seems warrented. Experiment basically.

As to the parameters for the the HP-7035B: The X plot actually travels 11" or about 28Cm. When I mention a X plot of 72Cm, that is a (major) modification to the HP-7035B on my part. So, going by your calculation, that would be 1000 steps across 28Cm. That would be 0.3888888...mm precision.

So, like folks have said, I should just get the gear, build some simple circuit to get some steps to mess with - and experiment. :c) And of course, there is feasibilty in the project idea in general.

richard2765:
As to the parameters for the the HP-7035B: The X plot actually travels 11" or about 28Cm. When I mention a X plot of 72Cm, that is a (major) modification to the HP-7035B on my part. So, going by your calculation, that would be 1000 steps across 28Cm. That would be 0.3888888...mm precision.

How about leaving the plotter unmodified, and writing 3 traces across it in the required time period, separated in the Y axis, instead of just one? Obviously you will have only 1/3 of the resolution in the Y axis, but does that matter for your application? You would need a circuit (probably based on an op-amp, or perhaps a simple resistor network) to allow the Arduino to add or subtract an offset voltage to the Y input to the plotter.

I presume you have some reason for using a plotter instead of a chart recorder?

dc42:
How about leaving the plotter unmodified, and writing 3 traces across it in the required time period, separated in the Y axis, instead of just one? Obviously you will have only 1/3 of the resolution in the Y axis, but does that matter for your application? You would need a circuit (probably based on an op-amp, or perhaps a simple resistor network) to allow the Arduino to add or subtract an offset voltage to the Y input to the plotter.

I presume you have some reason for using a plotter instead of a chart recorder?

Yes, very clever, just arrange for three passes each of 8 hours duration. Indeed, a chart recorder would be the way to go for reading outside temperature data, open-ended in duration as it is. I'm just messing really with this plotter. I may arrange later for chart paper to move under the pen - driven by a synchronous motor.

Know nothing of microcontrollers. Looking at the UNO.