• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Build Electronic Circuits

Build Electronic Circuits

Electronics explained in a simple way

  • Start Learning
    • Basic Electronics
    • Digital Electronics
    • Circuits
    • Practical Skills
      • Printed Circuit Boards
    • Microcontrollers
      • Arduino
    • Maker Lifestyle
      • Podcast
    • Academy
  • About Me
  • Blog
  • Academy
  • Contact
You are here: Home / Microcontrollers / Arduino / Arduino Radar Tutorial: Fading an LED With My Breath

Arduino Radar Tutorial: Fading an LED With My Breath

August 12, 2015 By Øyvind Nydal Dahl 25 Comments

Arduino radar project on a breadboardI built this Arduino radar project, where I control the brightness of an LED with my breath. In this tutorial, I will show you exactly how to do it.

It was an experiment to get the XeThru radar to work with Arduino. I plan to expand on this later, and build more useful applications.

And I will share with you how to connect the hardware, and how to create the Arduino code.

Just to be clear: This is not a sonar pretending to be a radar. This is a radar. With electromagnetic waves.

The Hardware

XeThru is a radar module from Novelda. You can use it to detect movement in a room, and even measure the breath of a person, without contact.

Since it’s using electromagnetic waves, you could build it into your wall or some other object, to create an invisible intruder alarm sensor.

For example:

You could build it into an alarm clock, and place it on your night stand. Without anything connected to your body or your bed.

Then it would monitor your breathing pattern, and your movements throughout the night. This information can help you understand the quality of your sleep. Are you getting the sleep cycles you need?

Or, you could build it into a handheld device for the police. They can place it on a door to see if there is anyone in the room before entering.

There are other radars available, like these:

http://reactancelabs.com/?p=293
http://hackaday.com/2014/06/14/the-first-arduino-radar-shield/

But they’re quite big, because of their antennas.

The XeThru module fits in my hand:

XeThru Radar Module

How To Connect

You control the XeThru radar module with two UART pins.

I used an Arduino UNO, with an RGB LED and three 100 Ohm resistors.

The module uses 2.8V levels. Since my Arduino use 5V levels, I needed a voltage level converter. Other than that, it was pretty straight-forward.

Circuit diagram for the arduino radar

The level shifter I used, was a BSS138 board from Tinkersoup here in Berlin.

To make it work, I also needed a 2.8V supply. Luckily, the USB-module for the XeThru radar has a 2.8V supply pin that I could use.

Pitfall:
I spent a lot of time scratching my head in the beginning. I didn’t get any response from the radar! The reason was that I had forgot to connect the ground….

Arduino radar on a breadboard

Writing Code for the Arduino Radar

From the documentation of the serial protocol of the radar, I found out how to get the radar to send me respiration data:

-Reset the radar
-Load an app
-Set configurations (if any)
-Start the app

In the beginning, I had some problems. I just didn’t get any respiration data from the radar. After discussing the problem on the XeThru forum, I found that I had the wrong byte order for the application code.

I fixed that, and data came streaming in!

Type Conversion

Another thing I was struggling with, was type conversion. And with only an RGB LED as my output, it was a bit hard to debug. So I connected another Arduino with SPI, that I could use as a debugging console for a while, and got the type conversion sorted out.

I parsed the data that was coming in, and used the movement-value to set the brightness of the LED. This way, the LED faded in and out with the tiny movement of my body when breathing in and out.

Really cool to experience!

The Arduino did not process the data fast enough, so I also added a function to empty the buffer and sync the data for every time I fetched a new measurement. This way, I always got fresh data.

I’ve created a github repository for the arduino radar code, where you can find the latest version of the code. The plan is to turn it into a proper Arduino library for the XeThru radar.

Click here to see the code I used in the beginning.

What’s next?

Next up, is to create a useful device with the arduino radar. I’ll be sharing my experiences, code and hardware connections on my blog and newsletter.

Sign up below to get updates.

Filed Under: Arduino

Reader Interactions

