Project – IOT Shopping List

Project – IOT Shopping List

Are you looking for some interesting IOT projects? That’s what you need!! In this Tutorial you will learn how to make an IOT Shopping List!

Introduction to the IOT Shopping List

First of all I think that someone could think something like “IOT shopping list?!?! What do you mean?!”. I mean that this project is about making a shared shopping list on you smartphone. You can share the list with your friends, family…and whoever you want!!

Let’s make some example so that you can really understand the power of this project and how it works:

  • You can share the shopping list app with your friends.
  • Each person can add something to the list with the app that you shared. Everyone will see the new element in the list.
  • When someone adds something to the list everyone will recive a notification from the app.
  • When someone buys something from the list, he can cancel the element from the list.
  • It even works if you are not connected to the same WiFi of the boards. It works also if you use your mobile connection (such as 3G, 4G…all of this you just need internet connection).

How Can you use it?

  • Shopping list for the family: milk, bread, biscuits….
  • Shopping List with your friends for a party.
  • List of presents to make to someone.

What do you need?

You think that is a great project? Yes of course! For that reason you want to know what you need to make it! Let’s see:

That’s all…awesome!

How it Works?

We yet explained it’s functionalities, but maybe you want to know how it works.

So first of all you have to upload my code on the WeMos D1 mini board. (if it’s the first time you use that board don’t worry, I have a guide for you!)

Then make the app on Blynk as I will explain to you.

The Blynk app will be connected to the Blynk server. So when you do something on the app, it will be sent to the Blynk Server and then to the WeMos D1 mini connected to your WiFi at home.

We Don’t Need schematics for this Prjects!!

Just plug the WeMos board to your Computer.

Sketch

/*Code from Gate On Mechatronics, visit our Website for all the tutorials!
www.gatetronics.com */

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "your Token";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "network name";
char pass[] = "password";


const int nMax = 50;
int indice = 0;
String textIn[nMax];
String markedVector[nMax];


WidgetTable table;
BLYNK_ATTACH_WIDGET(table, V1);

void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  Blynk.virtualWrite(V1, "clr");


  table.onSelectChange([](int index, bool selected) {
    Serial.print("Item ");
    Serial.println(index);
   // Serial.println(selected ? "marked" : "unmarked");
    markedVector[index]=(selected ? "marked" : "unmarked");
    for(int i=0; i<indice; i++)
    {
      Serial.println(markedVector[i]);
    }
  });
}

void loop()
{
  Blynk.run();
}

BLYNK_WRITE(V0) 
{
  bool uguali = false;
  for(int i=0; i<indice; i++)
  {
    if(textIn[i] == param.asStr())
    {
      uguali = true;
    }
  }
  if(!uguali)
  {
    textIn[indice] = param.asStr();
    Blynk.virtualWrite(V1, "add", indice, textIn[indice], 0);
    markedVector[indice]="marked";
    indice++;

    //The message that you want to share with other people that share this app with you
    Blynk.notify("E' stato aggiunto un nuovo elemento alla lista della spesa!");
  }
}

BLYNK_WRITE(V11) {
  String temp[indice];
  int count=0;
  
  if(param.asInt()) 
  {
    for(int i=0; i<indice; i++)  
    {
      if((markedVector[i]=="marked"))
      {
        temp[count]=textIn[i];
        count++;
      }
    }

    for(int i=0; i<indice; i++)
    {
      markedVector[i]="marked";
    }
    
    table.clear();
    
    for(int i=0; i<count; i++)
    {
      textIn[i]=temp[i];
    }
    indice = count;
  }
    for(int i=0; i<indice; i++)
    {
      Blynk.virtualWrite(V1, "add", i, textIn[i], 0);
    }
}

/*Code from Gate On Mechatronics, visit our Website for all the tutorials!
www.gatetronics.com */

Blynk App

I will show you which widget you have to add and the settings of each widget.

Add a:

  • Button with this settings.
Blynk widget settings
  • Notification with this settings.
Blynk widget settings

  • Table with this settings.
Blynk widget settings
  • Text Input with this settings.
Blynk widget settings
  • You will have something like this.
Blynk widget settings

Try the code. Upload the code on the WeMos board and press the start button in blynk app (in the up-right).

Then if you want to share the app with other people:

Shared Acces -> ON

Generate Link and share the link with who you want!

Blynk widget settings

That’s all!! Hope you will enjoy this IOT Shopping List!

Davide Busco

Davide Busco is an engineering student at Federico II University of Naples. He uses his passion and studies to create his projects. He loves be a maker and spread his knowledge. Moreover he has gained the second place in a national makers-tournament between Italian's Universities.

2 thoughts on “Project – IOT Shopping List

Leave a Reply

Your email address will not be published. Required fields are marked *

en_GBEnglish (UK)
it_ITItaliano en_GBEnglish (UK)
%d bloggers like this: