Install Motion from the official Raspbian repository:

raspberrypi ~ $ sudo apt-get install motion

To start with Motion, download and try the following configuration file, which you can change later according to your needs:

raspberrypi ~ $ wget

Now run the driver in background, for example:

raspberrypi ~ $ uv4l --driver raspicam --auto-video_nr
 [notice] [core] Device detected!
 [notice] [core] Registering device node /dev/video0

Finally, run Motion:

raspberrypi ~ $ LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/ motion -c ./motion.conf

If you run motion as daemon and the camera is not detected properly for some reasons, try to load the driver with the –extension-presence=1 option. Check if the Motion HTTP server is up and running on your Raspberry Pi. For example, from your PC with firefox:

mypc ~ $ firefox http://raspberrypi:8081/