Software apps and online services
Hand tools and fabrication machines
Fox Advisor is a Sigfox-based project to be used in restaurants and franchises. It consists of a Smart Box (governed by Arduino MKR FOX 1200) installed in the centre of the table which improves the customer satisfaction by enabling direct feedback from clients to restaurant managers and other possible clients on the Internet. Fox Advisor uses the global Sigfox Network to send customers’ ratings to Sigfox-backend and, there, a custom HTTP callback sends these data to ThingSpeak IoT platform, incluying relevant information such as restaurant identifier or location.Benefits for customers and restaurants
The most remarkable advantages of Fox Advisor are:
- 140 packets per table is more than sufficient to send the variety of customer feedback generated along a whole day. Sigfox can increase the added value of the restaurant thanks to its low power consumption.
- Sigfox provides global coverage for entire countries, which allows restaurants located in both urban and rural areas to use the Fox Advisor rating platform with no wireless constraints.
- A straightforward interface allows customers to cooperate with the Smart Table, being able to control specific parameters of the table such as luminosity. ThingSpeak provides a visual interface to store the opinion of each customer.
- This project encourages socially-sustainable businesses thanks to the allergy indication RGB LED, among others. It maintains the personnel informed about customers’ special requirements with no need to make them feel uncomfortable talking about food intolerances. Additionally, clients can press a simple button to activate the notification LED and receive assistance from the personnel, ask for the check, etc.
Eating in a restaurant never was that funny! Improve user experience using Fox Advisor. It consists of a Smart Box located in the centre of a table, specifically developed to be used in restaurants and franchises. The following functionalities have been developed:
- Light adjustment: customers have a straightforward interface to control a LED strip and adapt the light level of their table.
- Allergy indication: each Smart Table includes a RGB LED which allows them to indicate any kind of allergy or intolerance. Through the panel, each customer can select a kind of special diet and a RGB LED will be immediately switched on to advise the personnel of the restaurant with no need to provide additional explanations. The colour code for diet requirements is: pink (gluten-free), blue (lactose-free), orange (sugar-free), yellow (vegetarian) and green (vegan).
- Staff notification: customers can press a button to switch on the red LED of the table, which will trigger an alarm to notify the restaurant staff about a special request.
- Rating: customers are able to rate the restaurant using the panel located at the centre of the table by answering three short questions: Service quality (0-5), Food quality (0-5), Did you enjoy? (0-5). The results are sent to Sigfox-backend and, there, a custom HTTP callback sends them to ThingSpeak IoT platform to provide a visual statistic representing the opinion of the last customers.
A post-it with the instructions of Fox Advisor is shown below:
Once we know what Fox Advisor is and its main functionalities, let's have fun! In a few steps we'll see how to build the initial prototype, including all the parts and leaving apart the 3D design for the following steps.
I) Setting up the MKR FOX 1200, LCD and keypad
Firstly, connect the 4x4 keypad and the 16x2 LCD according to the schematics provided. It's important to test how it works once every component is included to facilitate the assembly and to avoid confusing mistakes.
The wires used in the LCD must be as long as possible (at least as the ones shown in the picture below) because the LCD will be the highest part of the device once the 3D housing is included.
Note: it's not recommended to connect the board without having connected the antenna before.
II) Connecting the LED strip and notification LEDs
Then, we will include in the first place the indication LEDs (in the initial prototype I used a red LED and a RGB LED board, but I changed them later in order to make them fit with my 3D design, you can use any generic LED). The resistors were 1kΩ, three for the RGB and one for the red one. Refer to the schematics for more details.
Now it's time to use the LED strip. I obtained the one of the picture (1 meter long) for 5 € approximatelly, so it's not too expensive. You'll see that the one used in the schematics is RGB, don't worry because you can use the scheme connections considering that this one has only two terminals. Additionally, we'll need a generic NPN transistor with a potentiometer to control light intensity from Arduino board and a 9-12V battery.
To start with the LED strip, cut it at the length you want (35 cm for the 3D design of Fox Advisor) and try to cut a small area of silicone to leave the soldering terminals free of silicone (see the set of pictures below). Then, solder the terminals with not necessarily long wires.
We use the NPN transistor to control the light intensity from the Arduino I/O pins. The potentiometer varies the resistance value at this point and, thus, the voltage sent to Arduino. Once Arduino receives the voltage level at pin A6, we use the A5 pin to generate an equivalent voltage level and apply it to the base of the NPN, which amplifies the current provided to the LED strip. (Refer to the schematics for more detail).
III) Initial Fox Advisor prototype
Once followed the previous steps, we have our initial prototype complete! Test the code and verify it works to continue with the following software steps.
We'll need to include the libraries for the Arduino MKR FOX 1200 board. We can find them directly in the sketch menu of Arduino IDE. In case they're not present, we can include them using the libraries manager.
Then, select the board in the tools menu:
And repeat the previous steps to include the following libraries:
The complete source code is provided below, but here I leave a short description of the blocks that have been programmed:
There is an initialization of the LCD according to the Arduino pins where we've connected it. In this case the parameters are: (0, 1, 2, 3, 4, 5). Regarding the keypad, we have defined the rows and columns and connected it to digital 6, 7, 8, 9, 10, 11, 12 and 13 Arduino pins.
Then, in the set up block we will define the inputs, outputs and finally the default message to be shown by the LCD. In this case:
* FoxAdvisor * Can we help you?
The loop function has an event listener to identify any pressed key and manages the state of the LED strip through A5 and A6 pins. Once any key is pressed, a different routine is defined to be executed.
Keys B and C activate a LED in order to notify different aspects. Key D asks the customer to introduce any special diet requirement (using the RGB indicatino LED) and keys * and A are used to rate the restaurant. Once the restaurant has been rated, a structure containing the following information is sent via Sigfox:
Step #3: ThingSpeak
Restaurant ID, table ID, diet ID, question 1, question 2, question 3
ThingSpeak is an open IoT platform based on MATLAB analytics which matches perfectly with Sigfox technology. Is brings you the opportunity to receive custom HTTP callbacks from Sigfox backend (in Step #4 we'll analyse this step deeper) and the knowledge required for this is not too demanding. The network architecture I've used for Fox Advisor proposal is shown below:
We will start by creating a new account (I use a student license provided by the University of Castilla-La Mancha, Spain). Once we have the account, we will continue creating a new channel, which refers to the main dashboard that will show data. The channel can be private or publicly accessible, I preferred to make it public so that it can be shared here.
When you create the channel, tou'll be asked to fill the fields with the data we want to receive from Sigfox-backend (in this case we need the restaurant ID, table ID, diet requirements, and the opinion from customers stored in questions 1, 2 and 3). The channed ID will be assigned automatically.
For additional information, check the official documentation by clicking here.
To finish with ThingSpeak, in the API KEYS tab we have the private keys for our channel. Don't share these keys. We’ll use the WRITE API KEY to send data from Sigfox-backend to ThingSpeak, so copy the key for the following steps.
Once we have our ThingSpeak account and channel and Arduino programmed, let's contiinue by creating a new account and activating the Sigfox device. For this, click and select a provider (Arduino) and your country.
The next step is to introduce the ID and PAC codes. You'll find them in the Serial console of Arduino IDE, by executing the FirstConfiguration.ino example of the <SigFox.h> library.
Finally, if you don't have an account, you'll be able to create it in this step so that you registered device is associated with your user account.
Done! Now we have a Sigfox-backend account. It’s time to configure messages in order to be able to receive information in ThingSpeak platform. For this, once we log in we have access to the Sigfox dashboard, where we'll click on device and, then, device type.
Then, on the left-hand menu click 'callbacks' and create a 'custom callback'.
According to ThingSpeak API, we'll define the callback so that every field defined in our structure is sent via HTTP to ThingSpeak everytime a client rates our restaurant. This is the configuration I used:
Step #5: Data visualization
Type: DATA, UPLINK Channel: URL Custom payload config: restaurantID::uint:8 tableID::uint:8 allergy::uint:8 question1::uint:8 question2::uint:8 question3::uint:8 URL pattern: Use HTTP method: POST Content type: application/x-www-form-urlencoded
Finally, we'll test the complete system by rating the restaurant and verifying how the message is sent to Sigfox-backend and how the callback succeeds to send these data to ThingSpeak.
The response of the callback will be shown near every message sent at Sigfox-backend, and it should be something like this:
If we open our ThingSpeak channel, we'll find the data of the questionnaires represented in a column chart. We could also have the ID of the restaurant, the table or even the diet requirements (in case there are) because we're sending this information in each packet. Although, I didn't consider it necessary for the demo, take into account that you'll have access to all the information in ThingSpeak.
ThingSpeak gives us also the chance to program data visualization using MATLAB functions, so we'll complete the dashboard by including a custom program which shows the overall rating of clients in a scale 0-100% (using the previous questionnaire answers). For this, go to Apps -> MATLAB Visualizations -> new and paste the following MATLAB script:
% Celia Garrido-Hidalgo % Channel ID to read data from readChannelID = 357609; question1 = 4; question2 = 5; question3 = 6; % Channel Read API Key % If your channel is private, then enter the read API % Key between the '' below: readAPIKey = 'WRITEHEREYOURKEY'; question1Data = thingSpeakRead(readChannelID, 'Fields', question1, 'NumPoints', 5, 'ReadKey', readAPIKey); question2Data = thingSpeakRead(readChannelID, 'Fields', question2, 'NumPoints', 5, 'ReadKey', readAPIKey); question3Data = thingSpeakRead(readChannelID, 'Fields', question3, 'NumPoints', 5, 'ReadKey', readAPIKey); bar(1:5, 33.33/5*[question1Data question2Data question3Data], 0.5, 'stack') axis([0 6 0 100]) title('Customer satisfaction') xlabel('Customer ID') ylabel('Satisfaction (%)') legend('Service quality', 'Food quality', 'Did you enjoy?')
The output of the script is also public, so you can ckeck it here. The initial three charts including questionnaire answers are dynamically refreshed, but the Matlab script must be refreshed manually once we log into the channel (which is not a considerable problem). Once we execute the script and include it to our channel, we'll see something like this:
To finish, we'll enable location in the dashboard.Schematics
These are the schematics of the project using Fritzing. note that the 4x4 keypad model does not exactly correspond to the one I used, but the connections are still the same. Something similar happens with the LED, I used a RGB model for the schematics but the one I used in Fox Advisor is white.
To finish, I designed a 3D model for the device, including the holes for the LCD, keypad, potentiometer and LED strip. The design is shown below and the original files can be downloaded and edited here and here.
Additionally, I included a tiny box in order to build a usefull objet for the table of the restaurant, where clients can access to napkins, ketchup, salt, etc.
To print the design I used red PLA, the resulting part is shown in the pictures below, where the assembly of all components described for the initial prototype has been done:
Do you need more detail about how Fox Advisor works and the steps to build it? See the video below ;)