Make your Own Smart AI Chatbot Using Speech Recognition

Make your Own Smart AI Chatbot Using Speech Recognition
Smart ChatBot Thumbnail
ABOUT THIS PROJECT

We will make the chatbot that will recognize your speech and convert it into text using PictoBlox’s Speech Recognition Extension and then answer your questions accordingly.

Introduction

You must have used a chatbot at least once in your lifetime to ask a question on a website or maybe just to have fun! Today, we’re going to make one of our own.

We will first enter a few questions and their answers. Then, when the chatbot runs, it will recognize your speech and convert it into text using PictoBlox’s Speech Recognition Extension and then answer your questions accordingly.

Building Guide

Step 1: Prerequisites to make the Chatbot

You’ll need the following things to make the toy recognizer:

  1. A laptop or a computer with a camera
  2. The latest version of PictoBlox
  3. A good Internet connection.

Step 2: Setting Up the Project

Let’s begin by adding the Artificial Intelligence and Text to Speech extension. Follow the steps below to add the extension:

  1. Open PictoBlox.
  2. Click on Board and select evive.Selecting board
  3. Next, click on the Add extension button. You need to keep two things in mind while working with this extension:
    1. You need to log in to your PictoBlox account to use it.
    2. That your computer is connected to the internet.
  4. Select the Artificial Intelligence Extension.Artificial Intelligence extension
  5. Next, let’s add the Text-to-speech extension. This extension lets you convert the Audio into a text message. Click on the Add extension button again and scroll down till you find the text-to-speech extension.Text-to-Speech Extension

Step 3: Setting Up the Stage

Now, let’s set up the Stage by adding the Sprite and the Backdrop.

  1. Let’s begin by adding Abby, the sprite which will be the character of our chatbot to our project,
  2. Click on Choose a Sprite button.Adding New Sprite
  3. Select Abby from the library.Abby
  4. When Abby’s added, remove the Tobi’s sprite.
  5. Now, let’s add a good backdrop. Click on the Choose a Backdrop button and choose Boardwalk backdrop from the library.Broadwalk backdrop

You can add any sprite or backdrop of your choice.

Step 4: Writing the Script for AI Chatbot

Follow the steps below to write the script.

As we want to execute the program every time the green flag is clicked, thus place the when flag clicked hat block into the scripting area from the Events palette.when flag clicked

Introducing each other

Now to get the user familiar with our Chatbot, we will introduce Abby to the user and ask for the name of a user to add a personalized touch to it

  1. Thus, get a speak () block from Text to Speech palette. This block converts any text written in white space to audio form to be played on your PC/laptop speaker.
  2. Write “Hello, I am Abby your friend!” to introduce Abby to the user.
  3. Again add a speak () block and ask for the user’s name Write ”What is your name? ” into space given.
  4. This block will not store the user’s name for us. Thus, for storing users name we need to add more blocks. Get recognize speech for () secs in () block from the artificial intelligence extension blocks. This block records audio and sends it to the web to decode and convert the speech into the text form.
  5. Its result i.e the user’s name is stored in the speech recognition result block.
  6. Now to use the name in further communication we will store it in a variable. Go to the Variables tab, click on Make a New Variable and make a String type variable named “Name” to store the name of the user.
  7. Get a set () to () block from the Variables palette, select Name from the drop-down, and add speech recognition result inside it.
  8. Now to make our chatbot welcome users get a speak () block. Place a join () () block inside it from the Operators palette. Write “Welcome ” into the first space of the join block. And add the Name reporter block into the second space.

Chatting Up the Bot

  1. To continuously chat with our chatbot, we will add in a forever block from the Controls block palette below the speak block.
  2. Now we will first prompt the user to ask a question. To do so, get a speak () block and add a join () () block in it.
    evive Notes Icon
    Note: We will always add a join block, to make Abby say the user’s name.
  3. Write “What’s on your mind ” into the first space of the join block. And add the Name reporter block into the second space.
  4. Now to again recognize the user’s questions, we will add the recognize speech for () secs in () block from the artificial intelligence palette to record whatever the user is speaking.

