Menu Close

Raspberry on NodeMCU – Reading digital input through pushbutton

This tutorial of Robo India explains how to read digital input through push button on Blynk App using Raspberry P.

Detailed Tutorial

1. Introduction:

Blynk is a Platform with IOS and Android apps to control Arduino, Raspberry Pi and the likes over the Internet. It’s a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets.

A discrete signal (digital signal) supplied to the Raspberry Pi is known as digital input. This signal can be generated manually using a push button switch.

Push button switch is a switch which provides connectivity between its terminals when pressed. When the button is released terminals get disconnected.

This tutorial is for Raspberry Pi. Please note that the same tutorial can be performed on LUA as well.

S.No.ItemQuantity
1 Raspberry Pi 1
2 Pi Wedge B + 1
3 Breadboard 1
4 Jumper Male to male 3
5 Push Button Switch 1
6 Resistor 10k 1

1.1 Blynk App 

1.1 Blynk App 

Blynk application can be found from the following links –

1. Android Blynk App

2. IOS Blynk App

After downloading the app, create an account and log in. (If possible than log in with your real mail id for better connectivity later.)

2. Create on Blynk Project 

2.1 Create a new project and give it name PushButton and then Select device “Raspberry Pi 2/A+/B+”.

2.2 Add widget “Value Display” to read value of Push button.

2.3 Set input Digital pin 25 for GP25 of Raspberry Pi which is connected to Push Button.

 The Auth Token is very important – you’ll need to stick it into your Raspberry’s firmware. For now, copy it down or use the “E-mail” button to send it to yourself.

 3. Connecting with Raspberry Pi

3.1 .Open the command window and write:

  $ sudo apt-get update

3.2. To make sure your Pi is up to date with the latest versions of Raspbian:

  If you do not have GIT installed, you can install it with:

  $ sudo apt-get install git-core

3.3 .To obtain WiringPi using GIT (WiringPi is maintained under GIT for ease of change tracking,):

  $ git clone git://git.drogon.net/wiringPi

3.4. After that write:

  cd wiringPi
  ./bulid
  cd
  Git clone https://github.com/blynkkk/blynk-library
  cd blynk-library/linux
  Make clean all target=raspberry
  Sudo ./blynk --token=token num

4. Execution

After doing this, Raspberry pi is connected with your Blynk project. Press the pushbutton on raspberry pi breadboard and output is display on blynk app.

Then click the “Run” button in the top right corner of the Blynk app.

Then add more widgets to the project. They should immediately work, without uploading any new firmware.

5. Output

 When we press Push Button on Raspberry pi breadboard, Value on Blynk app will be HIGH, and when we release , value will be LOW.

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com


Leave a Reply