[Current Regulator] – Fixed Version


It’s been some time I didn’t write anything here.

I have finalised the first version of the software part. This is a fixed version (no remote control). It uses only interrupt to handle functional part. This project can be modified by MPlabX and uses the C18 compiler. To modify the current you need to modify « VALUE_LIMIT »:

#define VALUE_LIMIT 409 // About 200mA

You should adapt the value following your modifications to the schematic:

#define MAX_CURRENT 0.2
#define CURRENT_AOP_FACTOR 10

#define ADC_RANGE_V 5
#define ADC_STEP 5 / 1024

#define VALUE_LIMIT ((CURRENT_AOP_FACTOR * MAX_CURRENT) / (ADC_STEP))

You can also modify the PWM Frequency to optimize the ripple in function of your coil and capacitor:

// 39 = 100kHz
// Timer period = [(PR2) + 1] x 4 x TOSC x TMR2 prescaler
timer2_setup(39);

As you can see there is no code in the main loop all the work is done in the interrupt function, I’m currently working to add the remote serial control. Don’t hesitate to ask if you need help.

Concerning the hardware, I finally used a 1Ω resistor because on the breadboard there was to much noise, I think I will fix this on the real PCB (and maybe change the OpAmp). If you plan to use this for a more important current don’t forget to change the FET, the Coil and the Sense Resistor. If you change the MOSFET by a N-Channel or If you had a totem pole be sure to careful change the polarity of the PWM or the increment of the Duty-Cycle.

Current Regulator Schematic The schematic working with this code.

First version.

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s