UCLA “AirMouse” using ROHM Sensor Evaluation Kit – Part 1

UCLA “AirMouse” using ROHM Sensor Evaluation Kit – Part 1

3d airmouse

Click here to read Part 2 of this article >

3d airmouse

Today we introduce a 3D AirMouse inspired by a group of bright engineers from Institute of Electrical and Electronics Engineers (IEEE) Student Branch at the University of California, Los Angeles (UCLA). AirMouse functions much like a traditional computer mouse but has the ability to detect three-dimensional motions.

Device Plus has reached out to more than 100 top US colleges and universities in the hope of fostering student innovation by sponsoring projects that lack the funding or resources to pursue. Device Plus is currently offering a Hardware Sponsorship Program and is looking to collaborate with active student engineering organizations to build our “Connect” section. Please contact us for more information about this opportunity at info@deviceplus.com!



3d airmouse

UCLA IEEE is an IEEE student branch dedicated to “bringing hands-on, practical experiences to engineering students throughout the campus.”  The program is completely student run, and new members involved in project programs are taught and mentored by upperclassmen students.  Advanced Projects is one of UCLA IEEE’s four-year-long projects intended for students with moderate hardware and software experience to learn advanced topics in microcontroller hardware, communication protocols, schematic and board design, and more.

Students in Advanced Projects work in teams of 2-4 individuals to develop two projects over the course of the three quarters of the school year.  While working on the first project, AirMouse, students learn about concepts such as different communication protocols, hardware registers, and register manipulation.  Armed with this knowledge, students move on to build their very own quadcopter over the next two quarters while also learning along the way about other concepts such as using MOSFETs as switches and PWM speed control.

Find out more at http://ieeebruins.org

The original version of AirMouse was developed by Rahul Iyer, Aaron and Andrew Wilhelm, as part of UCLA IEEE’s Advanced Projects program.


AirMouse Overview

We’ve all used computer mice before, but they are limited to only working on top of flat surfaces like tables.  In this tutorial, we’ll make an “AirMouse,” a computer mouse that functions in 3D space!  Users can tilt the mouse to move the cursor on the screen, allowing for a wide range of customizable motions. We’ll first show you the basics of building the AirMouse, followed by some ideas on how to expand its functionality!

There are two main pieces that make up the AirMouse: the handheld mouse transmitter, and the receiver connected to the user’s computer.  The transmitter gathers information about the mouse’s orientation and the states of its buttons, while the receiver translates this information to perform corresponding actions on the computer screen.

For ease of use and compactness, we initially created the AirMouse using the Arduino Pro Mini and Teensy 3.2 microcontrollers, two of the smallest hobby microcontrollers available in the market.  The two microcontrollers communicated wirelessly through a pair of nRF24L01 RF modules, and the AirMouse detected motion with an MPU6050 accelerometer.

In this tutorial, however, we’ll show you a simpler build of the AirMouse using an Arduino Uno combined with an accelerometer on the ROHM sensor shield.  The ROHM sensor shield simplifies the design greatly because it is compact and handles the I2C communication with the sensor in accompanying libraries.



  • 1 x Arduino Uno microcontroller
  • 1 x ROHM Sensor Evaluation Kit
  • 1 x ROHM Accelerometer (KX022-1020)
  • 1 x nRF24L01+ RF module
  • Female header pins
  • Slide switch
  • 1 x Solderable perfboard large enough to fit the microcontroller and accompanying electronics
  • 2 x Push-buttons
  • 1 x 1s LiPo Battery
  • 1 x 1kΩ resistor
  • 1 x 3.3kΩ resistor


  • 1 x Teensy 3.2 microcontroller
  • 1 x NRF24L01+ RF module
  • Female header pins
  • 1 x Solderable perfboard large enough to fit the microcontroller and accompanying electronics
  • 1 x Red, Yellow, and Green LEDs
  • 1 x 150Ω resistor


Hardware Assembly

You can get creative in this step! As long as you follow the wiring diagram shown below, the actual placement of the components does not matter too much.  Make sure, however, that the AirMouse is comfortable to use! For example, you’ll probably want to mount the left and right-click pushbuttons such that they are easy to reach and unobstructed.

Before you begin putting the devices together, however, let’s take a look at the different connections we have to make.

3d airmouse

Figure 1. Transmitter Schematic (Note that the RF module’s Vcc is connected to 3.3V!)


3d airmouse

Figure 2. A protoboard “shield” for Arduino Uno.  Since the Uno’s headers do not exactly line up with the .1” pitch of the protoboard’s holes, jumper wires (in blue) for the button digital input lines are used.

The two RF modules are each connected to their respective microcontrollers via SPI buses.  To learn more about different communication protocols and SPI, check out our Arduino Communication Protocols Tutorial!  SPI is extremely useful in applications such as RF communication because its high speed allows two devices to transmit lots of data to each other at high data rates with low latency and high reliability.  As we discuss in the tutorial, SPI communication is synchronous and bidirectional, two features that significantly improve its transmit and receive speeds.

The RF module’s MOSI, MISO, and SCK lines must be connected to specific pins on the Arduino.  These pins are as follows:


