Categories
algorithm Arduino hardware software

DIY 3D Mouse

I have been doing quite a lot of CAD work recently and so decided to acquire a second hand 3D mouse on eBay, the now obsolete 3DConnextion SpaceExplorer.

Soon after that the TeachingTech YouTube Channel published a video about a DIY 3D Mouse that was made from commonly available parts and 3D printed plastic components.

I decided to make one and compare it to the commercial product.


What is a 3D Mouse?

A standard mouse used as with Windows or other screen GUI is operates in 2 dimensions (2D) as it moves a cursor up/down and left/right on the screen (X and Y cartesian coordinates).

A 3D mouse includes control of movement along the axis in/out (Z coordinates) from the screenoften using a rotating cylinder on a base that can be raised and lowered, as well as rotated to allow control of rotation about the X, Y and Z axes.

This type of mouse is used for movement in virtual 3D space, often in conjunction with Computer Aided Design (CAD) and 3D modelling software. It facilitates intuitive movement and model manipulation that gives the user the feeling of holding the 3D object in their hand.

Making the DIY 3D Mouse

The build is documented as a Printables project, so I won’t be repeating most of the information here.

The heart of the project is a great idea to use standard “PS2” analog joystick hardware modules (shown at right) to build the device.

Four joystick modules are arranged around a central control knob, as shown on the left, and the movements inferred from the combination of values returned read from the joysticks.

The hardware connections are shown below (copied from the Teaching Tech article).

Another clever trick is to configure the to control software to look like a 3DConnexion SpaceMouse, recognized by the 3DConnextion software driver, so that it works with all 3D CAD packages.

Calculating Movement from 4 Joysticks

The heart of the control software is working out what the combined movements of the internal joysticks mean. It wasn’t clear to me from the code, or the scant explanation at by the original code author, how this worked so I decided to work it out.

The 4 joysticks used in this project are labelled A, B, C and D. We can work out from the cable exit point in the 3D printed body that joystick C is at the front (forward position) of the 3D Mouse, with B, A and D in the Left, Reverse and Right positions, as shown in the diagram below.

