Use Ultrasonic Sensor With Magicbit [Magicblocks]

by magicbit in Circuits > Sensors

341 Views, 0 Favorites, 0 Comments

Use Ultrasonic Sensor With Magicbit [Magicblocks]

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.

Supplies

  • Magicbit - Pro

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.

Setting Up the Inject Block

screenshot_(176)_7C5eegcZL7.jpg
screenshot_(177)_xO2wovRyOx.jpg

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.

Setting Up the Ultrasonic Block

screenshot_(178)_8RGTDKxmUz.jpg
screenshot_(179)_U8r2CU7Mp7.jpg
screenshot_(91)_cipugIu2pD.jpg
screenshot_(180)_sS5BvAFyUp.jpg
screenshot_(181)_gBEFPGELLb.jpg
screenshot_(183)_ZncyxjBLhu.jpg

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).

Setup the Gauge Block

screenshot_(186)_hcsl92bTni.jpg
screenshot_(182)_wCt6F61jDN.jpg
Capture.JPG
screenshot__34__LgAo8klYI3.jpg
screenshot__35__x1BhIXZnSM.jpg
screenshot__37__sCxZ7X5jV4.jpg

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.

IMPORTANT

Make sure you type your device id on the Ultrasonic node properties.

Finally Deploying the Blocks

screenshot__88__o65645S9to.jpg
screenshot__89__qsXqYHDwdI.jpg
screenshot_(184)_29q5TC8i3y.jpg
screenshot_(185)_seqPIjZqiC.jpg

  • 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.

Troubleshooting

  • Check whether your Magicbit is connected to the internet.
  • Check whether the correct PINs is used (e.g. 'PIN 32' or 'PIN 33').