Covid Safety Helmet Part 1: an Intro to Tinkercad Circuits!

by TheJetpack in Circuits > Sensors

1614 Views, 12 Favorites, 0 Comments

Covid Safety Helmet Part 1: an Intro to Tinkercad Circuits!

Combined.png

Hello, friend!

In this two-part series, we'll learn how to use Tinkercad's Circuits - a fun, powerful, and educational tool for learning about how circuits work! One of the best ways to learn, is to do. So, we'll first design our very own project: the circuitry for a Covid safety helmet!

Our goal is to create a helmet that will alert you when a person is approaching. That way, you can remain safe from Covid by moving away in order to keep the distance between you and that person.

By the end of this project, you'll have a basic understanding of how to design circuits and program using Tinkercad. Although this may sound difficult, don't worry! I'll be here to guide you along the entire process - just learn and enjoy!

Supplies

  1. All you need is a Tinkercad account!
    Don't have one? Register for free at www.tinkercad.com.

Open Tinkercad

0.png

Login to Tinkercad (or register, if you have't yet).

After logging into the dashboard, go to the left sidebar and select "Circuits".

Afterwards, select "Create new Circuit" (circled in orange). Here, we have the freedom to be creative and design whatever circuits we want. You can also accurately simulate your circuits to see how they'd work in the real world, before you actually build one in real life!

Now, we're ready to begin!

Title Your Project

1.png

After you press "Create new Circuit", you'll be greeted with this empty workspace.

First things first - all of our projects will be saved on our dashboard (from the previous step), so it's important that we name our projects so we can remember and find them later on!

If you look in the top left, there will be a fun random title generated for you. You can click it to replace that title with your own. Here, I titled it "Covid Safety Helmet".

Adding Our Micro:bit

2.png

We'll start our project by adding a micro:bit.

A micro:bit is a small computer that you can learn programming on. It has a ton of cool features such as LED lights, a compass, and customizable buttons!

This micro:bit is what will process all of the information from our sensors (which we will add later on). The micro:bit will also give us that information in an easy way that we can understand.

To add this to our workspace, we'll use the sidebar on the right. Here, you'll find a whole bunch of components that you can use. Let's ignore everything else for now, and search "microbit".

Select the micro:bit, and bring it to the workspace.

Adding Our Sensor

4.png

Now that we have our micro:bit, let's add a sensor. We'll add something called a PIR sensor, which is short for Passive Infrared sensor.

A PIR can detect infrared radiation - or heat. Because humans give off heat but objects such as walls, water bottles, and leaves do not, this sensor can be used to detect when humans are nearby.

Usually, it can "see" up to 5m (16ft) away, which is good because this will allow us to get an early warning when people approach, letting us react before they reach the 2m (6ft) social distancing guidelines.

Understanding the Components

5.png

Now that we have our two parts, how can we connect them together to allow the micro:bit to communicate with the PIR sensor?

It's quite simple on Tinkercad. You may see that there are 3 pins on the bottom of the PIR sensor.

  1. When you hover your mouse over them, you'll see that the first pin is the "Signal" pin, which means that this will give a signal when it detects a person.
  2. The second pin is "Power", which is where we connect a electricity source in order to turn the PIR sensor on.
  3. The third pin is "Ground", which is where all of the "used" electricity will exit the PIR sensor.

------------------------------------------------------------------------------------------------------------------------------------------------------

You may notice that there are also 5 points on the bottom of the micro:bit where wires can connect to. Hover your mouse over them.

  1. The first 3 points are labeled P0, P1, and P2. These points are customizable and they can either take in signals (input) or throw out signals (output). There are many different ways we can use these points because they are highly customizable! More on that later...
  2. The 3V point is a 3 volt electricity source. Remember that our PIR sensor needs an electricity source? Well, we can get that electricity from the micro:bit's 3V point!
  3. The GND point is short for "ground", which is where the electricity can "exit" to after doing it's job. The PIR sensor's ground pin can be connected here.

Connecting the Components

7.png

To connect the pins, first click one pin with your cursor. Then, click a different pin (where you want to connect the first pin to). You'll see that a wire formed! You can click the wire to change its color if you want. Or, you can delete it and retry if it looks messy. Try laying the wires cleanly so you can trace where each wire is later!

After connecting your wires, check to see if it matches what I have. If so, great! If not, no worries! Delete the wires and try again.

You can probably imagine what's going on now. It's a simple loop:

  1. Electricity leaves the micro:bit →
  2. → enters the PIR sensor through it's "Power" pin →
  3. → does some work within the PIR sensor →
  4. → leaves the PIR sensor through its "Ground" pin or "Signal" pin →
  5. → goes to the micro:bit's "Ground" pin or "P0" pin

Simulating Our Circuit (Part 1)

8.png

When we create circuits on Tinkercad, we can also simulate them.

This way, we can experiment to see how our circuit's components may react in the real world, which can help you plan and design circuits without having to do "trial-and-error" and spending time and money on something that may not work!

To simulate our circuit, press the "Start Simulation" button that is found towards the top right...

Simulating Our Circuit (Part 2)

10.png

With the simulation running, we can interact with our circuit.

Click the PIR sensor. A ball will appear. Imagine that this ball is a human. You can click and move that human around.

You may notice that when you move the ball inside the red zone near the PIR sensor, the sensor lights up. If this is true, you've wired everything correctly! When you move the ball out of the PIR's detection zone, the sensor stops lighting up. Play around with it!

You might also notice that when the ball is within the detection zone but it is stationary, the PIR doesn't get activated. This is not a problem because humans move a lot, so the sensor will pretty much always detect people that are near your space.

How about the micro:bit? We already connected the signal wire, so why isn't anything happening?!

Don't worry, this is expected!

Although we connected the signal wire, the micro:bit computer doesn't know what to do with the information that the PIR sensor is giving it. We'll tell it what to do by programming it in the next step.

Codeblock Basics

11.png

Exit out of the simulation, and then click "Code" (next to "Start Simulation"). This will open a new, larger sidebar on the right.

Besides desigining and simulating circuits, we can also program on Tinkercad using Codeblocks. Codeblocks are an easy way to learn about the logic behind programming, which is a great introduction to coding before delving into more advanced languages like Javascript, Python, or C.

Let's begin by familiarizing ourselves with the Codeblock environment. On the left hand side of the Codeblock sidebar, there are blocks of code that you can drag and drop. On the right hand side is your actual code. Try exploring by dragging and dropping some pieces.

Once you are familiar with it, clear the coding space (by dragging the blocks into the trash can on the bottom right) so we can begin adding our code for the circuit.

Programming the Micro:bit (Part 1)

12.png

Let's get started by searching through the "Input" blocks, and dragging "on pin [P0] changed to [High]". This is an input because this will feed the micro:bit information.

Basically, the P0 point (where our signal wire connects) can have two values: high or low. High means that there is a signal, and low means that there is no signal.

If the PIR sensor detects an intruder, would the signal be high or low? If you answered high, you're right! Alternatively, when there is no intruder in the detection zone (or in the ultra-rare case that the intruder is perfectly still), there will be a low electrical signal.

Therefore, the logic behind our code is basically: "when a person is detected, do ____".

Right now, it does nothing because we haven't defined something for it to do (it's blank). So, let's make it do something.

