When ever we completed our shopping in stores, we check for the counter that is having less number of customers. What if we know the status of each counter without going near to it, which enables us to choose the counter without reaching them and leads to save our valuable time. Same thing can be applicable at entrance gates also.
Introduction:This project is mainly based on the Bolt IoT Platform. You can get lifetime access of the Bolt Wi-Fi module and Cloud on Amazon.
The primary function of this project is to read the sensor value and turn ON/OFF the LED. If the PIR sensor value is “ZERO” then the Bolt Wi-Fi module will turn-off the LED until the reading of the sensor changes to 1. If the sensor value is “ONE” then it will turn-on the buzzer for alerting the customers who are standing in front of the PIR sensor for no reason. Then it turn-off the buzzer and turn-on the LED with less intensity to state that the status has been updated and the LED glows with full intensity. So, based on the LED indication we can choose the counter with less queue line for billing our groceries. If we place more sensors at different distances from billing counter then there will be more accurate indication of customer flow at each counter.
The secondary function is to send Email to the customers or post in the Telegram channel about the customer flow at Entrance gates of their stores. Basically, this can be helpful at the time of any festive sale. The customers who are not in the premises of the store to check the status of number of customers standing in the queue line can check in the telegram channel of the store. VIP customers can get update through Email also. So, that the customers can manage their time to visit the stores for shopping.
Steps for Building the Circuit :- Take one LED and 330 ohm resistor. With the help of breadboard which is provided in Bolt IoT kit, make the connections as shown in figure. Make sure that longer leg(Positive terminal) of LED is connected to resistor and Negative leg of LED remains at other end as ground.
- Now add buzzer for alerting the people who were blocking the PIR sensor without any reason. Make sure to connect the shorter leg of buzzer to the ground.
- Next we should add PIR sensor to the circuit as shown in below figures. But for PIR sensor there are total 3 terminals (Vcc, GND, Output) so we should make use of jumping wires.
- Now take the Bolt Wi-Fi Module and connect as per the schematic diagram using jumper wires as given below.
STEP 1 : Create Bolt Cloud account
1.Log-in to BOLT cloud using the link www.cloud.boltiot.com
2.Click on “Sign Up” option and fill all the credintials
3.Click on “Register”
4.Now confirm your mail and Click on “Get started”
STEP 2 : Link the Bolt Wi-Fi module to the cloud
1. Download Bolt IoT app and install it in your Mobile phone, which will be available in Play store.
2. Login using the same Bolt Cloud credentials and link your module to the cloud by following the instructions given in application.
- You can find this in https://trainings.boltiot.com
After Completion of the above steps, you must create the product.
Creating the Product :
- Click on the Product icon at the side bar to configure your device.
- Click on Add product, Give the product name as Customer_Flow and also select “Input devices” and “GPIO” and Click “Done”.
- Now make the Hardware settings as shown in the Fig, Do not forget to give variable name as “pir” for 0 Digital pin as shown.
- Now click on code and choose js(java script). Give name as "customer_flow" and write the code.
setChartLibrary('google-chart');
setChartTitle('Customer flow');
setChartType('barGraph');
setAxisName('time_stamp','pir');
setAnimation(true);
setCrosshair(true);
plotChart('time_stamp','pir');
- After saving the code, Link the device as shown below. You will get online indication only if your device is powered ON using the Micro USB cable.
- Also make sure that both blue and green lights are in ON condition.
- Now view the device ouput by clicking on "Actions" button, The output graph will be as shown below. Here the output value becomes high only when there is a person standing in front of Pir sensor at that particular time.
- Enable the Bolt API in the API Section which can be used in Ubuntu for controlling device without the help of Cloud.
1.Click the API Section in Bolt cloud
2.Enable the API Key
3.Generate the API key
2. Ubuntu Server :DOWNLOAD AND INSTALL THE VMWARE WORKSTATION AND UBUNTU SERVER USING THE GIVEN LINKS
https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_workstation_player/12_0
http://releases.ubuntu.com/16.04/ubuntu-16.04.6-server-i386.iso
INSTALL THE UBUNTU PACKAGES :
sudo apt-get -y update
sudo apt install python3-pip
sudo pip3 install boltiot
3. Telegram API:Create telegram channel
- Go to the home screen of TELEGRAM app.
- Swipe from the left side to reveal the menu.
- Click on “New Channel”.
- In the next screen put channel as public and give a name to the channel and the link as shown below.
- Now searh for Bot Father using search bar and create new bot by typing "/start"
- Here name the bot as "NoWait alert Bot" and Bot user name as “lesswait alert_bot’
- Note down the bot token which is most important one to connect with device and application.
- Now make the Bot as an admin to the channel. For this click on add admin shown below.
- Search the bot using Bot name and make it as Admin. Make sure to give the admin Rights as shown below.
- As shown below, Bot had became Admin now.
Using this link https://www.mailgun.com, you can create mailgun account by following the instructions.
Write PYTHON Code In Ubuntu :Login to ubuntu and do the following steps.
- Create a new file in python library to hold our configurations.
- Connect to UBUNTU Os and type the “sudo mkdir waiting_line”
- Type “cd waiting_line” to move into folder
- Create a python file in the folder as “sudo nano waiting_line.py”
- Add the following code :
1. You can find 'API Key' and 'Device Id' in Bolt IoT Cloud platform
2. In Telegram you can find 'chat Id' and 'Bot Id'.
3. Mailgun API key, Sender Email and Sandbox URL can be found in your Mailgun account.
- In the above code, “get_sensor_value_from_pin()” is function that declared to return the sensor value from selected pin.
- The line “mybolt.digitalRead()” returns the value of that pin.
- The response returned from the pin by the Bolt Cloud needs to be converted into JSON for ease of use.
- “data= json.loads(response)” converts response from cloud to JSON object
- If the cloud returns 1 then the request was made successful
- If anything else from 1 means request has failed.
Now send a request to Telegram to send a message to the channel that we had created before using the function, as shown below.
- As shown above the function “send_telegram_message()” is used to send message via telegram. For which Url with bot id is given.
- Here we need to make HTTP request to telegram server. So, we make use of Url. The “POST request” which contains all the data like Url and data to be contained in the request is used here.
- Here the status of the request is stored in “ok ” field as True or False
- Here the count = 0 is used to make the count of reading taken by sensor.
Now there will be no errors as we had checked for errors using Try – Except block.
Code for getting sensor value and executing according to the conditions :
We used While loop to run this code infinite times. To stop the execution while running, we have to use CNTRL+C button.
- I had used mybolt.digitalRead(‘0’) as I had connected the PIR sensor to GPIO-0 pin.
- Ifcondition is used in the above code is to figure out any Error.
If Sensor value is equal to ‘ZERO’ then there will be no person standing in front of the sensor which shows the less customer flow.
- In the above code, mod function is used to send the status of the current flow via Email and Telegram one after the other.
- If mod >0 condition is used to send the Email to the customers when the reading sensor value is 0 for odd number of time. For 1st, 3rd, 5thand so on.
- Similarly if it is Even number of time like 2nd, 4th, 6th and so on. Telegram post will be sent.
- Also for the situation like billing counters which I had discussed earlier. The indication of less customer flow was shown by turning off LED and Buzzer.
If Sensor value is equal to ‘ONE’ then there will be some persons standing in queue, which shows customer flow.
- If sensor value is 1 then it sends Email and Telegram as mentioned above.
- To indicate the confirmed customer flow, LED will start glowing with 100 intensity. After time sleep it glows with full intensity.
Advantage of Buzzer :Here buzzer is used to alert any person who is standing infront of pir sensor with out any cause. So, that they can move aside and the next reading of the PIR sensor will be “zero”. By which customer can be intimated with Emial or Telegram.
Applications of the Project :
1.At Billing Counters
2. At Entrance Gates whenever there is a festive sale:
3. Can be used as Smart calling bell system also.
SCHEMATIC DIAGRAM OF THE PROJECT:
BLACK WIRE – GROUND
RED WIRE – 5V SUPPLY
YELLOW – GPIO 0 Pin
PURPLE – GPIO 1 Pin
BROWN – GPIO 2 Pin
- If there is more customer flow at billing Counters, you will be notified by glowing LED as shown below
- If there is more customer flow in front of Entrance gates during festive sale and you notified via Email.
- If there is low customer flow in front of Entrance gates during festive sale and you notified via Email.
- Telegram channel posts are as shown in below.
SMART INDICATOR OF CUSTOMER-FLOW IN QUEUE [Demonstration Video]
Comments