Organize and Share your Electronics the way you want. Sign-Up for a free account now. It takes only 30 seconds!

Arduino Radar Tutorial: Fading an LED With My Breath

Arduino Radar Tutorial: Fading an LED With My Breath

I 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.

Copyright Build Electronic Circuits

Read more Here







 

More Articles to Read

App note: EPIC: Electro-Pyrotechnic Initiator Chip Resistor
App note: EPIC: Electro-Pyrotechnic Initiator Chip Resistor
App note: Noise analysis for high-speed op amps
App note: Noise analysis for high-speed op amps
Skill Sunday: Arrays
Skill Sunday: Arrays
App note: Infrared remote control implementation with MSP430FR4xx
App note: Infrared remote control implementation with MSP430FR4xx
Gesture Controlled Smart Home
Gesture Controlled Smart Home
Design for a Wideband, Differential Transimpedance DAC Output
Design for a Wideband, Differential Transimpedance DAC Output
Wrist thrusters let you fly through the water effortlessly
Wrist thrusters let you fly through the water effortlessly
Bertan/Spellman 225-20R HV power supply teardown
Bertan/Spellman 225-20R HV power supply teardown
Blinking Christmas Lights
Blinking Christmas Lights
Adjusting clock with alarm, hygrometer & thermometer on 1.8″ ST7735 display
Adjusting clock with alarm, hygrometer & thermometer on 1.8″ ST7735 display
Adding an “extra sense” with rangefinders
Adding an “extra sense” with rangefinders
This wireless game controller looks like a rug
This wireless game controller looks like a rug
How to run your ESP8266 for years on a battery
How to run your ESP8266 for years on a battery
Calibration of a 3-Phase Energy Meter Board on the ADE7754
Calibration of a 3-Phase Energy Meter Board on the ADE7754
Making beats on a tiny Arduino DJ controller
Making beats on a tiny Arduino DJ controller
Qinsi-QS5100 Sn63Pb37 solder profile
Qinsi-QS5100 Sn63Pb37 solder profile
Water Detection System
Water Detection System
Professional Hi-Fi 15W Tube Amplifier circuit
Professional Hi-Fi 15W Tube Amplifier circuit
This Arduino machine will judge how sick your ollies are
This Arduino machine will judge how sick your ollies are
Turn an old payphone into a boombox for ’90s hits
Turn an old payphone into a boombox for ’90s hits

Top


Shares