OpAmp/Voltage comparator as UART tx buffer?

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

Greets,

 

I need to connect 8 atmega UART rx slaves, in about 1 meter intervals and thought of using opamps or voltage comparators as voltage followers to boost the UART TX signal from the master MCU (see attachment). Do you think this would work at lower baud rates, say under 38400?

 

Attachment(s): 

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

Why not use a standard RS485 configuration?

Ross McKenzie ValuSoft Melbourne Australia

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

Op amps or comparators are really not very good for that. For multiple slaves, you really should use RS422 or RS485 transceivers. They are made exactly for this purpose. 

 

Jim

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

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

Yep, I know about rs422 and RS485, I've even got some MAX485 chips, and that's what I wanted to use at first, but since I'm doing this at home, i.e. no electrical noise, and the distances are small, I thought maybe I could use a simpler setup with the less wires.

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

There is a system called SDI-12 which is a single wire half-duplex asynchronous data system. Its pretty slow (1200 baud is standard, I think). But it supports multiple devices on a single wire (plus common) network.

 

RS-485 can do full bidirectional data on a single pair of wires. It is differential but each device receiver and transmitter connects to the same pair of wires. So, RS485 uses no more wires than RS232 or equivalent. 

 

One of your big problems with having multiple devices as you describe is that each slave's transmitter has to be disconnected from the system to allow the selected slave to send data. As soon as you figure out how to do that disconnect, you have an RS485 transceiver. The receive part is easy, its the transmit part that will kill you.

 

Jim

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

Last Edited: Thu. Aug 15, 2019 - 05:17 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you don't use RSxxx interface chips, try using schmitt trigger input gates.  Assuming you are just sending logic levels down the line, rather than "full voltage" rs xxx levels, such as +/-12V.

 

Before you get too fancy, just try it using pure wires & nothing else (or with a tx buffer) .....you might get lucky, depending upon shielding, gnd connections, capacitances, noise, etc.   However, this is for your use. not a product or for anything critical (like controlling your bandsaw or automated welding station).   As mentioned, if you need bidirectional comm, it can be much more complicated.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

The average home alarm system uses a transistor to pull a wire low and a comparator to recover the data - it's cheap 'n' cheerful. I'm lazy, so I'd go the RS485 chip as basically no design is required and there's a fair chance it will work. If you're even lazier, go for the LTC1785 chips as they have higher voltage specs and good ESD specs. The average 485 chips needs some protection.

 

As for no electrical noise in a house - unless it is a faraday cage, there's heaps of noise sources - wifi, mobile phones, zillions of switchedmode power supplies, static discharge, fridge compressors turning on/off, washing machines (you should see the signal on the 'scope at my place from the washing machine!) and there's lightning.

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

You can also look at LIN (at least as a physical layer)

 

https://en.wikipedia.org/wiki/Local_Interconnect_Network

 

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

Although I have to agree with the others on 485, one other possibility with 1 meter distant slaves, is have each slave act as a repeater, with two serial ttl level interfaces, each rx's and buffers the packet, then if not addressed to itself, the packet is sent to the next slave, that rx's and repeats as needed.  With a proper protocol this can work both directions in the chain. 

Just a thought.

 

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

The security system I formerly worked on professionally used a repeater system. But, it was formed in a loop so it was two wire (RS422) single direction only. It worked quite well. Packets include the destination address and when any device receives a message with its own destination, it removes it from the loop.

 

Jim

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

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

Thanks for the input guys

 

In my project I just need to switch different segments of some led strips on and off, so low baud rates are ok. The slaves (arduino pro minis) only need to listen. From the beginning I planned to use RS485 chips, but then thought what if I could do it simpler but did not want to do the testing, soldering the opamp/v-comparator boards, connecting everything, etc...

 

Another option would have been to use wireless receivers, but I wanted to keep the price down and simpler software implementation.

 

Kartman wrote:

 

As for no electrical noise in a house - unless it is a faraday cage, there's heaps of noise sources - wifi, mobile phones, zillions of switchedmode power supplies, static discharge, fridge compressors turning on/off, washing machines (you should see the signal on the 'scope at my place from the washing machine!) and there's lightning.

 

 

Looks like I'm going to have to go with RS485 after all.

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

How was an opamp going to be easier than an RS485 transciever, anyway?

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

