4-20mA and voting logic via micro controller

Thread Starter

Nick Bacon

Joined Nov 7, 2016
130
With reference to voltage drop. 1km is the theoretical maximum. In practice 500m would be the longest distance. Extra power supplies would be needed for longer distances. Cable would have to be the correct spec.

if the digital inputs are fed into the master mcu, the AD421 is connected to the mcu to generate the 4-20mA loop. Is that correct. If so, the AD421 could be located on the slave unit and read the signals from the master and generate the 4-29mA loop.

It is difficult to convey what I am looking at doing.
 

Sensacell

Joined Jun 19, 2012
3,786
A picture is worth 1K words.

Draw and posts a high-level block diagram of your system.

Just the act of making the drawing will help your thinking.

500 meters CAT-5 cable round-trip resistance is 84 ohms.
 

Thread Starter

Nick Bacon

Joined Nov 7, 2016
130
A picture is worth 1K words.

Draw and posts a high-level block diagram of your system.

Just the act of making the drawing will help your thinking.

500 meters CAT-5 cable round-trip resistance is 84 ohms.
The cable used will not be CAT-5, it will be twisted pair and shielded, but more suitable for the environment.

I have put together 2 basic diagrams. I am still not decided whether to implement, single MCU master and slave or twin MCU master and slave (one controlling odd channels, one controlling even channels) This is a redundancy feature, split the system into 2 sections and if one half develops a fault then the other half still works.

One main point of concern with using only one MCU is the availability of through hole mount versions with enough pins. The ideal MCU only has 40 pins. The whole system is through hole design because it is low volume production. I can consider surface mount if I can find a way to mount on through hole boards.
 

Attachments

Last edited:

Sensacell

Joined Jun 19, 2012
3,786
Your diagrams are made from the perspective of "too close to the tree to see the forest"
You obviously have a detailed plan for this system, but it's totally opaque to anyone not inside your head.
The diagrams provide no insight to the "big picture" problems you are asking for help with.

1) try grouping function blocks according to physical location
2) show the desired path of data / power flow between these blocks
3) show what kind of data needs to be exchanged
4) think about the assumptions you are making that are non-obvious to a person looking at the diagram
 

Picbuster

Joined Dec 2, 2013
1,059
Hi, The application is measurement and control. The ideal situation is that the 4-20mA loop be transmitted via the RS485 to the slave units, this way it can be accessed from any slave device.
What you need is a simple PIC (like 16f690 ) with serial I/O this I/O will communicate with a RS485 1/2 duplex chip.
4-20mA circuit

The pic is generating/providing 24V current is limited to 25mA.
you measure the voltage over one resistor.
Now you have to identify the density you want (10/12/16 or more bits >10 select PIC with SPI) ten is a std pic adc.
Connecting input to resistor depends on 2/3 or 4 wire sensor.
The Slave program is simple send on request ( [stx] [Address] [Data] [terminator][Checksum] [eot]
The request ( master function) is simple use the same format but change Data into command for units. (esq S,Address and ?,x send data
P,Y/N switch 24V On Off)
Master receives the raw data from pic( I assume that the master is more power full to generate a float/double.

Few hours playing with xc8 compiler and off you go.
Hardware step-up needed depending on power supply.

be aware that >20mA is a short cut < 4mA is a open wire ( master to detect)
No response (master to detect)
Polling rate different devices 4 byte times approx. ( field experience)

That's all.
Picbuster
 

Thread Starter

Nick Bacon

Joined Nov 7, 2016
130
What you need is a simple PIC (like 16f690 ) with serial I/O this I/O will communicate with a RS485 1/2 duplex chip.
4-20mA circuit

The pic is generating/providing 24V current is limited to 25mA.
you measure the voltage over one resistor.
Now you have to identify the density you want (10/12/16 or more bits >10 select PIC with SPI) ten is a std pic adc.
Connecting input to resistor depends on 2/3 or 4 wire sensor.
The Slave program is simple send on request ( [stx] [Address] [Data] [terminator][Checksum] [eot]
The request ( master function) is simple use the same format but change Data into command for units. (esq S,Address and ?,x send data
P,Y/N switch 24V On Off)
Master receives the raw data from pic( I assume that the master is more power full to generate a float/double.

Few hours playing with xc8 compiler and off you go.
Hardware step-up needed depending on power supply.

be aware that >20mA is a short cut < 4mA is a open wire ( master to detect)
No response (master to detect)
Polling rate different devices 4 byte times approx. ( field experience)

That's all.
Picbuster
I have played around a got a number of the features working. As I have upto 24 sensors, I need an MCU with probably 40 IO pins, this rules out through hole chips. I think I will probably go down the road of a 64 pin surface mount chip and create a surface mount to though hole board and get a batch made. I would use the same MCU (on surface mount to through hole board) for the master and the slaves. Just different code for each.

I have decided that I will pay someone to write the code of the MCU's, I am not really getting anywhere fast, as I just do have the knowledge to do it myself. I cant do the RS485 communication or the 4-20mA. Just trying to find the right person now.
 
Top