Showing posts with label Arduino Leonardo. Show all posts
Showing posts with label Arduino Leonardo. Show all posts

Monday, August 08, 2016

DIY Virtual Reality Skateboard


This is a really fun and easy project that can be done in about an hour. On the bottom of the skateboard is an accelerometer/gyro with an Arduino board that transmits the angular motion of the board via Bluetooth to a little VR game I made in Unity for Android phones. So, when you turn on your Arduino and the bluetooth connects with your phone, you start moving forward. Lean left and you go left, lean right and you go right. Lift up the front wheels and your character will jump. This only works for Android phones and your phone must be compatible with Google Cardboard. So, if you have an old skateboard laying around, turn it into a virtual reality snowboard. 




Step 1: What You Need?

1 x USB Type-B Cable 
1 x HC-06 Bluetooth Module 
1 x MPU-6050 Accelerometer /Gyro
1 x 9V Battery Holder with On/Off Switch 
Male-to-Male Jumper Wires 
Female-to-Male Jumper Wires
1 x Computer with Arduino IDE
1 x Google Cardboard Style Virtual Reality Headset 
1 x Skateboard
4 x Tennis Board ( to keep from rolling away) 
1 x Soldering Iron and Solder
Hot Glue Gun 
Screw And Nuts 

Optional
Cable Cover
Arduino Compatible UNO Ultimate Starter Kit / Learning Kit
USB To Power Jack Cable



Don't have components? Don't worry. Just click the component's name. 



Step 2: Assemble Your Device

Assemble your device as shown in the picture above.

You will need to solder the header pins onto the MPU-6050, if your soldering iron is new and the tip is clean this can be done in about 11 seconds. If your soldering iron tip is dirty and old this will quickly become the hardest thing you have ever done (speaking from experience).

Make sure the orientation of everything is exactly as shown in the pictures above so you do not have to get into the code and edit anything.

Attach everything to you skateboard EXACTLY as shown (really just make sure the MPU6050 is facing the same direction as the picture).




Here I glued the battery box to the board with hot glue and screwed the Arduino board down. I used an old school board because a wider board is better for the purposes of this experience. It is pretty hard to balance on a board while in virtual reality.
The Leonardo works much better for this.

Note: If you are using an Arduino Uno all the connections are the same except:
SDA goes to A4 and SCL goes to A5



Step 3: Upload The Code 


IMPORTANT: Unplug the RX and TX pins before uploading the code to your board. 



Step 4:Download app to your phone



Download apps: Here

You will need to go into your security settings and allow apps to be installed from unknown developers.

Make sure to pair the Bluetooth module to your phone, do not change the default name (HC-06). The password should be 1234.

Notes:
If enough people make this I can try to make a better snowboard game, or make an actual skateboard game depending on what I get requests for.

When your turn on your Arduino device make sure the skateboard is flat on the ground and then open the app. As soon as the Bluetooth connects you will drop in.

If the Bluetooth becomes disconnected, restart the app (it is set to connect at the start of the app only, for right now).





Accelerometer Arduino Leonardo Arduino UNO R3 bluetooth bluetooth module Hard hc-06 Intermediate MPU-6050 project virtual reality

Tuesday, July 26, 2016

Arduino PowerPoint Pointer

The last time that I had to do an PowerPoint presentation it was very frustrating to be all the time with my mouse in my hand, it was not simple design for this function.

With a new presentation coming up titled "Introduction to Arduino," I thought, what best way to show some of the capabilities of the Arduino board then to build a quick power point presenter tool with it.

The first idea that pops has, "Why not use the TV Remote?" Design to be hold in a more ergonomic position that the mouse (for this case).




Step 1: What You Need?

1 x IR Sensor ( Infrared Receiver VS1838B use in this project.)
1 x TV Remote
1 x Micro USB Cable 

Don't have components? Don't worry. Just click the component's name. 

Step 2: Build Your Circuit.

The connection diagram is very easy, simple connect the GND from the sensor to Arduino GND pin, 5V from the sensor to the 5V pin in the Arduino and the Data pin from the sensor to Digital Pin 2 of the Arduino.


Step 3: Upload The Code.

The code part is divided in two steps. In the fist one, you will need to read the keys that you want to use from your TV Remote. It this you will be able to decode the IR signal send out from the remote.

The second part, we will use the information from step one, and assign the keys to there new functions as PowerPointer pointers.

Start by downloading the IR remote Arduino Library and install it in the correct folder. You can downloaded from there.

Do not forget to follow installation procedure recommend in the github page.

For step one, upload the Code 1 to your Arduino. Open a Serial Monitor window, if everything is ok, you should start to different numbers every time you press on key in the TV remote.


Serial Monitor Output

Store the numbers corresponding to the keys that you want to use. In my case, I used the central foreword and backward key in my TV remote.

Replace my numbers in the "If" structures in the Code 2 and upload.




If you are using the Arduino Leonardo, after the upload, every time that you press the selected TV remote keys, they will act as the foreword and backward arrows from your keyboard.

I used the arrow keys for pushing the slides forward and backward.

Step 4: Test Your Pointer

On PowerPoint


Now open your presentation and if you are in "Slide Mode", the slides will change back and foreword every time that you press previous selected keys from your TV remote.

Other Arduino board


If you are using other Arduino boards, I think that is also possible to build this project however some changes need to be done.

The big difference is that the Atmega8U2 or equivalent chip, responsible for the communication between the ATmega328 and the computer, needs to be flashed. I did not had the need to do this, because with the Arduino Leonardo, Zero and DUE appear as native keyboard or mouses when defined and connected to your computer.

Thanks for reading.




Arduino Leonardo easy IR Sensor PowerPoint Pointer project VS1838B

 

  • Copyright © Arduino Tutorial ™ is a registered trademark.
    Designed by Templateism. Hosted on Blogger Templates.