Adding the Questions and their Answers

Chatbot normally answers the predefined questions fed in it. Thus, now, we will be adding common questions which if matched chatbot can reply with the respective answer.

  1. Now get an if-else block from Controls block palette to check if recognized speech matches the question.
  2. Inside the if arm, we will add an () = () block to check result.
  3. Now into the first blank space of equal to block, place, the speech recognition result block, and type in the question ” Who am I? ” in second space.
  4. We will want our chatbot to reply as “You are and the name of the user”. Thus, get a speak () block from the text-to-speech palette into the if portion and add a join () () block inside it from the operator’s block palate.
  5. Write “You are ” into the first space of the join block. And add the Name reporter block into the second space.
  6. Similarly, I’ll be adding a few sample questions, you can add the questions and answers according to your choice.
  7. Duplicate the if arm and place it below the else arm.
  8. We will edit out the contents with appropriate questions and their answers.
  9. You can add in as many questions as you want.

Making Chatbot do Something Extraordinary

Apart from playing around with simple questions and answers, you can even add some special features to your chatbots such as celebrate bday, crack jokes, make it play a song, and much more. We will be making one such custom event for Bday.

  1. Duplicate the if-else block as we did previously and change the question portion with the statement ” It’s my birthday”.
  2. Now when the speech matches, we will change the backdrop to the birthday theme. Thus, add in the Party backdrop from the add backdrop option.
  3. Place the switch backdrop to () block from Looks block palette and choose party from the drop-down.
  4. Now to wish the user get a speak () block and add a join () () block inside it inside the first space write “Happy Birthday ” and add the Name reporter block into the second space.
  5. Now, to play the birthday song, go to the Sounds tab from the top and click on choose a sound button. And the Birthday sound.
  6. Come back to the script.
  7. From the sounds block palate, add play sound until done block below the speak block and choose birthday from the drop-down.

Adding the Default Case

Now, let’s add the default case, if the recognized result does not match any predefined questions then we will make Abby say “Sorry! I don’t understand it yet.”

Add a speak () block into the last else arm of the question and write “Sorry! I don’t understand it yet.”.

Making Abby Talk

Now to make chatbot look more realistic we will be making one small script.  This script will make the character move its face and hands to make Abby look like she is talking.

  1. First, get one more when the flag is clicked block and add the forever block below it.
  2. Now from the looks block palette get a next costume block.
  3. Now to make costume switch visible place a wait () block from Controls block palette and add the wait time of 0.5 seconds.

With this, your script is ready just click on the flag button to start chatting with a chatbot.

 

 

 

Code

DESCRIPTION DOWNLOAD CODE
Smart Chatbot A Download

Virtual Doctor Using Natural Language Processing Extension in PictoBlox

Virtual Doctor Using Natural Language Processing Extension in PictoBlox

Table Of Content

Introduction

You feel a little unwell, who do you tell your symptoms first? (Except mom.) Google! Yes, you google the symptoms, find what is the thing that has made you unwell, and then you move on to find a remedy for the same.

In this project, we are going to make a virtual doctor using the NLP extension. You need to tell your symptoms to him and he will tell you what caught you and what shall you do next.

Wonder how will the virtual doctor figure the disease as many have a couple of symptoms same. Using NLP!

So let’s begin by understanding what NLP is.

Components Required

IMAGE COMPONENT QUANTITY AVAILABLE IN KIT
PictoBlox Download NOW

Building Guide

Step 1: What is NLP?

NLP stands for Natural Language Processing.

This is the area of AI concerned with the interaction between computers and humans in natural language. The aim of this extension is to help computers understand language as well as we do.

Along with the NLP Extension, there are a lot of new features added to the latest version of PictoBlox. You may need to download PictoBlox or update it to use the latest features.

