The main objective is to reduce loss in revenue due to delayed shelf-restocking (when product is in-stock in the store but not stocked on the shelf) and inaccurate forecasting (under-estimating future product sales) practices. The result is to demonstrate inventory automation using ECIS system by enabling the means to monitor and track store inventory in real-time, perform data analysis remotely in cloud, improve shopping experience for the consumers and increase revenue for the retailers in the retail industry. Machine Learning code can be found on my GitHub: https://github.com/priyankkalgaonkar

Dependencies:   mbed

ECE 53301: Wireless and Multimedia Computing Final Project Report – Group 1

Inventory Automation Using Electronically Connected Intelligent Shelves.

Code Developed by: Priyank Kalgaonkar.

Department of Electrical and Computer Engineering, Purdue School of Engineering and Technology at IUPUI.

Submitted as partial fulfillment for the requirement of Fall 2019 - ECE 53301-26877: Wireless and Multimedia Computing course.

Date of Submission: December 12, 2019.

Committer:
priyank12p
Date:
Thu Dec 12 01:04:52 2019 +0000
Revision:
0:b0c4c25d37ab
Initial Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
priyank12p 0:b0c4c25d37ab 1 /* Copyright (c) 2013 Prabhu Desai
priyank12p 0:b0c4c25d37ab 2 * pdtechworld@gmail.com
priyank12p 0:b0c4c25d37ab 3 *
priyank12p 0:b0c4c25d37ab 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
priyank12p 0:b0c4c25d37ab 5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
priyank12p 0:b0c4c25d37ab 6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
priyank12p 0:b0c4c25d37ab 7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
priyank12p 0:b0c4c25d37ab 8 * furnished to do so, subject to the following conditions:
priyank12p 0:b0c4c25d37ab 9 *
priyank12p 0:b0c4c25d37ab 10 * The above copyright notice and this permission notice shall be included in all copies or
priyank12p 0:b0c4c25d37ab 11 * substantial portions of the Software.
priyank12p 0:b0c4c25d37ab 12 *
priyank12p 0:b0c4c25d37ab 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
priyank12p 0:b0c4c25d37ab 14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
priyank12p 0:b0c4c25d37ab 15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
priyank12p 0:b0c4c25d37ab 16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
priyank12p 0:b0c4c25d37ab 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
priyank12p 0:b0c4c25d37ab 18 */
priyank12p 0:b0c4c25d37ab 19
priyank12p 0:b0c4c25d37ab 20
priyank12p 0:b0c4c25d37ab 21 #include "hcsr04.h"
priyank12p 0:b0c4c25d37ab 22
priyank12p 0:b0c4c25d37ab 23
priyank12p 0:b0c4c25d37ab 24 HCSR04::HCSR04(PinName TrigPin,PinName EchoPin):
priyank12p 0:b0c4c25d37ab 25 trigger(TrigPin), echo(EchoPin)
priyank12p 0:b0c4c25d37ab 26 {
priyank12p 0:b0c4c25d37ab 27 pulsetime.stop();
priyank12p 0:b0c4c25d37ab 28 pulsetime.reset();
priyank12p 0:b0c4c25d37ab 29 echo.rise(this,&HCSR04::isr_rise);
priyank12p 0:b0c4c25d37ab 30 echo.fall(this,&HCSR04::isr_fall);
priyank12p 0:b0c4c25d37ab 31 trigger=0;
priyank12p 0:b0c4c25d37ab 32 }
priyank12p 0:b0c4c25d37ab 33
priyank12p 0:b0c4c25d37ab 34 HCSR04::~HCSR04()
priyank12p 0:b0c4c25d37ab 35 {
priyank12p 0:b0c4c25d37ab 36 }
priyank12p 0:b0c4c25d37ab 37
priyank12p 0:b0c4c25d37ab 38 void HCSR04::isr_rise(void)
priyank12p 0:b0c4c25d37ab 39 {
priyank12p 0:b0c4c25d37ab 40 pulsetime.start();
priyank12p 0:b0c4c25d37ab 41 }
priyank12p 0:b0c4c25d37ab 42 void HCSR04::start(void)
priyank12p 0:b0c4c25d37ab 43 {
priyank12p 0:b0c4c25d37ab 44 trigger=1;
priyank12p 0:b0c4c25d37ab 45 wait_us(10);
priyank12p 0:b0c4c25d37ab 46 trigger=0;
priyank12p 0:b0c4c25d37ab 47 }
priyank12p 0:b0c4c25d37ab 48
priyank12p 0:b0c4c25d37ab 49 void HCSR04::isr_fall(void)
priyank12p 0:b0c4c25d37ab 50 {
priyank12p 0:b0c4c25d37ab 51 pulsetime.stop();
priyank12p 0:b0c4c25d37ab 52 pulsedur = pulsetime.read_us();
priyank12p 0:b0c4c25d37ab 53 distance= (pulsedur*343)/20000;
priyank12p 0:b0c4c25d37ab 54 pulsetime.reset();
priyank12p 0:b0c4c25d37ab 55 }
priyank12p 0:b0c4c25d37ab 56
priyank12p 0:b0c4c25d37ab 57 void HCSR04::rise (void (*fptr)(void))
priyank12p 0:b0c4c25d37ab 58 {
priyank12p 0:b0c4c25d37ab 59 echo.rise(fptr);
priyank12p 0:b0c4c25d37ab 60 }
priyank12p 0:b0c4c25d37ab 61 void HCSR04::fall (void (*fptr)(void))
priyank12p 0:b0c4c25d37ab 62 {
priyank12p 0:b0c4c25d37ab 63 echo.fall(fptr);
priyank12p 0:b0c4c25d37ab 64 }
priyank12p 0:b0c4c25d37ab 65
priyank12p 0:b0c4c25d37ab 66 unsigned int HCSR04::get_dist_cm()
priyank12p 0:b0c4c25d37ab 67 {
priyank12p 0:b0c4c25d37ab 68 return distance;
priyank12p 0:b0c4c25d37ab 69 }
priyank12p 0:b0c4c25d37ab 70 unsigned int HCSR04::get_pulse_us()
priyank12p 0:b0c4c25d37ab 71 {
priyank12p 0:b0c4c25d37ab 72 return pulsedur;
priyank12p 0:b0c4c25d37ab 73 }
priyank12p 0:b0c4c25d37ab 74
priyank12p 0:b0c4c25d37ab 75
priyank12p 0:b0c4c25d37ab 76
priyank12p 0:b0c4c25d37ab 77 /*******************************************************
priyank12p 0:b0c4c25d37ab 78 Here is a sample code usage
priyank12p 0:b0c4c25d37ab 79 *********************************************************
priyank12p 0:b0c4c25d37ab 80 #include "hcsr04.h"
priyank12p 0:b0c4c25d37ab 81 HCSR04 usensor(p25,p6);
priyank12p 0:b0c4c25d37ab 82 int main()
priyank12p 0:b0c4c25d37ab 83 {
priyank12p 0:b0c4c25d37ab 84 unsigned char count=0;
priyank12p 0:b0c4c25d37ab 85 while(1) {
priyank12p 0:b0c4c25d37ab 86 usensor.start();
priyank12p 0:b0c4c25d37ab 87 wait_ms(500);
priyank12p 0:b0c4c25d37ab 88 dist=usensor.get_dist_cm();
priyank12p 0:b0c4c25d37ab 89 lcd.cls();
priyank12p 0:b0c4c25d37ab 90 lcd.locate(0,0);
priyank12p 0:b0c4c25d37ab 91 lcd.printf("cm:%ld",dist );
priyank12p 0:b0c4c25d37ab 92
priyank12p 0:b0c4c25d37ab 93 count++;
priyank12p 0:b0c4c25d37ab 94 lcd.locate(0,1);
priyank12p 0:b0c4c25d37ab 95 lcd.printf("Distance =%d",count);
priyank12p 0:b0c4c25d37ab 96
priyank12p 0:b0c4c25d37ab 97 }
priyank12p 0:b0c4c25d37ab 98 */