tri state buffer?

Hi I have an idea for either a custom board or shield that basically just improves the digital output capabilities of the pins( hoping for >100ma, maybe 300ma max)while still having the flexibility as an input I was figuring some sort of tri-state buffer, so that it can output vcc,gnd and still pass on any digital reading in a z state does anyone know of any simple ics that do this? A quick search wasn't fruitful for me I was thinking op amps at first but idk how I would make that into a zstate if I could find some nice smd packages that'd be nice and I could probably make a board out of it, but if its alot of individual components ill have to make it a shield any suggestions? Also if anyone knows a good fast adc that'd be nice, if I make a shield I might as well expand the adc capabilities watever you guys know would be appreciated, this is like one of those projects with no particular goal other than see if I can accomplish it in the given space

You're saying you want to use the pin as both input and output? Can't generally be done using only the one pin, because the output transistor wouldn't know whether it's the input trying to drive current into your pin (and thus the transistor), or the Arduino. You could just wire the output pins to 220 Ohm resistors to the gate pin of some MOSFET transistors as low-end drivers. This works great. BS170 costs pennies, is small (TO-92) and drives up to 500 mA. Also use a 10k pull-down between gate and ground. The only draw-back is that, when you use the pin as "input," that "input" will also turn on the transistor. If you have nothing hooked to that transistor at the time, that won't matter.

Well, your "current" requirement makes finding perfect part rather difficult but you could consider using something like a 74HCT367 or 74HC244 and then GANGING I/O pins to get more current... but the reality of these parts is that they can really only drive about 35mA each.

Interesting...tri-state buffer. In Intel 8080, 8085, 8086, 8088 use tri-state buffer for the data lines ... 74LS244 , if I can recall. By properly wires them, it might work. HC244 is fine too ( a CMOS ) , I prefer LS244 - TTL resistant to static. CMOS, not so so...

I would use a strong driver like a L293D to drive the high & low current
http://www.ti.com/product/l293d
You’d need an additional pin to disable them when you want to go into tristate and/or input mode.

Hmm, perhaps i might use that l293 and maybe just have one pin dedicated (probably txt pin since most people leave those alone anyway) controlling a sipa register to control pairs of pins, the only drawback other than the used pin being it would have to be in pairs I guess it'd be kind of hard to detect when the arduino is in a z state input without biasing that input with an intermediate circuit? those tristate buffer are basically what I came across in my search and disappointed me with their current capabilities, My main goal would have been making a regular sized fully functional board excpet the whole enhanced output capabilities thing, preferebly without altering any code or making a library this will probably end up as a shield with a library : / would have been nice as a nice small board anyone also know of any good maybe 16bit adc? I was thinking if im gonna beef up the output and put it on a shield I might as we'll beef up the analog input with built in voltage dividers maybe up to 24v and use the extra bits to retain an accurate reading from the divided voltage Also do they make an ic similiar to the l293 in an smd package? The dataheet only mentions dip

I believe the reason it is a DIP is so that cooling can be provided.
Pairs - yeah, I guess so with the EN1,2 and EN3,4 pins.
Just realized that I have 1 extra pin grounded - pin 8 should go to 5V also. Updated picture posted.

If you want surface mount, then I think you’re going to have to go to discrete logic level N and P channel MOSFETs
go to digikey.com, search for MOSFET
FETs - Single
In stock
logic level
surface mount
pick a current you want to support
I picked 400mA, got a page of results back, as an example.
You’ll have to add your own logic to enable them to drive or to turn them off when you want to use the pin as an input.

ADCs: Analog Devices makes a lot of nice chips.
For example:
http://www.analog.com/en/analog-to-digital-converters/ad-converters/ad7988-5/products/product.html

@CrossRoads

Nice idea using the L293.

Thanks Techone.

That adc looks cool, I've never worked with adc's before and the only questionable thing after reading the datasheet is what would be the easiest way to get a 2.5v vdd? It says max is 2.65v so that's pretty picky