Step 2: Setting the Stage for the Virtual Doctor

Open PictoBlox.

Let’s begin by setting up the stage.

  1. Delete Tobi’s Sprite.
  2. Click on Upload Sprite Button and upload the Doctor Sprite.Doctor Sprite
  3. Go to the Backdrop Palette, add the Blue Sky backdrop from the library.
  4. To get the hospital on the stage, Upload the image of hospital as the backdrop.Hospital Sprite
  5. You may find the one backdrop of Blue Sky and one of the hospital. Copy the hospital image and then paste it into the backdrop of Blue Sky.
  6. Adjust the placement of the hospital and doctor according to your choice.
  7. The final stage will look like this:Setting the stage for Virtual Doctor

You can download the sprites of doctor and hospital from here.

Step 3: Training the Text Classifier

Now that we have set the stage. Let’s begin by training the text data for diseases. We need to train PictoBlox to analyze the text and perform the corresponding action.

Add text data in classes

We will first add data i.e the symptoms for three diseases, COVID-19Malaria, and Diabetes one-by-one.

  1. Go to the My Blocks palette and create a block named Data for COVID-19.Text Classifier
  2. To make the text classifier, we need the Natural Language Processing extension. Add the Natural Language Processing extension from the extension library.
  3. Take the Data for COVID-19 hat block and drop an add () as () block below it.
  4. In place of text in the add () as () block, write the first command, “Dry Cough”. In place of class, write “COVID-19”. COVID-19 will be the name of the class.text classifier
  5. We’re going to give the classifier three more symptoms to add to our class. You can add many as you may find. Duplicate the add () as () block and write the rest of the symptoms in them.text classifier
  6. Now, we similarly need to add text training blocks for the other two diseases too.text classifiertext classifier

Training the Classifier

Now that we have added data in classes, we need to train our classifier.

  1. Create a block named Train Data.
  2. Take the Train Data hat block and add a reset text classifier block below it from the Natural Language Processing palette.reset text classifier block in NLP
  3. Add the Data for COVID-19, Data for Malaria, and Data for Diabetes stack blocks one after the other.
  4. Add a train text classifier block.Train text classifier block
  5. The script will look like this:Training Classifier using NLP

With this our text classifier for our virtual doctor is trained, it’s time to bring it into action.

To get step-by-step training for AI and ML, you can look into the Online Course for Artificial Intelligence for Kids.

Step 4: Final Script for the Virtual Doctor Using NLP

Let’s begin to write the script that to make the virtual doctor say the name of the disease we have after we tell him our symptoms.

  1. Add a when flag clicked hat block to run the script when the green flag is clicked.
  2. Drop the Train Data stack block below it.script for virtual doctor using NLP
  3. Let’s make the doctor greet us. Add a say () for () seconds block from the Looks palette. Write “Hello! Welcome to the virtual hospital” in the first space given.
  4. Next, we’ll want the doctor to ask the symptoms, thus from the Operators palette, add a ask () and wait block. Write “How are you feeling today? Please tell me your symptoms.” in the space given.Virtual doctor using NLP
  5. Here is when we will write the symptoms and the doctor will tell us the remedies for the same. Place an if () block into the scripting area.
  6. Add an () = () block from the Operator palette.
  7. Inside the first space of the () = () block, drop a get class of () block. In the second space, write “COVID-19”.Get class of block
  8. Inside the get class of () block, drop a answer block from the Sensing palette.
  9. This will check the symptoms you enter with the text data, and if they match with COVID class, the doctor will say out the disease as COVID-19.
  10. matching the symptom entered by patient with the train dataInto the if () arm place a say () for () seconds block.
  11. Place join () () block from the Operator palette.
  12. Write “You are infected with  ” in the first space. Add another join block in the second space. Drop a get class of () block into the first space of the second join block and write “.” to complete the statement in the second space. Inside the get class of () block, drop an answer block from the Sensing palette.Diagonising the dieases
  13. Now that we got to know the disease, doctor will say the remedy for the same. Place a say () for () seconds block from the Looks Palette and write the remedies into it. If you need to write more remedies, you can use another say block too.COVID diagonized and remedy
  14. With this diagnosis of COVID is done, we will now follow similar steps for Malaria and Diabetes. Duplicate the if block and make the changes respectively.Malaria diagonized and remedyDiabetesdiagonized and remedy
  15. With this our script is complete.Virtual doctor using NLP in PictoBlox

