'Don't Touch Me' Anti-Virus Alarm

2,600

26

2

Introduction: 'Don't Touch Me' Anti-Virus Alarm

About: I used to teach middle school science, but now I run my own online educational science website. I spend my days designing new projects for students and Makers to put together.

Sometimes you just want to keep people at arms length, such as when you have a cold or the other people might have a horrible virus of their own. For those situations you need a device that warns you when others are getting too close. Thats why we built the "Don't Touch Me" Anti-Virus Alarm system! Whenever someone gets within 6 feet of you the speaker will start emitting a loud and annoying sound while the LED starts flashing faster and faster. Protect yourself today with proven technology!

We wanted to build a silly project to help pass our time in quarantine so we built this. It's a pretty simple project overall, using an Arduino for the brain and a simple ultrasonic range finder as a sensor. We built this using Crazy Circuits components so we could stick the project onto LEGO, but you could also easily build this using standard components and any Arduino compatible board.

If you like our projects and want to see more of what we get up to each week please follow us on Instagram, Twitter, Facebook, and YouTube.

Supplies

Brown Dog Gadgets does in fact sell kits and supplies, but you don't need to buy anything from us to make this project. Though if you do it does help support us in creating new projects and teacher resources.

Electronics:

Other Supplies:

Step 1: Video Guide

For those of you who hate to read we also made this handy video guide.

Step 2: Lay Out LEGO and Electronics Components

In general you can just look at the above diagram and see how everything is connected.

We start by laying out some LEGO plates in order to build a platform for the Robotics Board to sit on. We used some 2x4 plates, but some 1 stud wide plates would also work just fine. You could also just have the Robotics Board hand off the edge of your LEGO base plate as well.

Then, plan out where your electronics will go. We chained the Negative of our LED and Piezo Speaker off each other, but you don't have to do that.

Lastly we added our 1/8th inch Maker Tape. This stuff is a nylon conductive tape which is super strong and durable which makes it perfect for the pressure fit of our Crazy Circuits components.

Step 3: Sensor Holder

Use some 2x3 and 2x2 bricks to build a platform for the sensor.

We'll also use a couple of 1x6 bricks to hold the sensor in place.

If you have a 3D printer you can also try printing your own sensor holder!

Step 4: Wire Up Sensor

The Robotics Board has pin headers on the back end for easy connection to sensors.

The way our code is set up we're using Pin 6 for the Echo and Pin 5 for the Trigger. Connect VCC to any 5V pin and GND to any GND pin.

We also used a 1x2 Technic brick as a wire organizer. Shoving four ribbon cables through it is possible, just don't expect to ever be able to take them out again.

Step 5: Add More Bricks

Add in a couple of 1x6 and 1x4 LEGO bricks to hold the sensor in place.

We also added some longer 1x6 LEGO Technic bricks to the top so we could attach the lanyard.

Step 6: Upload Code

Before this thing will work you'll need to upload code. If you've not done so already, make sure you have the latest version of the free Arduino IDE software installed on your computer.

Our code is found at our GitHub repo along with the NewTone_1.0 library. You'll need to install the NewTone library for this project to work.

The code is very straight forward. You can change the distance settings as well as which pins are being used for input and outputs.

Step 7: Enjoy!

Thats pretty much it for this project. We hope you've enjoyed making a personal alarm system for yourself.

With any luck you won't need it, but it may come in handy.

Or if nothing else you can use it to alert you to when a cat, dog, or small child is trying to sneak up on you while you work/ study at home. Pesky small mammals!