How could I use mosfets? Id understand for 0 or 5v output but wouldn't being set at input cause it to float and the two mosfets just act weird? How could I disable both mosfets and allow that same pin to be used as an input?

2.5V, use two 10Ks from 5v voltage divider. Or get a 2.5V precise source.

MOSFETs, like I said you will need some additional logic to disable the gate drives so the MOSFET outputs can float & allow the external source to drive the pin.

I think this circuit is kinda convoluted, but it sorta gets the idea across.
When the Enable pin is active High, the top AND gates are allowed to follow the Logic signal to drive the Gate’s high & low.

When the Enable pin is Low, the top AND gates are forced LOW so the MOSFET gates are forced to the offstate, and the bottom AND gate is allowed to follow the output of the MOSFET.
The 7406’s are open collector, so they need a pullup resistor to have their output go high.

I may need another inverter somewhere so that a Logic High results in the output being High, and the output High showing up as high at the Logic pin.
Or we can just say the output is an inverter.

That'd probably work the only problem with that is space that it would take up just a though but is it possible to simply detect the current to trigger the z state? Say there is a 10ma load on a pin to trigger the higher power supply, if the pin is set at input then the higher power supply will act weird but doesn't matter as another circuit detects that's the current draw is below a threshold and disconnects the higher power output and allows that's pin to be used as input how can I detect the presence of a 10ma load? I was thinking a shunt to an opamp to trigger the disconnecting circuit, but what also can I use to disconnect the power supply? I could just use that to trigger the zstate of the l293 but it'd be 100% perfect to not have to have it in pairs

Take a look at this chip TXB0104 http://www.ti.com/product/txb0104

and do the same at much higher currents ...

Yeah that's basically what im aiming for, I like the l293 actually because it gives the opportunity to not only have 5v out but up to 36v which could be useful I guess, I will probably go that route and just figure out how to automatically disconnect the power output when in input mode

There's no automatically - if you want to drive the pin as an input, you'll have to take the Enable line low to turn off the 600mA driver, and use pinMode to set the ATMega pin to an INPUT or its 40mA driver is going to fight your external source as well. You could read something from the source on a different pin, something the software could use to control the Enable line and assert the pinMode control, if you are thinking of that as automatic:

if (digitalRead (outputControl) == 0){
digitalWrite (enablePin, LOW);
pinMode (outputPin, INPUT);
dataInput = digitalRead (outputPin);
}

Id like to try and keep it automatic with hardware if possible I want it so that if the atmega has a pin in input it senses that there is no(minimal) current flow and trigger the zstate of the power output I was thinking actually to have a dummy load on every pin, a voltage divider with the center on the pin, so that it has 2.5v at the pin, then when its either sinking or sourcing there willl be current flow, except when its input and it will not affect either resistor in the divider I think if I pick the values carefully(maybe some simulation needed or just use the 10k ones I have) I can get a dependable input detector then I just have that trigger the zstate on the l293 for the pin pair is there a way I can use an op amp or comaprator to detect if a voltage is a certain level without it being too exact where it will never show equal? if I use 0805 resistors this may not be too bad in size, but a funtime soldering 20 pins worth or I may just could the easy way out and use the 13 pins always output and save the others for input, but that's not as fun

Since most of the time your using a pin only one way for any given project why not have a jumper select or alternate contacts for direct wire vs boosted output. Also the times when the pin would change from an in to an out or visversa in one project are most likely signal level and would not need the high current capability.

Thats a good idea, but then again if this was for a particular project id just have set input /outputs
this is more of a see if I can do it project, just a learning experience I guess
I think im gonna try my input detector idea, do some testing and see what happens and how I can use it

So, as I already said, the hardware can't read your mind.

The best approximation is probably to provide separate output and input connections. The output is driven by a Darlington or similar driver. The input goes straight to the pin, perhaps with a buffer. The main drawbacks are space (output + input pins) and the input actually driving the output pin, too (which doesn't matter if nothing is hooked up.)