A first idea for a super simple RS232 temperature probe with the temp PIC

I have made it even simpler, and managed to interface the PIC to RS232 _without_ any extra parts.

Test setup: ftp://panteltje.com/pub/PIC_RS232_temperature_probe_test_setup_img_1446.jpg

New diagram: ftp://panteltje.com/pub/PIC_RS232_temperature_probe_2_diagram_img_1445.jpg

Asm code:

formatting link

This is new asm code, you can select non-inverting RS232, this omits the MAX232 or transistors. An advantage of doing RS232 in software :-)

The idea is based on DTR being positive, and supplying about 10 mA to the 5.1 V zener. The PIC will switch the RS232 between 0 and +5V. This works great on the USB to RS232 adaptors I have :-)

Only 3 parts! The cap needs to be next to the PIC, use a small one, low thermal mass, perhaps cut of some of the PIC pins, even lower thermal mass... Or use a smaller package perhaps. The zener needs to be in a spot that does not heat up, for example the connector. So this gives you a super cheap temp sensor with RS232 out... You can log temps too.

There is also a programmable temperature alarm output on pin 2, not used in this example.

Reply to
Jan Panteltje
Loading thread data ...

Er, DTR can be up to +12 volts. You're going to blow that zener, then the PIC, the first time you plug it into a 12v RS-232 port. You need at least a drop resistor to limit current in the zener to it's maximum.

Also, you'll fail to drive a true RS-232 port's Rx pin, as it requires you go to -3v. I suspect such ports are rare these days, but it's something to keep in mind.

Otherwise it's a "cool" project :-)

Reply to
DJ Delorie

On a sunny day (13 Aug 2009 15:55:28 -0400) it happened DJ Delorie wrote in :

The RS232 spec specifies the outputs as short circuit proof.

formatting link

There is no max current specified, but I measure 11 V open and 10mA short circuit current on teh PC out o nCOM 1. I measure 7.87 V open and 15.3 mA short circuit current on DTR on the USB to RS232 adaptor. Neither will damage any zeners, and a zener is not even a short.

But sure add your resistro if you must, better a fuse then !! This can be done with a very thin wire / PCB track :-) No extra cost.

Since most RS232 (and especially the ones this is intended for) are chip generated, nothing to worry about.

Disclaimer applies.

I know, and I think all these things use a BJT and a diode to ground in the base, and an input resistor.

Yep. Nice to monitor heatsink temp if you are testing something. I had it up to 150°C and it was still working OK. It goes to about -20°C too.

Reply to
Jan Panteltje

I was thinking, the PIC *isn't*.

I checked the cheapest 0603 5.1v zener at digikey, it can handle 200 mW. That's 40 mA. To get 40mA from (12-5) volts, that's only 180 ohms. Larger zeners mean smaller resistors (they can handle more power).

Alternately, you could use a small LDO regulator instead of the zener, but I suppose you'd only need it if you actually ran into an rs232 port that was too powerful. Rare, I suppose.

Another option: for the cost of the usb-serial converter, you could add an FT232 chip to your PIC and make it a usb-based thermometer, and avoid all the power problems completely :-)

It's not just about protecting the circuit that way, it's about letting it run despite the 12 volt inputs.

Like I said, rare.

Good for room or outdoor temperatures. The only temperature in my house I monitor outside that range is the woodstove, which requires a special thermocouple anyway.

Reply to
DJ Delorie

Just to stir the pot a bit, both my memory and the web page you provide says +/- 15V .... not 12V. Look at the specs nearer the bottom and not the author's writing earlier on. And that's when it is loaded by a receiver that also meets specs between 3k and 7k ohm. (Drivers must limit short-circuit current to less than 1/2 amp.)

RS232D is supposed to use the band between -3V and +3V as a transition region and the two bands from +3 to +5, and from -3 to -5, as their noise margin. Logic states of MARK and SPACE don't even begin until a magnitude of 5V is reached (loaded.) A lot of laptops can't even get there, I gather. But that's the spec.

So DTR can be up to 15V, loaded, and 25V unloaded. Unless I missed something.

Jon

Reply to
Jon Kirwan

On a sunny day (Thu, 13 Aug 2009 23:36:31 GMT) it happened Jon Kirwan wrote in :

Yea, well, the point with 'specs' that nobody follows, is that it is hard to find a safe area that satisfies mathematician types that are used to calculate resistances between points in infinite resistor matrices.

As _infinite_ resistor matrices do not exist, they are wasting their, and everybody else's, time, and then later at higher age (if not overrun by a car as in that cartoon) before getting to that, lose themselves into string theory :-)

From what I have measured my USB to RS232 adaptor only outputs about 6.8V on DTR. That leaves 1.8 V for a 78L05, so I preferred the zener. If you are rich like Larkin you use a 78L05 and have that perfection feeling, while of course there may exist RS232 stuff that outputs even less... needing a more complex switch mode perhaps... or an external AC adaptor, or just use the MAX232 that in itself also outputs like 6,8 V....

As to the TX side, it will simply always work.