Be the First to Share

    Recommendations

    • Halloween Contest

      Halloween Contest
    • Rocks, Gems, and Stones Speed Challenge

      Rocks, Gems, and Stones Speed Challenge
    • Organization Contest

      Organization Contest

    2 Comments

    0
    bosscherhenk
    bosscherhenk

    Question 1 year ago

    I have a problem.
    I use de arduino nano every

    Arduino:1.8.12 (Windows Store 1.8.33.0) (Windows 10), Board:"Arduino Nano Every, ATMEGA328"
    WAARSCHUWING: bibliotheek NewPing beweert te werken onder architectuur avr, arm en kan incompatible zijn met uw huidige board dat werkt onder architectuur megaavr.
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp: In static member function 'static void NewPing::timer_us(unsigned int, void (*)())':
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:254:3: error: 'OCR2A' was not declared in this scope
    OCR2A = min((frequency>>2) - 1, 255); // Every count is 4uS, so divide by 4 (bitwise shift right 2) subtract one, then make sure we don't go over 255 limit.
    ^~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:255:3: error: 'TIMSK2' was not declared in this scope
    TIMSK2 |= (1<<OCIE2A); // Enable Timer2 interrupt.
    ^~~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:255:3: note: suggested alternative: 'TIMERB2'
    TIMSK2 |= (1<<OCIE2A); // Enable Timer2 interrupt.
    ^~~~~~
    TIMERB2
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:255:17: error: 'OCIE2A' was not declared in this scope
    TIMSK2 |= (1<<OCIE2A); // Enable Timer2 interrupt.
    ^~~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp: In static member function 'static void NewPing::timer_ms(long unsigned int, void (*)())':
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:274:3: error: 'OCR2A' was not declared in this scope
    OCR2A = 249; // Every count is 4uS, so 1ms = 250 counts - 1.
    ^~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:275:3: error: 'TIMSK2' was not declared in this scope
    TIMSK2 |= (1<<OCIE2A); // Enable Timer2 interrupt.
    ^~~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:275:3: note: suggested alternative: 'TIMERB2'
    TIMSK2 |= (1<<OCIE2A); // Enable Timer2 interrupt.
    ^~~~~~
    TIMERB2
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:275:17: error: 'OCIE2A' was not declared in this scope
    TIMSK2 |= (1<<OCIE2A); // Enable Timer2 interrupt.
    ^~~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp: In static member function 'static void NewPing::timer_stop()':
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:286:3: error: 'TIMSK2' was not declared in this scope
    TIMSK2 &= ~(1<<OCIE2A);
    ^~~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:286:3: note: suggested alternative: 'TIMERB2'
    TIMSK2 &= ~(1<<OCIE2A);
    ^~~~~~
    TIMERB2
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:286:18: error: 'OCIE2A' was not declared in this scope
    TIMSK2 &= ~(1<<OCIE2A);
    ^~~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp: In static member function 'static void NewPing::timer_setup()':
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:311:3: error: 'ASSR' was not declared in this scope
    ASSR &= ~(1<<AS2); // Set clock, not pin.
    ^~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:311:3: note: suggested alternative: 'SS'
    ASSR &= ~(1<<AS2); // Set clock, not pin.
    ^~~~
    SS
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:311:16: error: 'AS2' was not declared in this scope
    ASSR &= ~(1<<AS2); // Set clock, not pin.
    ^~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:311:16: note: suggested alternative: 'A2'
    ASSR &= ~(1<<AS2); // Set clock, not pin.
    ^~~
    A2
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:312:3: error: 'TCCR2A' was not declared in this scope
    TCCR2A = (1<<WGM21); // Set Timer2 to CTC mode.
    ^~~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:312:3: note: suggested alternative: 'TCB2'
    TCCR2A = (1<<WGM21); // Set Timer2 to CTC mode.
    ^~~~~~
    TCB2
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:312:16: error: 'WGM21' was not declared in this scope
    TCCR2A = (1<<WGM21); // Set Timer2 to CTC mode.
    ^~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:313:3: error: 'TCCR2B' was not declared in this scope
    TCCR2B = (1<<CS22); // Set Timer2 prescaler to 64 (4uS/count, 4uS-1020uS range).
    ^~~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:313:3: note: suggested alternative: 'TCB2'
    TCCR2B = (1<<CS22); // Set Timer2 prescaler to 64 (4uS/count, 4uS-1020uS range).
    ^~~~~~
    TCB2
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:313:16: error: 'CS22' was not declared in this scope
    TCCR2B = (1<<CS22); // Set Timer2 prescaler to 64 (4uS/count, 4uS-1020uS range).
    ^~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:314:3: error: 'TCNT2' was not declared in this scope
    TCNT2 = 0; // Reset Timer2 counter.
    ^~~~~
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:314:3: note: suggested alternative: 'TCB2'
    TCNT2 = 0; // Reset Timer2 counter.
    ^~~~~
    TCB2
    In file included from C:\Users\henkb\Documents\ArduinoData\packages\arduino\hardware\megaavr\1.8.5\cores\arduino/Arduino.h:27:0,
    from C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.h:148,
    from C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:7:
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp: In function 'void TIMER2_COMPA_vect()':
    C:\Users\henkb\Documents\Arduino\libraries\NewPing\src\NewPing.cpp:337:6: warning: 'TIMER2_COMPA_vect' appears to be a misspelled 'signal' handler, missing '__vector' prefix [-Wmisspelled-isr]
    ISR(TIMER2_COMPA_vect) {
    ^
    exit status 1
    Fout bij het compileren voor board Arduino Nano Every
    Dit rapport zou meer informatie bevatten met
    "Uitgebreide uitvoer weergeven tijden compilatie"
    optie aan in Bestand -> Voorkeuren.

    i dont now what to do,

    Henk Bosscher

    0
    TechnoChic
    TechnoChic

    1 year ago

    This is great! I want to use it on my dog - 6ft from me and 6ft from my dog too! No petting! :)