Hi all
Ive made a diy boost converter which is working to some extent using an arduino to switch the transistor.
Im using the first attached schematic but I added the resistor in schematic 2 so that I can read the voltage as the code I found needs it.
I am not to sure what size inductor I have its marked with (331), ive got a 1N4007 diode and a 35v 1000uF cap and this transistor C2383 pdf, C2383 Description, C2383 Datasheet, C2383 view ::: ALLDATASHEET :::
// Sketch for Elektor Design Tip 090894-I
// Arduino step-up converter
//
// CPV, 25/11/2009
#define TIMER_CLK_STOP 0x00 /* Timer stopped */
#define TIMER_CLK_DIV1 0x01 /* Timer clocked at F_CPU */
#define TIMER_CLK_DIV8 0x02 /* Timer clocked at F_CPU/8 */
#define TIMER_CLK_DIV64 0x03 /* Timer clocked at F_CPU/64 */
#define TIMER_CLK_DIV256 0x04 /* Timer clocked at F_CPU/256 */
#define TIMER_CLK_DIV1024 0x05 /* Timer clocked at F_CPU/1024 */
#define VREF (5.0) /* volt */
#define VREF_FIDDLE (0.07) /* volt, to correct for resistor precision problems etc. */
#define VRATIO (22.0/(82.0+22.0)) /* Vadc/Vout, these are the feedback resistor values in kOhm */
const int gate = 11; // Gate drive pin (PWM).
const int feedback = 0; // Vout measure input.
int vout = 0;
int vout_average = 0; // For debug/feedback only.
int vtarget = 0;
const int hysteresis = 3;
int pwm = 255;
#define PRESCALE 25 /* times 10 ms */
int prescale = 0;
// Not used, for completeness sake only.
float adc_to_vout(int adc)
{
return ((float)adc*(VREF+VREF_FIDDLE))/(1023.0*VRATIO);
}
// Convert an output voltage to an ADC value.
// Calculations are done in ADC values (int), not volts (float).
int vout_to_adc(float volt)
{
return (int)((volt*VRATIO/(VREF+VREF_FIDDLE))*1023.0);
}
void setup()
{
// Setup serial port for control & debug.
Serial.begin(9600);
// Pins default to inputs, so we only have to setup this one.
pinMode(gate,OUTPUT);
// Here are some instructions that write directly to registers.
// The goal is to set the PWM frequency as fast as possible
// and to activate the right output(s).
TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM21) | _BV(WGM20);
TCCR2B = _BV(TIMER_CLK_DIV1); // Set prescaler to 1.
// Set initial output voltage to 10.0 V.
vtarget = vout_to_adc(10.0);
// Another direct register write.
OCR2A = pwm; // Set duty cycle (0..255).
}
void loop()
{
// Measure the current value of Vout.
vout = analogRead(feedback);
// Keep a running average of Vout (for feedback only).
vout_average += vout;
// Adjust PWM so that the target will be reached.
// Use a hysteresis to prevent fast oscillations
// around the target value.
if (vout>vtarget+hysteresis) pwm -= 1;
else if (vout<vtarget-hysteresis) pwm += 1;
OCR2A = pwm; // Update PWM.
// Don't print Vout every time we go through the loop.
prescale += 1;
if (prescale>=PRESCALE)
{
// Print Vout to the serial monitor:
Serial.print("vout = " );
Serial.println(vout_average/PRESCALE);
vout_average = 0;
prescale = 0;
}
// See if a new target value came in.
// Values should _always_ be three digits long: 000 to 240
// The third digit is the decimal, i.e. 123 means 12.3 V.
if (Serial.available()>=3)
{
// Convert 3-digit ASCII value to target voltage.
int temp = (Serial.read()-'0')*100; // tens
temp += (Serial.read()-'0')*10; // units
temp += Serial.read()-'0'; // decimal
if (temp>240) temp = 240; // No more than 24 V!
// Set new target.
vtarget = vout_to_adc(temp/10.0);
// Show what we understood.
Serial.print("vtarget = ");
Serial.println(vtarget);
}
// Wait 10 milliseconds.
// This way we sample at 100 Hz.
delay(10);
}
I am trying to run some high power Leds off a 3.7 lipo 1200mah, this is the driver http://irlock.com/products/high-power-led-driver
My problem is my Leds are blinking not very fast but they go from dim to very bright to dim again.
What am I doing wrong?
Thanks M.....

