solenoid valve control help

juve021

Member
Hey all, I'm working on a project where an 08m will control the dampening rate of a variable shock/strut. The shock/strut has a solenoid controlling oil flowing though an orifice. Specs are: 12v, 5.2 ohms (@12v) and I've obtained information that 2 distinct levels of dampening that I want to achieve are created when 0.2 amps and 1.6 amps are supplied to the solenoid. They are also normally pwm operated so I'd like to supply them with a pwm signal from the 08M. Could someone advise me how I could do this, circuitry wise? Can I just use say a TIP-120 attached to the pwm output of 08M? How would precisely achieve .2 amps and 1.6 with pwm? Thanks in advance!
 

Dippy

Moderator
I would start off with a standard generously specced MOSFET type arrangement for triggering.

Look in Manual 3 about how to trigger a solenoid or relay. Easy stuff.
You will probably need extra surge-absorbing and decoupling capacitors.

For exact currents you will need a current sensing chip . There are millions around, take your pick.
You can then feedback the value in code to adjust PWM in order to get the correct current. You can use a simple PID type calc.

Quite honestly you can probably calibrate a current/PWM value that is good enough and maybe trim it with a simple cut-down PID if needed. It just dpends how fussy all this is. Do you know?


Whether or not you can drive a MOSFET directly I don't know.
You can drive it, but when you start upping the frequency it can go pants.
I'm bored with rattling on about Gate capacitance/charge so I'll leave that to others.
Without knowing all the performance characterisitics of the bits 'n' pieces I couldn't tell you whether a really fast or medium Fq PWM is best.
Do you know?

For safety/reliability etc I would use a MOSFET driver.
And I would say that , unless we have someone here who has doen EXACTLY what you want, then experimentation is needed.

What is your electronics skill level?
Your code skill level?
Your budget?
Your time frame?
Is this on a road going vehicle that will be driven anywhere near me?
If this is vehicular do you know about safe power supply design?
I'll leave others to do the deserved Nanny bit.

If you have little experience (and it sounds like it) then keep it in your garden :)


Note: Numerous Data Sheets on MOSFETs and drivers can be viewed to see example schematics (circuit diagrams).
have a search on the Farnell site.
 

SAborn

Senior Member
Sometimes we need to use a little trial testing to work the values out.

I would set up the circuit with a pot as a voltage divider on a input and read the adc value and adjust the pwm in program to increase and decrease the pwm as the pot was adjusted.

With a amp meter connected between the circuit and solenoid adjust the pot till you have a amp reading of 0.2.
Now run a debug to see what the actual pwm values are, make a note of the values.

Repeat the test for 1.6 amp.

Now simply write the values noted into the final fixed program and remove the pot.

I have used a similar circuit with the 08m driving a large transistor via a resistor on the base pin to operate a variable flow control solenoid on a hydraulic system running a large conveyor belt.

Don't forget to protect the circuit with a diode across the solenoid coil for the EMF that the coil will generate.
 
Last edited:

Adamey

Senior Member
I'd use a logic level high side switch. I know some people prefer a straight MOSFET over a logic level one for their low RDS ON, but your application isn't that difficult.

I've taken apart countless automotive ECU's and control modules and looked at their components and how they are arranged. They are chock full of logic level high side switches. There are obvious reasons why they use them:

- Direct interface with a microcontroller.
- Integrated charge pump so no MOSFET driver needed.
- Designed to work with motors, solenoids and other common automotive loads.
- Usually quite bulletproof with protection from load dumps, short circuits, over current, over temperature and built-in clamping diodes.
- Many have a diagnostic output and/or a current sense output you can read directly with your microcontroller to monitor your switch.


In your case I don't think I'd bother with any kind of feedback or loop. I'd just use an ammeter to measure my average current and find out what duty cycle you need to get the current you're looking for. An 08M isn't going to be fast enough for any kind of PID stuff.
 

Dippy

Moderator
Sounds good Adamey.

Give Juvey a couple of example devices so he can:
a) See if they are suitable speed/power.
b) See if they are available near him.

PID comes in all sorts of shapes and imaginations.
Just depends on requirements and your maths ability.
The requirements here are pretty slow in the scheme of things and this is simple feedback and a quick loop of basic maths. Not rocket science.
But I tend to agree - mainly because I suggested it first :)

