The client has given us permission to feature this project on the understanding that their name and specific details are redacted.
Client | XXXXXXXXXXXXXXXX Limited |
---|---|
UN SDGs | 03 Good Health And Well-Being |
Impact | United Kingdom |
Technologies | PHP, API, IoT |
During the Pandemic we were asked by XXXXXXXXXXXXXXXX to develop a system which would allow a member of the public to use their mobile phone to pay for a product and, without making contact, receive a physical item which would be released automatically. The mechanism needed to be retrospectively added to equipment already distraibued around the UK
There were several challenges that we needed to overcome with this project.
Firstly, different approaches were tested for the user to trigger the payment application on their phone. QR codes were becoming popular, but the risks of abuse when attached to the outside of equipment when left in a public environment were too high for application taking payments. It was decided that NFC chips were much more secure as long as they weren’t writeable.
Secondly, with the short time-frame to get the application out and being used there wasn’t time to educate the public or to download apps. It was decided that opening the payment system in a web browser was the most frictionless approach to take.
Once the customer had interacted with the NFC chip, opened the browser and successfully paid, the application had to send a signal to the device. This was achieved using MQTT (a lightweight, publish-subscribe, machine to machine network protocol for designed for the Internet of Things). This had to wake the device up, send the instruction, trigger the mechanism, and send the success message back to the applications. Every step was logged in the database.
$url = 'mqtt.thingstream.io';
$port = 1883;
$client = new karpy47\PhpMqttClient\MQTTClient($url, $port);
// $client->setDebug();
$client->setAuthentication($username, $password);
$client->setEncryption('../cert.pem');
$success = $client->sendConnect($client_id, true, 20, 10000);
if ($success) {
$client->sendSubscribe('events/connectSuccess');
$messages = $client->getPublishMessages(
100,
true,
false
);
foreach ($messages as $message) {
$connectedDevice = json_decode($message['message'], true);
if($connectedDevice['identityId'] == $device){
echo 'device '.$device.' found';
}
}
$client->sendDisconnect();
}
$client->close();
The project was successfully rolled out to the target audience and helped a specific community interact with equipment which was retrofitted with minimal effort and allowed them to receive the products without making physical contact.