void_switch icon indicating copy to clipboard operation
void_switch copied to clipboard

Switching hall effect sensors on/off

Open TAImatem opened this issue 2 years ago • 5 comments

I am somewhat concerned with power consumption given that each sensor seems to consume around 4-6mA. I wonder if it would be possible to turn on hall effect sensors cluster-by-cluster while polling. Maybe like turn on the cluster -> wait about 0.1ms -> poll the cluster.

Managed to find Texas Instruments design paper that involves duty cycling, they use 50-60mcs delay (although they use their, own significantly more expensive DRV5033 sensors). www.ti.com/lit/ug/tidub69/tidub69.PDF (nice)

That approach could probably be used to simplify the circuit as well

TAImatem avatar Jun 24 '22 18:06 TAImatem

Although I guess you can just as easily turn on all hall sensor -> wait -> poll -> turn all off. I suspect polling time would take significantly less time than waiting for hall sensors to stabilize. And in case of strict power requirements (like wireless keyboard) you can cut polling rate to 10 times a second when idling (should be enough to be perceived as immediate when user resumes typing and would consume around 1/1000 of total hall sensors power (assuming duty cycle length would be at 0.1ms))

TAImatem avatar Jun 24 '22 18:06 TAImatem

That said, even sk6805 (at 15mA), not to mention ws2812 (at 60mA), would be consuming significantly more power at 100%. Though I really doubt anyone would enjoy 5-21W of backlight (but hey, you could use keyboard as desk lamp 🤣)

TAImatem avatar Jun 24 '22 19:06 TAImatem

This is something I've been researching a lot... I doubt doing power-efficient linear hall effect sensing is realistic because those sensors need too much time to "settle" after power on before you can take reliable measurements. Hall effect switches on the other hand can be found in packages that use so little power as to be nearly non-existent.

The trouble with using such ultra low power hall effect switches is that they can be expensive and you also need to carefully calibrate the position of the switch above the sensor and have a fixed actuation distance (it couldn't be adjustable). If you're going to go that far I was thinking it might make more sense to just add a tiny conductive rubber pad to the bottom of the stem and just turn it into a contact switch that smacks into some tracks on the PCB to form a circuit (like a game pad button).

riskable avatar Sep 12 '22 18:09 riskable

IMO what you proposed would give a rather terrible feel, partially because you can't really have any after-travel, and something tells me there's gonna be a noticeable jitter (admittedly reed switches also have up to 1ms of jitter). Also you might have to perform a rather frequent throughout cleaning. And it would be pretty hard to implement on non-planar keyboards. IMO if one is willing to compromise on analog input he/she could use optical switches: they don't seem to be super expensive (on AliExpress they seem to go around 1$ for 10pcs or 20$ (smh) for 100pcs) and come with convenient mounting holes (i.e. ITR20005). You would still need to powercycle them, but turn-on/off time should be around 10mcs (advised power consumption seems to be around 20ma, but can be lower). Optical switches do limit material choice significantly though since for best results casing should be able to block outer IR light and stem would have to at least have some sort of IR-blocking shutter attached to it. The switches would also have to have a hole in them and that can significantly worsen metallic dust problem.

I personally would rather powercycle ordinary linear hall sensors line-by-line if latency is not an issue since it comes with additional benefit of simplified circuitry (sensor outputs can be joined in columns through diods and/or transistors). If my dso138mini supports external trigger I might do some experimentation on turn on times: basically just use a square waveform as Vcc, set a magnet at constant distance and see how long it will take on average for Vout to settle; Repeat the procedure with various distances

TAImatem avatar Sep 12 '22 20:09 TAImatem

I have an update to this! I did some testing with a through-hole 49E linear hall effect sensor and I was able to figure out that you can ignore the settling time for the most part as long as you remain consistent with how long you keep the sensor powered on.

Basically, if you power on the sensor and then ~3 microseconds later you take a reading the value could be 2300 instead of 2500 (just an example). However, it'll always be off by that same amount. There doesn't seem to be much variation in how much it's "off" (for the same length of time). I only tested the one sensor but powering it on and then reading it immediately thereafter results in the same value every time--even though it'll be like 100-200mV away from it's "settled" value.

Caveat: The sensor in question did not have any capacitors and was running off my USB hub's 5V supply (which is strangely exceptionally stable--on that one USB hub anyway hehe).

I suspect that if I did more testing I'd see more voltage wobble up/down if I waited much longer than just 3 microseconds before taking a reading. However, since the RP2040 board I was testing with can turn a GPIO pin on (that went through a non-MOSFET transistor turned on the sensor) and read an analog pin within 3 microseconds (~1µs to set the GPIO pin to HIGH and 2µs to read) the values were more consistent than if you were doing it through say, an asynchronous process/loop mechanism.

riskable avatar Sep 24 '22 16:09 riskable