Control a Motor With Magicbit [Magicblocks]

by magicbit in Circuits > Electronics

145 Views, 1 Favorites, 0 Comments

Control a Motor With Magicbit [Magicblocks]

Control a Motor with Magicbit [Magicblocks]

This tutorial will teach you to control a motor with a Magicbit using Magicblocks.

Supplies

  • Magicbit - Pro

Story

Hello and Welcome, This short tutorial will teach you to Control a motor by a Magicbit using Magicblocks.

There are 3 main methods of achieving this goal;

  • By using Inject Block.
  • By using Dashboard Switch.
  • By using Dashboard Slider.

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.

(Method 1) Setting Up the Inject Block [Method 1]

screenshot_(56)_BHasPrSAEZ.jpg
screenshot_(75)_vv9DjRHR3w.jpg
screenshot_(76)_lP9x2smzCf.jpg
screenshot_(77)_PqWqqVVlve.jpg

1. Drag & drop the Inject block from the input nodes section on the left of the screen to the Flow.

2. Double-click on the block and select the type of payload from the drop-down menu to a numerical input (number).

3. Next type a value between 0 & 100 (1 means off and 100 means full speed).

4. Setup an 'Off' node usind the same above method.

Setting Up the Motor Block [Method 1]

screenshot_(78)_dweps97lZe.jpg
screenshot_(79)_MHdJPUz3GV.jpg
screenshot_(91)_bSbwgZJyib.jpg
screenshot_(80)_dNp2tqkAgU.jpg
screenshot_(81)_opTYuQEUZ3.jpg
Capture.JPG
screenshot__34__LgAo8klYI3.jpg
screenshot__35__x1BhIXZnSM.jpg
screenshot__37__sCxZ7X5jV4.jpg

1. Drag & drop the Motor block from the Magicbit nodes section on the left of the screen to the flow.

2. Double-click on the motor block and type or paste your unique Device id from the Device Manager Tab on your Magicblocks account. [ This will link the motor block with the motor connected to the your Magicbit ]

3. Magicbit has two motor PINs. Connect it to one of them and make sure to choose the correct motor PIN from the drop-down menu.

[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 motor node properties and choose the PIN which your motor is connected.

Finally Deploying the Blocks [Method 1]

screenshot_(82)_ZbTpQ830d8.jpg

1. Connect the inject block with the display node.

2. Click on Deploy button on the top right-hand corner of the screen.

3. After deploying click on the box left-side of the inject block to activate it and this will turn on the motor.

Troubleshooting [Method 1]

  • Check whether your Magicbit is connected to the internet.
  • Check whether the motor is connected correctly and correct motor PIN is used.

(Method 2) Setting Up the Switch Block [Method 2]

screenshot_(83)_HH299B4IAr.jpg
screenshot_(84)_6rWiNzCaMX.jpg

1. Drag & drop the Switch block from the dashboard nodes section to the Flow.

2. Double-click on the switch node and set up a basic dashboard ui [user- interface] from the drop-down menu and a name for your field.

3. Select the Mode as number input from the drop-down menu for both On and Off. And set on payload as 75 and off payload as 1.

Setting Up the Motor Block [Method 2]

screenshot_(79)_YZLFuA6wex.jpg
screenshot_(91)_FAfrypgpRu.jpg
Capture.JPG
screenshot__34__LgAo8klYI3.jpg
screenshot__35__x1BhIXZnSM.jpg
screenshot__37__sCxZ7X5jV4.jpg

1. Drag & drop the Motor block from the Magicbit nodes section on the left of the screen to the flow.

2. Double-click on the Motor block and type or paste your unique Device id from the Device Manager Tab on your Magicblocks account. [ This will link the motor block with motor connected to your Magicbit display ]

[Optional] Import Already Setup Nodes

  • 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 motor node properties and choose the PIN which your motor is connected.

Finally Deploying the Blocks & Using the Dashboard UI to Access It [Method 2]

screenshot_(85)_CM41j2RXlH.jpg
  • Connect the text input block with the display node.
  • 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.
  • Toggle the switch on and off to control the motor.
  • Copy the your Dashboard URL and this can be accessed via the internet to display text onto your Magicbit Display from anywhere in the World.

Troubleshooting [Method 2]

  • Check whether your Magicbit is connected to the internet.
  • Check whether the motor is connected correctly and correct motor PIN is used.

(Method 3) Setting Up the Slider Block [Method 3]

screenshot_(86)_s5L65EWezP.jpg
screenshot_(87)_nNfBqkfsxo.jpg

1. Drag & drop the Slider block from the dashboard nodes section to the Flow.

2. Double-click on the slider node and set up a basic dashboard ui [user- interface] from the drop-down menu and a name for your field.

3. Setup the slider node as below.

Setting Up the Motor Block [Method 3]

screenshot_(79)_QX2YJEvtbY.jpg
screenshot_(91)_7VODyKQwjY.jpg
Capture.JPG
screenshot__34__LgAo8klYI3.jpg
screenshot__35__x1BhIXZnSM.jpg
screenshot__37__sCxZ7X5jV4.jpg

1. Drag & drop the Motor block from the Magicbit nodes section on the left of the screen to the flow.

2. Double-click on the Motor block and type or paste your unique Device id from the Device Manager Tab on your Magicblocks account. [ This will link the motor block with motor connected to your Magicbit display ]

[Optional] Import Already Setup Nodes

  • 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 motor node properties and choose the PIN which your motor is connected.

Finally Deploying the Blocks & Using the Dashboard UI to Access It [Method 2]

screenshot_(90)_sH78qFo3D0.jpg

  • Connect the text input block with the display node.
  • 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.
  • Grab the slider to control the motor.

Troubleshooting [Method 3]

  • Check whether your Magicbit is connected to the internet.
  • Check whether the motor is connected correctly and correct motor PIN is used.