element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Open Arduino
  • Challenges & Projects
  • Project14
  • Open Arduino
  • More
  • Cancel
Open Arduino
Blog LS Cubed: Little Sister Security System
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Open Arduino to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fmilburn
  • Date Created: 17 Apr 2018 5:24 AM Date Created
  • Views 6718 views
  • Likes 16 likes
  • Comments 35 comments
  • rcwl-0516
  • hc-sr04
  • pir
  • esp8266
  • arduino_classic
  • openarduinoch
  • esp-now
  • arduino
  • wemos
  • d1 mini
Related
Recommended

LS Cubed: Little Sister Security System

fmilburn
fmilburn
17 Apr 2018

This project is a collaboration with my 6 year old grandson and is also my offering in the open Arduino contest to celebrate the birthday of Arduino and Project14.

 

4/24 Update:  Wrote up the final project.  Included some of the material from the discussion comments into the main body of the write-up.  Corrected a few small typos and errors.

 

Project Objectives

Create a device which will alert older siblings when their two year old toddler sister is getting into stuff she shouldn't - especially the Lego model that was just completed.  Or, for the more technically oriented:

  • Install the ESP8266 core into the Arduino IDE with the Board Manager
  • Learn how to use ESP-NOW, a point to point protocol works on the ESP family using the Arduino IDE
  • Experiment with different sensors, especially the RCWL-0156 "radar" sensor

Most of all, have a bit of fun.

 

Background

My grandson recently came to visit and was excited to tell me that he had a good idea for a project that also served a pressing need.  Specifically that his two year old sister was constantly getting into things (e.g. the Lego project that he had just completed) and it had to be stopped.  I asked him to draw up a proposal and here it is:

 

image

 

He is just learning to read and write so I will interpret it for you.  The object in the upper left is a waterproof bracelet that transmits the location of the toddler by radio.  The object lower right is a waterproof thing that you can put on your wrist that has a screen, beeper, and LED to alert you when the toddler is somewhere she shouldn't be.  They are waterproof because they are planning to go to a waterpark and it might get wet.

 

Back in the day, when I was a boy and way before the Arduino, I would have solved the problem like this:

image

It pretty well explains why I became a mechanical engineer and not an electrical/electronics engineer or computer science major.  Clearly this will not do and an Arduino is required.

 

One Approach

Keeping track of and managing two year olds is one of the hardest things on the planet.  They are among the wiliest and most clever of all creatures.  If we can pull this off it could be worth a fortune! 

 

The constraints are:

  • I need to build it in the next week or two because that is the next time I will see my client (grandson) and he wants it yesterday
  • It needs to be suitable for little kids
  • It needs to be Arduino based or at least use the Arduino IDE

 

Here is an approach in line with what my grandson imagined:

  • Bracelet for the toddler that has a Bluetooth beacon run off of coin cell
  • Station(s) that could be placed near Lego or other desired locations that would detect signal strength of the Bluetooth beacon from the bracelet and send Bluetooth or Wi-Fi signal warning when the toddler was close
  • Smartwatch that would buzz and light up on the client's wrist when warning is received and show the location of the toddler

 

Let's Get Real

That approach is not going to happen.  I don't have the materials on hand and there is only a week or two.  These might be useful....

 

  • Two ESP8266 Wemos D1 Minis
  • HC-SR04 distance sensor
  • PIR sensor
  • RCWL-0516 "radar" sensor

 

There are many other ways of detecting and sending notice of human presence, but these are the ones readily available to me.

 

I don't have much experience with the ESP8266 so this will be a good learning experience.  The project will be divided into two phases:  a concept selection phase where the sensors at hand are tested and a build phase where something that will work as a first pass is created.  During the concept selection phase code will be separately developed for the hardware and then combined into one test package.  The three sensors could potentially complement each other and all included in the final product or perhaps only one will be needed.

 

Disclaimer:  This is a fun project.  However, the code and hardware that follows only demonstrates concepts.  Transmissions are not secure, the code is not fully tested, and the hardware does not make a reliable security system.

 

Lets Get Started

 

ESP8266

image

This project will use the Wemos D1 mini, an easy to use ESP8266 board that can run on the Arduino IDE and is shown above.  They can be purchased from the usual Chinese and internet sources.  The github page is here for the Arduino implementation and it also has links to documentation and the boards manager.  I had no problem installing it via the boards manager in Arduino 1.8.4.  I did run into a conflict with my virus protection software (McAfee) which occasionally would not let it compile on Windows 10.  Microsoft virus protection ran without a problem.

 

