Introduction: Wireless CAD Model Navigator

While designing a 3d model it becomes really hard to move around the model and check whether everything is looking good or not. So when I searched for the keyboard and mouse controller circuits and found out that it was possible with a few types of Arduino boards like pro mini, Leonardo, etc because they are having something called HID support which helps them to connect to our laptop as a keyboard or mouse. But I am having only Arduino UNO which is not having HID support. After some digging, I came across the ESP32 microcontroller as a Bluetooth keyboard or mouse which works on BLE (Bluetooth low energy) which I haven't used till now so I thought of trying it now.

Supplies

1) ESP32

2) MPU6050 sensor

3) Push-button

4) Few connecting wires

5) Small bread board

Step 1: Overview

ESP32 is a series of low-cost, low-power systems on a chip microcontroller with integrated Wi-Fi and dual-mode Bluetooth. The ESP32 series employs either a Tensilica Xtensa LX6 microprocessor in both dual-core and single-core variations, an Xtensa LX7 dual-core microprocessor, or a single-core RISC-V microprocessor and includes built-in antenna switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules. ESP32 is created and developed by Espressif Systems, a Shanghai-based Chinese company, and is manufactured by TSMC using its 40 nm process. It is a successor to the ESP8266 microcontroller. Here I have used the ESP32 dev kit module.

The MPU6050 has both a gyroscope and an accelerometer, using which we can measure rotation along all three axes, static acceleration due to gravity, as well as motion, shock, or dynamic acceleration due to vibration.

And a normal push button.

I have used MPU6050 to detect the motion of the circuit whether it was tilted x-axis or y-axis. Once it is detected the data is sent to ESP32 via the I2C protocol. ESP32 sends the keystrokes and mouse strokes to the laptop via BLE. And this whole process happens only when the button is pressed in the circuit. Because without the button the circuit has the power to overtake the actual mouse and keyboard of the laptop.

The whole project was made possible with help of a beautiful library developed by blackketter/ESP32-BLE-Combo


Step 2: Basic Software Setup

We can upload code into ESP32 devboard using Arduino IDE. For IDE setup follow this tutorial by randomnerdtutorials.com for step by step process.

Step 3: Hardware Setup

For hardware we need to connect a push button and MPU6050 sensor with ESP32.

Interfacing pushbutton with ESP32 by microcontrollerslab.com, connect the push button to PIN 2

Interfacing MPU6050 sensor with ESP32 by randomnerdtutorials.com

Step 4: Coding

Code for the project is available on GitHub.

For running this project we have to link few libraries

1) Adafruit_MPU6050.h

2) Adafruit_Sensor.h

3) BleCombo.h

How to include libraries in Arduino IDE?

Now paste the code form above Github link, connect your ESP32 to your PC, select correct board, COM port and click upload.

Step 5: Connecting With PC

Once uploading of the code is done, you can connect to the circuit from your PC by going into Bluetooth settings. The circuit appears as ESP32 Keyboard/Mouse. Pair with it.


Noice its done and circuit is ready to be used.

Step 6: Testing the Ciruit

Open Fusion 360 and click on push button to make the circuit work, and move in the direction you want the 3D model to move

Step 7: Observation

The real challenge is testing the circuit as I mentioned earlier the library has the power to control the main mouse and keyboard. So during the testing many times the circuit messed up my laptop by opening the same application multiple times which makes the laptop hang. To come out the circuit needs to be disconnected which stops the Bluetooth and the laptop doesn't come into control until the laptop is kept in sleep mode and turned on. This was overcome by adding a small push button so that we can send the keystrokes only when required.

Remote Control Contest

Participated in the
Remote Control Contest