Electronic – Analog signal exchange between microcontroller and PLC

analogmicrocontrollerplcpwmsignal

Overview

I need to create an analog voltage of 0V-24V for the PLC ( s7-1200) with a
microcontroller with operating voltage 5V.

Approach

I've been doing this research since yesterday. I'll share the results of my research. I need your feedbacks.

First of all, I was uncertain about this. I decided to drive a 24V DC signal with a mosfet. So I'm gonna raise my signal. In my opinion it wouldn't be right to use pwm to drive this mofets. If I drive a mosfet with 0-5v pwm, I would get a 0-24v pwm signal from the mosfet output. So I decided to produce an analog signal. (also 8 bit, 256 step pwm signal would not be sensitive.) What you think about my approches? Am I right?

I've found a lot of methods to produce an analog signal.

  • Low pass filter. (I read and passed that it has a negative effect on the bandwidth and some things I don't understand.)
  • R2R ladder (After seeing option 3, I didn't look at that much.)
  • mcp4725 I2C DAC, ( I liked it very much. It was good to write the signal you want to eeprom with the I2C. Because my analog signals won't change very fast.I don't need high speeds.) Because of this chip's I2C addresses, only two can be used at a time. So I will multiply I2C channels with TCA9548A. I need 16 analog output. After that, I will raise this analog signal with a mosfet.

Yes, I need your comments and suggestions.

Best regards

Best Answer

Try this

schematic

simulate this circuit – Schematic created using CircuitLab