To learn more about the ESP8266 I watched the YouTube videos by Andreas Spiess and highly recommend them if you are unfamiliar with the ESP family.  In episode #172 he discusses ESP-NOW which is a point to point method for connecting two or more ESPs to each other using the Arduino IDE.  It is small, fast, and does not require connection to an internet access point.  Among the constraints of ESP-NOW are:

  • Limited to 250 bytes per transmission
  • Only 20 ESP devices can be connected (10 with security enabled)

The advantages include:

  • Since a router / connection is not necessary it can be operated anywhere
  • Faster than connecting to the internet
  • Lower energy requirements
  • Lower overhead

Watch the videos by Andreas for much more information.

 

I developed a "Hello World" sketch using ESP-NOW based on code by Andreas and posted it here on Github.  It consists of a send and receive sketch which I recommend you try if you are following along.  I use a C style struct for the data and display it on the serial monitor when both sending and receiving.  It is not secure in any way, form, or fashion.

 

RCWL-0516

image

Shown above is the RCWL-0516 "radar" sensor.  Once again, Andreas has a YouTube video on these sensors which he covers in episode 135.  There is considerable discussion on the internet about how these work and whether they are really radar and I suggest interested persons to google.  In addition there is some very good discussion by element14 members in the comments below.  The origin of the RCWL-0516 seems to be detection for turning lights on and off in a way similar to how PIR sensors are sometimes used.  They are quite inexpensive and again can be found in the usual Chinese sources.  An interesting feature is that they can "see through walls" as I will demonstrate shortly in a video.  A simple sketch I developed can be found here on Github.  It sends message to the serial terminal when motion is detected.  Note that there is a pause between readings that is set by the sensor and cannot be changed in the code.

 

PIR Sensor

image

 

Members of element14 will be familiar with PIR sensors and their use.  The PIR sensor I used has a delay set by the hardware before it signals high again after a trigger which cannot be changed in firmware.  I have posted my own short sketch on Github for the ESP8266.

 

HC-SR04

image

Again, I imagine that most element14 members and users of the Arduino are familiar with Ultrasonic sensors as seen above.  The inexpensive version here is readily available from Chinese sources.  The theory is described in some detail in my Github code for the ESP8266 linked here.

 

Breadboarding the Components

 

Sending Unit

image

It is time to put it all together and the sending unit can be seen above.  From left to right there is the RCWL-0516 radar, the PIR sensor, the ultrasonic distance sensor and the ESP8266.  Note the voltage dividers being used to protect the 3V3 pins on the ESP8266.  All of the sensors are being powered by a 5V rail coming from the ESP8266.  The pins being used are the same ones outlined in the individual sketches above.

 

My code can be found here on Github.  If you have worked through the sketches above it shouldn't be too hard to follow but I am available if there are questions.

 

Receiving Unit

image

The receiving unit can be seen here.  Left to right is the ESP8266, a red LED that toggles when the "radar" goes high, a yellow LED that toggles when the PIR goes high, and a blue LED that toggles when meaningful changes occur in the distance sensed by the ultrasonic sensor.  Output is also sent over the serial connection to the Arduino terminal if connected.

 

First Trial

Here is a video of the concepts being tested in my lab.  It works image

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

At this point I decided to concentrate on the RCWL-0516 and learn more about its capabilities and limitations.  Read the comments below for suggestions from other element14 members who provided much useful information and direction.

 

Exploring the Analog side of the RCWL-0516

The RCWL-0516 has an IC onboard labelled RCWL-9196.  Pin 12 of the IC has the amplified analog signal from the antenna.  When connected to the oscilloscope we see activity like that in the figure below.

image

When there is no activity the trace has an offset of about 1.7 Volts.  When movement is detected excursions of plus / minus 1.7 Volts around the offset occur with high activity.  Higher activity closer in gives the greatest excursions and this can be used to indicate activity in addition to that indicated by the LOW / HIGH digital output.  A simple Arduino sketch was written which reads the analog signal and can plot it or output it to LEDs indicating the level of activity.  Further discussion of the development can be found in the comments below.

 

Prototype

A prototype was built on 4 x 6 cm plated through-hole perfboard that would be more permanent and rugged.

image

Note the yellow lead which attaches to pin 12 of the IC on the RCWL-0516 and the analog pin on the ESP8266.  I've also added LEDs for this version which indicate the analog signal strength as read on the analog pin of the ESP8266.  The red LED triggers at about the same point as the digital output of the sensor and the code is located here. The layout can be rearranged with the sensor laying down and placed in a enclosure for additional protection.

image

 

 

 

Real World Testing

