Space Mouse With Arduino Micro *UPDATE*

39,157

284

160

Introduction: Space Mouse With Arduino Micro *UPDATE*

Hello Makers!

I love 3D cad design and one of the most common panel I use while designing is...View.

I often need to spin the object around, zoom in and out, slice it and so on.

There are amazing professional 3D mice you can buy, but they are not cheap. They usually cost from £150 up.

So...I built my own one! With a couple of extra features because....why not.

The Space Mouse has a joystic with push button integrated and 3 independent customizable buttons.

The functions I use in my setup are:

  • Joystic = rotate view (free orbit)
  • Quick joystic press = home view
  • Press and move = zoom
  • Button 1 = slice view
  • Button 2 = show/hide constraints
  • Button 3 = delete

Supplies

Step 1: The Design and Parts

The design is pretty simple: the base holds all the components and the lid closes them in.

This helps when you have to put the components together and makes the parts easy to print.

The objects to print are: base, lid, buttons holder and 3 buttons extensions. I decided to extend normal pbc push buttons instead of using panel mount units to keep the design compact and as low cost as possible.

The total cost of this project is £15-20 which is pretty good compared to £160 you have to pay for a proper space mouse.

I also included a file to print 4 small washers to hold the joystick module to the base.

I used 0.12 mm layer resolution for all parts except the top which is 0.06 to get a smooth finish straight out of the printer.

I would suggest to use 40 mm/s max, this will make the printing process slower but more accurate.

Step 2: Simplified Version Without Buttons

If you don't have buttons (or you just don't want them) you can use this semplified version.

Step 3: Assembly

The first step is to put the Arduino in.

The base has the Arduino footprint already in place. Just push 4 or more headers (they should come with the board) into the print and place the board on top. Be quick when you solder the pins on the Arduino board, if you keep the soldering iron on the header too long you will start melting the 3D printed base.

After this, we have to connect the buttons and the joystic module.

Using a small gauge wire connect the three buttons in series for the common line (GND), and three single wires for the signals (in my case they are digital pins 7,8 and 9). I used the internal pullup function of Arduino to avoid resistors.

The button plate part has small holes to guide you while positioning the buttons. Use the soldering iron to heat up the pins a bit to help them take their place into the print.

When the buttons are ready, place the button module on the base using two 1.5 mm screws.

Now connect the joystic module (VCC to VCC, GND to GND, X to A0, Y to A1, Switch to digital pin 10) and connect it to the base using 1.5 mm screws and the small washers if you need them.

I designed the joystick mounting points with many holes in order to be used with different joystick module brands. They are all very similar but the dimension might vary slightly.

Next use the soldering iron to gently push the threaded inserts into the top holes of the base. Be gentle and use a knife or a tool to hold the inserts down while pulling back the soldering iron.

Finally place the lit on top and bolt it on with four M2.5 x 6 mm bolts.

I also painted it black with metal finish effect.

Step 4: Test and Use

Finally the Space Mouse is complete!

I tested it in Autodesk Fusion 360 and Autodesk Inventor. It works perfectly, sensitivity is good, not too fast or too slow. The response is immediate and precise.

Pros: It doesn't require specific drivers, cable or equipment. It can be easily configured to work with any software uploading the right sketch. And it is cheap.

Cons: It is a bit light; I will add some lead inside as soon as possible to prevent it from moving on the table. I am currently working on a software to switch from mouse to space mouse automatically to prevent conflict in movements.

I uploaded an Arduino sketch configured for Inventor and my pref. settings. You can change the buttons or function according to your software hotkeys.

You can also find a federence of keyboard declaration here:

https://www.arduino.cc/reference/en/language/funct...

If the main mouse is annoying you too much, try this free software:

https://www.mousemux.com/

It creates a second mouse (in switched mode) so you can use both mouse and space mouse independently.

If you like this project, check out the extended Creative Console!

https://www.instructables.com/Creative-Console-for...

Hope you enjoy the project!

3D Printed Contest

Participated in the
3D Printed Contest

12 People Made This Project!

Recommendations

  • Knitting and Crochet Speed Challenge

    Knitting and Crochet Speed Challenge
  • Raspberry Pi Contest

    Raspberry Pi Contest
  • New Year, New Skill Student Design Challenge

    New Year, New Skill Student Design Challenge

160 Comments

0
Oliv12
Oliv12

9 months ago

Hello Stefano, thank you very much for this valuable project.
On my side I updated the software in order to better fit my personnal needs under Fusion 360.
My version of the software is available there: https://github.com/freeasabeer/SpaceMouse

With this software the Space Mouse has the following modes available:
  • normal: moves the mouse pointer as with a normal mouse
  • pan: Fusion 360 pan mode (moves by simulating holding the middle mouse button)
  • rotate: Fusion 360 rotate mode (rotates part by simulating holding SHIFT key + middle mouse button)
  • zoom: Fusion 360 zoom mode (zooms in/out by simulating rolling the middle mouse button)
