Cool Summer in Belfast!

Hello everyone,


I am really enjoying the cool summer here in Belfast, especially with all the Early Stage Researchers (ESR) gathering together here at Queen’s University Belfast attending the 3rd FoodSmartphone Summer School. The summer school mainly focused on software development with topics such as smartphone App development, cloud services, software engineering, and entrepreneurship. And it was a big success thanks to the enthusiasm of all the participants and contributions of the organisers and speakers!


Visiting Bushmills whiskey factory

Most excitingly, we all ESRs presented our research progress in front of the FoodSmartphone consortium in Bushmills, Northern Ireland. The nice town is famous for the production of the famous and historical Bushmills whiskey. We also toured the Bushmills whiskey factory and witnessed the production of Bushmills whiskey – now it is highly automated production line with quality control!

Talking about quality control, we are developing smartphone analysers for low-cost, portable, and rapid food analysis that can be used for on-site food quality control. I am developing image analysis algorithms that can be used to improve accuracy and automation of smartphone optical biosensing. Eventually, these algorithms would be able to promote on-site food analysis by novice end-users.

Since I am an algorithm lover, below introduces an algorithm that I have come up with named FoodSmartphone food analysis algorithm (FSP-FAA) that can be used to demonstrate the workflow of our FoodSmartphone biosensors which would enable on-site food analysis. The algorithm was designed to demo the key ideas of our FoodSmartphone project. So please do not take the parameters and outputs seriously (just for fun).


To visualise the FSP-FAA and make it fun to play, I have created the following code in JavaScript:

document.body.innerHTML = ''; = "block";

var p = document.createElement('h1');
p.textContent = 'Hello, welcome to try out the FoodSmartphone Food Analysis Algorithm!';

var biosensor = document.createElement("input");
biosensor.type = "text"; = "100%"; = "biosensor";
biosensor.placeholder = "Biosensor (e.g. FoodSmartphone)";

var analyte = document.createElement("input");
analyte.type = "text"; = "100%"; = "analyte";
analyte.placeholder = "Target analyte (e.g. allergens)";

var start = document.createElement("button");
start.type = "button";
start.innerHTML = "Click me to start analysing!";

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));

start.onclick = async function fun() {
    var b_text = document.getElementById("biosensor").value;
    var a_text = document.getElementById("analyte").value;
    if (b_text.toLowerCase() != "FoodSmartphone".toLowerCase()) {
        await sleep(2000);
        r = Math.random();
        e = Math.random() * 0.4 - 0.2;
        document.getElementById("result").innerHTML = r + e;
        document.getElementById("error").innerHTML = e;

    if (!a_text.toLowerCase().includes("allergen") && !a_text.toLowerCase().includes("bacteria") && !a_text.toLowerCase().includes("pesticide") && !a_text.toLowerCase().includes("toxin")) {
        document.getElementById("result").innerHTML = "Not supported yet";
    await sleep(1000);
    r = Math.random();
    e = Math.random() * 0.2 - 0.1;
    l = 0.5;
    document.getElementById("result").innerHTML = r + e > l ? "Not safe" : "Safe";
    document.getElementById("error").innerHTML = e;

var result = document.createElement("p");
result.textContent = "Result:";

var res = document.createElement("label"); = "result";

var error = document.createElement("p");
error.textContent = "Error:";

var err = document.createElement("label"); = "error";


And this code can be ran in your web browser! Just follow these 4 simple steps to try it out by yourself:


Step 1: Open an arbitrary webpage (e.g.


Step 2: Open the console in your web browser on a desktop or laptop.

Most web browsers on desktop or laptop will allow opening of the JavaScript console by pressing F12 (Chrome and Internet Explorer) on your keyboard. If it does not work for your computer and browser, please follow this link for more details ( Then, the console can be opened by following the “console” tab.



Step 3: Copy the JavaScript code above, paste it into the console, and press enter to run it!



Step 4: The program will appear in the current webpage. Play with it in your browser!



Okay, hope you enjoyed playing around with the Do-It-Yourself (DIY) small program in your browser! You can also modify the parameters in the code to see how the result will be affected. Please leave a comment below if you have any idea or question. And thank you very much for reading the blog!


Until next time,


Best regards,


1 comment on “Cool Summer in Belfast!

  1. Pingback: How Can Information Technology Help Shape a Better Food Supply System? – FoodSmartphone ESR Blogs

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: