This is a geek tutorial but just a little adjust to your device to make a real convenience. Take a look how the folks over Wonderhowt made it:
I spend practically all day surfing the web and writing on my laptop, and just as much time texting and checking emails on my smartphone. So, it's only natural for me to charge my iPhone using the USB port on my MacBook Pro.
Since that USB port is located on the left side of my computer, I occasionally rest my phone on the edge of the left palm rest.
As it turns out, my MacBook Pro doesn't really like this. It hates it so much that it actually falls asleep.
I'm not kidding you. Whenever my iPhone is resting on the left side of my MacBook Pro, the screen turns black and it acts like the notebook display was closed. Simply taking the phone off is enough to bring my computer back to life, but why?
If you have a newer MacBook or MacBook Pro model, this has probably happened to you a few times. If you have the phone there before you even power on the laptop, you're probably even more confused, since it looks like your Mac doesn't want to start up.
What causes this?
The Hall Effect
The newer MacBook, MacBook Air, and MacBook Pro models (2008 and later) have what's called a Hall Effect sensor. This sensor is an electrical switch operated by an applied magnetic field, activated whenever a magnet comes in close range of it.
In newer unibody models without a removable battery, it's usually located on the left side of the lower body below the palm rest. It's located on the right edge just where the front of the optical drive slot ends on older models that have a removable battery.
When you close your powered-on Mac notebook, a tiny magnet in the bezel of the display triggers the Hall Effect sensor and puts your computer into automatic sleep mode.
Why Your Phone Triggers the Hall Effect
The speakers located at the bottom of your iPhone have two magnets—the electromagnet and the permanent magnet—which interact with each other as any two magnets would.
The magnets cause fluctuation, which makes the speaker coil move back and forth; when the coil moves, it pushes and pulls on the speaker cone. This vibrates the air in front of the speaker, creating sound waves and the music we love to hear.
This isn't limited to just iPhones, either. After realizing exactly why my iPhone was putting my MacBook to sleep, I decided to test out two other devices. In the video below, you can see me triggering the Hall Effect sensor in my MBP using an iPhone 5, Samsung Galaxy S3, and Samsung Galaxy Note 2.
Other mobile devices, like an iPad or Nexus 7—even another laptop—will likely also trigger the Hall Effect sensor.
I visited my local Apple Store and talked to one of the employees about this issue, mainly to see if there was a case that was good enough to prevent this from happening.
Apparently, there isn't a special case or anything else you can do to stop this from happening, except for the obvious—don't place your phone on your MacBook.
So there you have it. The magnets in your smartphone trigger the Hall Effect sensor in your MacBook, which then causes your MacBook to fall asleep. Either this will annoy you or it will be another way for you to put your MacBook to sleep without closing it. Maybe even a clever prank.