Software apps and online services
Individuals and companies have filers, to keep their documents, some filers contain very secret and important files that you would not want to be tampered with by some person that got the key to your office.
What stops your "colleague" from searching your filer for that document that will get him the promotion? What stops your parents from eyeing your test results? SafeFiler aims to revolutionise your filer, if you are a company or just a person with a filer, SafeFiler will turn your old filer into a shiny, smart, connected device.
The owner of the filer can lock it by just pressing a button on the go, on the phone application. And no, the filer will not be locked by a huge magnetic lock that can be ripped off, it will emit a high frequency alarm that will make that "colleague" put the filler back. The user can also log the number of pages in each section of the filer through the phon app, this data is also visible on the device and on an online dashboard. Packed with tonnes of cool features, SafeFiler makes filing a little funner.
SafeFiler has 3 ends; the device, the application and the cloud dashboard. The user can access all of these ends and so, control their filer. The NXP Rapid IoT device and phone application exchange data between each other when they are connected through Bluetooth.
SafeFiler is split into 3 sections; Pages, Security and Status. Each one of these functions quite independently on all three ends. Each of these sections are detailed below.
The NXP device is positioned inside the filer, on the centre piece between the clips to allow the filer to close with the device in it.
Section 1: Pages
This section registers the number of pages in every sector of the filer, the application comes with 4 sections for the filer, sections in the filer are separated by separator sheets. SafeFiler allows the user to record the number of pages as he/she adds them, by simply pressing the plus button on the application next to the section the page was added to.
The user can also remove pages from the count on the app. These values are then sent to the NXP device, where they are displayed on the screen.
Section 2: Security
The second section of the project is the safety feature that allows the user to lock the filer and check its current state. The NXP device reads its accelerometer data to check if the filer is open or closed based on its current position. It then sends this data to the phone application which then relays it to the cloud.
The user can easily lock the filer through the application. By pressing the lock or unlock buttons on the application, the phone sends the command to lock or unlock the filer to the device, placed in the filer. The RGB LED indicates if the filer is locked or unlocked by its colour. The lock state is also printed on the home page of the device.
If the filer is opened while it is locked, the device senses this and automatically turns on an alarm on the device, the alarm state is also visible on the application, to alert the user that the filer is open anywhere, at any time.
Section 3: Status
This section gives the user a look at the current status of the device, it allows the user to see if the device is charging or not, and the current battery level, so that they can recharge it when it is out of battery. The device sends the battery level and state regularly to the phone where the data is displayed. This data is also visible on the device's home page.
The Rapid IoT device, application and cloud communicate with each other constantly. If the device is connected to the phone application, the two ends will exchange information with each other. This allows the user to easily interact with their filler from anywhere. Below is an illustration of the functionality overview.
The Double Check System
SafeFiler introduces a double check system, this prevents the NXP device from not receiving commands from the application (and vice versa) and so ending up in the application and device being out of synch.
This feature is especially important in adding a page to a section of the filer through the phone app, as, if the user presses the add button in the application but the device is not currently connected to the app, the value on the app will increment but the one on the device will remain the same, causing them to fall out of synch.
The double check system works in a simple way; when the user increments a section through he app, the app does not send the new number of pages to the device, but sends an incrementation command. When the device receives the command, it increments the value, displays it and then sends it back to the app where it is also displayed. So the app and device will never fall out of synch.
A Quick Code Overview
As the project has a lot of functions, the code is quite big. As mentioned before, there are 3 ends to the code and 3 sections. Each section is independent from the other. A confusing diagram of the code overview is below.
The User Interface On the Device
The device is brightened up by NXPs lovely page structure, allowing us to create an intuitive user interface rapidly and easily. The device has a network of pages, supplying the user with the information they need about their filer. The pages are all displayed below.
Below are some images capturing the device in action, for a better reference to how the project works, there is a video above.
The individual or business that uses this project will benefit in:
- Keeping a count of the number of pages in each section of the filer as pages are added
- locking the filer to prevent unwanted access to it easily, through the mobile application
- Rapidly monitoring the number of pages and current battery level and lock state from the online dashboard at any time, anywhere.
Step 1: Required Apparatus
The NXP Rapid IoT kit provides us with everything we need to build the project. The list of requirements is below.
- 1, Rapid IoT Kit
- 1, Sim Key
- 1, Smart Phone
Step 2: Connecting the Circuit
Luckily enough, there is no circuit to get going with, as everything we need for this project is inside the NXP device.
Step 3: Preparing the NXP Environment
I have chosen to build the project using the online studio, as it is considerably easier to create code with than the MCU Espresso software. It runs on a block programming language which is easy to use even without any coding experience.
To start off, you will need to create an NXP account to access the online studio, to do so follow the steps below.
So now that the environment is set up, we have to open the code for the project on the editor, the steps below will guide you through this process. There are 2 ways of getting the code for the project.
- The first one is to get the code from the code section below, copy it and open it in a code editor, you have to then saave the file as a
- The second step is to use this link to directly download the code, it is a link to a shared document on google drive.
So now that you got the code, we will move on to the next step, deciphering the pool of blocks on the screen.
Step 4: Acknowledging the Code
He Now we need to get through the code step-by-step. Though it may seem like a big lot of blocks, it is made sense of in this section. There are 3 ends, each one of these has a different page of code. There are many parts to the code, each one is explained below.
For help with understanding the environment, use this link, it provides many examples of code and gets you started.
For documentation on all blocks and their functions, consult this link.
- Device - NXP Rapid IoT
This part of the device's code controls the main pages on the device and the data that is printed on them. The first group controls the way the pages are toggled between; using the electrodes. The second part controls the sectionspage under the home page and calculates the total number of pages in the filer. The third part sets the data on the home page.
This section of code gives the phone application feedback on the amount of pages that are in each section of the filler at intervals of 500 milliseconds.
This part of the code waits for the phone application to change the number of pages in a section, when this happens, the new number is stored in a global variable and then displayed on the according page, the buzzer also beeps to confirm that the data was received.
This section of the code checks if the device is locked, if it is, it turns the RGB LED red, if it is not, it turns it green. It also feeds back the current lock state to the application as part of the double check system.
This part of the code reads the battery percentage and if the device is charging and stores this information in global variables, these values are then sent to the app and displayed.
The heart of the device, this section analyses the accelerometer data and then processes it to determine if the device is flat on a surface or not, therefore detecting if the filer is open or closed. The backlight of the device is then turned on or off accordingly and the data is sent to the phone app.
The final section of the device's code, it controls the security side of the project. It checks to see if the filer is locked and then if it is opened, if the locked filer is opened, it turns the buzzer on until the filler is closed or unlocked. The alarm state (on or off) is sent to the cloud.
This section of the code controls the add and subtract buttons on the application which change the values of the number of pages in each section of the filer. If a button is pressed, an increment or decrement command is sent to the device.
The heart of the app, this section of code, continuing below the marked area reads the feedback sent from the device and then displays it on labels and sends particular pieces of data to the cloud.
This part of the app's code reads the feedback sent from the device in relation to the battery level and battery charging state, it displays the battery level and shows an image of a charging battery if the device is currently charging or a normal battery otherwise.
This part of the code reads the raw states of certain values, these are the unprocessed states and consist of integers. For example lockState sends "locked" and "unlocked" to the app while rawState sends 1 and 0 to the app. This data is not used by the app but is directly sent to the cloud to be displayed as gauges.
This section of the code checks to see if the user pressed the lock or unlock buttons on the app, the locked and unlocked image is shown accordingly and the change in state is sent to the device.
This section creates the section_cloud stack in the cloud, it is composed of the number of pages in each one of the 4 sections.
This part of the code creates the special_cloud section of the cloud, here, the battery level, lock state, alarm state and the open state are stocked.
The last section of the code creates the raw_cloud section of the cloud. This section has the raw integer values that are displayed as gauges on the dashboard.
Step 5: Uploading the Code
The next thing to do is actually put the code onto the device and run it, and then connect out app to the device, Firstly, we have to edit some variables, well only the title of the filer, follow the steps below for this.
So now that the code is ready to go, and personalised, it is time to upload it. The first thing that we need to do is actually get the device into bootloader mode. This is quite tricky at first, and it took me quite a while to get, but the diagram below should be helpful.
So now all that is left to do is get the code running on the device.
Step6- Provisioning the Device
The next step is to connect the device to your phone, to do this, you will need the NXP Rapid IoT app on your phone. You can get it in the App Store or in the Play Store. After you have the app, sign in using your NXP account and then follow the steps below. Ensure that the device is running and Bluetooth is enabled on your phone.
Step 7 - Setting Up The Dashboard
So having the application is great, but being able to monitor the device from anywhere is another great feature of this project. The last step is to set up the NXP dashboard so we can visualise the data. We have been storing the data received from the device on the cloud via the phone application. We have stored data under 3 sections.
These are explained in the Acknowledgingthe Code section above. When creating the dashboard, we will have to refer to these blocks of data. A hierarchy diagram is included below detailing all data found in each one of the sections
So now, we can follow the steps below to set up the dashboard for the project.
It is possible to also display more data in gauges, such as open state and charging state, they can be included in the dashboard if you wish.
Finally, place the device in the filer and lock It away. Simple to build and a cool project to keep people away from your filers. No enclosure is needed in this case as the NXP device comes ready-enclosed.
Battery wise, the device will last approximately 4 hours, so I would personally recommend having a power bank connected to your device in the filer, I mean, It does fit. Have fun with the project.
I came up with the idea of making this project as I was putting away some files (tests) that I would throw in a filler as in a void and let time decay them. But then I thought that filers must have a better use, and so decided to brighten the idea of filing up a bit. And that's how SafeFiler came along. Combining both security and maintenance together to create the filer of the future. And here it is.