Press the green flag to start the script.

Step 5: Conclusion

To escalate the project instead of typing your symptoms you can use speech recognition blocks to recognize your voice and then diagnosis the diseases.

Code

DESCRIPTION DOWNLOAD CODE
Virtual Doctor Using NLP Download

Face-Recognition based Attendance System using Micro: bit

Face-Recognition based Attendance System using Micro: bit
Face Recognition Based Attendance System Using Micro: bit
ABOUT THIS PROJECT

Learn how to make Attendance System Based on Face-Recognition in PictoBlox using Micro: bit.

PROJECT INFO

Introduction

You might have seen a couple of attendance Systems around, but the one that we are going to make today is one-of-its-kind. In this project, we’re going to show you how to make a face recognition-based attendance system in PictoBlox AI using micro: bit.

We will use one of the buttons on micro:bit, i.e. button B to feed a new image into our system. To scan a face, we will use the other button – button A. Once the system matches the face detected with the sample image, it will display the name of that person on micro:bit’s LED matrix. and add the time stamp into an excel sheet.

Let’s begin.

 

Building Guide

Step 1: Prerequisites

To make this attendance system all you need is:

  1. A laptop or a computer
  2. Camera/Webcam
  3. The latest version of PictoBlox (Download the latest version from here)
  4. A good Internet connection.
  5. Micro: bit
  6. USB cable

Step 2: Setting Up the Project

  1. Open PictoBlox.
  2. To work with the latest extensions you need to keep two things in mind.
    1. That your computer is connected to the Internet
    2. You need to login to PictoBlox.
  3. Click on the Add Extension button and choose Face Detection extension and wait for a little while till the models get loaded.Face-detection Extension
  4. Now to log the timestamp of attendance, we need to add the Data Logger extension.
  5. Click on the Add Extension button again and choose Data Logger from the list. This extension lets you generate a CSV file according to your requirement and store data in it.data logger extension

Connecting the micro: bit with the computer:

  1. Connect your micro: bit using the USB cable to the laptop. Now, install the Scratch link from here.
  2. Click on the connect button and select the appropriate device.

Step 3: Setting Up the Stage

  1. Let’s first set up the stage. Click on the choose a backdrop button and select the backdrop of your choice. Here we will be using the blue sky backdrop for the same.
  2. Now, on pressing the green flag, the default backdrop that is the Blue sky backdrop should come, thus, place when flag clicked hat block from the Events palette and place switch backdrop to block below it. Make sure that Blue Sky is selected from the backdrop.
  3. Also, we first need the camera to be turned OFF, thus, from the Face detection palette, use the turn on video on stage with 0% transparency block and choose OFF from the dropdown menu.Setting Up the Project of Attendance System
  4. Now, we will make Tobi give instructions to the user.
  5. Thus, place a say block from the Looks palette.
  6. To mark the attendance, we need the user to press the Button A on the micro: bit. Thus write “Please press Button A to mark the attendance” in the space given.
  7. Now, to instruct the user to press Button B to feed the face, duplicate the say block and write “Please press Button B to mark the attendance” in the space given.Setting Up the Project of Attendance System
  8. Now we will create a new file to store the attendance data. From the logger palette, choose a create block we will give it a name “Attendance 2020”.

The final script looks like this:

Setting Up the Project of Attendance System2

 

Step 4: Making the Attendance System Store the Image

