• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Driving a Bi-Stable solenoid

Hello all,

My first project trying to use a bi-stable solenoid. The solenoid itself is not that high torque device so no high power requirements here.

Solenoid specs:
Operating voltage: 5VDC
Coil resistance: 30Ω ~ 0.166mA
CW/CCW pulse timing: 50ms/100ms (min/max)

The device this is going to work along with has a dedicated TTL (high) input to turn it ON and is powered ON as long as the TTL is high, would like to use this same TTL to activate this solenoid either CW/CCW and then do the reverse when the TTL is low. A 5VDC 0.2A power supply is available to drive the solenoid from this device.

Have been looking at some threads discussing H-Bridges to work with latching solenoids, is this still the way to go these days and/or is there a better way in this situaiton?

Any suggestions?

thanks
 

Pommie

Well-Known Member
Most Helpful Member
Looks like you'll need a H-bridge but not a high power one. Something like the mp6513. The TTL input being high makes no sense. Only outputs can be high/low. What is the actual TTL device?

Mike.
 
Maybe I should rephrase it, lets say it is a +5VDC signal coming out of an Arduino board digital pins going through a buffer. I use this to power On a device which turns On when it receives a high input and stays On as long as this input is high on one of its controlling pins. Would like to use this same signal to control the solenoid as well as they both are in the same path in the physical device.
 
Last edited:

KeepItSimpleStupid

Well-Known Member
Most Helpful Member
Most of the h-bridges need a NOT enable and a Direction signal. Not enable was used because TTL typically floats high and that woul turn the driver off. Your H-bridge would have to be MOSFET based becase of the lower voltage drop.

Bi-stable is good because all it needs is a pulse. With some solenoids you have to reduce the power when in hold mode/

There are some drivers that have 3 inputs to allow coast and brake.
 
I can update the arduino source code to our needs, so not a problem there and I still have more than enough space left to add more code on Mega board. If you can show me a sample on how to drive one, I can probably adapt it to multiple ones. If it makes things easy, I can even decouple driving solenoid from coupling it to the power On TTL of other device. I can implement driving solenoids completely independent.
 

Pommie

Well-Known Member
Most Helpful Member
Here's some (untested) code that I think should work.
Code:
/* The pin numbers that the
*  driver boards are connected
*/
uint8_t pins[8] = {1,2,3,4,5,6,7,8};
uint32_t tick[4];

void turnOn(uint8_t num,uint8_t dir){
    tick[num]=millis();                       //store time switched on
    digitalWrite(pins[num*2],LOW);             //ensure both outputs are low
    digitalWrite(pins[num*2+1],LOW);
    if(dir==1){                                             
        digitalWrite(pins[num*2],HIGH);        //move CW
    }else{     
        digitalWrite(pins[num*2+1],HIGH);      //move CCW
    }
}

void turnOff(){
    for(uint8_t i=0;i<4;i++){
        if(tick[i]>0){                       //is this output on?
            if((millis()-tick)>=75){         //has it been on for 75mS?
                digitalWrite(pins[i*2],LOW);  //turn it off
                digitalWrite(pins[i*2+1],LOW);
                tick[i]=0;                   //clear time
            }
        }
    }
}
You will need to set pinMode for the 8 pins and fill in the correct values in the pin array and clear the tick array in setup.
Just continually call the turnOff code from the loop and to move a solenoid call turnOn with num=the number of the solenoid and dir to +1 or 255 (-1) for the direction.

HTH

Mike.
Edit corrected typo in code.
 
Last edited:
Great thanks will give this a try when I get my hands on couple of those boards. BTW, when you say " continually call the turnOff code from the loop", does it really need to be run all the time on Arduino program loop even when the solenoid if in "OFF" state?
 

Pommie

Well-Known Member
Most Helpful Member
The turn off has to come 75mS after the turn on. The routine only checks solenoids that are on and turns them off if 75mS has elapsed. It could have been done using a delay (75) in the turnOn routine but that would prevent other code running. The 75mS is halfway between the min and max times.

Mike.
 

Latest threads

EE World Online Articles

Loading
Top