Programming the Micro:bit (Part 2)

15.png

Let's add an output codeblock called "show leds". This codeblock allows us to mess around with the lights on the micro:bit. You can toggle the LED grid to create any design you want. I added a smiley face. This is an output because the micro:bit is giving out information.

Then, let's change the [HIGH] to [LOW] on the input codeblock.

Because we changed the signal from high to low, our code now is saying:

when there is low signal on P0, turn the LEDs on to create a smiley face

This means that when there is no person moving in our detection zone, the micro:bit will show a smiley face because it's safe! =)

Programming the Micro:bit (Part 3)

16.png

We know what the micro:bit will do when there is no person around the detection zone. How about when someone is there?

Let's define that also. Add another input codeblock "on pin [P0] changed to [High]".

This time, we'll leave it as [HIGH] because we're going to use it to do something when a person is detected.

Add another led output, and create a design! I used a frowny face because when the person is in the detection zone, it may be less safe! =(

Testing Our Code

17.png

Run the simulation once more. Move around the ball (aka person) and see how your micro:bit reacts.

If it's not doing what you want it to do, retry the previous step and cross-check your codeblocks with my screenshot. Don't give up! :)

Adding Additional PIR Sensors

18.png

If your code from the previous step functioned correctly, great work! Now, let's advance our project.

So far, we only used one PIR sensor so we can only detect people in one area. What about for the rest of the space around us? We need more sensors!

Close the Code sidebar (by clicking "Code") if it's still open, and search for another PIR sensor. Add it to your workspace and wire it.

Note: Wire this second PIR sensor's signal pin to P1 or P2 (I connected it to P1). Don't connect it to the P0 since that point is already being used by the first sensor. If you do, the micro:bit won't be able to tell which PIR is sending signals!

Although in the Tinkercad workspace I put both PIR sensors facing up (to make the screen cleaner), when you actually attach the PIRs on your helmet, one PIR sensor can be attached facing the left side of the helmet so it scans the area left of you, and the other can be placed on the right side of the helmet to scan the area right of you.