If it were me, I'd spend a little time doing experiments to see which worked best. Spending an extra fiver would be well worth it, but I realise that so many PICAXErs like to economise. :rolleyes:
 

juve021

Member
Thanks for the help all.

I'm fairly knowledgeable with electronics and have used the picaxe in automotive applications in the past however I am no means an expert.

SAborn, I like your method. Like Adam said, the pwm will only give me a measured average current output though, is this correct?

Also can you give me some example pwm starting values?
 
Last edited:

Dippy

Moderator
Without care or thought you may struggle getting accurate current figures when doing series current measurement with a complex reactive (and possibly resonant) device and using PWMing.
Especially with a cheap digital multimeter and just stuffing it in series.
Have a think about it as there is a solution.
 

fernando_g

Senior Member
Go to the STMicro's web site. Look for the keyword Omnifet. These are very rugged, fully auto-protected devices, some even with diagnostic capabilites. They are available in many ratings and packages; and are being used on automotive apps all over the world.

Infineon is also very strong on these type of rugged Fets. Don't remember their trade name, though.
 

hippy

Ex-Staff (retired)
@ juve021 : Could you clarify whether a PID loop or other automated control of the solenoid is required. It's not clear in the first post if you want to automatically adjust the shocks or just have a switch on the dashboard for hard and soft ride.
 

juve021

Member
@ juve021 : Could you clarify whether a PID loop or other automated control of the solenoid is required. It's not clear in the first post if you want to automatically adjust the shocks or just have a switch on the dashboard for hard and soft ride.
hippy, you hit the nail on the head...sorry for not being clear. What I want to achieve at first is have a 2way switch on the dash for adjusting the rate, hard/soft. Later on, I might feel brave enough to add other variables to the mix (i.e. throttle position, acclerometer readings etc) and that could necessitate feedback. But I'd just like to get a simple version working now.

Another thing to think about is obviously, I have 4 of these shocks to control.
 

MartinM57

Moderator
...and you have to be sure that PWM'ing is actually an appropriate mechanism for supplying a "constant current" to these things - or do they need 0.2A/1.6A DC current to work as advertised? In which case you'ld be into controllable constant current devices instead.
 

Dippy

Moderator
Good point, but we can only digest what we are fed:-
"They are also normally pwm operated ..." from post#1.

This was really why I wanted to get to grips with electronics experience.
 

juve021

Member
Good point, but we can only digest what we are fed:-
"They are also normally pwm operated ..." from post#1.

This was really why I wanted to get to grips with electronics experience.
I know for a fact that they are fed a pwm signal...updated @ 500hz from another automotive module
 

hippy

Ex-Staff (retired)
I know for a fact that they are fed a pwm signal...updated @ 500hz from another automotive module
Could you not just replicate the circuit used in that module ? It might require a bit of tweaking but could give a good indication of what one should be looking at for the middle ground between PICAXE and solenoid.
 

Adamey

Senior Member
Sounds good Adamey.

Give Juvey a couple of example devices so he can:
a) See if they are suitable speed/power.
b) See if they are available near him.
I'm mobile so can't get to the website I want. However, go to st.com and search "high side" in their keyword search field.

The one I'm using for my automotive project is a quad channel high side with logic level inputs, current sense and comes in a package similar to a SOIC-28. It's rated for 10A continuous, if I remember correctly, but is designed for loads with high inrush currents (like light bulbs) and also works with inductive loads.
 

juve021

Member
Could you not just replicate the circuit used in that module ? It might require a bit of tweaking but could give a good indication of what one should be looking at for the middle ground between PICAXE and solenoid.
I could, if I had the car anymore...working on a project on a car I don't own anymore but I buddy of mine owns (and who doesn't live near me). Also, the car works on CANBUS signals so its not a simple as hooking up a scope....

I know that it gets a pwm signal cause I have the dealership software for diagnostics and it explicitly indicates this.
 

Dippy

Moderator
Well, assuming no-one can hand you the solution, I think you have enough info to start experimenting.
 

juve021

Member
yup I will have to experiment.

assuming I can get 1 shock working...how can drive 4 using one pwm signal? Can I just split the pwm and use say 4 MOFSETs?
 

Dippy

Moderator
Just buy 4 PICAXEs and do serial comms.
If I were doing it I'd have one master and a slave per damper.
It's easy.
 
Top