We will first write the script to store the sample images of whose attendance we need to track. Thus, let’s first recognize the image from the camera feed and store them in the computer’s memory. As soon as we Button B on the micro: bit the data should be stored on the computer’s memory.

  1. Thus, from the micro: bit palette drag and drop when the B button pressed block.Feeding the Face into the System
  2. To analyze the images from the camera, we need the camera to be ON. Thus, from the face detection palette, place a turn on video on stage with 0% transparency block.
  3. Next, we will make Tobi say, “Feeding the Face”, thus place a say block from the Looks palette.Feeding the Face into the System
  4. Similarly, we will display “Feeding…” on the LED matrix too, thus, from the micro: bit palette, place display text block and write “Feeding…” in it.display text block of Micro:bit
  5. Next, we will store the images of the user into memory. Thus, from the Face detection palette, place adds class 1 as stage block. Select 1 from the first drop-down and stage from the second. To identify the user as his/her name, write the user name into the space given.Feeding the Face into the System
  6. Once the face is added into the memory, we’ll make Tobi say “Face Added into the Database” using the say block from the Looks palette.
  7. Next, we need to turn OFF the camera and come back to the default backdrop. Thus, from the face detection palette, place a turn on video on stage with 0% transparency block, and choose OFF from the drop-down menu.
  8. Finally, to come back to the default backdrop, place switch backdrop to block from the Looks palette and choose Blue Sky from the drop-downFeeding the Face into the System

With this, the script to enter the face into the memory for our face-based attendance system is completed.Feeding the Face into the System

 

Step 5: Marking the Attendance into attendance system using Micro: bit’s button

  1. To execute the program, whenever the Button A is pressed on the micro: bit, thus, from the micro: bit palette, drag and drop when A button pressed hat block.Scanning the Face
  2. As we want to verify the image from the camera feed, we will make sure that the camera is on, thus add the turn on video block.
  3. Add a delay of 3 secs using the wait block from the controls palette.
  4. We need to match the faces on the stage thus, drag and drop the do Face matching on stage block.do face matching
  5. Now to store the data we will add blocks from the data logger extension. To store the timestamp, place a set the data 1 to block and drag and drop the current timestamp block into the space given. The get current timestamp block contains all the date and time-related information.
  6. Now in the second data, we will store the class of recognized face which contains the name of a person whose face is recognized.
  7. Now that data has been loaded, but to permanently save the data onto the file we need to use the save data block.
  8. Now, if the faces are matched, we need to print the name of the user on the LED matrix, thus, from the micro: bit palette, place display text block and drop the get class of face detected block in the space given.get class of face blockdisplay text bloc
  9. Also, we would like Tobi to inform the user that the Attendance is marked and greet. Thus, place a say block from the Looks palette and write Attendance Marked in the space given.
  10. Now to greet the user we want Tobi to say welcome along with the user’s name.
  11. Thus, from the Operators palette, place a join block, write “Welcome “ in the space in the first join block, drag and drop another join block into the second input. Place get class of face detected in the first input of the second join block and write “ !” in the second input of the second join block.Storing the Face into the Sheet
  12. Finally, let’s switch the backdrop to the default. Thus, place switch backdrop to and choose Blue Sky from the drop-down menu.Storing the Face into the Sheet

With this the script of our face-recognition based attendance system is complete.Scanning the Face

 

 

Code

DESCRIPTION DOWNLOAD CODE
Face Recognition Based Attendance System Using Micro: bit Script Download

DIY Mini Safe Locker Using Servo

DIY Mini Safe Locker Using Servo
DIY Mini Safe Locker Using Servo
ABOUT THIS PROJECT

Make your own DIY mini-safe locker using components from the evive Starter Kit and control it using evive’s slide switch!

PROJECT INFO

Introduction

A mini safe locker comes in handy when you want to keep your precious little belongings safe but also close to you(r heart). Though the ones used at homes require a) a LOT of metal b) next-level tech, what we’re making is our own version of the DIY mini safe locker that kids can use to keep their cookies safe from their siblings 😉