Comments


  1. navidad says

    October 14, 2015

    Great tutorial! too bad, this little device costs 400$… which is too expensive, in my opinion. There are board based on HB 100 Microwave Sensor Module, at around 4$ that can detect movement through walls

    Reply

    • admin says

      October 14, 2015

      I don’t know the HB 100 sensor. But I think it’s a lot less sensitive. I doubt that you can measure breathing with it. But yeah, the price difference is a bit high at the moment. But WiFi modules were also pricey a few years ago, and now you can find them for $5 =)

      Oyvind

      Reply

    • zert says

      March 30, 2018

      Do you have tested the device through walls ? Does it still work ?

      Given that the X4M200 uses EM that can go through wall , that could be possible, depending on the frequency used.

      Reply

      • admin says

        April 9, 2018

        Yes, it can work. But it depends on the material of the wall.

        Best,
        Oyvind

        Reply

  2. CHOUAIBOU NSANGOU says

    April 10, 2017

    Hi Oyvind,
    What is the reference of the usb communication board and where to find it ?

    Best regards,
    Chouaibou NSANGOU.

    Reply

    • admin says

      April 17, 2017

      Hi,

      The USB communication board is custom made by XeThru. But their newer boards don’t need an external communication board.

      Best,
      Oyvind

      Reply

  3. Herman Bergwerf says

    December 15, 2017

    From the specs of the X2M200 sensor it should be able to feed it 5V (directly from the Arduino) and use a 3.3V to 5V level shifter for communication, is that right?
    Thanks :-)

    Reply

    • admin says

      December 18, 2017

      That sounds right, yes. I haven’t worked with this in a while though, so double check what I say ;)

      Reply

  4. Nanaui Amoros says

    December 29, 2017

    Hello Øyvind, great tutorial!

    Do you know if it would work with the new X4M200 respiration sensor?

    Thanks!

    Reply

    • admin says

      January 8, 2018

      Hi Nanaui,

      Thanks =)
      I think the protocol should be the same, and in that case it should work. But I haven’t used that chip, so I can’t make any promises :)

      Oyvind

      Reply

      • Nanaui Amoros says

        January 9, 2018

        Thanks! I will try it!!

        Reply

  5. luanty says

    February 6, 2018

    Hi, I’d like to know if the USB communication board is included in the Rader or is needed to buy it in other ways.

    Reply

    • admin says

      February 12, 2018

      Hey, they have different products with different features. Check out their webshop for the latest updates: https://www.xethru.com/shop/

      Best,
      Oyvind

      Reply

  6. Karen says

    September 20, 2018

    Such a great project and tutorial! I would like to ask what if there are multiple people in the same room? Will it pick up messy data?

    Reply

    • admin says

      September 20, 2018

      Thanks =)

      It could. But it all depends on how you process the data. The radar outputs raw radar data, which is lots of pulses, then you have to create algorithms to process it.

      Detecting two persons breathing, could be easy or it could be hard, depending on their position and if they are moving a lot.

      Best,
      Oyvind

      Reply

  7. Sai Jyothi says

    March 22, 2019

    Hi,
    At the beginning of the code, you mentioned that the definitions are for Arduino mega board what changes should I make for other Arduino boards and where can I find the reference for performing the same.

    Reply

Trackbacks

  1. Arduino Radar Watches You Breathe | Hackaday says:
    August 15, 2015 at 1:01 pm

    […] We’ve all likely watched an episode of “Star Trek” and admired the level of integration on the sick bay diagnostic bed. With its suite of wireless sensors and flat panel display, even the 1960s imagining of the future blows away the decidedly wired experience of a modern day ICU stay. But we may be getting closer to [Dr. McCoy]’s experience with this radar-based respiration detector. […]

    Reply
  2. Arduino Radar Watches You Breathe | Ad Pub says:
    August 15, 2015 at 2:30 pm

    […] We’ve all likely watched an episode of “Star Trek” and admired the level of integration on the sick bay diagnostic bed. With its suite of wireless sensors and flat panel display, even the 1960s imagining of the future blows away the decidedly wired experience of a modern day ICU stay. But we may be getting closer to [Dr. McCoy]’s experience with this radar-based respiration detector. […]

    Reply
  3. Arduino Radar Watches You Breathe | Hack The Planet says:
    August 15, 2015 at 5:52 pm

    […] We’ve all likely watched an episode of “Star Trek” and admired the level of integration on the sick bay diagnostic bed. With its suite of wireless sensors and flat panel display, even the 1960s imagining of the future blows away the decidedly wired experience of a modern day ICU stay. But we may be getting closer to [Dr. McCoy]‘s experience with this radar-based respiration detector. […]

    Reply
  4. MCU Turkey – MCU Turkey Haftalık Bülten says:
    August 16, 2015 at 4:09 pm

    […] Sensörün resmi web sitesi burada. Fiyatı ise 400$. Bu pahalı ama eğlenceli projeye buradan ulaşabilirsiniz. Ayrıca test videosunuda aşağıdan […]

    Reply
  5. Arduino Radar Tutorial: Fading an LED With My Breath - Electronics-Lab says:
    August 17, 2015 at 11:24 am

    […] Arduino Radar Tutorial: Fading an LED With My Breath – [Link] […]

    Reply
  6. Control an LED with your breathe | Atmel | Bits & Pieces says:
    August 19, 2015 at 5:40 pm

    […] one of these boards on hand, Maker Øyvind Dahl decided to build an Arduino radar that could control the brightness of an LED with his breath. To accomplish this, he hooked […]

    Reply
  7. LED's aansturen met je adem - Mancave says:
    September 3, 2015 at 9:38 am

    […] gebruikt de Arduino om data van de XeThru te verwerken en om de LED aan te sturen. Op zijn blog Build Electronic Circuits lees je welke hardware je nodig hebt, hoe je Arduino en XeThru met elkaar connect en welke code je […]

    Reply
  8. How to Measure Breathing with Radar and Arduino #Arduino « Adafruit Industries – Makers, hackers, artists, designers and engineers! says:
    September 20, 2015 at 8:00 am

    […] Don’t miss the full write up! […]

    Reply
  9. Mindfull interactive installation – tina burton says:
    January 31, 2019 at 1:58 pm

    […] https://www.build-electronic-circuits.com/arduino-radar-tutorial/ […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Search:

Footer

Topics

  • Basic Electronics
  • Digital Electronics
  • Circuits
  • Practical Skills
  • Microcontrollers
  • Maker Lifestyle
  • Newsletter Archive

Social:

  • Facebook
  • Twitter
  • YouTube

Products

  • Electronics Course
  • Other Products

Copyright © 2022 · Ohmify AS · Terms and Conditions · Privacy Policy