fbpx
Magicblocks Lesson 11: Soil Moisture Sensor
Magicblocks Project

Use Soil Moisture Sensor with Magicbit [Magicblocks]

Use the Soil Moisture Sensor with your Magicbit using Magicblocks

Components Required

Story

Hello and Welcome, This short tutorial will teach you to use the Soil Moisture Sensor with Magicbit using Magicblocks.

There are 1 main method of achieving this goal;

  • By using Dashboard Gauge.

First, log into your Magicblocks account,

Magicblocks is easy visual programming software to program your Magicbit. Anyone can program their microcontroller by using magicblocks.io and there is no need for 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

Setting Up the Analog In Block

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

2. Double-click on the Analog In block and select your unique Device ID from the drop-down menu.

3. Choose ‘PIN33’ from the PIN drop-down menu. (Connects with component connect to the PIN33 on your Magicbit)

4. Select the Method as Interrupt from the drop-down menu.

Set up the Range Block

(This Node is used to inverse the input values from the Analog In node)

1. Drag & Drop the Range block from the function nodes section on the left of the screen to the flow.

2. Type the input range and result range as below;

(Make sure to tick the ‘Round result to the nearest integer’ check box to avoid decimals)

Set up the Gauge Block

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

2. Change the Range of the Gauge to 0 – 4095.

[Optional] Import Already Setup Nodes

If you had trouble setting up nodes, you can use the import feature in Magicblocks to get the nodes that have been already set up.

  • First copy this code to your clipboard;
[{"id":"3b7d79c9.fa3036","type":"AI","z":"d2db2033.c2624","name":"","epId":"","pin":"33","method":"1","threshold":100,"x":240,"y":1760,"wires":[["bfa58900.ff53f8"]]},{"id":"bfa58900.ff53f8","type":"range","z":"d2db2033.c2624","minin":"0","maxin":"4095","minout":"4095","maxout":"0","action":"scale","round":true,"property":"payload","name":"","x":450,"y":1800,"wires":[["191c4b3c.70d715"]]},{"id":"191c4b3c.70d715","type":"ui_gauge","z":"d2db2033.c2624","name":"","group":"6e81dbf8.7888c4","order":0,"width":0,"height":0,"gtype":"gage","title":"Soil Moisture","label":"units","format":"{{value}}","min":0,"max":"4095","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":650,"y":1840,"wires":[]},{"id":"6e81dbf8.7888c4","type":"ui_group","z":"","name":"Soil Moisture Sensor Module","tab":"1e4dddd7.63fc02","order":1,"disp":true,"width":"11","collapse":false},{"id":"1e4dddd7.63fc02","type":"ui_tab","z":"","name":"MagicbitWorkshop","icon":"dashboard","order":1}]
  • 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 Analog In node properties.

Finally, Deploying the Blocks

  • Make sure all the blocks are connected.
  • Click on the Deploy button on the top right-hand corner of the screen.
  • After deploying, go to the dashboard UI by clicking the link to the dashboard URL on the top right-hand corner of the screen.
Use Soil Moisture Sensor with Magicbit pic 15
Click the URL in the top right corner
Use Soil Moisture Sensor with Magicbit pic 16
Click the URL in the top right corner
  • Connect the component to the Magicbit physically.
Use Soil Moisture Sensor with Magicbit pic 17
Project overview
  • Any Moisture change in the soil will be displayed on the Dashboard Gauge.
Use Soil Moisture Sensor with Magicbit pic 18
Project results
Use Soil Moisture Sensor with Magicbit pic 19
Project results

Troubleshooting

  • Check whether your Magicbit is connected to the internet.
  • Check whether the correct PIN is used (e.g., ‘PIN 33’).

If you need help or couldn’t understand a step be sure to check out our YouTube video by clicking here: Youtube Video

 

Related Posts
Leave a Reply

Your email address will not be published.Required fields are marked *