Alts: https://hachyderm.io/@samhenrigold/115159295473019599, https://bsky.app/profile/samhenri.gold/post/3ly7252lx422d
Theremin Mode: https://twitter.com/samhenrigold/status/1964464940049453153
Github: https://github.com/samhenrigold/LidAngleSensor
To those wondering why the MacBook would have a sensor for this, it’s likely there to support Desk View[0]. It shows the items on your desk in a geometrically correct, top-down view. Knowing the angle of the display is very helpful when applying keystone correction.
Other laptops have this too. Linux has a driver for it.
https://www.phoronix.com/news/Intel-Hinge-Driver-Linux-5.12
The sensor angle would be in a file like `/sys/bus/iio/devices/iio:device*/in_angl0_raw` (device number can vary). At least I have this in a config file and remember it working (maybe on a different computer?). I cannot get it to work anymore on my laptop.
A fun entry to the trend "stupid volume controller" a while back I guess would be to use this to control the volume, heh.
See "The Laptop Accordion" from 2016 https://www.youtube.com/watch?v=zMJAevVri5w
https://x.com/nevmed/status/1640004745250078723
I wonder if Apple uses this internally at Apple stores to set the screen angle at 76 degrees.
This was used as part of a 2017 competition to make the worst volume controllers: https://x.com/0xDesigner/status/1642554834535477249
Missed a huge opportunity to play the sound of a monstrous wooden door sound when the lid closes. Looking forward to the update!
I wonder why? Presumably this information doesn't come for free, and Apple spends money to put this sensor in.
Is it a backup if the magnet for closed lid detection fails? Is it some kind of input for the brightness sensor or True Tone? Is it for warranty investigation, that if the hinge breaks they can figure out if it was physically pushed too far, or was repeatedly slammed open and shut like a toy?
Apple is going to see an increase in MacBook Pro hinges breaking from people trying to play the Star Trek theme in theremin mode or other songs with other instrument sounds.
Apple: How did the hinge break?
Customer: I don’t know, I just opened it one day and it came off.
You could use that to display some kind of billboard affect, so that an image is always in a correct aspect ration to the observer in front :D Please could someone with a macbook do this and post a video here? :D
And this little thingy makes a lot of M2 MacBook Airs fail.
Confused why it says that 'this API is not exposed' while it's a simple HID device.
Author can submit this to the AppStore.
Great! so they already know that I've been squinting at a 42deg gap trying to use my old MBP. The year with the faulty designed screen connector which was only covered for replacement on certain models, not mine. I wonder if that is why they added this, to check for 'holding the lid wrong'. If I open it any further I need a reboot to get the display back, oh and that angle decreases over time.
I wouldnt mind but I was 95% of the time clamshell, and still the keyboard made from butterflies wings lasted next to no time, and the battery put on too much weight after only 30 something cycles. After all these years I never understand how they produce such lemon models some years, just trying to save a few cents here and there. The one before was thermal paste nvidia meltdown.
The most interesting takeaway from this project and the Mac touchpad actually measuring it's pressure in grams[1] is how Apple seems to prioritise it's ability to deliver new features in later software releases rather than their BOM.
I work in the automotive industry, and for volume products the price-cutting is really brutal. If you can save a cent somewhere you will, because that cent multiplied by 8 million cars a year is a sizeable amount of money.
This seems to be generally true for most OEMs of hardware products, but not for Apple. Apple could have cut costs by just using a magnet and a reed switch/hall effect sensor, because it is not using the exact angle of the screen anyway (afaik?), but they chose not to.
They could have implemented their "3d Touch" by using a simpler circuit which just indicates if the press was really hard or soft. But again they chose not too.
And they sell over 20 million Macs per year, so they really sacrifice a sizeable amount of profit
A lot of foldables have a hinge angle sensor - it's actually a public API in Android, and robust enough that we use it to detect whether a device is a foldable:
https://source.android.com/docs/core/interaction/sensors/sen...
I learned of the lid angle sensor due to my MBP draining its battery. Whenever I flew across the country I'd always end up with a dead battery. Originally thought it was some process preventing sleep but was spinning circles hunting it down until one night, I closed the laptop... the screen turned off as it was closing and just as it shut.. you could see the faint glow of the screen turning back on again. If I cracked the lid open 1/8th of an inch it would turn off again.
I had thought that the MBP (an Intel one) had used magnets to detect lid closure but alas that's when I learned of the lid angle sensor and all the symptoms I was experiencing made sense. Basically the laptop would wake up when shut and the screen would stay on the entire time thus draining the battery.
Ended up getting the LAS replaced which was not DIY'able unfortunately... but was a relatively cheap fix (~$90).
In case you do not have this sensor, you can use the ambient light sensor to achieve a similar effect: https://youtu.be/pzJwDs6KRXA?feature=shared
I clicked around and the README links to this python lib: https://github.com/tcsenpai/pybooklid
Probably a nicer interface for anyone who wants to play with this :)
Does anyone remember the slapbooks?
There was a sensor where it would detect when you slapped the side of the screen, and a guy wired it up so when you did that it shifted to the next space (virtual desktop).
Looks like something is off with the value. That “exact angle” makes zero sense
Reminds me of a "stable window" app gadget from mid-2000's that used the built-in accelerometer to make a window stable irrespectively of laptop's tilt.
Close/open sound font ideas
> Jacket zipper
> C Major scale
> Slide whistle
> Washboard
> Airlock
> Vinyl record scratch
As someone who recently wrecked their MacBook's screen by leaving something hard and pointy in between keyboard and screen when closing the lid, I wonder if one can turn on the webcam briefly before the lid closes and sound an alarm if it detects anything in the way.
this just makes me miss the old Mac OS that let you add sound effects to anything.
Is this part of telemetry?
I sure hope they don’t feed it to advertisers to fingerprint me!
Microsoft has had this in their Surface Book. It has a screen that could detach and be used as a table, which had an accelerometer in it that could measure the angle.
Does anyone know if this is used by any program to check if you are actually looking at the screen? I could imagine it being used for some blackmirror type stuff
Is there a downloadable source for this? I’d love to add it.
My understanding is that this sensor is used to help adjust speaker behavior for better sound, but I can't find a link to support that.
MacBook Protractor
Seems like they should expose it, perhaps done for security reasons. I can in-vision some interesting apps using the angle.
The Nintendo Switch 2 according to Welcome Tour can also detect hinge angle. Unclear if this is a sensor or clever math though.
my guess: probably there to support the camera system and depth camera.
although unless there's some sort of angle measurement with respect to the ground in the base, i'm not sure what it would be useful for. maybe to provide continuity for the depth camera when the lid angle is changing (without heavy duty estimation calculations).
Is it the angle of the hinge or the angle of the screen? I assume the latter... my laptop is rarely on a level surface.
Someone should make a video game where you have to jerk the hinge back and forth for basic movement
How is this useful? I don't get it? Is not a touchscreen, doesn't fold...
Chances are there's an accelerometer in the screen and one in the base.
It would be cool if the Macbook can figure out the relative position of a newly connected external monitor. It would help in setting up the monitor with little manual adjustments.
Since covid, we no longer have assigned desks at work --- it's first come, first served. And while most are respectful of the desks we have "chosen" for ourselves, every once in a while, I'll have to sit at some other, often new desk. And that means my laptop will not recognize the monitor and that I'll have to configure it (scaling, relative position, etc).
And Windows being the mediocre OS that it is, will always select to duplicate the screens even though the logical choice is to extend. My laptop screen and the external monitor aren't even the same aspect ratio. SMH.
At least Macs have the sense to extend screens by default. Though, if I could place a Macbook on the desk, plug in the external monitor, tilt the screen back until the camera can see the monitor, the hinge sensor and cameras can work together to figure out where the monitor is relative to the laptop, and automatically determine the right settings for the monitor instead of requiring my intervention.
Posts like this are the reason I keep visiting HN, THANK YOU!
Thats cool. I love it
Finally there is a sensor that can measure my tilt.
Cool. @Grok, write an application for decrypting a file based on rotating the hinge clockwise X degrees, counter Y degrees, then clockwise Z degrees.
Looks like opportunity for gymnastics app!
Protractor app when?
Hahaha that’s awesome
This is the best thing ever
This post was also made (by the same person, it seems) on Mastodon: https://hachyderm.io/@samhenrigold/115159295473019599 — which has the added benefit of not being X, not requiring cookies, and has more information than the tweet, including a follow-up "theremin" hinge.
lol apple
Why does it say it's by Lisa?
I signed up for my developer account when I was a kid, used my mom's name, and now it's stuck that way forever and I can't change it. That's life.
Classic Apple overengineering. Every other laptop I know of just uses a single lid switch. It reminds me of their mouse that has capacitive buttons and a speaker to produce clicking sounds.
[flagged]
Ok but why?
Meanwhile, Samsung makes luxury devices that have foldable screens ...
Apple has a _lot_ of catching up to do.
And also it has a magnet to detect the lid being closed. People think this is over engineered, but I've yet to see another brand that has a working closed lid detection
Yea this is how the new Apple silicon devices will start if they are off. The fingerprint sensor is just used to manually do it or override the current state / put it into recovery mode.
The lid angle sensor is also serialized to the motherboard: you cannot replace it, or the motherboard, without performing calibration, which can be performed by an apple authorized service provider, or alternatively, in Europe (and elsewhere where Apple offers parts for self-service repair), you can purchase the sensor from Apple, connect the machine to the internet after replacing it, to then perform the calibration, only if the sensor was purchased from Apple.
So the hardware is capable of performing the calibration, Apple just does not graciously grant you the right to install a recycled or third party sensor in your machine.
https://www.ifixit.com/Answers/View/759262/Torn+Lid+angle+se...