I made a number of tests around the house to see how my samples of the sensor performed.

  • Reliable sensing of an adult to 3.5 meters or greater
  • Reliable sensing through walls in some instances although attenuated
  • Sensing of movement outside a car when subject is close by
  • Some glass (e.g. double paned UV coated sliding door) almost completely blocks
  • Antenna reception is best on the "front" or IC side of the board and attenuated roughly 50% around sides and back.  It can also detect above and below the antenna.

 

But the real test is can it detect a fast moving 2 year old?  In the following test the too cute subject is coming from around a wall to the left of video.  The sensor is on top of the table and the digital trigger occurs when the blue LED on the ESP8266 lights up.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

We observe that:

  • She is not detected until after she rounds the corner from behind the wall
  • The digital signal comes only after she is very close and reaching for the milk

 

I conclude that it works, but for a smaller subject range is not as good.

 

Summary

The project accomplished the following:

  • Used the Arduino IDE to successfully program the ESP8266
  • Showed how to use ESP-NOW, a point to point protocol that works on the ESP family using the Arduino IDE and does not require a router or connection to the internet
  • Experimented successfully with different detection sensors and wrote code that should be transferrable to any Arduino
  • Dug deeper into the RCWL-0516 "radar" sensor
    • Experimented with capabilities and limitations
    • Explored the analog side of the sensor
  • Successfully developed a system for detecting siblings and had fun doing it.

 

Possible future improvements to the project include:

  • Additional exploration of the detection capabilities of the RCWL-0516
  • Look at making the antenna more directional
  • Use of Bluetooth LE or other technology to reduce the size and power requirements of the radio

 

Thanks for reading and special thanks to mcb1 for all of his helpful comments and suggestions.  Extra special thanks to my grandson for a great idea and to his little sister for keeping us on our toes.

 

References and Links

Andreas Spiess Videos - Good introductions to the ESP8266 and the RCWL-0516

My Github Repository for this Project

Analog side of the RCWL-0516 - Thanks Mark, see additional links in comments below

Original patent describing how the RCWL-0516 works - Thanks Jon, see additional link in comments below

https://www.youtube.com/channel/UCu7_D0o48KbfhpEohoP7YSQ

  • Sign in to reply

Top Comments

  • mcb1
    mcb1 over 7 years ago +7
    Nice project. Seems you have a budding inventor there. Great find on the 'radar' sensor. They are a microwave device that uses frequency shifting to sense a moving object. Most of the tests don't seem…
  • genebren
    genebren over 7 years ago +4
    Frank, Fun little project. It is great that you and your Grandson are working together on a problem. Projects are fun for little kids. Gene
  • mcb1
    mcb1 over 7 years ago +4
    It certainly looks like it did trigger ... but as you say it wasn't until it was too late. Well done, I think you have achieved the intent of the request. More importantly your grandson might be able to…
  • fmilburn
    fmilburn over 4 years ago in reply to stewieman

    Hello Alex,

     

    I am not much of a C++ programmer but the C++ compiler requires that certain things like variables, functions and classes be defined before (or ahead of) the source code.  This information can be placed in a header file using the suffix h, for example espnow.h which is a library provided when an Espressif board is loaded into Arduino.  The C++ files that use this information must include the # include directive, for example #include <espnow.h>  usually at the top of the file.

     

    It has been a while since I wrote this so I had a quick look through the code.  I don't see any local libraries written by me, only things like espnow.h which are provided by Espressif.  What kind of issues are you encountering when you try to run the code sketch?

     

    Frank

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • stewieman
    stewieman over 4 years ago

    Hey, fmilburn this is exactly what I'm looking for, however, I'm a noob and don't really get header files. do you have somewhere where I can access these header files? I'm using 2 esp 32s. thanks so much.

     

    Alex

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fmilburn
    fmilburn over 6 years ago in reply to mcb1

    Nothing new on my end with the sensor....  I was looking back at my "content" and noticed that this has the most hits of anything I have ever posted and then thought about your project.  Focusing the beam would be pretty neat.

     

    Frank

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 6 years ago in reply to fmilburn
    were you able to get your hands on any of these and test them?

    Got them = image

    Tested     = image

     

    I've had some other things take over, but I have been contemplating the housing that wouldn't look out of place.

    It was important because it can affect the performance, and I wanted to see if I could 'focus' the beam, hence why it's been in my thoughts.

     

    Do you have some updated info?

     

    Thanks for checking.

    Mark

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fmilburn
    fmilburn over 6 years ago in reply to mcb1

    Hi Mark,

     

    I may have missed it but were you able to get your hands on any of these and test them?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube