Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
FieldbusGateway_PumpPLC.agent.nut
FieldbusGateway_PumpPLC.device.nut
README.md

README.md

Pump PLC

This example uses an impAccelerator™ Fielbus Gateway and the Electric Imp Modbus Library to contol a Click Programmable Logic Controller (PLC). The PLC listens for a button press and activates a pump. When active, the pump pushes water into a tank, and the PLC monitors the water level. The Fielbus Gateway uploads the current water level and the pump status to several cloud services.

Hardware

Software Dependencies

Device Code

The Fielbus Gateway’s imp005 polls the PLC for changes to the button state and signal from the water-level sensor. When a button-state change is detected, the pump is turned on or off. The status LEDs on the Fieldbus Accelerator are toggled to indicate when the button is pressed and when the pump is active. The water level is monitored by a sensor and when it reaches certain thresholds, a stack light is turned on. If the water level reaches a maximum threshold, the pump will be turned off automatically. The device reports all pump state and water-level changes to the agent.

Agent Code

The agent sends all water level and pump status data to Autodesk Fusion Connect, IBM Watson and Initial state. The maximum water level threshold is set in the Autodesk application, and the agent listens for changes and passes those to the device.

Note The web services all require accounts and access keys to push data. The keys have been removed from this example code, and so you will have sign up for any or all of these services as you require and paste their access keys into the appropriate variables before the agent can push data to those services.