The joysticks are oriented in a circular fashion on the side of the case. This means that the the joysticks on opposite sides will feed back opposite values (ie, one positive and one negative) when moved in the same direction horizontally but the same values when moved vertically (see the V and H axes in the diagram above.

The 3D Mouse movements axes are shown at the top of the mouse manipulation knob (xyz axes).

The simplest case is a translation in the z direction. The mouse knob is pushed up of down. The values read from all the joysticks be the same (or very similar) in the vertical direction, so the combined reading will be the sum of all values divided by the number of joysticks to bring the value back into the correct range
ie, z = (AV + BV + CV + DV) / 4.

For a translation movement in the y direction (shifting the knob left/right, we are interested in the deflection of the A and C joysticks in the horizontal direction but need to reverse the sign of one of these ie, y = (AH – CH) / 2. Similar logic applies for translation in the x direction with joysticks B and D being involved.

Rotating the knob about the z axis creates the same (or similar) readings in all the joysticks in the horizontal direction. So the rotation ‘amount’ is determined as
rz = (AH + BH + CH + DH) / 4.

Similarly rotating the knob about the x and y axes is the combined output of A/C and B/D in the vertical direction.

For completeness, here are all the formulas derived:

  • z = (AV + BV + CV + DV) / 4
  • y = (AH – CH) / 2
  • x = (BH – DH) / 2
  • rz = (AH + BH + CH + DH) / 4
  • rx = (AV – CV) / 2
  • ry = (BV – DV) / 2

Depending on the actual output read from the the joystick V/H axes, the calculated 3D xyz directions may need to be reversed.

Software

I extensively modified reworked published software to make it more maintainable and added switches to the 3D mouse interface (my derived code is available in my code repository)

The software is split into three main parts:

  1. Read the 4 joysticks and combine the readings as outlined above.
  2. If the switches are enabled, read the state of the switches.
  3. Report all the readings through a HID USB interface.

A special boards.txt file is used as a trick to make the project look like a 3DConnexion device. I found the instructions provided in the original article to be incorrect if you are using Arduino IDE v2.0 or greater.

  • The location of the board families has changed to /Users/<your name>/AppData/Local/Arduino15/packages
  • The boards.txt file has changed. The correct boards.txt can be found at my code repository in the docs folder.

Testing & Conclusion

The idea has merit, but it does not work as well as the commercial version. I guess no surprises here, as you are paying many multiples more for the commercial product.

From a software perspective, it works well.

However, the mouse movements feel really mushy compared to a SpaceMouse. The small version is still a lot bulkier than my now relatively large SpaceExlorer (photos below), making it uncomfortable to use for extended periods.

Categories
3D Print algorithm Arduino hardware software

LED Matrix Hourglass Timer

I was intrigued by a recent project I saw that used two LED matrices placed diagonally to create an hourglass. The animated movement of the LEDs seemed a good simulation of the sand particles moving through the hourglass.

As is common, the project emphasized on how the hardware was wired together, which is trivial, without much explanation of its more challenging/interesting software aspects.

Additionally, most of the solutions I saw used an inertial position sensor to determine the position of the matrix, which seemed overkill for the simple functionality required.

So I decided to explore this topic and here is my solution.

Categories
woodworking

Old Time Automobile

Most years I try to use up woodworking offcuts by making a batch of wooden toys to donate at community ‘giving’ Christmas Trees.

The toy I make most frequently is an Old Time Automobile that I found plans for decades ago. It uses small pieces of wood that are easily sourced in a scrap pile, and I think it looks great.

This post provides plans for this toy and describes how to put one together. Maybe you can make one and give it away too.

Categories
woodworking

Taming Workshop Vacuum Hose Hell

Like many hobby woodworkers my wood shop doubles up as the garage which, limiting the amount of permanent ‘installation’ for equipment. This includes dust collection, and for many years I have been working with a single generic workshop vacuum moved between each source machine’s dust port.

Over many years the number of tools I own has multiplied and most of them seem to have uniquely sized dust ports. Recently I reached a point where I had enough and decided to tame this Vacuum Hose Hell (VHH) of adapters and connectors that made it all work and decided to do something about it.

Categories
algorithm Arduino software

Weighing Stuff (HX711 weigh scales ADC) – Part 2

In the first part we looked at the HX711 hardware for implementing weigh scales systems.

This part will cover how software interacts with the hardware, requirements for a library and how to write a weigh scale application.

Categories
Arduino hardware software

Weighing Stuff (HX711 weigh scales ADC) – Part 1

If you search for ‘Arduino’ and ‘weighing’ you very quickly come across the HX711 board module and an associated world of strain gauges and load cells.

All this looked interesting with some learning along the way. The result is that I took a dive into the subject and ended up with some new knowledge and ideas for the future.

In this first part I cover the hardware requirements and in the next how to write software to implement a weighing system.

Categories
algorithm Arduino software

A Display Framework for Scoreboards

Scoreboards seem to be quite popular as beginner projects but the results are often very specific to the hardware used and very ‘hard coded’ to the original purpose.

It seemed to me that there are some parts of this style of application that are generic and probably independent to the type of scoreboard (sport and/or hardware used). I wanted to explore which parts and how this could drive a generic framework to create and update any scoreboard.

Categories
electronics hardware

DIY Thread Burner

A thread burner is a tool used to cut and melt the end of polymer-based threads (polyester, nylon, etc.) and paracords. By applying a very targeted application of heat, thread burners efficiently melt the last little bit of thread sticking out after the thread is clipped. They are also used to melt the knotted ends of threads to prevent the knot from loosening or untying.

For some time, I have been using a commercial thread burner to seal my leatherwork stitching but have become increasingly irritated by the large number of AA batteries it consumes. There has to be a better way to do this, so I decided to make my own.

Categories
algorithm Arduino software

Drag Race Start Lights

I fell into an internet search rabbit hole and came across ‘Drag Racing’ start lights. I had seen references to these on the Arduino forum and they looked interesting enough, and followed well defined rules, to be a relatively simple project for programming practice.

Here’s the result from an afternoon of tinkering.

Categories
algorithm Arduino software

Rock/Paper/Scissors Arduino Game

Rock/Paper/Scissors (RPS) is a game using simple rules and a circular winning strategy that I thought would be interesting to code. Additionally, there is an element of suspense/anticipation to the game that adds to its enjoyment, and I challenged myself with trying to capture this part of the experience as well.

So, during a few of the many recent rainy days I decided to spend some time seeing what I could do with an Arduino Uno, some tact switches and a few LED matrix modules.