Another easy way to do this is to use an opto-isolator like 4N35 or PC817.
Take a look on the ArduinoInfo.Info WIKI:
http://arduino-info.wikispaces.com/Popular-ICs and scroll to OPTO-ELECTRONIC IC'S
These are less than 50 cents each and you don't have to worry about "What is grounded"...