Follow

First test of a strain gauge trackpoint. I snapped one strain gauge while figuring out how to mount one well!

It sort of works! There's a lot of noise even though I stuck a 1uf cap on the analog pin. It's also not super sensitive - without the capacitor the signal is only barely visible through the noise.

There are proper load cell amplifiers for this - I think they'd be worth a try.

Here's a closer view of the setup. It's a 3D printed cross suspended above the table, with a strain gauge on one of the arms. The gauge is wired to a PCB with a Wheatstone bridge and an LM358 amplifier. The output from that is smoothed with a capacitor and then goes into an analog pin on the arduino.

I'm wondering how much of the noise is due to the wire length and lack of shielding, and how much is unavoidable.

Once my strain gauges arrived I built a version 2 of the strain gauge trackpoint, with both axes hooked up.

I've attached all 4 strain gauges to allow for temperature compensation later, but for now this seems to be ok. It's a lot more sensitive with the gauges superglued to the thing! Before they were secured with double sided tape, which must have absorbed some of the strain.

Great, I've somehow managed to (temporarily) brick both that Arduino and my backup one. Seems like the Mouse.h stops them properly connecting to my computer over USB, even without actually using anything from it.

The prototype actually works surprisingly well! It has no acceleration or anything and it's a bit slow, but once I added a dead zone it's already fairly usable.

Not sure if you can see it in the video once it's compressed, but it's moving the pointer.

I also printed a cute little TPU cap for extra grip on the screw head!

Added some mouse buttons to my pointing stick prototype. They're very much not ideal, but good enough for testing! Built into a keyboard you'd probably want them to be much lower profile.

I *think* I've successfully reverse engineered the strain gauge amplifier circuit.

It would be great if someone familiar with opamp circuits could take a look at the opamp bit at the bottom and tell me if it looks about right. I've got no idea.

Here are some links to buy the module:
aliexpress.com/item/3280824105
hobbycomponents.com/sensors/96

I simulated the amplification portion of the BF350-3AA strain gauge amplifier. For the range of resistances I've seen across the strain gauge (348.8-351.2 ohms), a V_TUNE of 0.5V gets me a 0-5V output.

I think once I have some components decided (e.g. I can get a hold of 348R resistors instead of 360R) then I can re-simulate to tune the resistor values and thus the gain.

I made some slight modifications to the strain gauge amplifier circuit, to use through-hole components for prototyping and add some gain adjustment.

There'll be something wrong with it but that's why it's designed for perfboard rather than a proper PCB.

The capacitor values are complete guesses though.

The parts for the strain gauge amplifier have all arrived now so I tried assembling one on perfboard. As far as I can tell I've done it ok (after forgetting to connect V_excite to half the bridge circuit) but I can't manage to strip the enamelled wire.

Apparently the best way is to heat it with a 400°C soldering iron and plenty of flux, but that didn't seem to be working.

Once I get that connected I can actually start tweaking the resistances.

Once I got the perfboard strain gauge amplifier prototype properly connected to the gauges, it still didn't work.

The method of stripping the enamel off the wires that worked for me was sanding. Some ~600 grit sandpaper worked well.

I probed a few voltages and checked the connections but couldn't see what was wrong.

So the next step was to do what I should have done in the first place - build it on breadboard!

I assumed that there'd be some dodgy connections so I had skipped it. There are, but it still mostly works!

I've found some settings for feedback resistors and V_TUNE that seem to work well - time to figure out what gain it actually gives me!

It looks like the gain values I settled on were -41.3 for stage 1 and 9.125 for stage 2. The second stage could probably be turned down a bit to allow for the signal to be offset a bit.

I'm kind of wondering why I couldn't just do that amplification in one stage - amplify by ~400x instead. I guess that makes it harder to adjust the offset.

The V_TUNE I ended up with was 1.040V, which I think means the bridge circuit is a few tens of millivolts offset when the trackpoint is centred. Not bad.

Tried out using a single inverting amplifier with a gain of 100x on the strain gauge bridge circuit. It seemed workable, with a range of ~0.75V when wiggling the stick.

I might increase that by changing resistors later, but I think that this could work to keep it simple. It means that I can use a single LM358 to amplify both axes of the pointing stick. Exact resistor values can be decided later - I think it would be good to actually get PCBs made!

I was able to use the 2.5V from the TL431 as the Arduino's AREF, so it could get more resolution in the right range. I haven't yet done the calculations to figure out the tolerance on the centre voltage. It would probably be wise to allow me to select whether the AREF is 2.5V or VCC.

I killed the strain gauges of one axis of the pointing stick prototype, so I put together a neater one. This one has the magnet wire connect straight to a rigidly mounted thicker wire, which will hopefully make it a lot less fragile!

I think if I do a proper version of this, it'll need to use something surface mount, because this took hours.

Is this a thing you can do with a digital potentiometer? It would be a way to get high resolution in a small range without needing a really high res DAC.

Otherwise, are there (cheapish) DACs where you can set two voltages for the output to be between?

I'm considering replacing the reference arm of the strain gauge bridge circuit with something like this. That way the microcontroller can set the reference point to zero it easily.

