Welcome to your first prototype!
"Are you ready for this?"
We'll walk along this path with you, making sure you'll be able to succeed in making your very first prototype.
For your first prototype, you'll make a simple nudging device that helps people realize if they are standing too close to you (might be helpful during these troubling times). This first prototype will use an , which is a small that will enable us to control this nudging device we're building today.
The goal for this first prototype is for you to get familiar with how you can program an Arduino by using our coding tool, and then later making the device work through an online emulator.
Additionally, we've created a video briefly going through this build you'll be making, so feel free to watch it before you start your first project.
Without further ado, grab yourself a cup of and lets get started!
Step 0: Open the Coding Tool
First step is to press here. You now have both this guide and our amazing tool open.
It's through the coding tool that you'll be solving the next few steps to create the code for our device.
Step 1: Choose components 🤔
In this step you need to add an and an . You adjust the settings of the component by clicking on them. If you add too many, you can cross them away. You can see these steps in the GIF below.
As soon as you have added the sensor and the LED, head down to the next step!
Step 2: Configure pins for ultrasonic sensor 📸
Let's start with the ultrasonic sensor. You'll have to configure the for the sensor, that is, how the sensor is being controlled by the Arduino. As a standard, the tool sets the pins to 9 and 10 for the echo and trig pins respectively. Choosing the pins does not really matter in most cases, so in this example, we're changing the pins for you to see the changes highlighted in the code. Let's change the pins to pins 2 and 3, as shown in the GIF below.
Step 3: Configure distance + distance name 📛
Next step, let's personalize how close we would want an object to come near the sensor before the LED lights up. Maybe we would want some personal contact, without people getting too close, so let's set the distance to 50cm. We're also going to change the name of the saved distance to "MaxDistance" so that we know exactly what we're working with.
When you have followed the steps shown in the video, continue on to step 4.
Step 4: Configure LED pins + "On When" trigger 🔧
As we did in step 2 with the ultrasonic sensor, we're now going to configure the pin for the LED. The LED only needs one pin defined, so let's set it to pin 10! Now we would like the LED to turn on when the distance to the sensor, is below the "MaxDistance". To do that, we simply set the On When to our MaxDistance, which will trigger the LED at our MaxDistance. Lastly, since we're using a red LED in our example later, let us change the name of the LED to "RedLED", just for good measure.
Step 5: Enjoy the show 🥤🍿
Now there's nothing left but to enjoy the creation you've made! By using the online simulator below, you can press the button "Start Simulation" and then press the top part of the ultrasonic sensor, which will enable the distance sensing.
You can see how it works in the GIF above, and try it yourself with the tool below!
Enjoying the show in person!
If you're in possession of the different components included in this guide, you can try building the setup yourself as shown in the TinkerCAD example, by following the guide! Afterwards, you can copy the code you made through the coding tool, and paste it into the Arduino App. If everything is connected correctly, the LED should light up whenever the sensor detects an object within 50cm of the sensor.
Where to go now?
Now that you might have a feel for doing a bit of mechatronics, you can go and read or maybe .