Vengito Arge Bilişim Medya Mühendislik

Wordpress Blog of Vengito

Email Automation — 9 May 2021

Email Automation

 Email Automation has following features: 

  • Sending mass email
  • Load recipient list from Excel file (*.xlsx)
  • Pause/Resume mail sending
  • Set number of emails to send in one hour or send as fast as possible
  • Ping email server address while setup email server
  • HTML syntax highlighting for email content
YR Drive Easy Connect —

YR Drive Easy Connect

YR Drive Easy Connect

In order to use this application you need to buy a device from Yılmaz Redüktör (

  • Read and write parameters of Yılmaz Motor Drivers
  • Connection to RS485 (Modbus) of motor driver via Bluetooth
  • Monitor some parameters of motor driver
  • Save and load parameter sets
  • Copy parameters from one drive to an other drive

Delta PLC Read/Write internal relay M in C# — 13 April 2021

Delta PLC Read/Write internal relay M in C#

Delta PLC provides Modbus communication library DMT, which can be used in C# ​​to communicate with Delta PLC over RS485 (Modbus).

First of all to use DMT with your application following functions should be imported from kernel32.dll and DMT.dll:

using System.Reflection;

[DllImport("kernel32.dll", CharSet = CharSet.Auto)] 
static extern IntPtr LoadLibrary(string dllPath);
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
static extern bool FreeLibrary(IntPtr hDll);

// Serial Communication
[DllImport("DMT.dll", CharSet = CharSet.Auto)]
static extern int OpenModbusSerial(int conn_num, int baud_rate, int data_len, char parity, int stop_bits, int modbus_mode);
[DllImport("DMT.dll", CharSet = CharSet.Auto)]
static extern void CloseSerial(int conn_num);
// MODBUS Address Calculation
[DllImport("DMT.dll", CharSet = CharSet.Auto)]
static extern int DevToAddrW(string series, string device, int qty);

// Wrapped MODBUS Funcion : 0x02
[DllImport("DMT.dll", CharSet = CharSet.Auto)]
static extern int ReadInputsW(int comm_type, int conn_num, int slave_addr, int dev_addr, int qty, UInt32[] data_r, StringBuilder req, StringBuilder res);
// Wrapped MODBUS Funcion : 0x05		   
[DllImport("DMT.dll", CharSet = CharSet.Auto)]
static extern int WriteSingleCoilW(int comm_type, int conn_num, int slave_addr, int dev_addr, UInt32 data_w, StringBuilder req, StringBuilder res);

To load DMT.dll call “LoadLibrary” from kernel32.dll at the beginning and do not forget to call “FreeLibrary” from kernel32.dll at the end:

System.IntPtr hDMTDll = LoadLibrary(AppDomain.CurrentDomain.BaseDirectory + "DMT.dll"); // explicitly link to DMT.dll

We need also a delegate to disconnect from serial:

int conn_num = 1; //COM Port (COM1)
delegate void DelegateClose(int conn_num); // function pointer for disconnection
DelegateClose CloseModbus = new DelegateClose(CloseSerial);
CloseModbus = CloseSerial;

Then we should open serial connection to start communication:

int modbus_mode = 1; // 1:ASCII , 2:RTU
int baud_rate = 9600; 
int data_len = 7;
char parity = 'E'; // Even
int stop_bits = 1; 
int plc_node = 1; //Modbus node number

int status = OpenModbusSerial(conn_num, baud_rate, data_len, parity, stop_bits, modbus_mode);

If variable “status” is bigger than zero, it means we are successfully connected. Example code to write zero (false) to internal relay M21:

StringBuilder req = new StringBuilder(1024);
StringBuilder res = new StringBuilder(1024);
if (status > 0)

            int addr = DevToAddrW("DVP", "M21", 1); //Get int address of internal relay M21 
            int sonuc = WriteSingleCoilW(0, conn_num, plc_node, addr, 0, req, res);
            if (sonuc == -1)


Example code to read internal relay M23:

UInt32[] data_from_dev = new UInt32[1];
data_from_dev[0] = 0;
UInt32[] data_to_dev = new UInt32[1];
data_to_dev[0] = 0;
int addr = DevToAddrW("DVP", "M23", 1);
int sonuc = ReadInputsW(0, conn_num, plc_node, addr, 1, data_from_dev, req, res);
if (sonuc != -1)
			MessageBox.Show("Read Success");
            if (data_from_dev[0] == 1)
				MessageBox.Show("M23 is true");

To close serial communication:


With this code example abov you can manage your PLC software from your PC. To use it while entire machine is running put your code in a Thread.

Secure Instant Messaging — 5 April 2021
3DES File Encryption (C#) — 4 April 2021

3DES File Encryption (C#)

In cryptography, Triple DES (3DES or TDES) is a symmetric-key block cipher, which applies the DES cipher algorithm three times to each data block.

To use 3DES functionality first off all we need to include “System.Security.Cryptography”.

using System.Security.Cryptography;

Then we should create and adjust an object which will do encryption:

var tdese = TripleDES.Create();
tdese.Mode = CipherMode.ECB;
tdese.Padding = PaddingMode.PKCS7;
tdese.Key = ConvertHexStringToByteArray("AABBCCDDEE11223344556677889900FF");
var encryptor = tdese.CreateEncryptor();

“ConvertHexStringToByteArray” function to convert hex string to byte array:

  public static byte[] ConvertHexStringToByteArray(string hexString)
            if (hexString.Length % 2 != 0)
                throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "The binary key cannot have an odd number of digits: {0}", hexString));

            byte[] HexAsBytes = new byte[hexString.Length / 2];
            for (int index = 0; index < HexAsBytes.Length; index++)
                string byteValue = hexString.Substring(index * 2, 2);

                if (byteValue == "  ")
                    HexAsBytes[index] = Convert.ToByte("32");
                    HexAsBytes[index] = byte.Parse(byteValue, NumberStyles.HexNumber, CultureInfo.InvariantCulture);

            return HexAsBytes;

Source code below shows how to use object “encryptor” to encrypt the file “FileToEncrypt.txt”.

byte[] result = null;
byte[] data = File.ReadAllBytes("FileToEncrypt.txt");
using (var mse = new MemoryStream())
      using (var cs = new CryptoStream(mse, encryptor, CryptoStreamMode.Write))
                            cs.Write(data, 0, data.Length);

      result = mse.ToArray();

if (result != null)
      string encrypteddata = UTF8Encoding.Default.GetString(result);
      File.AppendAllText("OutputFileName" + ".enc", encrypteddata, UTF8Encoding.Default);

With this code we can store our file “FileToEncrypt.txt” encrypted as “OutputFileName.enc”. Decryption can be done with “tdese.CreateDecryptor();”.

Arduino Wifi Setup —

Arduino Wifi Setup

A IoT device programmed with Arduino need connect to WiFi at start of device to use internet for data transfer etc. First of all we need to include header file “WiFiClient” to our sketch.

#include <WiFiClient.h>

With code below we will let user enter WiFi credentials over serial communication. we should add this code to our setup() part of our Arduino sketch.

Serial.write("Please enter name of your wifi network\n");
while(Serial.available() == 0){};
String Uid=Serial.readStringUntil('\n');

Serial.write("Please enter password of your wifi network\n");
while(Serial.available() == 0){};
String pass= Serial.readStringUntil('\n');

If you want give user a tool to setup WiFi over serial you can download a free serial communication tool “Vengito Serial Tool”. With this tool user can connect IoT device easily and enter WiFi credentials.

After user entered credentials device should try connecting to internet. Code below have 3 parts and also should be in setup() part of our sketch. First part disconnects from any WiFi network if it is connected already. Second part starts connection with Wifi.begin function. And the last part waits connecting and gives IP address of device over serial port if device connected WiFi successfully.

WiFi.begin(Uid, pass); //begin WiFi connection
unsigned long startedWaiting = millis();
// Wait for connection
while (WiFi.status() != WL_CONNECTED && millis() - startedWaiting <= 25000) 
if(WiFi.status() != WL_CONNECTED)
	Serial.print("IP address: ");

You can try this code with ESP8266 or any other chip which supports Arduino.

LabVIEW Example Videos _ Part 1 — 2 April 2021
How to do Simulations with Scilab Xcos Tutorial Video _ Part 1 —
Monitor Temperature, Humidity, Fire and Smoke of Room — 31 March 2021

Monitor Temperature, Humidity, Fire and Smoke of Room

RoomLog measures ambient temperature and humdity.According to setted min and max values RoomLog sends email (if enabled) and activates 3.3V digital outputs. RoomLog also checks fire and smoke.If RoomLog detects fire or smoke, it sends email and activates 3.3V digital outputs.

  • Monitor ambient temperature and humidity
  • Check fire and smoke around
  • 3.3V Alarm Output for Temp., Humidity, Fire and Smoke
  • Sends Alarm Emails
  • Linux OS
File Privacy — 30 March 2021
10 Volt Sensor and Ambient Measurement with 3.3 Volt Alarm Outputs — 21 March 2021

10 Volt Sensor and Ambient Measurement with 3.3 Volt Alarm Outputs

After calibrating and setting maximum and minimum limits this device gives 3.3V output if limit exceeded. It has 4 sensor connections available and accordingly has four 3.3V digital output connections. Raw sensor value will be multiplied with a constant value and an other constant value will be added to have calibrated value. This calibrated sensor value will be compared with setted limits for decision of 3.3V outputs.

• Four ±10V Sensor Input
• Four 3.3V Alarm Output
• Monitor ambient temperature and humidity
• Linux OS

24 Volt Digital Counter for Production Monitoring —

24 Volt Digital Counter for Production Monitoring

ProduLog — Machine Monitoring System
• Devices on Wi-Fi network will found automatically
• Every device gets a label
• 4 counter per device (24V Input)
• Monitor counters online
• Generate daily and monthly reports at any time
• Automatically sending reports via mail
• Data logging customizable in minute or hour
• Track history of counters
• 200 Counter (50 device) per server

Create your website with
Get started