Skip to content

jaykch/microbit-media-controller

Repository files navigation

Micro:bit Music Controller · GitHub license

Check out the demo on youtube

An awesome project to control your media keys through micro:bit buttons and gesture control!
View Demo · Report Bug

Table of Contents

About The Project

This controller connects the BBC Micro:bit with a windows pc and acts like a media controller. It has the following functions

  • Play: Ability to play/pause music, videos etc.
  • Mute: Ability to mute/unmute system volume
  • Next: Acts as the next button on a keyboard
  • Previous: Acts as the previous button on a keyboard
  • Volume Up: Increases system volume
  • Volume Down: Decreases system volume

Built With

This project uses the following software and languages

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Here is the list of all the prerequisites you would need to install on your system in order to run this device

  • Node.js v10.15.3
https://nodejs.org/en/download/
  • npm
https://www.npmjs.com/get-npm
  • Python
https://www.python.org/downloads/
  • Additional build tools are required to be able to run media keys on windows. Run these commands from an administrative shell to install software dependencies:

    Note: You need to install windows build tools version 4.0 or higher

npm install --global --production windows-build-tools
npm install -g node-gyp

Installation

  1. Add all dependencies using npm

    npm install
  2. Connect your micro:bit to the computer using a USB stick

  3. Run port file to check what port your micro:bit is connected to

    node port.js

    You will get your com port as below:

    Port Image

  4. Change port in server.js file

    Com Change

  5. Run node server to start communicating with your micro:bit

    node server.js

Note: You still need to deploy the hex file to your micro:bit. These steps only install the server. Please go through the deployment below to start using your micro:bit.

Deployment

Copy the Micro:bit Music Controller hex file to your micro:bit and Enjoy!

Demo and Description

Check out the demo on youtube here - View Demo

Below is a list of all controls and gestures for each function

  • Play/Pause: Use button a to toggle between play and pause Button Layout

    1. When you press button a the system starts playing media and displays the below image

      Play LEDs

    2. When you press button a again the system pauses the media

      Pause LEDs
  • Mute/Unmute: Use button a to toggle between play and pause Button Layout

    1. When you press button b it mutes the volume

      Mute LEDs

    2. When you press button b again it unmutes the system

      Unmute LEDs
  • Next:
    Tilt your micro:bit to the right to go to next track

    Tilt Right

    If you ware playing any music on Spotify/Windows it will play the next track and show the below LEDs on successful change

    Next LEDs

  • Previous: Tilt your micro:bit to the left to go to next track

    Tilt Left

    If you ware playing any music on Spotify/Windows it will play the previous track and show the below LEDs on successful change

    Previous LEDs

  • Volume Up: Tilt your micro:bit upwards to increase volume

    Tilt Up

    This gesture will increase system volume and show a plus sign on micro:bit

    Plus LEDs

  • Volume Down: Tilt your micro:bit downwards to decrease volume

    Tilt Down

    This gesture will reduce system volume and show a minus sign on micro:bit

    Minus LEDs

Author

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Serialport - Library for serial communication to micro:bit
  • Robotjs - Library to simulate key-presses

About

Use your microbit to control media keys on windows

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published