My tweakers.net interview on the joystick project!
Categories for Arduino
Today I completed another small project. I’ve got this ‘smart meter’ in my house. The smart bit is that automatically sends off the meter data to the network provider. But I can not see the actual power usage from inside my apartment.
My meter has an infrared LED interface (right next to the meter above 1000 imp / kWh), which gives a pulse for every kWh consumed. By measuring the time between pulses and to count I’m on a current consumption in watts (3.6 / pulse duration to be exact).
The graph shows that it works well. I still can not explain all the peaks, but the high consumption (800W) between 10:30 and 16:00 is my electrical water boiler. The other major consumers are the refrigerator, the coffee and tea (for short peaks).
Measuring is knowing!
IR sensor diagram (led1 not used for now).
Closeup of the meter
Today I managed to get a little prototype done for a little simulated feedback. I connected the audio output of my PC to an Arduino and did some software signal processing to filter out the high frequencies, leaving the low frequencies < 20Hz. I then wired this data to an old vibration motor from a XBox360 controller.
As a simple test I played an Elite gameplay recording from youtube, and it worked!! Adjustments are necessary but it adds to the sense in the same way that you ‘feel’ a subwoofer. Which isn’t strange because I technically made a subwoofer, the difference is that I didn’t use a speaker but a ‘tactile feedback motor’.
Tomorrow i see if I can rip a proper microphone jack from an old soundcard and solder a prototype together instead of this breadboard drama…
When I noticed the availability of Elite:Dangerous for OS X, I immediately investigated my options on getting a proper Hands-On-Throttle-And-Stick, or HOTAS to play this wonderful game. You can get a very decent joystick combo at €30 and upwards but what’s the fun in that? I decided to make my own.
read all about it here
I’m finished soldering and wiring the throttle assembly. All the buttons work and are recognised in-game. All the leds work and all the animations a properly triggered.
No picture this time. I want to save them for when i’m done.
Today I finished the soldering of the prototype board and I am very much a happy camper now. Dropping the breadboard and switching to properly soldered wires made the whole contraption much more stable. The potentiometers have almost no jitter anymore even though there’s 2 meter of cable between the two modules. The data is looks pretty solid. The potentiometers I am using right now were taken from a scrapheap, but after I sprayed some ‘Kontakt’ contact spray into the potmeters they runs absolutely smooth and jitter-free.
I have a few more solder joints to do to finish up the lighting scheme for the throttle housing, and then I have a few lights left on the yoke (X/Y stage). This second module doesn’t have the throttle lighting bar so it hasn’t got as much leds as the other one.
All this means that i am close to finishing the project. I need to figure out a way to mount the modules to my desk or my chair. The modules aren’t heavy enough to sit solid on the desk. Some mounting fixture is needed and i’m not ready to drill holes in the desk just yet.
And so we arrive at the end of yet another day of tinkering. Working on the electronic bits here and there. I managed to connect and test all the analog axes. They work great but my change to turn the Z-axis into a proper ‘Throttle’ HID report resulted in Elite Dangerous no longer recognising the axis. So that was a total waste of time. Nevertheless I also worked on some lighting effects and they look pretty ok. Not as bright as I would’ve liked but legible nonetheless.
So the status now is a working throttle block with a few lights, and a partially working X/Y stage with just the trigger, no light, and a buckload of wires sticking out with a possible chance of shorting something out. That will be my first priority.
All the hardware works. All communication between throttle and yoke works, the lights work, the data gets through. It is now a question of expanding on the same concept (connect a light, connect a button).
Firmware is also coming along nicely. With this amount of leds and wires it is becoming impossible to keep the firmware generic, especially with all the animation stages going on. I did keep the source nice and clean though by using a few object classes here and there so people checking out the code later on should be able to understand it. One example is a Calibration class which takes care of doing all the math work to take the potmeter value and turn it into an self-calibrating value between -32000 and 32000 (which is what the joystick reports to the computer). So what does the calibration do? Well basically after plugging in the device is filters out the noise, calculates the minimum and maximum values and transforms that into a proper scale with a few end-stop deadzones. The deadzones will make sure that the maximum or minimum value can be reached in top or bottom 5% of the stick. The reason for this work is to avoid having to implement a custom calibration tool.
Tomorrow I hope to move from the breadboard to a solderboard so I can get rid of all the jumper cables and have some solid reliable connections. All these wires is making the readings a bit noisy.
I’m making nice progress. Without going into a lot of details I just want to share some images.
On top of the slightly basic handle I’m putting a ‘button block’. I have no other word for it yet but it sounds like a nice working title. The concept is that during this 1st prototype I am designing stuff one step at a time. Like little LEGO bricks I stick’em together until I’ve worked out a better solution.
So here are the bits that I’ve got working and finished:
- Throttle level mechanics
- Yoke mechanics (X/Y)
- Yoke spring centering mechanism
- Mounting plate
- Throttle centering latch
- Wiring board A (inside the yoke)
- Wiring board B (just a breakout board to connect all the wires to a detachable connector)
So today it’s down to the button mayhem. Even though I’ve written earlier about using motorcycle parts, i’m decided to drop that thought. After playing in SketchUp for like maybe 12 hours the solution struck me, and I may have come up with the most challenging SketchUp component of my entire life:
On the pictures you see the SketchUp design of the mounting head and the front plate for a thumb joystick sourced from an XBox360 controller. I chose a mounting head that allows me to try/attach different front/back plates. This allows me to use the same design for left and right but with different button layouts (probably just mirrored). On the rear side there is room to put trigger buttons or other index/middle finger functionality. There’s plenty of room and it looks pretty nice.
Yes, I need to do more sanding.
Because I found my current HOTAS controller inadequate I decided to design and build my own custom HOTAS. I have access to a 3D-printer at home, soldering skills and Arduino programming skills so it should be an easy project. One week into the project, I have never found such an amazing and interesting project! I hope you enjoy reading about my progress.
Today I refactored all the sizes for mounting holes and connections. These are the current dimensions (for reference)
- Mounting to panels, interconnections, etc: M3, ø3mm (1.5 radius)
- Handle mount ø14mm
- Centering disc inner diameter ø14.4mm (radius 7.2mm)
- Gimbal rotating connections are M4 mounts are obviously ø4mm, but holes that should allow movement are ø4.2mm
- The Potmeter side of the rotating connections are ø7.2mm for the fixed potmeter part (fixed with washer and screw), and ø6.2mm for the rotating shaft. Since the shaft is a very tight fit not further screws or fasteners are required.
- The Mounting bracket hole has a slanted hole, top size is ø38mm, lower hole is ø36mm. I advise a mounting plate of 3mm thickness with a ø40mm cutout to allow maximum range.
Notice that all the TIGHT connection that are screwed in are exactly the size of the bolt (m3 = ø3mm), while all holes that allow movement need another 0.2mm room (added 0.1mm towards the radius).
The controller bits are to be mounted on the back side of a panel, instead of on top of some sort of housing. This makes it possible to mount the controls on a flat surface. In this first picture you see the gimbal design and the centering disc which is used to have the controller return to the neutral position. The stiffness of the joystick is done by tightening the horizontal bolts (not shown), while the calibration can be done by slightly rotating the potmeters.
This second photo shows the throttle assembly with a center latch that will be held back by a simple spring to give at least some sort of feedback towards the neutral position.
With this basis design done I am free to design the actual controls without having to rely on some commercial system. I am very excited. I’ll planning on assembling this tomorrow and get my first basic flight within the game!
- Firmware based on a Teensy, including auto-calibration on the extremes. This works about detecting the maximum deflection, and automatically calculate the minimum and maximum values of the potentiometers.
- Gimbal and throttle mechanics design
- Parts ordered for mounting plates and electronics
Loads to do:
- print parts
- assemble the mechanical items
- design laser-cut 3mm mounting plates for left and righthand controller.
- design and print thumb controls like weapon fire, up/down/left/right thrusters, etc. I got everything in my mind already.