Logging multiple RS232 sensors with Atmega328p

Hi all,

I am working on a project, a battery-driven datalogger for multiple RS232 sensors using an Atmega328 mcu. The ultimate goal is to be able to log up to 10-20 RS232 sensors (sensors are some of these Aanderaa Single Sensors, commercial oceanographic research sensors for dissolved oxygen, conductivity/temperature, pressure etc)

The idea is to have all sensors' RX and TX lines connected in parallel to an RS232 to TTL board (currently Sparkfun's MAX232), all sensor ground to the common ground, then enable power to the sensors one by one to receive data as a string of characters, which are then saved to a micro SD card prepended with a timestamp. Time will come from a DS3231 RTC board; for now from RTC_millis for testing the software. RS232 cable lengths are approx 1.5 m to each sensor.

I have a working breadboard prototype with 4 sensors and everything seems to work as expected, except that the MAX232 board drains approx 10 mA@3 V with 4 sensors connected in parallel (even if none of the sensors is on), while "normal" drain level is about 1-2 mA (which it is with only one sensor connected). However, I am worried that if I connect more sensors, the current drain may damage the MAX232 board or a sensor (e.g. by overloading sensor's RS232 transmitter?), and/or RS232 communication may stop working reliably. My next step according to my plan is to solder a circuit on a prototyping PCB that I can connect and test on a bottom lander system with min 4 max 9 sensors.

I have too little understanding of what one should do to run this type of a multi sensor RS232 system to work in a proper way, so any advice or links to useful materials would be very much appreciated.

You can not parallel RS-232 signals. Not without diodes. One TX can feed multiple RX, but you can not connect multiple TX together.

Absolutely correct. To the OP: can you supply links to the communications interface for the sensors. The link you gave is a marketing blurb with few if any technical details. Best would be if they have an RS-485 or RS-422 interface, With an RS-232 interface, you are really limited to 50ft. of wire unless special low-capacity cable is used.
Paul

You can google this your self but to get you started.

RS232 requires voltages of:
High = 8 to 15 Volts
Low = -8 to -15 Volts

The MAX232 inverts the signal so the normal serial output of an Arduino is inverted from the RS232 Signal.

Not directly related but the USB to Arduino serial cables perform this inversion.

I googled RS232 Multiplexer and found a number of boards. However these multiplexers do not handle the RS232 voltages.

Before you go too far I suggest you look more closely at your transducer specification. Perhaps they are not TRUE RS232 signals.

If you "parallel" your sensors, then the ones that are not powered may draw power from their RX or even TX pin when these pins are activated. It's not what I would do. USE max3232 to convert into TTL level (5V/0V) and use some multiplexer such as 74HC4051 to select the sensor to talk with.

I agree, but that would mean 10 to 20 MAX232 drivers. I'm hoping the sensors are not "true" RS232 and there is a less complex solution. But if not your suggestion is right on.

Maybe if your sensors are OK with +5V to -5V range, as MAX3232 really can't output +-12V, then 74HC4051 being an analog switch CAN do +5V and -5V so you only need one MAX on the MCU side.

Thanks everyone for your interest. There's a clear lack of people with any level of expertise regarding Arduino/Atmega MCUs, communication and electronics in general around me I could talk to, so I really appreciate all of you taking your time answering. I am mostly self-taught, so there are many gaps in my knowledge.

Now, back to the business. I realize very well that my serial communication design is a violation of RS232 protocol or standard. My real question is how far I can go with it and what can potentially be suggested to counteract the effects of RS232 standard violation. Right now the only worrying sign is the increased power drain of the Sparkfuns MAX232 board (10 mA vs 1-2). My biggest concern here is about not getting to a point when things may get damaged due to violation of the design, and this is where my knowledge lacks. If communication fails at some point, then okay, I abandon the project in its current form (but with no damage to the sensors or other electronics).

The way I have 4 sensors connected in my prototype now is:

  • 4 sensors RX are connected to Sparkfuns MAX232s TX, all the time.
  • Sparkfuns TX is connected to 4 sensors RX, all the time.
  • sensor ground lines are connected to the common ground, all the time.
  • I use Atmega digital pins to control P mosfets to switch on sensor +power one by one (later 595 shift register if I decide to continue with more sensors).

The sensors are set up in such way so they perform a measurement and report data at powerup. After that the sensor power is switched off and next sensor is switched on to do the measurement, and so on until the very last sensor. Then all the sensors are off until the next measurement. As all sensors are set to measure and report at powerup, I don't need to communicate with sensors other than receiving the output (but would like to keep this possibility for the future - if I can). Also, keeping the sensors off helps saving battery power. After noticing the increasied drain of my MAX232 board, I started switching it off too (by swithing off ground using N mosfet). Switched off, MAX232 does not consume any current at all which is also good as it helps to save battery power. The whole project is an underwater logger and is supposed to be run on battery.

There are several reasons for such an arrangements. The most important is that I want to reuse the existing underwater cables for this logger (custom made and very expensive). The existing cables are wired so that one cable serves 4 sensors from one common connection. In each such cable there is one individual wire per each of 4 sensors, plus 3 common wires. This was the main reason I decided to try using the individual line for power (that can be switched on and off) and the common lines for sensors RX, TX and gound lines. This implies that all sensors' RX, TX lines and ground lines remain connected at all times; power can however be switched on when none of the sensors the measurements. I am trying to check if it is possible to convert the existing sensor wiring (25+ years old system, another proprietary serial bus with no tech support/part replacement/new sensors available any longer and few other limitation) to RS232.

I understand critisizm re. the link I posted about the sensors. These are commercial sensors, and the company wants most to sell their own dataloggers (with communication based on their own modification of canbus to implement sensor and logger sleeping sleep mode). I can post here links to the individual sensors' datasheets, but you don't see much in there except that RS232 is supported (along with their canbus version) and where are the RX, TX, power and ground pins on the sensor socket. Here are examples for conductivity and oxygen sensors https://www.aanderaa.com/media/pdfs/d369_aanderaa_conductivity_sensor_4319.pdf and https://www.aanderaa.com/media/pdfs/d378_aanderaa_oxygen_sensor_4330_4330f.pdf
The sensors are expensive (which is why damaging the sensors is not good). I am using existing sensors with RS232 output available and I cannot easily change these to RS422 or RS485 (RS422 versions are available I think). Changing sensors would cost lots of time and money and this I cannot justify. I can try to talk to the sensor manufacturer company, I have a good contact there, but I am not sure they can or will be willing to help as they have their own bus system for operating multiple sensors.

The good news is RS-232 means you can short any pins to any other or all pins, forever, and no damage will occur. The devices can't work, obviously. The other good news is RS-232 means if you stay in the voltage limits, + and - 25 volts, the device cannot be damaged. May not work, but if actually up to standard, won't be damaged.
Otherwise, I guess you are going to have to test your design.
Paul

Thanks! I was probably to stressed to check simplest things, like the RS232 standard specs and Sparkfuns board chip specs. So far all values seem wo be well within the specs. Hopefully it will work.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.