RAPPAHANNOCK COMMUNITY COLLEGE STEM CAMP
  • Home
  • 2021 STEM Camp (HS)
    • PreAcademy prep
    • Day 1: Basics, Lights, and Temperature Sensor >
      • Day 1 Supplement: Measure Temperature
      • Day 1 Supplement: IR Temp Sensor
      • Day 1 Supplement: Identifying Resistors
      • Supplement: Controlling Buttons
      • Supplement: Controlling A Servo
    • Day 2: Measuring Pulse >
      • How the body absorbs light
      • Day 2 Supplement: IR Light Proximity Sensor
      • Day 2 Supplement: Motion Sensor
      • Code to start later on plotter
    • Day 3 Supplement: OLED Screen Basics >
      • Display Screen Temperature
      • IR Temp Sensor And Screen
      • Scrolling Screen Graph
    • Day 4: Finishing up/Show >
      • Pictures to OLED
      • BPM Pulse Sensor
      • Multimeter
  • Shared Google Folder
  • The Teachers
  • Archive
    • Pictures from prior years
    • 2021 STEM Camp (MS) >
      • Home (2021)
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Identifying Resistors
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Light Proximity Sensor
      • Day 2: Ultrasound >
        • Day 2 Supplement: IR Temp Sensor
        • Day 2 Supplement: Controlling A Servo
      • Day 3: Measuring Pulse >
        • Day 3 Supplement: Motion Sensor
      • Day 4: OLED Screen Basics >
        • Temperature Screen Display
        • IR Temp Sensor And Screen
      • Day 5 Friday: Finishing up/Show
    • 2020 STEM Camp >
      • Home (2020)
      • The 2020 Teachers
      • PreAcademy prep
      • Day 1 Monday: Basics and Lights >
        • Day 1 Supplement Activity
      • Day 2 Tuesday: Servos >
        • Day 2 (Suppliment Activities)
      • Day 3 Wednesday: Making an ECG/EKG! >
        • Day 3 (Supplement Page)
      • Day 4 Thursday: Controlling Servos with EMG >
        • Day 4 Supplemental Activity
      • Day 5 Friday: Finishing up/Show >
        • Unused lessons/content
    • 2018 Lessons >
      • Day 1: Basic Coding
      • Day 2: Motors
      • Day 3: Build Robot Claw
      • Day 4: Saving Positions
      • Day 5: Presentations
    • 2017 Camp >
      • Day 1 (Monday)
      • Day 2: Multicolor LED and Keypad
      • Day 3: Servo and Keypad
      • Day 4: Multiple Motors/Stepper Motor
      • Day 5: Presentations
    • Pictures archive for lessons (some graphic images)
  • Contact Us!

Picture
https://create.arduino.cc/projecthub/techstudycell/social-distancing-tool-using-ultrasonic-sensor-and-arduino-10f108

​
Picture

Buzz when your heart beats.

Here is the wiring diagram:

Picture
​   const int BuzzerPin = 3; //Buzzer Pin
    const int SwitchPin= 2; // Push-button pin
       
    void setup() {
        pinMode(BuzzerPin,OUTPUT); //Defines pinBuz as an Output
        pinMode(SwitchPin,INPUT); // Defines pinSwi as an input
              }
              
    void loop () {
      int botao; // To save the last logic state of the button
      botao = digitalRead(pinSwi); //Put the reading value of the switch on botao
      Serial.println(botao); //Shows the logic state of the input on Serial Monitor
      if (botao == 1) // Pressed button, logic State HIGH (5V)
      {
      digitalWrite(pinBuz,1); //Switch pressed, buzzer on
      }else
      {
      digitalWrite(pinBuz,0); //If the switch isn’t pressed, buzzer off.
      }
      delay(10); //reading delay
                }
     

Motion Sensor

The three pins are: 
     VCC (Vin): 
+ Vin to 5V
     Out (O output): Signal wire to digital pin 2 
     GND (- aka ground): GND - ground to board GND 
Wire up your motion detector like this picture. 

Below is code for us to get started. 
Picture

Touchless Soap Dispenser: Ultrasound 

Draft code here: https://drive.google.com/drive/folders/1owAatidlxF5nuy-WP4LoVd80rhknXz7c
arduino_code.ino
File Size: 0 kb
File Type: ino
Download File

