How to communicate and control multiple devices using uController

Hello,

I' m trying to construct a system controlled by an arduino (or teensy maybe). I wish to make the arduino to be an interface between computer and the rest of the system.

System consist of 3 temp sensors (DS18B20 using DallasTemperature.h) and 4 serial devices.

Temp Sensors communicate with arduino through spi and only transfers data, no receive!
Serial Dev. 1,2 and 3 have 2 way RS232 communication
Serial Dev. 4 have one way RS232 communication

I think I need to parallel process all individual units out of Temp sensors. Thus I used milis method (example given here). First I only inserted the temp sensors for 1000 milis periods to the example design then the led responses delayed or even not function.

At the moment all serial devices have direct connection to the computer and only temp sensors have connection to the arduino then computer.

Can you please give some advice how to better construct my system architecture?

Thanks in advance and best wishes!

Could You make some kind of flow chart showing Your plans?
It looks like unusually well planned.

macellan:
System consist of 2 temp sensors (DS18B20 using DallasTemperature.h) and 4 serial devices.

What are the serial devices?

How much data (how many bytes) are in each message and how many messages does each of them send (or receive) every minute.

If the serial devices can currently communicate with the PC, why are you thinking of changing that?

Note that Arduinos use TTL signal levels and not RS232 signal levels. If your serial devices work at RS232 signal levels you will need a converter such as a MAX232 to convert to the Arduinos TTL signal levels.

...R

@Railroader and @Robin2 Thank you for your interest :slight_smile:

Let me try to explain little bir more.
A have a Counter design built on an FPGA, 3 temperature sensors and 3 power supplies.
Counter has start stop capability and transmit resulting data in 1 sec periods. I control it through USB/UART converter and a GUI on computer
Temp sensors are connected to a UNO and continuously transmit data in 1 sec periods. No start/stop capability.
Power supplies are communicating through a USB-to-RS232 converter cable and depending on temp values I need to turn them on or off.

So instead of connecting 5 cables to the computer I thoguht to connect them all to a microController (voltage conversion is not a big problem with max232) and then connect that microController to the Computer. This looks interesting to me because I don' t know how to do that yet and also will lower the mess of cables on the table.

As clear, all of the devices need asyncronous communication since all perform different tasks and the given example didn't let me do what I explained.

I believe that simple is the best. Ok. Here I want to learn also how to perform parallel tasks using a microController as well and convert the system in a compact form.

So that' s all :slight_smile:

Thanks in advance !

Please also answer the first two questions in Reply #2

What exactly do you mean by "start/stop capability"? Do you mean that there are times when you don't need the data so you just stop the device that sends the data?

...R

Robin2:
Please also answer the first two questions in Reply #2
What exactly do you mean by "start/stop capability"? Do you mean that there are times when you don't need the data so you just stop the device that sends the data?
...R

I already listyed all devices??

We can accept all temp sensors as 1 arduino UNO since they are all connected to the same arduino.

Start/Stop capability --> Yes, simply stop it and/or restart.

Data rate...

Counter : Transmit ->13 bytes/sec (60*13 bytes per minute), Receive -> start/stop: 1 byte when it is necessary

Temps Sens. : Transmit -> 14 bytes/sec (60*14 bytes per minute), Receive -> Nothing

Power Supplies: Transmit -> 1 byte (as command response), Receive-> 1 byte when it is necessary (differs depending on control command )

All needs to work asyncronous ...

Hope it is clear this time.

I should also have asked you about the baud rates.

An Arduino Mega has 3 spare HardwareSerial ports that could be used to communicate with your Counter and your two Power Supplies. You could probably supplement that with the use of SoftwareSerial to create a 4th connection to receive data from the Temperature Sensor IF that sensor can communicate at 38400 baud or (preferrably) at 9600 baud. SoftwareSerial won't work at high baud rates.

Then you could communicate with the Uno using I2C to collect its data. See this Arduino to Arduino I2C Tutorial

The Mega could then send consolidated messages to the PC.

Might that be solution?

...R

Hi,

macellan:
Temp Sensors communicate with arduino through spi and only transfers data, no receive!

I think you had better go do some R&D, DS18B20 is not SPI, in fact it is one wire and each sensor has a unique address.
Can you please tell us your electronics, programming, arduino, hardware experience?

Thanks.. Tom... :slight_smile:

Hi,
What is your application, what are you trying to do in the real world?

Tom... :slight_smile:

Dear @Robin2,

Thank you for the suggestions. But I can control them all individually. The thing is, they all need to be controlled seperately. When I read temperature, I need to turn on/off the PS without delay on other devices' communcations.

There is a "milis() method", you seperately follow the time periods between each action on a specific task but it didn' t work for me properly. There happened certain delays on other lines.

So this needs parallel processing but is it possible on arduino?

Dear @TomGeorge,

I' m trying to measure pulse output of a device which looks affected by tempertaure of the environment. So PSs are used for cooler system and depending on the temperature, I need to turn on/off the heater/cooler.

So when I perform pulse count, I need to follow the temperature and control the power supply as well.

macellan:
Dear @Robin2,

Thank you for the suggestions. But I can control them all individually. The thing is, they all need to be controlled seperately. When I read temperature, I need to turn on/off the PS without delay on other devices' communcations.

There is nothing in my suggestion that prevents that - I rather assumed that's what you wanted to do.

If you are unsure about the use of millis() have a look at how it is used in Several Things at a Time. Note how each function runs very briefly and returns to loop() so the next one can be called. None of the functions tries to complete a task in one call. And there may be dozens of calls to a function before it is actually time for it to do anything.

See Using millis() for timing. A beginners guide if you need more explanation.

If you continue to have trouble with millis() please post a short complete program that illustrates your problem.

...R