This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler: Relay Library for a relay

Other Parts Discussed in Thread: TM4C123GH6PM

Tool/software: TI C/C++ Compiler

Hello, I'm recently started working on CCS environment. I wanted to turn on and off a motor using Relay. I will be really thankful if you have suggestion on how to find library. Thank you !!

  • Which device are you using?  -George

  • TM4C123GH6PM. Im uSING ccs to compile. Thank You

    This is the picture. www.google.com/imgres
  • Perhaps more important than a "library" is your recognition & understanding - that unless the relay is VERY small & low voltage/low power - such use can prove FATAL to your MCU!

    MCUs serve as the "Intelligence Center" they are built for "thinking, processing, measuring" - NOT for "weight-lifting."

    The normal/customary means of driving a relay is to impose (place) a properly sized/typed transistor between the MCU's driving GPIO and the relay.     In this manner - the relatively weak MCU Output is able to "drive" the more powerful transistor - which in turn is able to "Turn On/Off" your relay's coil.      (assumes the transistor is sized/typed w/some care...)

    Relays are very SLOW devices.      (nearly as slow as '129 - which regularly are ("kicked from the left (speed) - lane by Turtles" employing their "horn/high-beams")     It is far more popular (and productive) to employ the (again) properly sized/rated Transistor (or transistor pair) to, "Run your Motor."       Thus Saving the cost/size penalty introduced by the (near) useless Relay.      (I WILL accept it - postage pre-paid - as my (partial) boat anchor)

    Google offers hundreds of pages of photos, circuit diagrams, even videos - "Proving this Transistor Control (usually via FETs) very much the most proper & popular method of small Motor Drive/Control...

  • cb1_mobile said:
    Perhaps more important than a "library" is your recognition & understanding - that unless the relay is VERY small & low voltage/low power - such use can prove FATAL to your MCU!

    Like.

    There's a little more to simple relay driving than just turning on a FET.

    cb1_mobile said:
    Relays are very SLOW devices.    

    Worst case I had was IIRC about 3/4 of a second, might actually have been slower.

    cb1_mobile said:
    It is far more popular (and productive) to employ the (again) properly sized/rated Transistor (or transistor pair) to, "Run your Motor."      

    That probably depends on motor size, but for miniature motors I can believe it to be true. And when it isn't true, the relays are not small devices either.

    Robert

  • Is it not (generally) agreed - that "just after" - the popularity of a "Relay Library" comes the "Horse Drawn Cart Library?" I cannot recall if the "carrot or whip" - proves the optimal driving source - for the latter... (as a small boy - I rode in such cart - around NYC's famed, "Central Park.")

    You "hint at" the necessity to "Quench the voltage spike" which results when the relay's coil is "de-energized" - and all that stored coil current - must "Go somewhere!" Properly sized/typed diode (placed between "V_Coil(+)" and "V_Coil(-)" - will "limit" the voltage excursion (spike) (upon coil's release) to "less than" destructive levels...
  • cb1_mobile said:
    You "hint at" the necessity to "Quench the voltage spike" which results when the relay's coil is "de-energized"

    There's also the draw of energizing the coil. The coil could easily take an order of magnitude more current (and at a higher voltage) than the micro. That can play havoc with the power rails.

    Robert

  • Indeed - unless the relay is very small - a transistor must be emplaced - with the "MCU driving the transistor" - which in turn - drives the relay's coil.

    Don't get the idea that "Relays are ALL Bad."      (i.e. block out (someone's) "horse-drawn cart comparison")

    In days long past - when the Shuttle Flew - and "Hams were aboard" - our (almost) legal, custom built RF, Linear Amplifiers were "too powerful" to be employed w/(even) the "best Power FETs" - which served as the SPDT, "High Gain Antenna Switch."     (had to switch between TX & RX/vice versa - and support 3.5KW - just (slightly) beyond the 1KW legal limit...

    Talking to a "fellow fanatic" - just 7 miles down the road - but w/"both his & my" parabolic dishes, "Aimed at the Moon" - (that's a 500K mile round trip i.e. Ham Radio MOON-BOUNCE) also was achieved under "Relay Control."     (and while "unclear" - if memory serves - the legal limit (may) have been (even) further violated...after all - that limit was (both) challenge & suggestion - to our "self-designed, engaged RF design learning - is that not true?)

    Relays DO "have their place" - although that place is (rarely) via (any) direct connection to any MCU!