The 3 space mouse buttons have the following functions:
  • button 1 (Left): simulates a left mouse button
  • button 2 (Middle): toggles between default, pan and rotate modes
  • button 3 (Right): simulates the ESC key
Joystick switch functions:
  • short press: simulates the F6 key (fits to zoom)
  • long press: activates the zoom mode.
    To zoom in: while keeping the joystick pressed, push the joystick.
    To zoom out: while keeping the joystick pressed, pull the joystick.
    When the joystick switch is released, the space mouse switches back to the previous mode that was active (normal, pan, rotate).
0
StefanoS48
StefanoS48

Reply 8 months ago

Great job!

0
DanH110
DanH110

Reply 3 days ago

Thanks for this, am using it

0
mimmolagonigro
mimmolagonigro

4 weeks ago

Ciao Stefano, ottimo progetto. Ho conosciuto il progetto grazie a salvatore Patti che ti ha menzionato. complimenti. hai un reposity GitHub dove tieni aggiornato il progetto?

0
StefanoS48
StefanoS48

Reply 4 weeks ago

Ciao! Grazie mille per i complimenti! No, non ho GitHub, ho realizzato questo progetto durante il primo lockdown ma una volta ripreso il lavoro il tempo libero è completamente sparito!

0
sebiiop
sebiiop

1 year ago

I followed your instructions but now i am facing a problem.
The mouse cursor keeps moving to the bottom right. i have no clue if this is a windows driver problem or if my arduino pro micro is somehow fishy.
do you have any clue how to fix this? couldnt find an answer in the arduino forums

0
StefanoS48
StefanoS48

Reply 1 year ago

Hi, are you using my sketch? If so, your joystick module might be faulty...if you made any changes in the code please send it to me so I can have a look!

0
sebiiop
sebiiop

Reply 1 year ago

and yes i am using your script, with the same pins soldered on the arduino

0
StefanoS48
StefanoS48

Reply 1 year ago

If this happens when the module is not connected it means the problem is somewhere else. Maybe your main mouse? Or something that makes conflicts with the mouse? Unplug everything first and try to exclude the problem...

0
sebiiop
sebiiop

Reply 1 year ago

i unplugged all my peripherals (mouse, keyboard, arduino volume control). it keeps moving. guess the problem is between the arduino and my windows 10 pc......
i then tried connecting it to my laptop. same phenomenon.

0
StefanoS48
StefanoS48

Reply 1 year ago

If you tried on a different pc the issue is definitively in the arduino. You might have a bad board or a bad joystick module. Try to find out what's going on with the serial monitor! I use win10 and no problems at all...

0
sebiiop
sebiiop

Reply 1 year ago

Hey.
i got 2 new arduino pro micro with the 32U4 chip. i uploaded your code (without connecting it to the joystick yet. so it is just the bare arduino) and i am again facing the same problem. the mouse just keeps moving to the bottom right side. i googled if someone faced the same problem with the mouse.h library, but couldnt find a solution.
i deinstalled and installed the arduino drivers multiple times from my pc and my laptop. Really frustrating

0
StefanoS48
StefanoS48

Reply 1 year ago

Hey, sorry to hear that. It is important to have the module connected because the sketch reads the position of it to set the middle. So only try when it is connected. I would also suggest to connect everything and gradually exclude the code commenting it. Take everything off and upload a "blank" sketch, then introduce variables and the rest one step at the time. Hope it helps!

0
sebiiop
sebiiop

Reply 1 year ago

i found someone who had the same problem with the absolute mouse mode of the arduino pro micro. it seems that a compensation for the drift has to be added. basically the arduino is sending signals all the time and because it is not calibratable, these values can induce "drift". the compensation accounts for opposite movement to the drift, therefore the mouse will stay still.
i will try to adjust your code. i hope i can get it running with this info.

still thank you for your time and effort

0
labair
labair

Reply 2 months ago

Did you ever get this issuefixed

0
marcodd750
marcodd750

Reply 4 months ago

Sebiop sei riuscito a farlo funzionare ? xke anche io ho il problema della deriva

0
LazerGold
LazerGold

Reply 1 year ago

Hi @sebiiop , did you work a solution to the drifting mouse cursor? I am also having the exact same issue. Would really appreciate you sharing if you did. Thanks!

0
StefanoS48
StefanoS48

Reply 1 year ago

Hi @LazerGold, try to connect the mouse with NO softwares open, just windows.
If you still have the problem, try to comment out the "zero" positioning of the joystick or to expand the boundaries. It might just be a different reading (every pot is slightly different!)

0
LazerGold
LazerGold

Reply 1 year ago

Hi @sebiiop, were you able to find a solution to the drifting cursor issue? I am having the same problem too. Would appreciate any advice you can offer. Thanks.