And finally this was just an example, for the poor among us, like Joerg, who have to count every cent, and will love the cheap zener and non-transistor, Hell the connector is the most expensive thing in this whole design. Tell me were you can find an temp sensor with RS232 output for less then 1 Euro (1.5 $ no wait 1.6 $, no wait 1.7 $ oh, well you know what I mean...

That all said, I intent to try mine with a 78L05, as it seems there is a 1 degree difference in temp output if run from the PC or from the USB to RS232 adaptor, due to different zener current. Not really important, as it is not specified at 1 C accuracy, and can easily calibrated out in software, but just curious if the 78L05 will live up to it's dropout specs.

I am going to use this one to monitor my transmitter heat sink temperature, maybe control a fan with it.

Somebody in China will read this, expect cheap RS232 out temp probes soon ;-) Hey guys, make them in the millions :-) We set the standards :-)

Reply to
Jan Panteltje

On a sunny day (13 Aug 2009 19:08:57 -0400) it happened DJ Delorie wrote in :

See my reply to Jon Kirwan.

Reply to
Jan Panteltje

matrices.

as in that cartoon)

DTR.

Thats the difference between building rock solid commercial circuits and circuits that only work as a prototype.

--
Failure does not prove something is impossible, failure simply
indicates you are not using the right tools...
                     "If it doesn't fit, use a bigger hammer!"
--------------------------------------------------------------
Reply to
Nico Coesel

matrices.

as in that cartoon)

DTR.

Nobody follows the "rules". When I designed the first 1488/1489 RS-232 driver/receiver set (in the early '60's), the _spec_ was ±10V

Now it is common to see 0 => +3.3V, taking advantage that the original designed threshold was ~+0.6V (to avoid requiring split supplies for the receiver; AND to meet the floating input response spec).

...Jim Thompson

--
| James E.Thompson, P.E.                           |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  |
| E-mail Icon at http://www.analog-innovations.com |    1962     |
             
 I love to cook with wine     Sometimes I even put it in the food
Reply to
Jim Thompson

On a sunny day (Fri, 14 Aug 2009 17:30:49 GMT) it happened snipped-for-privacy@puntnl.niks (Nico Coesel) wrote in :

That is very much a non-sentence. I am not going to challenge you to come up with an example where this does not work. But I say that you will have a very hard time finding one.

Now the ball is in your court.

This thing is intended to be used with a laptop, or PC, with a reasonable cable length, to measure temperatures of objects under test. It does that just fine, and I have also decided _not_ to use a low drop regulator.

It is in the public domain, anybody is free to use the source and add whatever they think they need to make it usable for their purposes.

As such it is a lot more professional then a $$$$+++ black box where you have no control over anything, other then a promise to have it repaired for more $$$$+++++++ if it fails, but hey if you want to get ripped of enjoy it, if you can :-) It is also possible you never measure temperature, in that case what do you care. Oh I see it now: Your professional modules overheat in spite of those extra fans blowing on it, but you donotwantoknow, so you reject good cheap temp sensors :-)

El Pante.

EVERYBODY SHOULD HAVE SOME OF THESE SENSORS IN THE WORKSHOP.

How to view temperatures in an xterm and log those to a file at the same time in Linux, with this sensor: ptlrc -d /dev/ttyUSB1 -b 9600 | tee temp.log You can find ptlrc here:

formatting link

Did you know the output on pin 2 of the PIC sensor can drive a power MOSFET to control for example a fan? All that is needed is a resistor and capacitor to ground, and a logic level MOSFET.

formatting link

hehe :-)

Reply to
Jan Panteltje

Well, I'm just trying to stir things up, as I said. But to continue being argumentative:

Some older devices did actually follow them. I even tried such a driver (the slew rate spec was beyond my hobby skills to be certain of, though.) Some of those devices are still around and being used on occasion.

matrices.

Designing a driver for RS232D is not as simple as designing such a receiver. Meeting specs with the receiver is actually __NOT__ hard. I can speak from having done one or more that I believe did meet the spec. (We can always argue about it, though.)

as in that cartoon)

Ah, but theory is fun and it does apply to other circumstances. In this case for example, superposition is used quite profoundly by Spice because it works so well. And 1st year electronics books discuss it at length when talking about solving networks by any of at least three common methods.

So the principles are germane and practical.

DTR.

Have you exhaustively checked all devices? I've seen it a lot lower, in practice, on some laptops for example. And higher, as well.

