I am currently testing the LabView for Arduino toolkit.
I need to generate a 0-5V DC voltage out of a PWM channel to control the sensitivity of a photomultiplier.
This control voltage will generate a high voltage of 0-1250V at the photomultiplier tube circuit.
(I plan to use a 2-pole lowpass filter based on an LM358 OpAmp to smoothen the PWM signal)
I have so far just connected an LED (of course plus serial resistor) to the PWM output and can dim the LED with the PWM using a 0-255 control.
So far so good.
However, when I connect the LED to the PWM output it is fully lit already when the Arduino (UNO) is conncted to the PC, even though the vi is not yet running, so the lopass would propbably already supply a full 5V to the photomultiplier at that stage.
This is not good as a 5V output would switch the photomultipler to its full high voltage of 1250V instantly, whereas I would normally start much lower and increase hi voltage (= sensitivity) only as needed by the light levels.
As soon as I start the vi, the LED turns off and I can use the dial to adjust the brightness from zero to full, but the damage will be done to the photomultiplier already, because it receives a 5V control voltage from the Arduino even before the vi comes to play.
Why is the PMT output hi and not not zero before the vi starts???
What can I do to force a zero signal at the PWM output when the Arduino is connected to the PC but the vi to control the whole thing is not yet started?
When the Arduino is reset the I/O pins default to INPUT. This looks like an open circuit to whatever is connected to that pin. A mild pull-down resistor should prevent the output from floating HIGH.
Which pin are you using for your PWM output?
Do you set pinMode()? It's not necessary when using analogWrite().
Do you use a digitalWrite() to set the pin to LOW in setup?
Perhaps there is a bug in your code but you'd have to post your code to get opinions on that.
The LabView interface uses its own sketch. That sketch is doing something to cause the pin to be high. So you need to go to those guys to figure out how to prevent the pin from defaulting output (and high).
As an aside, why go to the complication of building a 2-pole filter using an op amp and a pile of discrete components, when using a D to A chip would be much simpler?
The only problem is then that I have uploaded the LabView toolkit for Arduino onto the UNO and presumbly I would need to add that code to the LabView sketch?
Thanks James, I have not yet submersed myself fully into the toolkit but will certainly do this.
For the time being I am just using a digital out pin and a logic level MOSFET to switch the generated DC voltage to prevent my photomultiplier to be forced to max. sensitivity on power-on.