dimming 0-10v fluorescent ballast

i know this should be easy, but i am new and a little lost.
i am trying to dim a mark 7 dimmable ballast with an ultra sonic sensor, i have the sensor running leds, but am not sure how to control the 0-10v ballast.
it seems like i can do it with the analog in/outs?
the ballast has 2 control wires. + 10v and - 0v, the tech guys at the company say it just needs a vareable resister between the two lines that then control the dimming. +10v=high, 0v=low,
can i run 10v out of an analog out ?
do i have to use an op amp?

has any one run anything like this, or seen it done anywere?

any help would be great.



you need an op amp with a voltage gain of 2 (5V Arduino * 2 = 10V). The op amp will have to run off something close to a 12V supply to make it work right. Google 741 & op amp & non-inverting, or just build this circuit with a 741 op amp and two 10K resistors.



do you know where i could find the code to run it after i build the op amp?
or how to change the curent code i’m the led on?

int led = 13;
int potvalue = 0;
int trigger = 2; // pin for the LED
int dataIn = 3;
int x;
unsigned long TimPulse;
long timeOut = 1000000;

void setup() {
pinMode(trigger, OUTPUT); // declare the ledPin as an output
pinMode(dataIn, INPUT); // declare the ledPin as an output

Serial.begin(9600); // initialize the serial port

void loop() {
digitalWrite(trigger, HIGH);
digitalWrite(trigger, LOW);

TimPulse = pulseIn(dataIn, HIGH);

// scale down pulse val to 0-255
TimPulse = TimPulse / 125;

// reverse that
TimPulse = 255 - TimPulse;

Serial.println(TimPulse, DEC);

analogWrite(led, TimPulse);

// wait a bit



that code should work…


thanks for your help,
but i’m having issues hooking the op amp to the ballast, it dimms the lights to about half, but to doesn’t dim with the sensor at all.
any clues? or maybe know were i could find some photos on the web of what the wireing should look like.



post a picture of how you have it wired, and your code…



I’m about to look at control of a ballast, I’m currently thinking about an i2c DAC or Digital potentiometer, any pointers from anyone ?
Again a 0-10v ouptut is required.