Bicycle Kickstand Position Sensor From Magicbit[Magicblocks]

by magicbit in Circuits > Sensors

166 Views, 0 Favorites, 0 Comments

Bicycle Kickstand Position Sensor From Magicbit[Magicblocks]

Bicycle Kickstand Position from Magicbit [Magicblocks]

Simple DIY Project to make Kickstand Position Sensor with a 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
  • Jumper wires (generic)

Story

Hello and Welcome, This is a simple DIY project to make Kickstand Position Sensor with a Magicbit using Magicblocks.

There are 2 main methods of achieving this goal;

  • By using Dashboard Text Output.
  • By using Dashboard Text Output.

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.

Setup the Digital in Block

screenshot_(194)_RMPrtYVY9P.jpg
screenshot_(209)_CH7P0Ssg3Z.jpg
screenshot__91__0acAaGOCa6.jpg
screenshot_(196)_XO6Rw7NQlM.jpg
screenshot__95__m3nITSp1X8.jpg

1. Drag & Drop the Digital In block from the Magicbit-nodes section to the flow.

2. Double-click on the Digital In block and type or paste your unique Device id from the Device Manager Tab on your Magicblocks account. [ This will link the module connected as a digital signal from the Magicbit ]

3. Both PINs 32 & 33 can be used to with the Tilt Sensor, so connect it to one of them and make sure to choose the correct PIN (which you connected the sensor) from the drop-down menu.

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

[Magicbit PIN Layout]

img_20200813_150513_73nrmlGAMC.jpg

Setup the Display Block

screenshot_(197)_vAeImivdpH.jpg
screenshot_(205)_jfJZOg35OF.jpg

1. Drag & Drop the Display block from the Magicbit-nodes section to the flow.

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

Setup the Text Block

screenshot_(198)_Z1GZJPRqhw.jpg
screenshot_(204)_eeH2RPgX0T.jpg

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

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

Setup the Change Block

screenshot_(199)_xzYC0YCH9z.jpg
screenshot_(200)_UwiP4bZRc3.jpg
screenshot_(201)_vl3xadMHTP.jpg
screenshot_(202)_uBtrDVhxXn.jpg
screenshot_(203)_3EFn3hcn6G.jpg
Capture.JPG
screenshot__34__LgAo8klYI3.jpg
screenshot__35__x1BhIXZnSM.jpg
screenshot__37__sCxZ7X5jV4.jpg

(This Node is used to change the 1 & 0 signal input from the Digital In node to any text you want)

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

2. Add new rule from the '+' Button to use 2 rules.

3. Change the function of both of the rules from Set to Change from the drop-down menu.
4. Next change the 'Search for' function from String(text) to Number in both of the rules. And make sure the 'Replace with' function is set to String(text).

5. Set up the rules.

  • The First Rule to search for '0' in signal input and replace it with our text (e.g. 'Deployed' or 'On')
  • The Second Rule to search for '1' in signal input and replace it with our text (e.g. 'Retracted' or 'Off')

[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 Digital In & Display nodes' properties and choose the PIN which your Tilt Sensor is connected.

Project Overview

kickstand_diag_nFs0V83a7z.jpg

Finally Deploying the Blocks

screenshot_(127)_RCGNUGMX7i.jpg
screenshot_(129)_fkLhnG9Nw0.jpg
screenshot_(206)_p3aXRJQAj3.jpg
screenshot_(207)_ezXk8hJFoQ.jpg

  • Connect the all the blocks.
  • 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.
  • Deploying & Retracting the bicycle kickstand will interact with the Dashboard and the OLED Display to show you the current position of the Kickstand.

Troubleshooting

  • Check whether your Magicbit is connected to the internet.
  • Check whether the Tilt Sensor is connected correctly and correct PIN is used (e.g. PIN 33).