Introduction: Use Ultrasonic Sensor With Magicbit [Magicblocks]
This tutorial will teach you to use the Ultrasonic Sensor with your Magicbit using Magicblocks. We are using magicbit as the development board in this project which is based on ESP32. Therefore any ESP32 development board can be used in this project.
- Magicbit - Pro
Step 1: Story
Hello and Welcome, This short tutorial will teach you to use Ultrasonic sensor with your Magicbit using Magicblocks.
There are 1 main method of achieving this goal;
- By using Dashboard Gauge.
First of all log into to your Magicblocks account,
Magicblocks is an easy visual programming software for program your magicbit. Anyone can program their micro controller by using magicblocks.io and there is no need of programming knowledge. You can sign up for free.
Start and Open the Playground.
Next make sure your Magicbit is connected to the internet and plugged-in and also linked to your account through Device Manager.
All Done? then scroll down to Method 1
List of Items Required
Magicbit: Magicbit Is an integrated development platform based on ESP32 for learning, prototyping, coding, electronics, robotics, IoT and solution designing.
Step 2: Setting Up the Inject Block
1. Drag & drop the Inject block from the input nodes section on the left of the screen to the Flow.
2. Set the Payload as timestamp and set the Repeat to interval.
Step 3: Setting Up the Ultrasonic Block
1. Drag & drop the Ultrasonic block from the input nodes section on the left of the screen to the Flow.
2. Double-click on the Ultrasonic block and type or paste your unique Device id from the Device Manager Tab on your Magicblocks account. [ This will link the Ultrasonic sensor with the Magicbit ]
3. Connect the Ultrasonic sensor in the below configuration to the 'PIN 33' or 'PIN 32' (In this tutorial PIN 32 will be used).
Step 4: Setup the Gauge Block
1. Drag & drop the Gauge block from the dashboard nodes section to the Flow.
2. Change the Range of the Guage to 0 - 150.
[Optional] Import Already Setup Nodes
If you had trouble setting up nodes, you can use the import feature in Magicblocks to get the nodes which has been already setup.
- First copy this code to your clipboard.
- Click on the options menu on the top right-hand corner of the screen.
- Next hover your cursor over the Import sub-menu.
- Then click on Clipboard and paste the code on your clipboard to the text field.
- Select current flow or new flow and click on Import.
Make sure you type your device id on the Ultrasonic node properties.
Step 5: Finally Deploying the Blocks
- Make sure all the blocks are connected.
- Click on Deploy button on the top right-hand corner of the screen.
- After deploying go to the dashboard ui by clicking the link to dashboard URL on the top right-hand corner of the screen.
- Interact with the Ultrasonic Sensor to display the change in the Dashboard Gauge.
- Check whether your Magicbit is connected to the internet.
- Check whether the correct PINs is used (e.g. 'PIN 32' or 'PIN 33').