Perhaps the master TX could drive a current source that can be chained through a few optocoupler inputs. Each mini could then listen to an optocoupler output with its RX pin. Current loops are fairly noise-tolerant, and each slave would be isolated.

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

Perhaps the master TX could drive a current source that can be chained through a few optocoupler inputs. Each mini could then listen to an optocoupler output with its RX pin. Current loops are fairly noise-tolerant, and each slave would be isolated.

That's pretty slick, if you can generate the higher (stacked) voltage needed to drive all the series leds. 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

In this situation I would recommend going as simple as possible.   You may not need any buffering for a total cable length of 25 feet (my part of the world has yet to "convert" to metric). 

Try also using the built-in analog comparator of the ATMega328P located on the Pro-Mini.  Or feed the input signal into the 8 inputs of a ULN2003 IC with each output going to the slave's UART input.

An op-amp used in your design would need a +5V/gnd power supply (LF358 maybe) and also need a high slew rate to handle digital signal edges.  Or perhaps a pair of 74HC14 hex inverters with hysteresis before each slave input.

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

But comparator will not provide an input to the UART. You would have to use a software UART to make that possible on a standard Mega or Tiny.

 

Jim

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

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

electronaut wrote:

I need to connect 8 atmega UART rx slaves, in about 1 meter intervals and thought of using opamps or voltage comparators as voltage followers to boost the UART TX signal from the master MCU (see attachment). Do you think this would work at lower baud rates, say under 38400?

..

 

In my project I just need to switch different segments of some led strips on and off, so low baud rates are ok. 

 

UART RX pins are CMOS in, so they do not need much buffering at all, however you may need to consider ground drop variations more. 

If you have good sized cables and GND varies by < 0.5V, a simple direct connection may work fine. Perhaps a series 1~5K for spike protection.

You can send some redundant data as insurance.

 

RS485/422 and CAN bus are differential, and tolerates reasonably large ground variations, but is something of overkill for a few meters and low bauds.

LIN uses 12v swings, so buys some ground tolerance simply by using a bigger swing, and modest speeds.

Opto couplers are very tolerant of ground differences/spikes, and something like H11L1 is fast, and low drive.  As mentioned above, if you have enough drive voltage you can series the opto LEDs.

 

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

Also, if units are close by, you can blast out the data on a few ultra bright leds aimed in different directions...They'll bounce around the room plenty good enough to pick up whatever you are sending out.  You can probably get some IR rcvr module to pick it right up.

For even more fun, you could even use ultrasonic transducers.   Of course, this all depends on how much time you want to spend fiddling with it.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

joeymorin wrote:

How was an opamp going to be easier than an RS485 transciever, anyway?

 

I thought I would need to solder less connections on the proto-board and avoid using double the wiring since RS485 is differential.

ron_sutherland wrote:

Perhaps the master TX could drive a current source that can be chained through a few optocoupler inputs. Each mini could then listen to an optocoupler output with its RX pin. Current loops are fairly noise-tolerant, and each slave would be isolated.

 

 yep, I thought about it, since I've built some MIDI circuits before and they all use optos on the inputs.

In any case, after reading all of the responses it makes sense to me to just go with the RS485, even though it will use double the wiring at these lengths the price difference is not substantial for me.

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

electronaut wrote:

I thought I would need to solder less connections on the proto-board and avoid using double the wiring since RS485 is differential.

50% more.  You'd need a common ground even with your op-amp proposal i.e. two conductors.  RS485 is three conductor (ideally, shielded twisted pair, but with short runs you could get away with three straight conductors).

 

A typical RS485 transceiver like the bog standard SN75176B needs only a bypass cap, and a termination resistor at either end of the bus.  Your op-amp strategy would likely need at least a cap and resistor at each station for >1 gain and stability.

 

EDIT: sp

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Sat. Aug 17, 2019 - 12:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joeymorin wrote:
the bog standard SN75176B needs only a bypass cap, and a termination resistor at either end of the bus.

It also helps to have a pull up on the RXD line as well.

 

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

ki0bk wrote:

It also helps to have a pull up on the RXD line as well.

On which RXD?  The one on the AVR?  Not needed, as the transceiver's RO is for "receiver output".  Even so, if you wanted a pullup, the AVR internal is sufficient.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]