Introduction: Hands-free Tokens
Now I am studying in +2 which is equivalent to 12th Grade. I am very interested in computer science and also my main subject is that. I spent a lot of time in developing Embedded projects. I have around 3 years of experience in the embedded field. I always focus on innovative and variety solutions. My parents gave me huge support for making this project.
The main theme of the contest is to create hands-free solutions.
Here I am creating a device called QMN(Queue Management Node) which can create a virtual token and thus it can maintain the virtual queue.
In certain queue's, we need to receive physical tokens from the counter that will probably lead you in danger. So by using this virtual tokens you can avoid that danger. You are actually getting virtual tokens on your smartphone. The token is completely hands-free.
It is a simple user-friendly virtual queue maker powered by Arduino MKR WiFI 1010.
Step 1: Demo Video
Watch the demo video to know about it.
Step 2: Things We Need
Step 3: How Does It Work?
Queue Management Node(QMN) is the device that is creating smart tokens. For creating the smart tokens, the person should be in the wifi range of Arduino MKR 1010. The person also needs a smartphone to get the process done. The workflow will go as follows...
- A WI-FI access point will be created by Arduino MKR 1010.
- The person who wants token needs to connect the phone to the access point & that will be redirected to the localhost.
- On that page, the person needs to enter his/her phone number. At that instant, OTP will be sent to the concerned number to verify it. The phone number is taken intentionally to give notification.
- After verifying the phone number, the token will be displayed on the localhost.
- When his/her turn comes the device(QMN) will send a message notification to the concerned person to take their turn.
This device is actually receiving the request from peoples and giving them the smart tokens. For sending the message we are using a Twilio SMS API in the QMN device. The notification of Turn can be sent by pressing the button in the QMN.
When all the tokens are called out, you can clear the memory by pressing the reset button on Arduino MKR WiFi 1010.
Step 4: User Interface
*) When you connected to the Access point, you will be redirected to the page like the first one.
*) After submitting the phone number, you will get an OTP on that number. Then it shows the OTP page to enter your OTP number.
*) When you submit the correct OTP, you will get the token on this token page.
*) If you entered the wrong OTP, it will show invalid OTP.
*) If your number had received the token already, it will tell you that you already registered.
That's all about the User Interface.
I don't know much about the HTML. My Dad made these pages more attractive by using CSS.
Step 5: Use Cases & Advantages
It can be used anywhere like Hospitals, Shops and Hotels.
- No internet connection required for getting tokens
- A simple user-friendly web interface.
- Native device notification, when the turn comes.
- No physical tokens.
- Easy to implement.
- No unnecessary waiting time, show up when your turn comes.
Step 6: Arduino MKR WiFi 1010
The brain of the device is Arduino MKR WiFi 1010. It is the easiest point of entry to basic IoT and pico-network application design. The board's main processor is a low power Arm® Cortex®-M0 32-bit SAMD21, like in the other boards within the Arduino MKR family. The WiFi and Bluetooth® connectivity is performed with a module from u-blox, the NINA-W10.
This device completely relies on the WiFi connectivity of the Arduino MKR WiFi 1010. The device uses both AP(Acces Point) mode and STA(Station) mode of wifi module. The device will intelligently switch between these modes for the proper operation of this device.
Step 7: Arduino IDE
The Arduino IDE is used here for programming the Arduino MKR WiFI 1010. Please have a look here for getting started with the device. Use the latest Arduino IDE for programming the Arduino MKR wifi 1010. Before going into programming check if there is any latest firmware update for the device. Please have a look here to know how to update the firmware.
Step 8: Captive Portal
We are actually creating an access point (AP) by Arduino MKR WiFI 1010, any device(mobile) can be connected to this AP. For going into the web interface in past, a person needs to type the IP address or hostname in the browser. That's almost okay, but the user needs to manually put the IP or hostname on the browser. That is a really weird thing. But in this case, the device which is connecting to the QMN will automatically be redirected to the web interface via the Captive Portal. Here the Captive Portal plays a big role in reducing the effort of the user. There are a lot of Captive Portal projects with Espressif devices, unfortunately there are none with the NINA library. Because the MKR WiFi 1010 uses the NINA library. At last, I found a project in Arduino hub which uses Captive Portal as the key things by JayV Then I began my project by taking it as the base code. It is almost working fine.
What we are actually doing is that we are setting DNS and to own Access Point(AP) - IP address and checking first (16) DNS requests via UDP port 53. After checking the first 16 requests we will send a response for the DNS requests with the redirected IP address of own Access Point. Then the phone will automatically load the web interface through the web browsers. The final effect will be like this when a device connected to the specified AP, the phone will automatically load the web interface. UDP server and Webserver work both at the same time. The web server is a simple main page with a form button for entering the phone number.
Step 9: Twilio & Things Speak
Unfortunately, I don't have a GSM module to send the messages. For sending the OTP and device notification we need to use any SMS API. So in this project, I used Twilio's SMS API for accomplishing the task. As we know that, for the API to work we need to give the HTTP request for the server. First I gave normal HTTP request without any encryption to the Twilio,but the Twilio didn't consider my request. They need SSL fingerprints to ensure security. I didn't see any functions in NINA libraries which support these SSL's. So I used Thingsspeak to trigger the Twilio. For using these services you need to register in both the platforms.
In Twilio create a new number and that will be the number in which you sent the data. You will get free credit in Twilio for messaging. For the trial account, you need to verify the numbers in which you want to send the data.
Go to Thingspeak.com, click on apps, then ThingHTTP, and then New ThingHTTP. This will take you to the setup page. You will have to find your Twilio account SID and auth token on your Twilio dashboard page.
- Name it Twilio Send SMS
- URL is https://api.twilio.com/2010-04-01/Accounts/YOUR TWILIO ACCOUNT SID/SMS/Messages
- HTTP Auth Username is YOUR TWILIO ACCOUNT SID
- HTTP Auth Password is YOUR TWILIO AUTH TOKEN
- Set the method to POST
- Content-type is application/x-www-form-urlencoded
- Click remove headers, and leave host blank
- Body = From=YOUR TWILIO NUMBER&To=%%number%%&Body=%%message%%
Click Save ThingHTTP. The API key of the ThingHTTp should be included in the Arduino Sketch.
Step 10: AP OR STA Mode
All the Arduino boards having Nina module do one role at a time i.e Station mode or Access Point mode . We need to constantly switch between these modes to get the job done. First, the QMN will be in AP mode after getting the number it will switch to the STA mode for sending the OTP. After sending the OTP the QMN will switch back to AP mode. If a person triggered the push button, the QMN will switch to STA mode for giving SMS notification. After that, it will come back to AP mode. For giving the internet connection we are switching the QMN for STA mode. The SMS API requires internet connection.
Step 11: TM1637 4 Bits Digital Tube LED Display & Push Button
The TM1637 4 Bits Digital Tube LED Display Module is an affordable solution for displaying the output data of your embedded project. Though the data displayed is restricted by numbers still it allows users to display some characters too like A, B, C etc. The current token number which will be running is displayed on this 4-bits seven-segment LED. This 7 segment LED Dsiplay has 4 digits which are controlled by TM1637 Driver Chip. It requires only two connections to control this TM1637 4 Bits Digital Tube LED Display Module. By looking on this display any one can easily understand the Token number. That's the real use of this device.
You need a library called TM1637Display.h for working with this module. Just download the library from here.
Here push button is used for calling the tokens. I have used the push-button module so it is very easy to integrate. Here the push button is in the pull-down mode. You can also easily make a module with a resistor and the push button.
Step 12: Circuit
The circuit is very simple, it doesn't consist of any complex hardware. Just connect as per the schematics. First I made the circuit on the breadboard. Then I wired with the jumpers.
Step 13: Case
I got this case from a local store. I just cut a small piece in the front for showing the seven segments led for showing the token. I have also torn two-piece from the side, one is for the push button and the other is for the USB cable. To giving power for the Node. This case is very suiting, All the components are placed very well.
Step 14: Arduino Sketch
All the HTML pages shown in the interface are stored in the flash memory of Arduino MKR WiFi 1010. For storing that I used the PROGMEM utility.
PROGMEM is part of the pgmspace.h library. It is included automatically in modern versions of the IDE. However, if you are using an IDE version below 1.0 (2011), you’ll first need to include the library at the top of your sketch, like this:
While PROGMEM could be used on a single variable, it is really only worth the fuss if you have a larger block of data that needs to be stored, which is usually easiest in an array. We have a large block of data here so we are going for this.
All the HTML files are stored in "source.h" tab. The entire code for this project can be found. Just upload this code into the Arduino device.
Step 15: The QMN..
The final outlook of the device. The device is ready to use. Just power it up with USB cable and enjoy!
Runner Up in the
"Can't Touch This" Family Contest