Instructables

Head Mouse - Game controller or disability aid

FeaturedContest Winner
Picture of Head Mouse - Game controller or disability aid
IMAG0196.jpg

My kids wanted to have a head controlled mouse for playing Minecraft - they wanted to move their heads and have the field of view move. I decided that was a challenge I couldn't resist, so I decided to build a movement controlled mouse using an arduino and a gyroscope chip.

Components

A-Star 32U4 Micro - a tiny Arduino Leonardo clone

LSM9DS0 Breakout board - a combined gyroscope, accelerometer and magnetometer

A 3.3V to 5V logic level converter

10k resistor

push button switch

strip board

I started off prototyping with an Arduino Uno, and but it doesn't have the ability to be a HID controller at the same time as being able to load the firmware via USB. I tried reading the sensors via the serial port, but that's just not the same as a genuine mouse because you always need a client piece of software running, which isn't elegant, nor is it always convenient. However, the Arduino Leonardo does have the ability to act as a mouse or a keyboard, so I decided to use one of those. In fact, what i decided to use was a clone of that. There is a fantastic clone board called the A-Star 32U4 Micro, which is tiny - just 1" x 0.6", and it's half the price, so it's a winner all round for this project,

For the gyroscope, I chose the LSM9DS0 chip which is a combined gyroscope, accelerometer and magnetometer, giving me the choice of being a bit more sophisticated about detecting movement. I don't have the facility to make my own circuit boards or to surface mount chips, so I bought it on a breakout board.

The LSM9DS0 runs with 3.3V outputs, but the processor needs 5V inputs, so a logic level converter for the SCL and SDA lines is required too.

Finally, it's a good idea to be able to turn the mouse operation of the device on and off without unplugging it - that way if you make a mistake, you can re-program it without the mouse feature running wild.

 
Remove these adsRemove these ads by Signing Up
1-40 of 74Next »
soapdude7 days ago

Awesome and simple project for the electronics beginner!
Do you have any tips or suggestions as how to reduce drag of the mouse? I often find myself having to move the mouse to the side or the top of the screen to readjust the location of the mouse with respect to my head! Thanks in advance!

millmore (author)  soapdude4 days ago
Yea, I know what you mean - it's the same as moving your mouse too far left or right - you need to pick the mouse up and move it back again. Not so easy to do with your head. One thing I did experiment with earlier on was having the direction of the mouse output as a serial stream from the arduino, and have a simple PC app to listen to that and turn it in to a mouse location on screen. It worked well and is immune to over pointing, but it needs the client side app to work, which I didn't like so much.

I think it's a good project, but I have a challenge for you to do it with a wirlis

photoace122 months ago
By the way, how much did this all cost?
millmore (author)  photoace122 months ago

I'm in the UK and bought everything from coolcomponents.co.uk. The gyroscope chip is the most expensive part of this - that cost £22. The arduino was £10, the logic level converter was £2. Everything else was scraps I had lying around, so that cost me about £35 in total. In the US you can get the same for about $50 from sparkfun. The gyroscope means it's not a cheap mouse, but it's fun.

you are paying a lot over the average price for your chips, on ebay you can get the 3 axis gyroscope / Accelerometer chip @ £2.50

item number 221428586941

or if you have time to wait from the Philippines @ £0.99

item number 121190957975

millmore (author)  Poppy Ann2 months ago

The first one is £3.85 now, but even so, that's a lot better value! It's not the same chip, but I've ordered one to see how it behaves in practice. If it works as well it would cut the cost to about £18. Thanks very much for the info.

Would you kindly update your instructable if that gyro-chip works?

Also, great job on the ible!

you are right they have gone up in less than 24 hours, i am thinking of building one to use on a quad copter i am building to operate the camera as the only other way of doing it is to use 2 more potentiometers on the transmitter and it is hard enough using the two sticks to operate it without letting go of one of them to try and operate the camera, i am lucky as i bought a few of the sensors when i first tried playing with a arduino and some of them were only $0.99 from china at the time i just bought a couple of everything so i would not have to wait if i wanted to build something as i hate waiting for things to arrive once i have decided to try building an item.

AlanMarrec1 month ago

I try to make the same things but with GY-521, I'm a beginner in Arduino World, so someone has any advices for me ?

Regards.

imzsan1 month ago

I want use GY-85 9DOF IMU sensor as it is quite cheaper than LSM9DS0

, but I do not know if the code can run on it .

Grateful if you can reply me

millmore (author)  imzsan1 month ago

I imagine the code would be different. You should google for an arduino library for it.

imzsan millmore1 month ago
Thx
imzsan2 months ago

thank you for sharing that amazing mouse!

I live in China, Where can I get the

A-Star 32U4 Micro except Cool Components? Also, I can not find this on sparkfun

millmore (author)  imzsan2 months ago

Fortunatly the manufacturer has a list of distributors worldwide;

http://www.pololu.com/distributors

imzsan millmore1 month ago

A-Star 32U4 Micro is based on Atmel’s ATmega32U4 AVR microcontroller, then I find this board which is also based on it, and it is half price of

A-Star 32U4 Micro. Can it be the substitute for A-Star 32U4 Micro? How can I build the circuit by using it? There is no pin 11, 3.3V and 5v on the following pic .

2014-05-27T09-20-33.025Z.png
imzsan imzsan1 month ago

Finally I find this one, hope it will work

