Monday, January 18, 2016

Mitsubishi PLC FX Series Communication with Arduino / Microcontroller




This PLC application about Mitsubishi PLC FX Series Communication with Arduino / Microcontroller.
Arduino such as Analog Input and Analog Output for Mitsubishi PLC FX Series.
Analog Input of Arduino transfer to D1 of Mitsubishi PLC FX, and D1 to PLC Output.
PLC Input to D0 of Mitsubishi PLC FX, and transfer to Analog Output of Arduino.

Mitsubishi PLC FX Series Communication with Arduino Microcontroller


Video Demonstration:

Mitsubishi PLC FX Series Communication with Arduino UNO Microcontroller



Hardware required for This PLC application

  1. Mitsubishi PLC FX Series, I use Mitsubishi PLC FX1S
  2. Mitsubishi FX PLC Cable (RS232 PLC Cable)
  3. Arduino UNO
  4. TTL to RS232 Module (Male RS232 or Use DB9 Male Crossover)
  5. Adaptor for Arduino
  6. 4 pieces Push Button for testing
  7. 4 pieces Light for testing
  8. 1 piece Potentiometer 10Kohm for testing
  9. 1 piece Multimeter or Multitester or  Voltmeter for testing

Mitsubishi PLC FX and Arduino Hardware


Hardware connections

A. Mitsubishi PLC FX and Arduino UNO

Mitsubishi PLC FX and Arduino UNO

B. Potentiometer, Multitester and Arduino UNO

  1. Potentiometer :
  2. Left connect to GND
    Center connect to Pin A0 Arduino
    Right connect to 5V
  3. Multitester / Voltmeter:
  4. Black of Probe connect to GND
    Red of Probe connect to Pin 9 Arduino


C. Push Button and Mitsubishi PLC FX

  1. Push button 1 connect to X000 of Mitsubishi PLC FX
  2. Push button 2 connect to X001 of Mitsubishi PLC FX
  3. Push button 3 connect to X002 of Mitsubishi PLC FX
  4. Push button 4 connect to X003 of Mitsubishi PLC FX


Arduino Software and Library

  1. Use Arduino Software (IDE) version 1.6.6
  2. Arduino Library : click here
  3. Extract and copy paste Mitsubishi_PLC_FX1S  to ..\arduino-nightly\libraries


Download Project File for Arduino and Mitsubishi PLC FX1S

  1. Arduino Project File : click here
  2. Mitsubishi PLC FX1S Project File : click here


FX PLC Ladder Programming

FX PLC Ladder Programming


Arduino  Code for Mitsubishi PLC FX Series Communication

#include <FX1S.h>
//by program-plc.blogspot.com
#define FX1Sbaud 19200
#define FX1Sformat SERIAL_8N1
#define FX1Stimeout 1000


enum
{
  FX1SPACKET1,
  FX1SPACKET2,
  FX1STOTAL_NO_OF_PACKETS
};
FX1SPacket FX1Spackets[FX1STOTAL_NO_OF_PACKETS];

FX1SpacketPointer FX1Spacket1 = &FX1Spackets[FX1SPACKET1];
FX1SpacketPointer FX1Spacket2 = &FX1Spackets[FX1SPACKET2];

unsigned int FX1SreadD[1];

unsigned int FX1SwriteD[1];

#define AnalogInputPin A0
#define AnalogOutputPin 9


void setup() {
  
FX1S_construct(FX1Spacket1, FX1S_READ_D, 0, 1, FX1SreadD);
  
FX1S_construct(FX1Spacket2, FX1S_WRITE_D, 1, 1, FX1SwriteD);

FX1S_configure(&Serial, FX1Sbaud, FX1Sformat, FX1Stimeout, FX1Spackets, FX1STOTAL_NO_OF_PACKETS);

}


void loop() {
  FX1S_update();

  //Write to D1
  int sensorValue = analogRead(AnalogInputPin);
  int outputValue = map(sensorValue, 0, 1023, 0, 32767);
  FX1SwriteD[0] = outputValue;

  //Read from D0
  unsigned int D0 = FX1SreadD[0];
  D0 = map(D0, 0, 32767, 0, 255); 
  analogWrite(AnalogOutputPin, D0);

}


Labels:







Newer Post Older Post Home

You may also like these ebook:

Get Free PLC eBook directly sent to your email,
and email subscription to program-plc.blogspot.com




We hate SPAM. Your information is never sold or shared with anyone.

Your Email Will Be 100% Secured !

Your email is stored safely on Google FeedBurner