Shop OBEX P1 Docs P2 Docs Learn Events
Long Distance Temperature Measurement — Parallax Forums

Long Distance Temperature Measurement

I have an application for using a Parallax propeller 1 microcontroller to control temperature and humidity in a chamber at a distance of fifty feet using a cable between the chamber and the control room with all the environmental constraints applied to the cable that include below zero to over 110 degrees F, rain, snow, hail, dust, etc.

What type measurement devices and protocol do you suggest?

Discovery

Comments

  • Using RS-485 as a transmission medium seems reasonable, and you can create your own protocol so that your specific needs are met. I've done many half-duplex apps with RS-485, usually Propeller-to-Propeller, but if your control room end has a PC you can put a USB-to-RS485 adapter on that end and let your program do its work.

  • evanhevanh Posts: 15,187

    Is it only the measuring you need to sort? What about the appliances to be controlled for maintaining the temperature and humidity. They often run from mains electricity. Do they exist already?

  • I am wondering if a fiber-optic link can be used with I2C between the propeller microcontroller and sensing/controlling devices.

    Yes the pumps, motors, fans, etc. exit in the controlled atmosphere chamber. the computer is in the control room separate from the chamber. There is electrical power in the chamber.

    Discovery

  • Since power is in the chamber I was thinking BME280 or BME680 for monitoring and maybe a XBEE or ESP8266 to transmit and receive the controls.

    Mike

  • Very good. The BME680 is in stock at Digikey. First phase is to get a BME680 and run it from the propeller then insert the XBEE to get the distance.

    Discovery

  • Take a look at the 1-wire DS18B20 digital temperature sensor.:

    https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf

    Maxim has a document describing how their 1-wire devices can operate over long cable lengths:

    https://www.maximintegrated.com/en/design/technical-documents/tutorials/1/148.html

    -Phil

  • A K type thermocouple would work. A max31855 is a good choice, fits your temp. range

  • Interesting article on the long distance 1-wire. I used the 1-wire devices on a system that used devices in a controlled atmosphere environment and the coax distances were less than ten feed. The system worked fine. Problems occurred when the devices were fifty feet distance and the coax was cold and wet.

    I will try a bread board using the XBEE wireless and the BME680 sensor. Hope it works.

    Discovery

  • evanhevanh Posts: 15,187

    An old but still used protocol is Modbus over RS485. It has the advantage of being openly documented, free (as in beer), and enjoys wide universal support in industrial gear. A look in the Object Exchange nets me a hit - https://github.com/parallaxinc/propeller/tree/master/libraries/community/p1/All/Modbus RTU

  • What XBee module should I order to fit into the Propeller Activity Board socket and provide RF with I2C controls?

    Is it available at Digikey?

    Discovery

  • I have used both the XBee Pro model and lastly the XBee WiFi before they came out with the series 3 models.

    In any case the all use the same pinout or board layout so they all should fit into the WX board.

    I use the WiFi module in deep sleep mode and have it wakeup every minute and connect to the WiFi network and then lets the P1 know it's up so it can send out a UDP broadcast packed with the collected data. The PC is then listening for this information and then records it.

    If you use the Pro model you will have to purchase two units so that they can talk to each other.

    Be careful with the BME680 module as it needs 64 bit floating point math for the air quality calculation and that is not available on the P1.

    You will also need the adapter board so that you can program the XBee unit prior to installation and testing.

    Mike

  • XBees are serially controlled and Parallax carries them; for example:

    -- https://www.parallax.com/product/xbee-s2c-802-15-4-w-pcb-antenna-xb24capit-001/

    You'll also want to get a programmer so that you can configure the XBee for custom features. This adapter can also be used with an XBee for your base station.

    -- https://www.parallax.com/product/xbee-usb-adapter-board/

    I work for a laser tag company and our P1 powered taggers and other devices have XBees in them. We use AP1 communications. Since you're just going point-to-point, you could get away with transparent mode.

  • Thank you mike and Jon,
    Somehow, I thought my approach was going to be easy...not for me.

    I really need the BME680 for temperature and humidity. Does the 64-bit requirement exclude the P1?

    Discovery

  • Mike and Jon,
    I have a Parallax Activity Board that has a built-in XBee socket. Can the XBee be programmed from my activity board? if so, how would it be accomplished?

    Discovery

  • You would have to program the Propeller that sits between the USB connection and the XBee to serve as a bridge. It might work (I've done this with other devices), but I think if you're going to deal with XBee it's worth having the programming adapter.

    I really need the BME680 for temperature and humidity. Does the 64-bit requirement exclude the P1?

    Someone more clever than me might have a solution. I only code in Spin/PASM, and haven't solved it yet (I have a time limit on devices I won't be using in a client project). What are your actual requirements vis-a-vis temperature and humidity range and resolution?

  • @Discovery said:
    Thank you mike and Jon,
    Somehow, I thought my approach was going to be easy...not for me.

    I really need the BME680 for temperature and humidity. Does the 64-bit requirement exclude the P1?

    Discovery

    Recently I bought and used SHTC3 sensors for humidity with temperature. They are very precise and are offered for attractive price on breakout boards.

  • I have used the BME280 for several years now and it does give you Temperature, Humidity, and Barometric pressure without the math issue.

    There are several drivers available for the P1 and P2 to use it.

    Mike

  • Very good Mike. I will return the BME680 and replace it with the BME280.

    The temperature range is 40 to 120 F and humidity range 20 to 90%.

    Discovery

  • The temperature range is 40 to 120 F and humidity range 20 to 90%.

    You could also use AM2302/DHT22 which just does temperature and humidify, but is pretty easy to interface. According to its documentation, you can read it from up to 100m away (not sure I'd do that).

  • I dug up my old DHT11 code and updated it in this test (measurement code should be moved to an object). This works with the DHT11 and the DHT22. Fair warning, though: this code uses waitpxx instructions which could cause your application to hang with a broken wire or sensor. That issue can be dealt with by launching a small Spin cog that does the reading so that your main app does not get snagged.

  • Jon, I am in over my head. I don't write code from scratch except for BS2 basic. I can modify someone's C or C++ code that works but that is about all.

    Discovery

  • JonnyMacJonnyMac Posts: 8,923
    edited 2021-11-26 20:28

    I can modify someone's C or C++ code

    It's my opinion, of course, but if you understand C well enough to modify code written by others, you could certainly learn Spin. In a day.

    Since I mentioned reading the sensor in another cog to prevent clobbering the main cog on a sensor failure, I've created the attached demo. It takes about 25ms to read the sensor, so I set the background loop period to 100ms, and synthesized an RTC.

  • Discovery,

    Having started with the BS2 myself, I would say that about 75% of Spin is similar to PBASIC.

    The Propeller Education Kit gives a very good introduction to Spin, but it doesn't explain much on how to use CONstants.
    https://www.parallax.com/package/propeller-education-kit-fundamentals-text-and-code/

    There is an entire section of the Propeller Manual on Spin.
    https://www.parallax.com/package/propeller-manual/

    I myself think Spin is way easier to use than C since it's based on BASIC.

    If there is something that you don't understand than just ask.

Sign In or Register to comment.