CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Pressure Control System

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Silverback01



Joined: 30 Sep 2008
Posts: 11

View user's profile Send private message

Pressure Control System
PostPosted: Fri Oct 10, 2008 9:36 am     Reply with quote

I'm working on an inflation system that goes on an R/C aircraft. Part of the aircraft has to be inflated in-flight. This is my first project involving electronics, programming, and a near-impossible system. The hard part seems to be the programming and integration of electronic components that can't be joined with a simple wire nut.

My setup is a high-pressure CO2 tank, a 12V electric solenoid valve, an analog 5V Omega pressure transducer, a pressure relief valve, and a PIC16F876A. The relief valve is there to keep from blowing up the inflated part, and it is not electronic, so it's out of the picture. The purpose of the PIC is to read the inputs from the pressure transducer and actuate the solenoid to maintain the pressure of the inflated system within a certain threshold. It sounds to me like a simple if-else statement.

Between the 5V pressure transducer, the PIC, and the 12V solenoid, what kinds of additional electronic components might I need to look into? I browsed this forum for similar projects and found that op-amps can be used as buffers, but I've only worked with them in their most basic configurations covered in an introductory circuits class. I've never physically seen a configuration for a buffer.

On the programming side, I have just finished the "hello world" equivalent of the PIC universe--meaning I can make lights flash on and off...and with a button too! However I have not worked with anything like motors and I/O devices that require other than a simple on-off configuration. I'm a mechanical and aerospace engineering student having to learn how to be an electrical and computer engineer on the fly.

My biggest reference so far has been the "Designing Embedded Systems with the PIC Microcontroller". Do any of you have any simple example C code laying around that is similar to what I'm doing or any suggestions before I let the smoke out?

Thanks!
_________________
John
Ttelmah
Guest







PostPosted: Fri Oct 10, 2008 10:08 am     Reply with quote

You are going to need a power transistor, or power driver, to drive the solenoid.
You are going to need a _trap diode_ on this driver, so that when if turns 'off', the energy stored in the inductor in the solenoid, is fed back into the power rail (if not, it'll find _somewhere_ to go, and do damage...).
You are going to need a capacitor on the 12v supply, that is large enough, so that when this energy is fed back into the rail, it doesn't rise to much.
You are going to need a 5v regulator to generate the rail for the PIC, and pressure sensor.
You are going to need smoothing on this rail, to stop oscillation of the regulator, and keep noise as signals change, under control.
You will need components to provide the clock for the PIC. You might want to consider another chip, which has it's own clock built in. A chip like the 16F916, which has a built in complete oscillator, might be considered a 'better' choice for this reason.
You will need to add some hysteresis to the statement, or a fixed time activation, otherwise as soon as you open the valve, the pressure will rise, and the code will switch the valve off.

Best Wishes
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Fri Oct 10, 2008 11:02 am     Reply with quote

A really good book to get would be Embedded C Programming and the Microchip PIC by Barnett, Cox and O'Cull.

As Ttelmah has said, consider a PIC with a built in oscillator as it will eliminate a few components.

Power supply:
12V battery - electrolytic capacitor (one end grounded) - 5V regulator - another electrolytic capacitor. Electrolytic capacitors are polarized - they behave as capacitors when their + terminal is at a higher voltage than their - terminal but they're dead shorts if you reverse the polarity. They're used because they have very high "densities" which is a roundabout way of saying that they have very high capacitance ratings in a very small size. The upstream capacitor - I'd guess that a 47uF should be sufficient. The downstream - 10uF should be plenty. You'll also need decoupling caps for each Vdd pin in your circuit, placed as close to the component (PIC, op amp, etc). A ceramic 0.1uF cap is sufficient. The regulator should be sized at about 150mA for the PIC & whatever analog circuitry you'll put with it PLUS whatever the current draw of the pressure sensor is. 500mA and 1A regulators are common and cheap - I have a feeling that a 500mA regulator will do fine.

You'll only need an op amp buffer between the pressure sensor and the PIC's A/D input if the pressure sensor can't drive the A/D input directly. The PIC's A/D input is roughly equivalent to a 10k resistor to ground. If you do need a buffer, use a rail-to-rail input/output type op amp, as they can tolerate/drive their inputs/outputs from power supply rail to power supply rail. I typically use the TI TLV237x family, but there are many others. If all you need is a buffering without amplification, use this cct:

pressure transducer out ---- "+" input of op amp
output of op amp ----- "-" input of op amp AND also connected to A/D input of PIC.

This circuit is a simple op amp voltage follower.

The cct to turn the solenoid on/off is pretty simple, but as Ttelmah has already said, it requires some extra components to ensure that nothing gets burned out. A solenoid is really just a coil (inductor). Inductors don't like being turned on/off and their way of showing their displeasure is by generating huge voltages which can fry things. That's why you'll need a flyback diode across the solenoid.

To turn the solenoid on/off you'll need a transistor. You can use a BJT or a FET, but my preference is to use FETs since I don't have to include a base resistor. A personal favourite is the 2N7000, which can handle up to 350mA in the TO-92 package. This should probably be sufficient to handle your solenoid, but you'll have to check.

12V - one solenoid terminal (doesn't matter which)
other solenoid terminal - drain of FET (D terminal)
source of FET (S terminal) - ground
gate of FET (G terminal) - PIC pin (set pin high (5V) to power the solenoid, set it low (0V) to turn the solenoid off)
connect a diode across the solenoid - cathode to the 12V side, anode to the FET side ("point" the diode "up" - toward the 12V supply)

Choose a diode that can tolerate a reverse voltage of at least 12V (no problems with this) and is rated for at least whatever the current draw of the solenoid is. A standard 1N4004 should do just fine.

Once you get a simple circuit prototyped, start writing the code. You'll learn a LOT during this phase, but it sounds like you're most of the way there already.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group