Adding Additional Code for the 2nd PIR

19.png

Open Code once more, and add a second set of codeblocks that are similar to the first. This time, however, click the dropdown on the new codeblocks and select P1 (or P2 if you connected the new PIR to P2).

For the PIR sensor on the left (which is connected to P0), I modified the LED output codeblock so that the left side of the LED grid is lit up. Similarly, for the PIR sensor on the right, I modified the LED output codeblock so that the right side of the LED grid is lit up.

When neither PIR is activated, the LED grid will still show a smiley face because it's safe!

Testing Code for Multiple PIRs

20.png

After adding and editing the codeblocks correctly, run a simulation again to test if your code works.

When the ball/human is moved into the detection zone of the left PIR, the LED grid on the micro:bit should light up the left side.

Similarly, if a person moves in the detection zone on the right side, the LED will light up on the right side.

Adding an Alarm

21.png

Now that we have two major blindspots covered (you may choose to add additional PIR sensors or micro:bits to cover even more area), let's take it one more step further.

What if you want to have hear an alarm whenever the PIR gets triggered? Not only would you be alerted (such as when you are asleep), but you can also scare off intruders in your personal space, keeping both you and the intruder safe from Covid.

Go to the sidebar on the right and search for "piezo". These are small "speakers" or "buzzers" that have a surface inside that vibrates when an electricity runs through it, creating a loud buzzing sound.

There are two pins on the piezo. Connect the negative pin to the micro:bit's ground, and connect the positive pin to the remaining P2 point on the micro:bit. This way, we can control it so that the buzzer will only sound when the micro:bit releases electrical current through it's P2 pin.

Note: Make sure you add a resistor on one of the pins of the piezo (either pin). This will enable us to limit the amount of current going into the piezo. Otherwise, unlimited amounts of current can break the micro:bit, piezo, or both!

  • I put a 1,000 ohm resistor, but you can put anything. I recommend putting something with 500 ohms - 2,000 ohms. The lower the resistance, the more current there will be, so the buzzer will be louder.

Coding the Buzzer

22.png

Like the LED grid, we need to program the micro:bit to ensure that the buzzer functions correctly. It might be annoying if the buzzer buzzes continuously when someone is in our detection zone, so let's code it so that it only buzzes once, when a person enters the detection zone (notifying us that someone's coming).

To do this, let's initialize the P2 pin. Add an "on start" codeblock, and an "analgo set pitch pin [P2]" code under it.

Then, inside each "on pin [ ] change to [HIGH]" codeblock, add a "analog pitch" output codeblock, below the LED output codeblock (if this wording is confusing, take a look at the screenshot above!).

This analog codeblock allows us to define two settings: the pitch, and the time.

  • The time setting tells it how long to play the tone. I put it at 500 ms (you can choose any number).
  • The pitch tells us how high pitch the tone should be.
    • Here, choose a different frequency for each PIR. I set one at 100 (low pitch) and another at 400 (high pitch). This way, you can tell which PIR sensor is triggered simply by the tone alone (without even having to look at the LED grid).

Final Simulation

23.png

Now, run your simulation one final time to make sure everything works.

If you replicated this Instructable, when a person enters the left-side detection zone, a low tone should briefly sound to notify you, and the left side of the LED grid should light up, letting you know that there is an intruder coming from the left.

When a person enters the right-side detection zone, a high tone should briefly sound to notify you, and the right side of the LED grid should light up, letting you know that an intruder is coming from the right.

When nobody is in either detection zone the LED grid should show a happy face, telling you that you're safe!

Final Thoughts, and Future Projects!

Combined.png

If you made it thorugh this Instructable, congratulations! Even if you struggled or didn't get to complete it, I'm sure you least learned a few things about Tinkercad, and that's what matters so great job!

Now that you have a social-distancing alarm circuit that works, if you want to take it to the next step and build this in the real world, you can purchase the supplies and connect the wires exactly like you did in this Tinkercad workspace.

The photo above is a 3D model (.stl) of the helmet I am working on, using the same exact circuit that we built in this Instructable. It has 2 PIR sensors on the sides, a micro:bit mounted on the front (for you to see the LED grid), and buzzers.

If you wish to use your own creativity alone, feel free to take it yet another step further by hot glueing your circuit to a helmet. Otherwise, stay tuned for my next Instructable, where we'll put together this helmet together!

Please note: If you are young, ask a guardian for help with using tools when building the circuit and helmet.

I hope you enjoyed this tutorial and that you are able to use what you learned about Tinkercad to be creative and create some of your own projects. I'm looking forward to seeing what you all create, so be sure to link your projects in the comments!

Have a fun and learning-filled 2021!