View previous topic :: View next topic |
Author |
Message |
beaker404
Joined: 24 Jul 2012 Posts: 163
|
|
Posted: Sun Oct 06, 2019 8:17 am |
|
|
I agree on the two wire is simpler observation, however, cabling requires me to get rid of a wire, single TX RX is one way to do this, another would be to transmit over my power line but that seems more complex, but in the end may be the only solution if I cannot work this level shift thing out.
still open for ideas.
at the laptop side, I have not space requirements so a bit more complexity is acceptable if it allows me to get rid of the wire between the laptop and PIC. |
|
|
beaker404
Joined: 24 Jul 2012 Posts: 163
|
|
Posted: Sun Oct 06, 2019 8:18 am |
|
|
I agree on the two wire is simpler observation, however, cabling requires me to get rid of a wire. Single TX RX is one way to do this, another would be to transmit over my power line but that seems more complex. But in the end may be the only solution if I cannot work this level shift thing out.
Still open for ideas.
At the laptop side, I have not space requirements so a bit more complexity is acceptable if it allows me to get rid of the wire between the laptop and PIC. |
|
|
beaker404
Joined: 24 Jul 2012 Posts: 163
|
|
Posted: Sun Oct 06, 2019 8:20 am |
|
|
Anyone have a circuit for what Ttelmah is talking about on the dual max232? Or a link to example circuitry? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Sun Oct 06, 2019 10:00 am |
|
|
You already have the basis.
Think about it. The Max232 you were using with two wires worked. It
converted the laptop signals to/from 5v.
Now you don't actually need two MAX232's, but just use the second
channel on this. Feed the output back into the second channel input, and
do the same for the RX channel.
Now the second channel RS232 lines then give you proper signaling
levels, which should then work with the diode circuit. You then feed these
on to the MAX232 attached to the PIC.
Obvious downside is that this is going to require 5v.
Remember that even with this 'one wire' interface, two wires are needed.
You need a ground connection as well. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Sun Oct 06, 2019 12:49 pm |
|
|
From your posts, you say you need gnd, pwr, txd, rxd so I have to ask why you can't use 4 conductor cable ?
Any (all) other methods require lots of parts and connections which complicates the project.
Sometimes the simplest solution is the best !
But if you have to only have 3 wires (gnd, pwr, com) it can be done.
It would be nice to KNOW what the laptop is using for '0' and '1' though.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Mon Oct 07, 2019 1:53 am |
|
|
If all that is needed is to send serial data bidirectionally on a
single wire, and you have power at both ends, then just forget RS232.
Simple open collector transistor drive at each end with a pull-up resistor.
Couple of inverters to give the correct logic at the PIC.
The line should idle 'high', and be pulled down whenever either end is
sending a bit.
Important to remember though that such a bidirectional system is going
to mean that both ends always receive everything they send, as well as
the 'replies'. Code at both ends needs to be able to handle this.
Honestly with Schottky diodes the published circuit 1, should work. However
note the comment at the end about the input impedance of some drivers.
I can quite believe that the resistors might have to go down to perhaps
2K2 on some inputs. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Mon Oct 07, 2019 5:02 am |
|
|
Have to wonder why , as Mr. T points out, an S diode and 2k2, even 3k3 won't work. CCS shows 'how to' have 2 PIC communicate on one wire in the FAQ section of the manual. Been there since the manual was a coilwire hard copy book !
You can also have laptop send data as voltage, receive data only as current on one wire. I've done that for 30+ years. More parts than diode and resistor though.
If all else fails, use an 8 pin PIC on the laptop side. It can not only connect to the remote PIC, it can filter the laptop transmission to not echo back to itself.
What you haven't said is the distance between the two devices. That is an important 'piece of the puzzle'.
Jay |
|
|
beaker404
Joined: 24 Jul 2012 Posts: 163
|
|
Posted: Mon Oct 07, 2019 6:40 am |
|
|
Not sure why this circuit does not work either. Schottky diode with a 2.2K resistors, still no send from laptop to PIC, PIC still talks to laptop.
Looking at a loopback of the laptop, voltage levels are +5 and -5
Will have to modify PIC code to see what is being sent as the only thing I am sending til the Laptop talks to the PIC is a simple greeting at power up.
As for the wire count, going 200 feet through a cable with only 5 conductors and I can only allocate 3 wires PWR GND COM for my circuit.
Hence the one wire for TX and RX. Would be done if I could have one more wire. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Mon Oct 07, 2019 7:30 am |
|
|
Seriously one glaring thing is cable length.
200 feet is only specified for RS232 at a maximum of 9600bps. At 57600bps
RS232 is only specified for 16 feet of cable.
If you are using 200' of cable it is not surprising that the connection won't
work.
You honestly need to be using a standard designed for longer links. However
most of these will be differential, so 2 wires used. However you talk about
5 core cable. 2 wire RS484, GND, and Vcc. Just four wires needed. |
|
|
beaker404
Joined: 24 Jul 2012 Posts: 163
|
|
Posted: Mon Oct 07, 2019 7:39 am |
|
|
I only have three of the 5 wires I can use, the other two are committed to other signals. Hence, I have to use three.
I know about the distance limitations, seems to work well with two wire.
The headache of dealing with existing hardware. |
|
|
beaker404
Joined: 24 Jul 2012 Posts: 163
|
|
Posted: Mon Oct 07, 2019 7:42 am |
|
|
I am only doing this on a breadboard for now, so distance is not the problem keeping the circuit from working.
Scope shows the TX to the PIC is only swinging between +2.5V and -5V.
Not +5 and -5 as it does when the two wire setup is used. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Mon Oct 07, 2019 8:52 am |
|
|
Seriously triple check your wiring. The pull 'up' is done by the diode, so
should only at worst be one diode drop below the version without the
circuit. The pull 'down' is the direction that will get worse. Sounds as
if the diode may be the wrong way round, or faulty. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Tue Oct 08, 2019 12:39 am |
|
|
A question. You say you have also tried circuit 3. You do realise this is only
half the circuit. You need what is shown there duplicated to do both
directions. However R2 can be shared between the two circuits.
Can you test the input resistance of the laptop?. Simple resistor and
pull the RX input up through a resistor. Then measure the voltage it goes
up to. You can then calculate the resistance involved.
Now the most likely reason for the problems is that the RS232 output on
the laptop-, has very limited current drive capability. Remember that when
running with the single signalling wire, each TX signal is having to pull
_two_ RX inputs up. So the load on the line doubles. It sounds as
if the driver used inside the laptop, does not deliver sufficient drive to do
this, hence the signal no longer pulls up adequately. Hence buffering
with a genuine MAX232, would probably be the way to go.
If you want to contact me privately and give an email address, I'll
send you the circuit needed to do this. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Re: RS232 on one wire |
Posted: Tue Oct 08, 2019 2:50 am |
|
|
beaker404 wrote: | I guessed the typo for the resistor was 4.7K then tried 47K. |
Like PCM says, it's not a typo.
It's a convention that's been around since 1952 as part of BS1852, and later modifications.
The purpose was to avoid decimal points "going missing" when circuit diagrams were copied/photocopied multiple times.
Most of the design engineers I've come across here in northern England either use the convention or have no problem with it.
Mike |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Tue Oct 08, 2019 5:03 am |
|
|
What baudrate can you use ? If possible, set it to say 1200 or even 300. Serial communications using wires has limits and there's a compromise or tradeoff. The longer the distance ,the slower you MUST go. There's entire books written about this. 2 examples. SATA drives are Serial and comm speed is very fast but the cable is maybe 10cm( 4 inches) meanwhile my remote energy systems run at 24 Baud( yes 24 bits per second) yet will signal over 24 KMs(15 MILES) of solid copper wire.
You've got 200' of wire,so you need to go slow ! Also, type and construction of wire matters. Twisted pairs and shielded are best, large gauge helps too. at 200', EMI pickup(noise) is quite probable. More 'fun' to deal with.
When you do get a 'method' that works, be sure to test at 2X the required baudrate, with LOTS of random length datastreams, for 3-4 days. Testing 'on the bench' is NOT good enough, Real World testing is a must !
Jay |
|
|
|