saket kulkarni

Smart Home

Using sensors, this device allows you to save energy and maximize security of your household.

IntermediateWork in progress2 hours2,242
Smart Home

Things used in this project

Hardware components

Grove - Ultrasonic Ranger
Seeed Studio Grove - Ultrasonic Ranger
Grove - Temperature Sensor
Seeed Studio Grove - Temperature Sensor
Grove - Light Sensor
Seeed Studio Grove - Light Sensor

Software apps and online services

Maker service
IFTTT Maker service
Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)


Read more


How the code determines what it will do


Smart Home code version 1.0

// This #include statement was automatically added by the Particle IDE.
#include <Grove-Ultrasonic-Ranger.h>
#define CLK D2//pins definitions for TM1637 and can be changed to other ports
#define DIO D3

//	Function: Measure the distance to obstacles in front and print the distance
//			  value to the serial terminal.The measured distance is from
//			  the range 0 to 400cm(157 inches).
//	Hardware: Grove - Ultrasonic Ranger
//	Arduino IDE: Arduino-1.0
//int Ultrasonic = D5;

Ultrasonic ultrasonic(D4);

void setup()
void loop()
    //int range;
	int digit;
    int pos = 3;
	long lastRange;
	//int lastRange;
	long RangeInCentimeters;
	Serial.println("The distance to obstacles in front is: ");
	RangeInCentimeters = ultrasonic.MeasureInCentimeters(); // two measurements should keep an interval
	Serial.println(" cm");
	if (RangeInCentimeters != lastRange) {
    lastRange = RangeInCentimeters;

    // Fill display with zeros
    for (int i = 0; i < 4; i++) {

    // Extract each digit from the range and write it to the display
    while (RangeInCentimeters >= 1) {
    // Get the current digit by performing modulo (%) division on the range
    digit  = RangeInCentimeters % 10;
    // Remove the trailing digit by whole-number division
    RangeInCentimeters /= 10;

Particle.publish("Someone walked by!!!", "Obstacle noticed at " + String(ultrasonic.MeasureInCentimeters()), PRIVATE);


saket kulkarni

saket kulkarni

1 project • 4 followers


Add projectSign up / Login