Components for making this safe locker are available in the evive Starter kit and it can easily be programmed in PictoBlox – our graphical programming software based on Scratch blocks. You can download it from HERE.

Ready for making your own safe locker? Let’s begin!

Components Required

IMAGE COMPONENT QUANTITY AVAILABLE IN KIT
evive 1
PictoBlox 1
Micro Servo Motor with Accessories 1

Building Guide

Step 1: Preparing the Box for the Safe Locker

For making the box for the safe locker, we first need to make a functional safe box that would help us store valuables in it. The box then needs a door, doorknob, and a locking mechanism.

We will start with how to make a safe locker with cardboard, but for now, we are going to make the safe box using the corrugated sheets.

Making the Top and Bottom of the Safe Box:

First, let’s make the top and bottom of the box.

  1. Take a yellow corrugated sheet of 30 cm * 15 cm and make a line at the center of the sheet and
  2. Now cut along the markings we would get two sheets of 15 cm * 15 cm each of which would act as the bottom and top of our safe box.Mini Safe Box making (2)

Making the Sides of the Safe Box:

The next step would be making walls for making the safe locker.

  1. For making the four walls, take a red corrugated sheet of 60 cm * 15 cm.
  2. Mark three lines on a red corrugated sheet at every 15 cm we would now get four equal squares each of these squares of dimension 15 cm*15 cm.Mini Safe Box making (3)
  3. Next, cut through the first layer along all the three lines designed, which makes the sheet easily foldable, thus removing the mess of gluing the walls together to make the wall of the safe box.Mini Safe Box making (4)

Making the Door of the Safe Box: 

We would need a door to access the valuables inside of the safe box.

  1. Thus, mark a square of 10 cm *10 cm inside the last square on the red corrugated sheet on which we have marked the walls.Mini Safe Box making (5)
  2. Cut along the three sides of this 10 cm * 10 cm square, but make sure not to completely cut through the fourth side.
  3. Create a slit on the fourth side through the first layer, this will give the door, a hinge structure to make the opening and closing of the door smooth.Mini Safe Box making (1)

The door is done!

Making the Door Handle

To open and close the door easily we would make a small doorknob or the door handle.

  1. Take a circle master and mark a small circle on a piece of corrugated sheet of approximately 5 cm diameter.Mini Safe Locker Making (2)
  2. Cut out the circular disk for a knob.
  3. Take a straw and cut a 1 cm tube from it for making the shaft of the doorknob.
  4. Take this straw piece and attach it to the doorknob, with this our door handle is ready.Mini Safe Locker Making (3)

Thus, the different components of the Safe box are ready!

Step 2: Designing the Interlocking Mechanism

We are going to use the servo as the main element of our Interlocking mechanism. Where a part of the door gets hooked to the servo horn thus keeping the door of the safe locker closed. Thus, let’s make the structure that will interlock with a servo motor.

  1. Take another small strip of a corrugated sheet of about 10cm * 4cm size and mark the two lines at an equal distance from one another.
  2. Now fold along the markings and by using some hot glue make sure the bends hold its shapes and all the bends are perfectly perpendicular.Mini Safe Locker Making (4)

Once done, keep it aside.

Step 3: Assembling the Mini Safe Locker

We will start assembling the components of the safe box that we have prepared.

  1. Take one of the two yellow 15cm * 15cm sheets which would act as the bottom and now attach the 3 walls of the safe perpendicular to it. Make sure to keep the fourth side open.Mini Safe Locker Making (1)
  2. Also, attach the door handle assembly we have prepared above near the opening edge on the fourth side using the hot glue.Locker Interlocking Mechanism (2)

Step 4: Completing the Interlocking Mechanism

This interlocking mechanism will provide security to our safe locker.

  1. Thus, take the U-shaped piece of corrugated sheet and attach it at the back of the door exactly behind the door handle using hot glue.Locker Interlocking Mechanism (3)
  2. The servo motor acts as the actuator which controls the locking mechanism.

