Renu Kumar
Published © GPL3+

Plant Monitoring Using Alexa

Plant monitoring using Arduino, Alexa and RPi.

BeginnerFull instructions provided1 hour7,429
Plant Monitoring Using Alexa

Things used in this project

Story

Read more

Schematics

Interface of Arduino AND Raspberrypi

Interface of Arduino with LM35

Interface of Arduino with LDR

Code

Python Script

Python
from flask import Flask

from flask_ask import Ask, statement, convert_errors

import RPi.GPIO as GPIO

import logging

import serial

import time

temp = 0

light = 0

serial1 = serial.Serial('/dev/ttyACM0',9600) //change according to yours

def caller1():

  read_data = 0

  read1 = serial1.readline()

  read_data = read1.rstrip('\n\r')

  n1 = str (read_data)

  n2 = str (read_data)

  temp = n1[:2]

  print temp

  light = n2[2:]

  return(temp)

def caller2():

  read_data = 0

  read1 = serial1.readline()

  read_data = read1.rstrip('\n\r')

  n2 = str (read_data)

  light = n2[2:]

  return(light)

app = Flask(__name__)

ask = Ask(app, '/')

logging.getLogger("flask_ask").setLevel(logging.DEBUG)

@ask.intent('temperature')

def temperature():

  x = 'The temperature is ' + caller1()

  return statement(x)

@ask.intent('light')

def light():

  x = 'The intensity of light is ' + caller2()

  return statement(x)

if __name__ == '__main__':

  app.run(debug=True)

Arduino

Arduino
  int ldr = 1;

  int temperature = 0;

  int tempc;

  void setup() {

  Serial.begin(9600);

  }

  void loop() {

  float val1 = analogRead(0);

  tempc =(5 * val1 * 100) / 1024.00;

  Serial.print(tempc);

  int val2 = analogRead(1);

  val2 = val2 * 0.10;

  Serial.println(val2);

  delay(1000);

  }

Credits

Renu Kumar

Renu Kumar

1 project • 6 followers

Comments