火狐截图_2014-05-27T16-57-07.689Z.png
imzsan millmore1 month ago

thanks a lot

imzsan imzsan1 month ago

I find it ! lol

area362 months ago

Warning I built one of these and they are amazing, but they do not work on ps3/wii/xbox GAMES. They do work on stertup screen but not on the actual games. For that you may need an Eagle Eye or to boot your computer in Ubuntu. Cheers!

millmore (author)  area362 months ago

There are limited PS3 games that support mouse, but there is an arduino library for it here;

https://code.google.com/p/unojoy/

You could use that to re-code it to be PS3 games controller.

area362 months ago

Warning I built one of these and they are amazing, but they do not work on ps3/wii/xbox GAMES. They do work on stertup screen but not on the actual games. For that you may need an Eagle Eye or to boot your computer in Ubuntu. Cheers!

richardlee2 months ago

cool, does it work with minecraft pe?

area362 months ago

When I try to upload I my text line..

LSM9DS0 dof(MODE_I2C, LSM9DS0_G, LSM9DS0_XM);

has en error surrounding it "'LSM9Ds0' does not name the type"

Any ideas of how I could fix this? I've tried placing the .cpp and .h files in the libraries folder in my arduino folder but still no luck. Any help? Thank you

millmore (author)  area362 months ago

Thanks for pointing that out. I have added the following to the instructions now which I think will solve the problem for you;

To use the code, create a folder called SFE_LSM9DS0 underneath {install directory}/Adruino/libraries, and put SFE_LSM9DS0.cpp and SFE_LSM9DS0.h in that folder. Then you can open headMouse2.ino and load it to your Arduino.
area36 millmore2 months ago

I still seam to be getting to same error message.

"LSM9DS0 dof(MODE_I2C, LSM9DS0_G, LSM9DS0_XM);"

'LSM9DS0' does not name a type

In function 'void setup()'

arror: 'dof' was not declared in this scope

in function 'void mouseMoveGyro()'

etc...

I tried copping your folder name and placing it in the Libraries under my arduino folder in the documents folder with the .cpp and .h files inside, but still not luck. Sorry about this mate! Appreciate the help.

area36 area362 months ago

The SFE_LSM9DS0 requires both the SPI and Wire libraries so I know that I need to include both in the Arduino sketch, before including the SFE_LSM9DS0 library. Maybe that's my problem? I'm not entirely sure where to find the SPI and wire libraries for the SFE_LSM9DS0.

millmore (author)  area362 months ago

Here's a guide to installing libraries;

http://arduino.cc/en/Guide/Libraries

SPI and Wire were there in Sketch v1.0.5 for me from the start.

area36 millmore2 months ago

Thank you I appreciate it! I was able to get rid of most the errors. Still trying to workout a few issues I'm having.

Screenshot (13).png
amplex2 months ago

When adding this project to arduino IDE 1.0.5, and adding the SFE_LSMDS0.cpp and .h files to the project before compiling, you get the following errors:

SFE_LSM9DS0\SFE_LSM9DS0.cpp.o: In function `LSM9DS0':
d:\download\arduino\libs\libraries\SFE_LSM9DS0/SFE_LSM9DS0.cpp:34: multiple definition of `LSM9DS0::LSM9DS0(interface_mode, unsigned char, unsigned char)'
SFE_LSM9DS0.cpp.o:C:\Users\amplex\AppData\Local\Temp\build195121791039841320.tmp/SFE_LSM9DS0.cpp:34: first defined here SFE_LSM9DS0\SFE_LSM9DS0.cpp.o: In function `LSM9DS0':

.... this continues for 100+ lines

The answer is to not add the SFE_LSM9DS0.cpp and .h file to the IDE before compiling. Start a new sketch with just the .ino, if the .cpp and .h are in the correct libs folder (imported using a SFE_LSM9DS0.zip file with an SFE_LSM9DS0 folder containing the 2 provided files) that is all you need.

Also, you might have to load the 32U4 drivers and Leonardo drivers twice (using 2 diff com ports) to get the device to sync with arduino IDE correctly. Still working on getting my serial monitor to communicate, not seeing anything at the moment when I run it.

millmore (author)  amplex2 months ago

Thanks for that. Yes, you are correct - you add the SFE_LSMDS0 files to the libs folder, and then don't need to add them to the project.

I personally didn't need to add the drivers twice, even though the COM port does change from time to time, but it's a good warning thanks. There are instructions on installing the software for the 32U4 here;

http://www.pololu.com/docs/0J61

zxrex2 months ago

Thanks, and please, record a few videos with different games with Your comments!

zazu_2472 months ago
Just an LCD in front of the eyes, and you have yourself an oculus rift
millmore (author)  zazu_2472 months ago

Looks like someone has done a good instructable for the LCD part here;

http://www.instructables.com/id/The-NovaA-DIY-Ocul...

Just need to join the two together for a complete system.

millmore (author)  zazu_2472 months ago

Good idea - perhaps I need to save up for one of those sets of LED glasses!

tisaconundrum2 months ago

I'd love to see a Video of this thing in action!

Seconded!

millmore (author)  akohli42 months ago

By popular demand, I have added a video of it in action.

akohli4 millmore2 months ago

<-- Mind blown by second part!!! Great job man!!

Lakes572 months ago

Excellent project!
One way of doing the blow "switch" would be to use a small PC or other type of fan as a generator and get the arduino to monitor the voltage from that.

1-40 of 74Next »