Table of Contents
Prev
Start: of Posts Show
Next

Send Data From USB Keyboard to PLC using Raspberry Pi and Modbus

Send data from usb keyboard to PLC used for input: password, product name, data setting, replacement selector switch, replacement push button switch, expand plc input, replacement sensors, data testing, and others.
For sending data to the PLC, used Raspberry Pi with RS232 PLC cable, RS232 Module and Modbus protocol.
The process of reading the data: Read data from the usb keyboard by raspberry pi, and Raspberry Pi send keyboard data to the PLC memory.
In this article, I will give an example to check the product name in the input from the keyboard.
If product name is toyota, the PLC output 0 is ON.
If product name is mazda, the PLC output 1 is ON.

Keyboard keystrokes process:
Product name 1: toyota
toyota = press 't','o','y','o','t','a', press Enter
t=keycode 23 (in plc memory = 23)
o=keycode 18 (in plc memory = 18)
y=keycode 28 (in plc memory = 28)
o=keycode 18 (in plc memory = 18)
t=keycode 23 (in plc memory = 23)
a=keycode 4 (in plc memory = 4)
return/enter = keycode 40 (in plc memory = 40)
Keycode for toyota


Product name 2: mazda
mazda = press 'm','a','z','d','a', press Enter
m=keycode 16 (in plc memory = 16)
a=keycode 4 (in plc memory = 4)
z=keycode 29 (in plc memory = 29)
d=keycode 7 (in plc memory = 7)
a=keycode 4 (in plc memory = 4)
return/enter = keycode 40 (in plc memory = 40)
Keycode for mazda


After Enter pressed, PLC Output 0 / PLC Output 1 is ON.
Additional Key:
Keypad Enter=keycode 88 (in plc memory = 88)
Escape = keycode 41 (in plc memory = 41)
Download all keyboard code, click here



Hardware and Software needed:
1. Hardware Image and Install Software: Same the link http://program-plc.blogspot.com/2014/06/home-automation-with-raspberry-pi.html
Only:
# Raspberry Pi, SD Card, mouse, keyboard, monitor and Adapter
# Programmable Logic Controller (PLC)
# PPI PLC Cable
# UART TTL to RS232 converter module
# RS232 crossover cable
2. USB PC Keyboard
Connecton for this application:
Connection of USB Keyboard to PLC and Raspberry Pi


On Raspberry Pi:
1. Get ID Information of Keyboard
Check Vendor ID and Product ID of Your USB Keyboard:
Open LXTerminal
Type lsusb
lsusb Vendor Id Product Id


2.Modified File of /etc/udev/rules.d/99-input.rules
Open LXTerminal
Type sudo nano /etc/udev/rules.d/99-input.rules
rules setting on raspberry pi

3. Change Hex Value of Vendor Id and Product Id on Python


Vendor Id and Product Id Setting on Python


Download Peoject File:
Copy-Paste this file to flash disk, extract rar file, and insert flash disk to USB on raspberry pi.
1. Python project file, click here
2. PLC Ladder Programming, click here
Video about Python project file setup on Raspberry Pi.



Hopefully this article can add your insights.
Please follow me:

ShareTo
Share on Facebook Tweet this Share to Google Plus Stumble this article
CLOSE

Enter Your Email Address