The CE pin on the RF module stands for Chip Enable, and can be used to tell the RF module to standby/sleep.  The CS pin on the RF module is the SPI slave-select pin.  These two pins must be connected to two separate GPIO pins on the Arduino, but do not need to be connected to any specific pins on the Arduino.

3d airmouse

Figure 3. Connection block diagram between the Arduino Uno and the RF module

Arduino Uno operates at 5V, whereas the nRF24L01+ operates at 3.3V. There is a voltage difference, but we can power the RF module by using the Arduino’s output pin without damaging the RF module. The power (Vcc) pin on the nRF24L01+ module should be connected to the Arduino’s regulated 3.3V output on the Uno.  Please ensure that you don’t connect the Vcc pin to 5V by accident, as this could damage the module!  In this project, it is okay to use the regulated output on the Arduino to power the RF module because (1) the module has a very low current draw to begin with, and (2) in software, we’ll configure the power amplification setting for the radio so that it is at a low value.

The Nordic Semiconductor datasheet for the nRF24L01+ chip at the center of this module states that the transmit and receive current consumptions of the module are 11.3mA and 13.5 mA respectively.  The Atmel chip at the heart of the Arduino is capable of supplying up to 40mA of current at each digital pin, and therefore at the lowest transmit and receive power settings (which are more than adequate for this project) the Arduino can successfully supply power to the RF module.  In the Arduino code, we’ll specify the LOW power consumption mode with the command setPALevel(RF24_PA_LOW), which tells the RF module that it cannot consume power past its second-lowest setting (the settings are MIN, LOW, HIGH, and MAX).

Now we’ll take a look at where these pins actually are on the RF module.  The following pinout shows the locations of these different pins.

3d airmouse

Figure 4. The pinout for the nRF24L01+ RF module.  Pin 1 on the module is indicated by a square around the header pin.  Note that the module is not symmetric with respect to the header pins. / ©Addicore

When attaching the RF module, you may want to consider using female headers on the perfboard, which will allow you to remove the module from the perfboard if necessary.

Additionally, take extra precaution when soldering the connections on the 4×2 header layout—the pins are quite close together, and any unwanted shorts can damage the module!  Make sure to leave plenty of space around the headers so that the different solder connections can be easily made.

The buttons for the mouse’s left and right-click functions are connected to Arduino digital pins that are set up as inputs.  We laid out each button so that the digital pins would read a logic high when the buttons were clicked and a logic low otherwise.  Magnified diagram for connecting the buttons looks something like this:

3d airmouse

Figure 5. The button layout used in this project.  When the button is clicked, the GPIO pin is connected to Vcc.

From the diagram above, we can see that when the button is clicked, the GPIO pin is directly connected to Vcc.  The resistor connected between the GPIO pin and ground “pulls down” the GPIO pin to Ground when the button is not clicked and is hence called a pull-down resistor.  It is needed to avoid a situation known as a floating logic level on the digital input pin.  This situation arises when a digital input is connected to either logic high or low, and can lead to unpredictable behavior such as high or low readings caused by system noise even when there are none.  We need a high-value resistor (in this case a 10k resistor works) because merely connecting the GPIO pin to ground would cause a short between Vcc and Ground when the button is clicked.  When the circuit is closed by pushing the button, the resistor reduces the current flowing between Vcc and ground, thereby preventing a dangerous short-circuit situation.

3d airmouse

Figure 6. Protoboard Shield on top of ROHM Sensor Shield.  The KX022 accelerometer module that comes with the Sensor Shield fits perfectly on top of the I2C header and below the protoboard.

Luckily, for us, ROHM Sensor Shield takes care of all the I2C hardware connections, and simplifies the I2C hardware setup by merely requiring the user to connect the accelerometer module to one of the I2C headers!  To learn more about the workings of I2C, check out our Arduino Communication Protocols Tutorial!


3d airmouse

Figure 7. Receiver Schematic (As above, the RF module’s Vcc is connected to 3.3V)

3d airmouse

Figure 8. The Receiver module. Two LEDs are connected to GPIO pins for debugging.

The connections on the receiver side are pretty much the same as those on the transmitter side.  The RF module’s different SPI pins are connected to their matching pins on the Teensy microcontroller (same pins as the Arduino).  You can also add LEDs to the device for debugging and display purposes.

Assembling the AirMouse is the most tedious aspect of the build, but is completely open to your creativity!  Experiment with making the modules smaller and more ergonomic and share your thoughts and builds with us!

While soldering, make sure to work with high-quality equipment in a well-ventilated area and take frequent breaks.  When you’ve finished the hardware build, check back with us for part 2—the software portion!

3d airmouse

Device Plus is looking to collaborate with active student engineering organizations and labs. For more information about our Hardware Sponsorship Program, please contact us at info@deviceplus.com


Click here to read Part 2 of this article >

Rahul Iyer
Rahul Iyer
Studying Electrical Engineering at UCLA, Rahul loves to work on electronics and robotics projects as a hobby. He is especially enthusiastic about electric vehicle technology and assistive robotics.

Check us out on Social Media