Solved: can a tristate output, control relay (on/off)

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi

 

i have an app, with a avr with some output's that switch from tristate to gnd

avr its on 5vdc but an "external circuit" works at 12vd with common gnd to avr

 

goal is the "external circuit" to control a relay followed by out (tristate/gn -> on/off relay)

 

have try with transistor bc548 driving relay but because even at tristated output some small current pass, output of transistor has some kind of analog out , and relay remain latched

 

can somehow this controled by simple transistor, or need some kind of buffered out , from avr ?!

Last Edited: Mon. Jan 2, 2017 - 10:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You said...

tristate/gn -> on/off relay

which to me means that when the AVR's output pulls to ground, you want the relay OFF. And when tristated output, you want the relay ON. 

 

Why tristate the AVR output? Surely simply driving it to its nominal 5VDC rail would turn on your BC548 and cause the relay to switch.

 

Need clarity...

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:

 

which to me means that when the AVR's output pulls to ground, you want the relay OFF. And when tristated output, you want the relay ON. 

 

correct (or opposite. gnd = relay on, tristate = relay off)

 

valusoft wrote:

Why tristate the AVR output? Surely simply driving it to its nominal 5VDC rail would turn on your BC548 and cause the relay to switch.

tristate because it needed to work in other purposes that way

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK try this quick and dirty idea.

 

D1 prevents any high on your AVR operating the circuit. D2 ensures that the AVR's loow switches OFF T1.

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you used a relay with built in diode? Is this what the OP is also using? You may otherwise get a fee deduction as a penalty.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cheeky

 

Very quick Eagle effort... no consideration for such niceties...

 

Gee I didn't even time to speel check.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hi plouf

 

Be aware that tristate on any pin only has high impedance between GND and VCC. Voltages below GND and in excess of VCC just see one (builtin protection) diode.

 

If you have VCC=5V an connects a resistor from 12V to a tristate pin, the diode conducts, and current flows through the resistor. Voltage over resistor approximately 12V - 5V - diode forward = 6.4V

 

In general: never ever connect any AVR pin to a voltage not between VCC and GND!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A tri-stated pin will float to any value, so supply a pull up resistor to the base of your xsistor to 5v, now your tri-state/gnd control signal will work!

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

 

valusoft wrote:

OK try this quick and dirty idea.

 

D1 prevents any high on your AVR operating the circuit. D2 ensures that the AVR's loow switches OFF T1.

 

 

 

Thanx for your time and solution , i tested it and works great

 

 

peteralarsen wrote:

Hi plouf

 

Be aware that tristate on any pin only has high impedance between GND and VCC. Voltages below GND and in excess of VCC just see one (builtin protection) diode.

 

If you have VCC=5V an connects a resistor from 12V to a tristate pin, the diode conducts, and current flows through the resistor. Voltage over resistor approximately 12V - 5V - diode forward = 6.4V

 

In general: never ever connect any AVR pin to a voltage not between VCC and GND!

 

It seems that something i miss about tristated pins is there any document, application note or somehting , describing deeper tristated schematic/work ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, a "tristate" pin will NOT float to "any" value. It is limited by the supply voltage of the MCU. If you try to exceed that, you can do real damage. For example, if you try to turn on/off a relay powered from +12V with a 5V MCU.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

is there any document, application note or somehting , describing deeper tristated schematic/work ?

Maybe some old TTL or CMOS data book of 30 or 40 years ago could have a good explanation.

 

hmmm just looked at your AVATAR, the book would be likely older than you. wink

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Mon. Jan 2, 2017 - 10:02 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 is there any document, application note or somehting , describing deeper tristated schematic/work ?

Well, could start here.

 

JC 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The real question, however, is why did you select a micro with fewer pins that you really need?

 

Although it is possible to make a pin serve multiple functions, unless you are making many PCB's the cost difference between the smaller micro, and the slightly larger one, usually doesn't justify the added complexity of the external circuitry, and the added complexity of the software.

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

plouf wrote:
It seems that something i miss about tristated pins is there any document, application note or somehting , describing deeper tristated schematic/work ?

 

Check the documentation for this processor: http://www.atmel.com/images/doc2...

 

See page 48, note the two reverse coupled diodes at the pin. If you try to pull the pin below GND og above VCC, one of the diodes will be forwarded. This is for protection.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry Jim, for not making myself clear, when I said "any" I meant any value between vcc and gnd!  Thanks for clarifying that!

 

Jim

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...