All Labels

  1. ABB PLC
  2. Allen Bradley PLC
  3. Analog Input
  4. Android
  5. Android and PLC
  6. Android Bluetooth
  7. Audio and PLC
  8. Automatic Gates using PLC
  9. Baldor PLC
  10. Battery Level Indicator using PLC Analog
  11. BMS
  12. Building Management System
  13. Car Ticketing Machine using PLC
  14. CIMON PLC
  15. Click Series PLC
  16. Computer Vision
  17. Computer Vision and PLC
  18. Control Seven Segment Display with PLC
  19. Conveyor Control Using PLC
  20. CPU PLC
  21. CV and PLC
  22. CX-One
  23. DCS
  24. DDC
  25. DELMIA V5
  26. DeltaV
  27. Digital Input
  28. DirectLogic PLC
  29. DirectSOFT PLC
  30. Eaton PLC
  31. Elevator with PLC Program
  32. EPICS PLC
  33. Fatek PLC
  34. Festo PLC
  35. Fieldbus
  36. Forex Trading and PLC
  37. FPGA PLC
  38. GE Fanuc PLC
  39. GP proface
  40. GX Developer
  41. Heater Controller with PLC
  42. Hitachi PLC
  43. HMI
  44. Home Automation
  45. Honeywell PLC
  46. IDEC PLC
  47. Keyence PLC
  48. Koyo PLC
  49. LED Display
  50. LG PLC
  51. Lock Unlock Door Using PLC
  52. Logixpro PLC
  53. Maple OIT
  54. Matsushita PLC
  55. MELSEC A
  56. MELSEC Q
  57. Memory PLC
  58. Micro PLC
  59. MicroSmart PLC
  60. Mitsubishi PLC
  61. Mobile Application
  62. Modbus
  63. ModBus Communication
  64. ModBus RTU
  65. ModBus RTU Communication
  66. Modicon PLC
  67. Momentum PLC
  68. Motion Control
  69. National Instruments PLC
  70. Omron PLC
  71. OPC
  72. PAC
  73. Panasonic PLC
  74. Parking Information using PLC
  75. Password Using PLC
  76. PLC
  77. PLC Analog Input Module
  78. PLC and Android
  79. PLC and Arduino
  80. PLC and CNC
  81. PLC and Computer
  82. PLC and Facebook
  83. PLC and PC
  84. PLC and Servo
  85. PLC and Visual Basic
  86. PLC Battery
  87. PLC Beginner Guide
  88. PLC Book
  89. PLC Cable
  90. PLC Codesys
  91. PLC Companies List
  92. PLC Computers
  93. PLC Design
  94. PLC for 3 Movement
  95. PLC for Assembly Line
  96. PLC for Automatic Welding
  97. PLC for Binding Machine
  98. PLC for Cutting Machine
  99. PLC for Filling Machine
  100. PLC for Fountain Application
  101. PLC for Injection Molding
  102. PLC for Marking
  103. PLC for Packing
  104. PLC for Rotary Bottle Washing
  105. PLC for Snack Vending Machine
  106. PLC for Sorter Machine
  107. PLC for Water Treatment
  108. PLC Hardware
  109. PLC Hybrid
  110. PLC Information
  111. PLC Knowledge
  112. PLC Language
  113. PLC Link Model
  114. PLC Mitsubishi Download
  115. PLC Model
  116. PLC Modules
  117. PLC Real Time Clock
  118. PLC Simulator
  119. PLC Software
  120. PLC Supplier
  121. PLC Types
  122. PLC Wiring
  123. PLC WorkShop
  124. PLC-ANALYZER
  125. PLCSIM
  126. Power Supply for PLC
  127. Profibus
  128. ProSafe PLC
  129. Push ON Push OFF with PLC
  130. Quickpanel Operator Interfaces
  131. Raspberry Pi
  132. Raspberry Pi and PLC
  133. RTU
  134. RTU and PLC
  135. SAS
  136. SCADA
  137. Schneider PLC
  138. SHARP PLC
  139. Siemens PLC
  140. Simple ModBus
  141. SINUMERIK CNC
  142. Small Modular PLC
  143. Standard Sequence Programming for PLC
  144. Substation Automation System
  145. Teco PLC
  146. Telemetry
  147. TEP PLC
  148. Texas Instruments PLC
  149. Timer Countdown with PLC
  150. Toshiba PLC
  151. Touch Screen PLC
  152. Traffic Light with PLC
  153. TWIDO PLC
  154. Types of PLC
  155. Unitary PLC
  156. Unitronics PLC
  157. USB Keyboard and PLC
  158. VIPA PLC
  159. Vision PLC
  160. Weighing Machine Using PLC
  161. Yokogawa PLC
  162. Zelio PLC

Search This Blog

Loading...
Copyright © 2009- All Rights Reserved