Well, I would definitely feel __very__ uncomfortable using 6.8V as a design criteria for DTR. Not because I think the spec is met by every device (we both know it's pretty rare), but because so many devices I've measured don't cleave to this supposed standard of 6.8v, either. It's all over the map and people seem these days to do what pleases them. Which makes this rather more complex than if folks had actually held to the standard more. I've seen DTRs at 3.3V on one laptop, obviously because that's the supply they had to use conveniently. And that's clearly not in the spec, at all, but neither is it anything like your 6.8V.

Naw. I'm poor. Or, at least, I've still the heart of a church mouse from times when I worked the fields to survive.

Yes. Much less. If I were going for this to be broadly useful, I'd go the extra steps.

I can't say. I didn't look.

have to count

For one-offs, I'd use what works, too.

(1.5 $ no wait 1.6 $, no wait 1.7 $ oh,

Um. I was just stirring a pot, not looking for a temp sensor.

degree difference in temp

zener current.

calibrated out in software,

maybe control a fan with it.

As far as my experience with Chinese manufacturers goes, they do what is asked explicitly (and pretty well) and everything else that isn't closely specified (with examples provided that they must exactly match) they will use whatever is the absolute least expensive (nothing at all, if possible) even if it makes the rest of the unit useless to do so. If you say

Reply to
Jon Kirwan

Yea, right. I was thinking along these lines long time ago and everything worked fine until our device was connected to some brand name PC and it stopped working.

Guess what? It required negative voltage to work properly.

Since it was 10+ years ago I do not remember the exact brand. It was something like HP, IBM, Intel, ...

--
Andrew
Reply to
Andrew

I have an older RS232 temperature probe that won't work *unless* it gets 12 volt signals from the PC. It had a power jack in case your PC "wasn't compatible" and you had to provide external power.

At that time, I remember it worked on most of our computers, but not the one we needed it for...

Reply to
DJ Delorie

Experience from the past. Try to connect a long piece of wire between such a circuit and a computer. Then you'll find out why they choose large signal levels and a grey area in the middle. If you release such a circuit in the wild you'll see someone comes up with a computer which has slightly different levels or a laptop with a noisy PSU (to start with).

regulator.

There a lots of cheap temperature sensors (Microchip has many) in small packages that can either be read by an A/D converter input or I2C.

--
Failure does not prove something is impossible, failure simply
indicates you are not using the right tools...
                     "If it doesn\'t fit, use a bigger hammer!"
--------------------------------------------------------------
Reply to
Nico Coesel

On a sunny day (Fri, 14 Aug 2009 20:29:32 GMT) it happened snipped-for-privacy@puntnl.niks (Nico Coesel) wrote in :

This works fine with more then a meter length on COM1. Remember the TX drives the line hard, the PIC can source whatever it can get from DTR, and sink many many milli amps. Looks like nice square waves here, not that slow rise time stuff. If problems occur: Simply lower the baudrate, it is set with a #define in the asm source. The PIC sends a new temp value about once per second (watchdog timeout basically). Communication program ptlrc goes down to 75 Baud, 150 C is 5 characters, 10 bits x 5 = 50 bits, less then a second ! See, you do not know what you are talking about. The '1' or '0' needs to be true before half the bit time, that is when the UART normally samples that line, and half a bit time at 75 Baud is 6.6666666 ms :-) So 6 ms will be fine. For a 10 mA sink / source to have say 4 V in 6 ms allows for a capacitance of Q = C.U = i.t makes C = i.t / U = .01 x .006 / 4 = 15 nF. RS232 low capacitance cable is about 100 pF per meter, so this allows for a cable length of 150 meter if using 75 baud.

Light bulb on now :-)?

I am aware of the RS232 problem, in the long ago past I have replaced some really long ones with optical ones (factory PC to PLC), with RS232 to optical Hirschman modules at each end (each with their AC adaptor).

You can do I2C (well I do it) via a par port, even over tenth of meters with screened cable. In any other case you need an extra micro.

Reply to
Jan Panteltje

On a sunny day (Fri, 14 Aug 2009 14:47:45 -0500) it happened "Andrew" wrote in :

Yes but this one does not require negative voltage. Anyways in an other project I use DTR and RTS to make pos and neg voltages:

formatting link
This requires the terminal program to set DTS and RTS accordingly, I think any mouse driver does that :-) And other advantage of using Linux, and writing your own software. Simlpy wrote a little routine to set DTR to + / RTS to -.

Well.... hehe those are big names....

Reply to
Jan Panteltje

He said the PC required a -ve voltage and I have had the same experience where TTL levels would not drive the PC RXD line, also a long time ago, probably on a Dell machine.

Reply to
nospam

On a sunny day (Sat, 15 Aug 2009 00:39:22 +0100) it happened nospam wrote in :

Did not Dell go out of business some time ago ;-)?

Reply to
Jan Panteltje

Are you really that ignorant of the PC world?

Reply to
nospam

On a sunny day (Sat, 15 Aug 2009 14:55:02 +0100) it happened nospam wrote in :

Na, everybody knows Dell went belly up years ago because it did not work with my PIC temp sensor. Got the joke now?

Actually all this bull about 15 year old PCs like Dell is a waste of time. Dell will these days use the same mobo chipsets as everybody else. Just for fun I programmed some new features in the PIC (still only a few bytes more), selectable baudrate down to 75 Bd, programmable hysteresis so it can really drive a fan or heater, and selectable ORin or hard drive for a power MOSFET.

formatting link
formatting link

Now what did you do, play with your Dell?

As more features are added testing becomes more involved, so bugs will also make their way. Testing at -20C is difficult, so I simulated that.

Reply to
Jan Panteltje

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.