A logic gate chip with 1 ea XOR and 2 ea AND gates?


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Most PICs power-up with the I/O's in Analog or Input Mode.

    If your first commands set the Relay I/O's to whichever the Failsafe state is, followed by the TRIS for those I/O's, you should not experience any problems.

    There is a gotcha here... that IF your I/O's are driving something like a ULN2004 or similar High-Current Driver, and you are using a Port with internal Global Pull-Up's (like PORTB on a 16F628), then the act of switching-ON the internal Pull-ups BEFORE you've set any I/O's to OUTPUT would be enough to flip them into an undesired state.

    So the rule is... immediately on Power-Up...

    1. Set your OUTPUTS to the desired High/Low state
    2. Disable any ANALOG
    3. Set appropriate TRIS for that PORT.

    Worst case scenario, is that Relays take a few mS to react, and if you mess up you might pulse the Relays with a few uS in the wrong state... theoretically, it shouldn't affect things... anyone with a Pacemaker please step forward for an experiment...

  2. #2
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default This is a scheamatic for PIC/RELAY/SOLENOID connection

    it is not clear how you have connected the two relays to the solenoid
    Attached is a schematic as to how I am connecting the PIC outputs to the RELAYS to control the SOLENOID via its RED and BLACK wires. This shoulld permit switching of the polarity to the RED BLACK wires depending on which control pin is active??
    I guess if I follow the steps from Melanie's email I can do this without inserting the 2XOR and Dual 2AND gates in between the two PIC control pins and the two relay coils??????
    Attached Images Attached Images  

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    This picture should be more clear.

    Al.

    Edit: picture is too small to see details, I attach a zipped one
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by aratti; - 26th June 2009 at 07:13.
    All progress began with an idea

  4. #4
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Have you ever tested or used your circuit with a latching

    aratti,
    Thanks for the schematic. Yours is a better approach than mine because it only requires two SPDT relays instead of two DPDT relays...cheaper! However I am a little concerned about whether "nothing happens" in your circuit for the state where both Relay 1 and 2 coils are turned on and both the Red and Black wires are connected to +9vdc. I am not certain what the latching solenoid does that I am looking at when both wires are high.
    Have your ever tested or used your circuit with an actual latching solenoid? If so what was your experience and can you refer me to the Part No. for the one you used??

  5. #5
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Latching solenoid are just a normal solenoid with the addition of a permanent magnet. When you connect the coil (Red to + and Black to 0) the magnetic field attract the iron core and when the core is in contact with the permanet magnet it will be hold without the need of the magnetic field generated by the coil. So to activate it you just keep the coil connected for a very short while.

    If you need to de-activate the solenoid, you will need to generate in the core a reverse magnectic field so that the core will be pushed away from the permanet magnet holding it. To obtain such a result you simply reverse the current flow into the coil, connecting the Red to 0 and the Black to + and hoops the solenoid has released the core.

    If you connect both wire to zero volts or both wire to +9 volts nothing will happen, and when I say nothing I mean it (no current will circulate at all), and the solenoid will keep is position. This is the max I can say to assure you.

    Have a nice day.

    Al.
    Last edited by aratti; - 26th June 2009 at 08:32.
    All progress began with an idea

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Instead of putting the battery terminals on the common of the relay, put the solenoid terminals on the common pins, and use a DPDT relay. Wire the N.O. pins with power and ground and wire the N.C. terminals opposite of the N.O. ones. With a DPDT relay you only need one control pin also.
    Tim Barr

  7. #7
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Question Will this schematic work like yours?

    Quote Originally Posted by aratti View Post
    This picture should be more clear.

    Al.

    Edit: picture is too small to see details, I attach a zipped one
    Anrati, I have designed the Relay Circuit for use with my 16F690 MCU as shown in the attached partial schematic. As you can see, pin RC2 controls one of the two SPDT relays and pin RC3 controls the other. I have purposely wired the ground from the battery rather than the positive terminal to the normally closed contacts on the two relays so that in case there is any leakage in the Solenoid_RED or Solenoid_BLACK wire circuits it won't drain the battery when the relays aren't actuated.

    Do you think this circuit will work? One of my concerns is finding a SPDT relay that can be operated within the 25 mA limit of the MCU output pin. Any suggestions where I can get one?Name:  MCU_Relay_Circuit.jpg
Views: 4764
Size:  31.5 KB

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi John,
    Why not just use an H Bridge to control your solenoid ?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  9. #9
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Do you think this circuit will work?
    Yes.

    One of my concerns is finding a SPDT relay that can be operated within the 25 mA limit of the MCU output pin. Any suggestions where I can get one
    See at this link they have reed relay @ 5V 10 mA.

    http://www.americanrelays.com/dip.pdf

    Al.
    All progress began with an idea

  10. #10
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    When I need a strange combination of logic gates that doesn't have to be exceedingly fast, I usually use a small PIC (12F series for example). Small, cheap and can be programmed to any function I need. The best part is that if I want to change something later, I can do it with programming instead of X-acto knives and little blue wires.
    Charles Linquist

  11. #11
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Question Right drive current...wrong drive voltage..any others?

    Quote Originally Posted by aratti View Post
    Yes.



    See at this link they have reed relay @ 5V 10 mA.

    http://www.americanrelays.com/dip.pdf

    Al.
    My 16F690 MCU is operating at 3.3 vdc. Therefore I need a relay (SPST or SPDT) whose coil voltage is 3.3 vdc with a coil resistance of 132 ohms or more, and a contact rating for 1 Amp when switching and 0.5 Amps when closed:
    3.3 vdc/.025 ma = 132 ohms
    Do you know of any sources? I have looked high and low with no success...most have coil resistances that require drive of 50 mA or more which is above 1-pin drive capabilty of the 16F690 and I didn't want to have to use more than one pin to trigger the relay.

    I have read that many of the 5V reed relays will still operate at 3.3vdc. What do you know about this?

    I appreciate your help. I am going to investigate the suggestion to use an "H-Bridge", but I know nothing about them. Can you point me to any good tutorials on H-Bridges for controlling solenoids that require more current than a PIC will provide?

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts