BICKY YADAV
Published © GPL3+

Collect sensor data & control from Telegram

Fetch sensor's data from Telegram

IntermediateFull instructions provided3 hours138
Collect sensor data & control from Telegram

Things used in this project

Hardware components

Desktop/Laptop
×1
Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
High Brightness LED, White
High Brightness LED, White
×1
ARDUINO UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Male/Male Jumper Wires
×7

Software apps and online services

Linux OS
Telegram
Arduino IDE
Arduino IDE
Python3

Story

Read more

Code

Arduino code for Ultrasonic sensor

Arduino
#include<BoltIoT-Arduino-Helper.h>
#include <BoltDeviceCredentials.h>
#define trigPin 12
#define echoPin 13
float time=0,distance=0;
long duration;
int distanceCm;
int pin1;
void setup() {
    pinMode(trigPin,OUTPUT);
    pinMode(echoPin,INPUT);
    Serial.begin(9600);
    Serial.setTimeout(50);
    boltiot.begin(Serial); //Communication
    pinMode(2,INPUT);
  }

  void loop() {
     digitalWrite(trigPin, LOW);
     delayMicroseconds(2);
     digitalWrite(trigPin, HIGH);
     delayMicroseconds(10);
     digitalWrite(trigPin, LOW);
     duration = pulseIn(echoPin, HIGH);
     distanceCm = duration * 0.0340 / 2;
     Serial.print(distanceCm);
     Serial.print("\n");
     delay(5000);
  }

configuration file for BOLT IOT

Python
Please edit BOLT API and device ID
bolt_api_key = "YOUR BOLT API"               
device_id = "DEVICE ID"                 

Header file for bolt-arduino-helper

This is an external link. In the src folder, you will found BoltDeviceCredentials.h and BoltIot-Arduino-Helper.h file.Edit Bolt credentials

Extract data from sensor and upload to database

In this project one python file(sensor.py) will run for extracting data and upload to database and another file (control.py) will be control telegram

Credits

BICKY YADAV

BICKY YADAV

1 project • 0 followers
Thanks to Inventrom.

Comments