But before attaching servo, we would set the angle to 90 degrees by using the evive firmware menu.

Setting the servo angle

Setting the servo angle has never been this easy, the plug and play feature of evive. Just follow the steps:

  1.  Attach the servo to evive’s servo channel 2Conenction Servo for Mini Safe Locker
  2. Switch ON evive.
  3. From the menu, select Controls
  4. Navigate to Servo
  5. Than select Servo 2
  6. Use potentiometer 2 to set the servo angle to 90°

Disconnect the servo.

Attaching the Servo Motor

Before we attach the servo motor, let’s first attach servo horns to it which will hook the U-shaped structure in it.

  1. Take one single-sided and one double-sided servo horn and fix them both to servo motor using a 20mm servo screw.Locker Interlocking Mechanism (5)
    evive Notes Icon
    Make sure not to disturb the servo angle while attaching the horn.
  2. Attach the servo motor to the door frame using some hot glue such that it interlocks with U- shaped corrugated sheet that we attached on the inside of the door.Locker Interlocking Mechanism (1)
  3. Once done, close the fourth side by applying some hot glue to the edges of the fourth side.Mini Safe Locker Using Servo (2)

With this most of the assembly is done but we need to make sure if our locking mechanism works properly or not before sealing off the top.

Step 5: Checking Whether our Locker Works Perfectly?

Once again, connect the servo motor to the servo channel 2 or s2 channel on the evive.Conenction Servo for Mini Safe Locker

Upload basic PictoBlox code by using the PictoBlox to the evive.

Use the slide switch 1 on the evive to lock and unlock the door of the safebox.

Step 6: Completing the Assembly of the Safe Locker

Now when we are sure that mechanism in our safebox works perfectly as we tried locking and unlocking the safe box. We will close the safebox by attaching the top.

Take the other yellow corrugated sheet of 15cm*15cm and close of the top of the safe locker using some hot glue.Mini Safe Locker Using Servo (1)

With this, the assembly and the connection of the safe box are ready!

Step 7: Writing the PictoBlox’s Code

Our safe locker will be operated with the help of a slide-switch of evive. Let’s write the code in PictoBlox.

  1. The program starts executing forever when evive starts up.
  2. When the slide-switch is pushed up, the servo angle changes to 100° which results in freeing the U-shaped structure which in turn opens the door.
  3. When the switch is at the center position or down position, the servo angle changes to or remains at 0° and the U-shaped structure gets hooked up to the servo horns thus the door remains locked.Safe Locker Code

Step 8: Making the Safe Locker Password Protected

For the advanced version, we will create a code using pictoblox which will help us open and close the locker only after entering a two-digit password for the safebox.

  1. The code, as usual, begins when evive starts up. We will set the password in the code itself.
  2. When slide switch is in the down position we would be allowed to enter the password by using the potentiometer 1 the display would show the entered password in real-time and access status of the door.
  3. As we are going to enter the password using the potentiometer, which gives a value between 0 to 1023 and we need our password to be any number between 0 to 100.
  4. Thus, we are going to use the map function for the same. Once the values are mapped, we need to check whether the slide-switch is up or not and if the value entered by us is similar to the password.map function block
  5. If yes, then the servo angle changes to 100 degrees thus unlocking the door. And “Access Granted” is displayed on evive’s screen.
  6. If no, the servo angle is set to 0 degrees and the door is locked and TFT displays “Access Denied”.Safe Locker Code 2

Step 9: Conclusion

With this, your DIY mini-safe locker is ready!

Circuit Diagram

DESCRIPTION CIRCUIT DIAGRAM
Attach the servo to evive’s servo channel 2

Code

DESCRIPTION DOWNLOAD CODE
PictoBlox Code Download
Password Protected Safe Locker Code Download
Arduino Code for Password Protected Safe Download