Monday, December 4, 2023

Wireless Equipment Control Using MATLAB-Based GUI

Saikat Patra is passionate about electronics and MCU-based embedded system applications -- Shibendu Mahata is an M.Tech (gold medallist) in instrumentation and electronics engineering from Jadavpur University. He has keen interest in MCU-based real-time embedded signal processing and process control systems

- Advertisement -

1. Download the ‘Legacy MATLAB and Simulink Support for Arduino’ package from Mathworks website. Extract the compressed folder named ‘ArduinoIO’. From ArduinoIO folder, copy folder ‘pde’ and paste it in C:\Program Files (or Program files x86)\Arduino\libraries. (The path may be different depending on the installation directory of the IDE.) After pasting the pde folder in the correct location, open Arduino IDE. If you have pasted the folder in the correct location, you can find ‘pde’ by clicking File Examples pde. Open the code by proceeding as follows: File Examples pde adioes.

2. Connect the Arduino Uno board to your PC. From Device Manager, note the COM port at which the Arduino Uno board is installed. From Tools menu in the Arduino IDE, select the board as Arduino Uno, followed by the COM Port number noted earlier. Upload ‘adioes’ code to the Arduino Uno board by pressing ‘Upload’ button in the IDE.

3. Now copy the entire contents of the extracted ArduinoIO folder to a folder in ‘My Documents’ (for Windows PC).

- Advertisement -

4. This GUI application program is developed in the R2014a version of MATLAB. After installing this version of MATLAB in your PC, open the file ‘install_arduino.m’ from the directory where you have copied the contents of ArduinoIO folder. Now run the install_arduino.m file. The code will correctly install and save the path of the Arduino support package.

5. Open the project’s source code file titled ‘relay_control_wireless.m’. Edit the line a=arduino (‘COM9’) with the COM port number in your PC where the Arduino Uno board has been installed. When you run the project file, MATLAB will try to communicate with the board. After successful communication is established, you can control the equipment by pressing the appropriate pushbutton in the GUI.

Download source folder

Construction and testing

A PCB layout of the transmitter side is shown in Fig. 7 and its components layout in Fig. 8. Similarly, actual-size PCB layout of the receiver is shown in Fig. 9 and its components layout in Fig. 10.

PCB layout of the transmitter circuit
Fig. 7: PCB layout of the transmitter circuit
Fig. 8: Components layout for the PCB in Fig. 7
PCB layout of the receiver circuit
Fig. 9: PCB layout of the receiver circuit
Fig. 10: Components layout for the PCB in Fig. 9

Download PCB and component layout PDFs: click here

Connect the transmitter unit of Wireless equipment control to the PC. After uploading the Arduino code into Board1 as explained above, run the MATLAB GUI program. Next, connect 9V battery to the receiver unit. Keep transmitter and receiver unit one meter apart. From the GUI program, click ‘on’ or ‘off’ button to switch on/off the corresponding electrical device. The ‘on’ status of the devices is indicated by the glowing of LED2 through LED5.

For troubleshooting, the expected values/voltages at various test points are listed in the table above.

Read our other MATLAB Based GUI Projects





Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components