Rainy or sunny cartoon – Learning path project 15

Our Learning Path is an itinerary designed to teach all the foundaments and a little more about electronics, coding and robotics.

When you complete all the projects you will be able to develop almost any project you can imagine. In each chapter new concepts are introduced. You will learn by doing in a funny way.

Build a funny cartoon so you can know if weather is rainy or sunny.

Project 15
RAINY OR SUNNY DAY CARTOON WARNING

Build this funny warning using our rain and steam sensor

BEFORE TO START

DIFFICULTY LEVEL: Intermediate
DURATION OF THE ACTIVITY: 40 min.

MATERIALS:
4in1 board
Buzzer
Battery holder & wires
Battery holder & wires

1 - Build&Code 4in1 board
1 - Rain and steam sensor
1 - Servomotor

Battery holder, USB cable and wires.

15 - Rain and steam sensor

The Rain and steam sensoris an analog sensor. When the sensor detects a higher level of humidity, the output voltage increases. The connector is not waterproof, please be careful not to put the connector directly in water.

It has a surface that has different conductivity lines. When more current is able to pass between them, higher value output.

In some way, it can be also used as a touch panel sensor in your maker creations, so your fingers are also conductive.

15 - Circuit

In next examples we used this connection scheme.

Connect wires from 4in1 board to components:
- DIO10 to Rain Sensor
- DIO3 to servomotor

That's the easiest part!!!
Let's code!!
15.1 - Sensor reading program

We can read sensor with a digital input. It wil return 1 when there is conductivity throught it's lines. Can be water, steam, or our finger. Be careful with water, to isolate the wires part from it.

Block Coding

Used live mode to see sensor output through variable value.

Arduino Coding
#define PIN_DIGITAL_RAIN_SENSOR 10  // Entrada digital para la señal del sensor de lluvia

int sensorValue = 0;

void setup(){
   Serial.begin(9600);
   pinMode(PIN_DIGITAL_RAIN_SENSOR, INPUT);
}
void loop(){
   sensorValue = digitalRead(PIN_DIGITAL_RAIN_SENSOR); // Leer datos del puerto digital
   Serial.print("Digital value: "); 
   Serial.println(sensorValue); // Salida del valor digital al monitor del puerto
 
   delay(500); // Retardo entre mediciones
}
15.2 - Automatic closing window

We imagine an application that consists of closing a window automatically when rain is detected to ensure all remains dry inside. We will use the servo as actuator to close the window.

Block Coding
Arduino Coding
#include <Servo.h>
#define WATERSENSOR 10

Servo cierre;

int sensorValue;

void setup(){
   Serial.begin(9600);
   digitalWrite(sensorValue, INPUT);
   cierre.attach(3);
}
void loop(){
  sensorValue = digitalRead(WATERSENSOR); // Leer datos del puerto digital
  
    if (sensorValue == HIGH){
      cierre.write(180);
      Serial.print("Digital value: "); 
      Serial.println(sensorValue);
   }   
   
   if (sensorValue == LOW){
      cierre.write(0);
      Serial.print("Digital value: "); 
      Serial.println(sensorValue); // Salida del valor digital al monitor del puerto
      delay(200);
       // Retardo entre mediciones
   }
}
Final project - Rainy or sunny day cartoon

You wake up in the morning, it's still dark and you're not sure of the outside weather. What clothes to choose? Here the solution! Build this funny cartoon!! Here cardboard template

Block coding
Arduino code
#include <Servo.h>
#define WATERSENSOR 10

Servo cierre;

int sensorValue;

void setup(){
   Serial.begin(9600);
   digitalWrite(sensorValue, INPUT);
   cierre.attach(3);
}
void loop(){
  sensorValue = digitalRead(WATERSENSOR); // Leer datos del puerto digital
  
    if (sensorValue == HIGH){
      cierre.write(180);
      Serial.print("Digital value: "); 
      Serial.println(sensorValue);
   }   
   
   if (sensorValue == LOW){
      cierre.write(0);
      Serial.print("Digital value: "); 
      Serial.println(sensorValue); // Salida del valor digital al monitor del puerto
      delay(200);
       // Retardo entre mediciones
   }
}
SHARE YOUR CARTOON!!
FINISHED!
previous arrow
next arrow
Slider

The Mega Maker Kit fits perfectly with the Learning Path, you can build all projects with it, but if you have other kits, you can also follow the entire itinerary and finish some projects, or buy the missing components. You can check in our Learning Path page.

0 0

0