The MCP4251 seems like a solid choice for a digital potentiometer. It's a dual pot one so I can do both X and Y channels.

The plan is to have the output from that be the reference for the strain gauge amplifier. The microcontroller can increase and decrease it to find/set a centre voltage when you're not touching the trackpoint. Should provide a good way to automatically correct any minor drift.

The MCP4251 digital potentiometer worked pretty well for adjusting the opamp bias! Unfortunately once I tried to get it to adjust automatically, some connection somewhere went dodgy and I couldn't get any further. I think it's time to make a proper PCB for this.

Show newer
@gbrnt just a cursory look but I see nothing obviously wrong. The lower opamp amplifies the bridge imbalance, the upper one amplifies the difference from the calibration point. It will only work in one direction (the strain gauge R cant get greater than the bridge resistors). I'm not sure about the opamp choice, but its cheap
@gbrnt actually im wrong about the one direction, sorry. it's ok
@gbrnt It takes writing it down before you really get what the circuit is doing lol

@piggo Thanks for taking a look! That's what I thought was happening, I was just not sure on the various feedback (and other) resistors round the opamps. Pretty sure I had a single lecture on opamps about 5 years ago!

@gbrnt what voltage are you getting on the output? If I'm reading it right, it should equal V_TUNE in idle state

@piggo I'm seeing 1.2V on output when V_TUNE is set to 330mV. It seems to max out at 3.05V and then doesn't change as you keep turning the pot. I'm not sure what V_TUNE that occurs at because I just broke one of the wires to the train gauge.

@piggo Oh are you saying that if the first opamp is outputting 0V, then the second one will compare V_TUNE to 0V and just output V_TUNE?

@gbrnt i dont think this will ever output 0V but i may b wrong about that, its been a while i last used opamps.

you have two inverting amplifiers, the plus rail is the "virtual ground". so when it detects "no signal" relative to this ground, it outputs zero. but that is relative to the virtual ground, so for a fully balanced bridge you get half v_excite out of the first amp

but it will never be exactly that because of resistor manufacturing errors etc. So v_tune must be set to equal this value so the second amplifier amplifies the signal and not amplify some nonsense offset

i think ideally you'd sense V_TUNE with an ADC too, and then subtract that from the result to get the real deviation

@piggo Weird thing is that the resistance of the gauge never equals the resistor it's paired with. I'm guessing they used 360R resistors because they're cheap/common and V_TUNE allows them to compensate for the 10 ohm difference?

@gbrnt i think so, it's a shitty cheap chinese circuit, isnt it? A real strain gauge would use 4 sensing elements and make the whole bridge out of these
@gbrnt and then use an instrumentation amplifier, but the ICs are expensive or you need 3-4 matched opamps i think

@piggo Yeah, the cheapness of this (and the fact that it already pretty much works as an input device!) is why I'm thinking of sticking with the LM358 solution, at least until I have the code side mature enough to find problems with it.

@piggo Yep, I couldn't even find any information on it which is why I

I think for my pointing stick I'll just do 2 strain gauges for each axis (so half bridge). I saw someone on stackexchange suggested just using a DAC for the comparison voltage on the opamp instead of the other half of the bridge. Might be worth a go!

@gbrnt the idea being that you avoid the tuning potentiometer?

@piggo Yeah exactly - if my goal is to build this into a keyboard and provide a PCB for other people to do the same tuning is a bit annoying (especially if it's more than once).

btw the rest of that first sentence was meant to be "which is why I tried to reverse engineer it"

@piggo Anyway I'm gonna leave this for tonight and put together a parts list to prototype it tomorrow!

Show newer

@cinebox Thanks, I might get an LM358 (apparently don't have one or it's hiding) and recreate the circuit myself!

@gbrnt actually doing the math its not as funky as it looks. Vout1 = 25Vtune +1200(Vb1 - Vb2)

@cinebox Thanks for calculating that! Those gains are calculated from the resistors around each opamp?

@gbrnt yes. the rule of thumb is to assume the two inputs of an opamp are equal voltage during steady state

@cinebox Ah I'd forgotten that! Thanks! I think I have my dad's copy of the Art of Electronics somewhere, should pick it up sometime

@gbrnt I've had success with scraping the wire with a sharp blade and using a screw terminal. Good luck!

@uglyhack Using a screw terminal how?

I didn't have much luck with a sharp blade but I didn't try for very long.

@gbrnt I meant screwing it into a screwterminal. The enameled wire I was using was platinum or nichrome, so I didn't think it would solder well, so I put it in a screw terminal instead.
I guess I wasn't thinking about what you were using. With normal copper wire I wouldn't expect a problem.

@gbrnt could probably also adjust the gain on the amplifiers to bring the maximum closer to your VCC

@cinebox Yeah, that should be easy enough with a resistor swap

@gbrnt Of course you could do that, it's one of the number one applications for those.

@AskChip Thanks for confirming, I thought it looked like it but I wasn't sure if I was just missing something :) I'll have a proper read of some datasheets now!

@gbrnt As long as you obey the voltage limits of the device.

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!