12 Powerful Ways to Use PLCs with SQL Databases - Part 1
Before he founded Inductive Automation, our CEO Steve Hechtman worked as a control system integrator and often encountered the obstacle of being unable to make operations-side data available to the IT side. This inspired Steve and his team of developers to create a tool — now known as the Ignition SQL Bridge Module — that moves data bidirectionally between PLCs and SQL databases using OPC.
Since then, members of the Ignition community have used the versatile capabilities of the SQL Bridge Module to implement many creative and effective solutions in their industrial systems. Co-Director of Sales Engineering Travis Cox highlighted a dozen of the most useful SQL Bridge tips in the webinar “12 Ways to Use PLCs and SQL Databases Together.” In this two-part blog series, we’ll unpack each of these tips in some detail.
1. History with Context
SQL Bridge can provide contextual data by leveraging data acquired from PLCs and combining it with data collected by the Tag Historian Module. SQL databases store external environmental data like work orders, operator interactions, product codes, and more, to offer a complete picture of an event or dataset. The Tag Historian Module contributes the historical data, which works in conjunction with SQL Bridge’s database connection to provide contextual data, which can then be sent to an HMI or other display.
2. Synchronize Two or More PLCs Through a SQL Database
Often, a process would be more efficient if multiple PLCs were communicating with one another as data points are logged or events are triggered. With SQL Bridge, information pulled from an individual PLC can trigger a change or new recipe, and information or values in the database can send a message to multiple PLCs simultaneously. PLC synchronization is important with time-related recipes or events; if PLCs are run on their own timers or clocks, they can easily conflict with one another, leading to errors in the process. With SQL Bridge, you can set the time and connect to each PLC so that they are all on the same schedule.
3. Barcode Scanning
Any barcode can be scanned and then transmitted to a database with SQL Bridge. Barcodes help identify products within a system, creating quicker updates and processes. For instance, airport baggage systems scan thousands of pieces of luggage every day to direct them to the correct terminal. Instead of implementing an expensive barcode scanning system, airports and other organizations can enable barcode scanning quickly and inexpensively by adding a simple direction within SQL Bridge. A PLC would scan the tag and send the data to the database via SQL Bridge. Based on the barcode information, the database would send the command to the PLC to direct the luggage’s transport to the correct location.
SQL Bridge can support the functionalities of a sequencer to keep track of a product and what is happening to it as it moves down the production line. In a car factory, robots that weld parts perform different sequences of actions based on the car model it is working on. The machine would first need to identify what model the car was (perhaps with a barcode scan), then that data would be sent to the SQL database. SQL Bridge would in turn send the robot’s welding directions back to the PLC.
5. Mapping Out PLC Values to Stored Procedures
Sometimes, operators might want to map specific PLC values as inputs or outputs to a stored procedure in a database. When a PLC is triggered by an event, SQL Bridge can map the PLC value to a stored procedure. The stored procedure, using its logic based on the value, will give back values to be written down on the PLC. Many of these functions can run according to timers, schedules, and triggers. By storing these procedures in a database, you can keep your software and PLCs cleaner and running more efficiently, while mapping PLC values for tracking.
Your database can communicate a schedule to PLCs for time-based functions in the SQL Bridge Module. For example, communicating with a large-scale sprinkler system could allow an operator to schedule the valve controllers to turn the system on and off based on the time of day. By connecting the controllers via a PLC to the database, SQL Bridge can send a timed schedule to the system, or change the schedule if variables like weather would impact the process. These messages could potentially connect through MQTT to SQL Bridge and the database, or with a more basic form of message delivery. MQTT allows data to be pushed to a database, rather than pulling values from a remote system.
Want a more in-depth look at SQL Bridge?
If you’d like to get more details on these SQL Bridge tips, watch this excerpt from our webinar:
In the next post in this series, we’ll share six additional uses for SQL Bridge, such as handshaking with PLCs, recipe management, OEE, and more.