Code V2
​https://drive.google.com/file/d/1KuEAgIkUvVa2rXHPusrJzWKoeSdCDnFm/view

IR Servo Touchless Soap Dispenser

1 Motor Version 

_______________________________________________________________________________________
#include "Servo.h" //Include Servo Motor library for using Servo
Servo myServo1;

#define sensor A0

int servo1 = A1; //Digital PWM pin used by the servo 1

void setup() {
Serial.begin(9600);
myServo1.attach(servo1);
pinMode(sensor, INPUT);
}

void loop() {
 if(digitalRead(sensor)){
 Serial.println("Active");
 myServo1.write(110);
 delay(300);
  }

​ else{
 Serial.println("Inactive");
 myServo1.write(0);
  }

delay(100);
}

2 Motor version

#include "Servo.h"        //Include Servo Motor library for using Servo

Servo myServo1;
Servo myServo2;

#define sensor A0
int servo1 = A1;   //Digital PWM pin used by the servo 1
int servo2 = A2; //Digital PWM pin used by the servo 2

void setup() {
Serial.begin(9600);
myServo1.attach(servo1);
myServo2.attach(servo2);
pinMode(sensor, INPUT);
}

void loop(){
if(digitalRead(sensor)){
Serial.println("Active");
myServo1.write(110);
myServo2.write(0);
delay(300);
}

​else{
Serial.println("Inactive");
myServo1.write(0);
myServo2.write(110);
}
​
delay(100);
}
Powered by Create your own unique website with customizable templates.
  • Home
  • 2021 STEM Camp (HS)
    • PreAcademy prep
    • Day 1: Basics, Lights, and Temperature Sensor >
      • Day 1 Supplement: Measure Temperature
      • Day 1 Supplement: IR Temp Sensor
      • Day 1 Supplement: Identifying Resistors
      • Supplement: Controlling Buttons
      • Supplement: Controlling A Servo
    • Day 2: Measuring Pulse >
      • How the body absorbs light
      • Day 2 Supplement: IR Light Proximity Sensor
      • Day 2 Supplement: Motion Sensor
      • Code to start later on plotter
    • Day 3 Supplement: OLED Screen Basics >
      • Display Screen Temperature
      • IR Temp Sensor And Screen
      • Scrolling Screen Graph
    • Day 4: Finishing up/Show >
      • Pictures to OLED
      • BPM Pulse Sensor
      • Multimeter
  • Shared Google Folder
  • The Teachers
  • Archive
    • Pictures from prior years
    • 2021 STEM Camp (MS) >
      • Home (2021)
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Identifying Resistors
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Light Proximity Sensor
      • Day 2: Ultrasound >
        • Day 2 Supplement: IR Temp Sensor
        • Day 2 Supplement: Controlling A Servo
      • Day 3: Measuring Pulse >
        • Day 3 Supplement: Motion Sensor
      • Day 4: OLED Screen Basics >
        • Temperature Screen Display
        • IR Temp Sensor And Screen
      • Day 5 Friday: Finishing up/Show
    • 2020 STEM Camp >
      • Home (2020)
      • The 2020 Teachers
      • PreAcademy prep
      • Day 1 Monday: Basics and Lights >
        • Day 1 Supplement Activity
      • Day 2 Tuesday: Servos >
        • Day 2 (Suppliment Activities)
      • Day 3 Wednesday: Making an ECG/EKG! >
        • Day 3 (Supplement Page)
      • Day 4 Thursday: Controlling Servos with EMG >
        • Day 4 Supplemental Activity
      • Day 5 Friday: Finishing up/Show >
        • Unused lessons/content
    • 2018 Lessons >
      • Day 1: Basic Coding
      • Day 2: Motors
      • Day 3: Build Robot Claw
      • Day 4: Saving Positions
      • Day 5: Presentations
    • 2017 Camp >
      • Day 1 (Monday)
      • Day 2: Multicolor LED and Keypad
      • Day 3: Servo and Keypad
      • Day 4: Multiple Motors/Stepper Motor
      • Day 5: Presentations
    • Pictures archive for lessons (some graphic images)
  • Contact Us!