Turn Smartphone into HMI, control Arduino Uno with “HMI Modbus Free” software via Modbus RTU

posted in: Microcontroller, PLC | 0

1. Prepare

  • Arduino Uno
  • Micro USB OTG Cable
  • HMI Modbus Free software download on CH Play

Here, I put the rheostat on pin A0 and Led 12

2. Arduino Programming

You see my previous post and follow, remember to test carefully with Modbus Poll so that when connecting to Smartphone you don’t have to check for errors. If you do not have RS485 circuits in the article, that’s okay, upload the code and go to the “Connection” section on Modbus Poll to select the Arduino’s com port and it will work without the need for a protocol converter to RS485.

Communication Modbus Arduino as Slave:

3. Create a program on HMI Modbus Free

Note: You need to enable OTG connection in the settings of your phone.

First create a Project and go to Edit servers list , click on the USB image and you will create a connection to the Modbus RTU Slave . Here I plug the Arduino’s cable straight in because it has a built-in TTL to USB IC already, with other Modbus RTU devices you need a USB to RS485 or RS232 converter . In addition, this software supports Modbus TCP and Modbus RTU via Bluetooth.

To turn on and off Led, you configure the button like me. According to my code in the previous post, the Arduino has an ID of 1 and the Led control register pin 12 has an address of 0 . Please pay attention to the Request section. And remember to enable Allow write request for the button.

To create a real-time graph of the A0 pin analog signal, you need to read the register with the address of 12 .

Download my sample project: Download

You can install it in the Import project section .

Leave a Reply

Your email address will not be published.