Introduction: Air Button for Volumio Using Ultrasonic Sensor

Picture of Air Button for Volumio Using Ultrasonic Sensor

I place my hand in the air and it’s my music player I have full control of. I change volume of the music and play or stop songs just by putting my hands high or low. I can program how ever I want to control the features of Volumio, the app for personal jukebox on cloud. However, it does not end there. It goes beyond the music app and controls just about any apps with my bare hands.

If you haven’t looked at my prior project using GPIO, check out from my related project on your right side. If it’s not there, try this link. It goes into details of what GPIO app does and how it is different. It also gives you instructions on how to build a traffic lights.

https://www.instructables.com/id/GPIO-for-Raspberry-Pi-B-B-Pi-2-running-PROTA-Pi-OS/?utm_source=base&utm_medium=related-instructables&utm_campaign=related_test

This is the bottom line.

I mesh an ultrasonic sensor and Volumio and I get levels of invisible buttons that I can customize how ever I want.

NOTE for your understanding
You need to download the app first on PROTA Pi to follow this Instructables. Install the app from AppRepo. By any chance, if you don’t have a copy of the OS, you can get your hands on it from the download. if you’re looking for a shortcut, this’s the one: Where-can-I-download link.

Step 1: What Do I Need?

Picture of What Do I Need?

What I need to prepare:

  • LED
  • ultrasonic sensor
  • breadboard
  • cables for GPIO
  • post it or notes(not mandatory if you’re good at rough estimates of heights)

As shown in the picture, I made connections with TxD, RxD, GND, and 5V. LED in the first picture is there to check if they’re properly working or not.

Step 2: Configure UART From the GPIO App

Picture of Configure UART From the GPIO App

Configure your settings as shown in the guideline of UI.

  • Baud rate : 38,400 bps
  • Data bit : 8 bit
  • Stop bit : 1 bit
  • Buffer size : 100
    • The buffer size means the number of letters that can be delivered at one transfer.

Step 3: Test the Ultrasonic Sensor

Picture of Test the Ultrasonic Sensor

The above two pictures in png format are actual automation rules that have been applied to my system and sharing with you all so that you can also apply to your system. Download the picture files and apply with a drag-and-drop on your app. If properly configured, the LED will turn on when you put your hand over the ultrasonic sensor and off when you put away.

If you want to create the test rules manually, follow the next step.

Step 4: Configure UART From the GPIO App (part 1/2)

Picture of Configure UART From the GPIO App (part 1/2)

This’s what it does.

“If the distance reading on ultrasonic is less than 10cm, turn on the LED."

<How to configure a sensor app>

  1. select GPIO app
  2. select UART serial
  3. UART Read
  4. (check the green checkbox)
  5. select and register filter : click '+ Advanced'
    Test True : {{{{{{data!split("\x03\x02^")}}[1]!to_int}}!le(100)}}
    (This may be a bit difficult step to some of us.. in short, le(less than and equal to) 100mm. Try testing by changing the numbers yourself!)

If you’d like to understand more about how to register code in filter values and build the rule for yourself, please try out the link(blog) below.

'Learn more about AMBLANG'

<How to configure an actuator app>

  1. select GPIO app
  2. select Write Digital
  3. select GPIO pin$
  4. (check the green checkbox), Set '1’(turn on the LED)

Step 5: Configure UART From the GPIO App (part 2/2)

Picture of Configure UART From the GPIO App (part 2/2)

This’s what it does.

“If the distance reading on ultrasonic is more than 10cm, turn off the LED."

<How to configure a sensor app>

  1. select GPIO app
  2. select UART serial
  3. UART Read
  4. (check the green checkbox)
  5. select and register filter : click '+ Advanced'
    Test True : {{{{{{data!split("\x03\x02^")}}[1]!to_int}}!ge(100)}}
    (ge(greater than and equal to) 100mm.)

<How to configure an actuator app>

  1. select GPIO app
  2. select Write Digital
  3. select GPIO pin$
  4. (check the green checkbox), Set '0’(turn off the LED)

Step 6: Build an Air Button!

Heights for Air Button

  • ~ 10cm : volume up
  • 11cm ~ 20cm : volume down
  • 21cm ~ 30cm : play music
  • 31cm ~ 40cm : stop music

I’ve marked the heights with Post-it so that I know where to place my hands.

You can follow my examples like above or set your own rules.

Step 7: Cheat Sheet & Wrap Up

Picture of Cheat Sheet & Wrap Up

Wrong. I didn’t post them accidentally. They are not the same images and I've posted them in the following order.

  • ~ 10cm : volume up
  • 11cm ~ 20cm : volume down
  • 21cm ~ 30cm : play music
  • 31cm ~ 40cm : stop music

Drag and drop the png files. I recommend you edit them if you’d like a bit of customization.

Examples in real-life:

  • “I wish I could turn on and off the bedside lights with Air Button."
  • “Turn on the monitors and notebook cooler with Air Button on my desk!"

To recap, this’s a button for controlling music but it doesn’t have to be. It can be just about anything you can imagine. It can be your button for controlling your Torrent download, robot vacuum cleaner, or even Mindcraft and Mindstorm! It’s up to you to decide.

Comments

About This Instructable

4,990views

77favorites

License:

More by kidofone:Air Button for Volumio using ultrasonic sensorGPIO for Raspberry Pi B, B+, Pi 2 running PROTA Pi OS (HTML5)Internet of Things projects
Add instructable to: