Bridge for Phidgets 4 adds support not only for 13 new VINT sensors, but also for FileMaker Server. That means you can now use this plug-in to automate monitoring of your servers rack temperature, tracking access using RFID tags, unlocking doors, and anything else you can imagine, all that 24 hours a day without having to leave a dedicated FileMaker Pro client open all the time. See how easily you can use it to monitor your server temperature and automatically switch ventilation on and off as needed:
You can easily get the hardware (except for the fancy fan and the home-made interrupted USB charging extension) directly from Phidgets. You can even replace the Temperature Phidget with the Humidity Phidget which measures both humidity and temperature, or the single-relay Phidget with the 4 x Relay Phidget capable of switching up to 4 circuits via the same single VINT port (although it needs an extra power supply). What’s just slightly more complicated is making it work on the software side, so let’s take a closer look at that…
Before you can start controlling your Phidgets hardware from your FileMaker app, you have to install all the necessary components. This includes the latest Phidgets drivers, the 24UPhidgetManager helper app, and the Bridge for Phidgets plug-in itself.
On the client side you need the plug-in and the drivers in order to be able to write and read your scripts and calculations, but you don’t need them to use the solution if all the logic will be triggered on the server only.
The 24UPhidgetManager helper app goes only to the server. It will take care of talking to the Phidgets, so that FileMaker Server does not have to. The helper app will then talk back to FileMaker Server via FileMaker Data API when it has data records to create or FileMaker scripts to execute.
The plug-in itself needs to be installed in up to three places. One for server-side scripts, one for the FileMaker Data API, and another one for the web publishing engine (if you want to use it within WebDirect or the legacy PHP API).
You will also have to create the 24uPluginsAllowedFunctions.txt file and explicitly allow your solution to use the plug-in functions there. This is our “hosting friendly” security feature allowing you to safely use our plug-ins on FileMaker Server without exposing them to anyone who can use Perform Script on Server in at least some database hosted there.
All the functionality of Bridge for Phidgets can be divided to two groups - on-demand functions, which you can use in scripts and calculations, and triggers, which get fired when certain events occur in the physical world sensed by the Phidgets devices.
The PhidgetServer example bundled with the plug-in will give you a good idea of what kinds of triggers you can configure on the server.
Server-side triggers use FileMaker Data API to do their job. A data trigger simply creates records in the defined table. This is the easiest and most efficient way to record sensor values and various other inputs for later processing. A script trigger will run a FileMaker script in your solution, and it’s up to you what you do in it. You can have both kinds of triggers fire either at a regular interval (every N seconds) or when a specific input/sensor value changes by more than specified amount (i.e. temperature changes by more than 1 degree).
In our example we define two triggers with the two scripts shown above. One to collect temperature at regular intervals and one to trigger a script when temperature changes by more than specified amount (so that we can catch when it exceeds defined maximum or drops below defined minimum), and turn the ventilator on or off, for instance.
This is the chart we can easily display thanks to recording the temperature every five minutes even if it has not changed:
To activate the triggers on the server, we have to perform the scripts on server, obviously. We also connect to the SBC and configure its port 5 as digital output, so that we can control the relay with it.
Last but not least (actually first) thing we do here is resetting the Data API account’s password to a randomly generated one, so that it cannot be used by a hacker to break into our solution. A bit paranoid but a nice trick you might appreciate using somewhere…
We didn’t want to invent a new scripting language just for our helper app, so any logic involving controlling relays, LEDs, motors and other outputs need to be done using scripts. Technically speaking, you could also use calculations evaluated as records are being created, but that could be very difficult to troubleshoot if it did not work as expected…
So we added the logic turning our fan on and off into a script that triggers when temperature changes by specified value step.
We also check whether the fan is already on (or off) before switching it, so that we don’t attempt to switch it and send/log an alert unnecessarily. In a real solution, you would probably have an extra level to watch for and produce a critical alert if the fan fails to cool the server down or if the temperature keeps dropping too much even after turning the fan off.
Don’t copy when you can steal
“Good artists copy, great artists steal” Pablo Picasso once said, at least according to Steve Jobs. Phil Schiller later clarified that by ‘stealing an idea’ Steve meant ‘figuring out what you like about it and what you want to incorporate into your idea, and taking it further and doing something new with it’.
Why would you copy all the steps explained above, when you can save yourself the hassle and just grab a copy of the example already done? Don’t hesitate and do just that:
It’s not only ready for you to install and use, but maybe you’ll also learn a few new FileMaker tricks from it, and hopefully also take it further and build something even better on top of it…
Please do let us know how you like it and what you’ve done with it. We look forward to hearing from you.