Automated Disinfectant Spray Dispenser COVID19

Canal de YouTube

Many of you have been asking me about a simple home project for dispensing gel and spraying disinfectant. Here is a small tutorial with diagram for wiring and some simple code to get you started.

The great thing about this project is that it is simple enough and the benefits are invaluable. There are so many cases of one family member bringing home the “germs” and unwillingly infecting other family members. Look out for your family, implement this project today!

Here is the code:


#include <Servo.h>
Servo myservo;
int calibrationTime = 30;
long unsigned int lowIn;

long unsigned int pause = 500;
boolean takeLowTime;
int pirPin = 6;    //the digital pin connected to the PIR sensor's output
int ledPin = 13;

void setup() {
 Serial.begin(9600);
 pinMode(pirPin, INPUT);
 pinMode(ledPin, OUTPUT);
 digitalWrite(pirPin, LOW);
 myservo.attach(9);  // attaches the servo on pin 9 to the servo object
 delay(1000);
 myservo.write(0);
}

void loop() {

 if (digitalRead(pirPin) == HIGH) {
   Serial.print("Motion at: ");
   Serial.print(millis() / 1000);
   Serial.println(" secs");
   digitalWrite(ledPin,HIGH);
   digitalWrite(pirPin, LOW);
   spray();
   digitalWrite(ledPin,LOW);
 }
}

void spray() {
 for (int i = 0; i <= 1; i++) {
   myservo.write(180);              
   Serial.println(180);
   digitalWrite(ledPin,HIGH);
   delay(1000);                       // waits 15ms for the servo to reach the position
   myservo.write(0);
   Serial.println(0);
   digitalWrite(ledPin,LOW);
   delay(1000);                       // waits 15ms for the servo to reach the position
   myservo.write(180);             
   Serial.println(180);
   myservo.write(0);
   Serial.println(0);
   digitalWrite(ledPin,HIGH);
   delay(2000);
 }
}

Arduino (IoT): Simple Tutorial GPS LS20031

GPS Arduino Santiapps

Arduino Honduras Santiapps Marcio Valenzuela

Tutorial GPS LS20031

En este tutorial recibiremos datos de un modulo GPS.

Requisitos:

  1. Computadora (mac)
  2. Arduino MEGA o UNO (el código cambia porque los Rx/Tx cambian)
  3. Modulo GPS LS20031
  4. Breadboard
  5. Arduino IDE (https://www.arduino.cc/en/Main/Software)

Arduino IoT: Simple Tutorial GPS Titan3 Santiapps Marcio Valenzuela
Arduino IoT: Simple Tutorial GPS LS20031

La conexión:

  • GPS Pin 5 (left-most when viewed from above) : No connection (or ground)
  • GPS Pin 4 : to Arduino ground (GND) pin
  • GPS Pin 3 : to Arduino pin 0
  • GPS Pin 2 : No connection
  • GPS Pin 1 (right-most when viewed from above) : to Arduino 3.3V pin

El código:

[code]
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
}

void loop() {

if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
}
[/code]

 

En el monitor serial saldrá algo así:

$GPGGA,105317.709,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4C
$GPGLL,8960.0000,N,00000.0000,E,105317.709,V,N*49
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,105317.709,V,8960.0000,N,00000.0000,E,0.00,0.00,010610,,,N*78
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32

Estas son NMEA sentences o datos NMEA (http://en.wikipedia.org/wiki/NMEA_0183) los cuales deben ser parsed a datos de ubicación, velocidad etc.  Esto lo logramos usando la TinyGPS library (http://arduiniana.org/libraries/tinygps/).

Para ello usamos las siguientes conexiones:

  • GPS Pin 5 (left-most when viewed from above) : No connection (or ground)
  • GPS Pin 4 : to Arduino ground (GND) pin
  • GPS Pin 3 : to Arduino pin 2
  • GPS Pin 2 : No connection
  • GPS Pin 1 (right-most when viewed from above) : to Arduino 3.3V pin

Ahora abramos el sketchtest_with_gps_device de la TinyGPS library desde File > Examples > TinyGPS > Examples > test_with_ps_device :


nss.begin(9600);

Ahora vemos:

Testing TinyGPS library v. 9
by Mikal Hart
Sizeof(gpsobject) = 103
Acquired Data
-------------
Lat/Long(10^-5 deg): -4223579, 17344651 Fix age: 14ms.
Lat/Long(float): -42.23579, 173.44651 Fix age: 22ms.
Date(ddmmyy): 0 Time(hhmmsscc): 11210560 Fix age: 35ms.
Date: 0/0/2000  Time: 11:21:5.60  Fix age: 40ms.
Alt(cm): 13870 Course(10^-2 deg): 999999999 
 Speed(10^-2 knots): 999999999
Alt(float): 138.70 Course(float): 10000000.00
Speed(knots): 10000000.00 (mph): 11507795.00 (mps): 5144444.00
 (kmph): 18520000.00
Stats: characters: 156236 sentences: 10 failed checksum: 35
-------------

Pronto veremos otro modulo, el Titan 3 de GTOP.