in Android

Build your own security camera with Raspberry PI and watch&control it online

Today, we are going to let Raspberry PI turn into a remote security cam that we can control and watch live anywhere on the planet with using our mobile phone. This is the maker version of dropcam, nestcam, etc. We call it Butterfly PI.

To make things simple, we prepare a step by step guide so that any maker or developer can build his/her own remote security camera. Btw, if you just want to try your own camera, let us assemble the camera for you. Keep in touch Here is the outline, first, we need to make the mobile app ready for camera. Secondly, build the camera. Let me tell what we have needed for building the camera in advance.

  • Android Phone(4.0 or higher)
  • Raspberry PI 2
  • Raspberry Camera Module
  • Power Adapter 5V – 1A with micro USB output
  • USB Audio Adapter(Optional)
  • USB Wi-Fi dongle(Raspberry PI 2 compatible) and Ethernet Cable

Let’s start.

Make Mobile Phone Ready

  • Download and install Butterfly TV from Google Play. Butterfly TV is integrated with our camera
  • Login to Butterfly TV and then click the My Butterfly PIs item in the menu


  • You should see the below screen when you first open the Butterfly PIs’ screen.



  • Click  “Add a new Butterfly PI” item in the menu as shown below.


  • Write your camera name([DeviceName]) and secret code([SecretCode]) to the dialog. You can write anything you want. Just don’t forget the name and secret code. We will need these values to authenticate Raspberry PI. We write “Balboa” for both device name and security code. (You should write something different than “Balboa”, this is our example)


  • After you click OK, you should see your Butterfly PI as offline like below



Build the camera

  •  We just need to edit a file in raspberry. Plug the power adapter and if you have keyboard and screen plug them as well (if you don’t have, you need to connect via ssh(explained below)) and edit /home/pi/startup/ Change the line
java -jar /home/pi/butterflypi.jar [DeviceName] [SecretCode] &

[DeviceName] and [SecretCode] are the parameters when you used registering the Butterfly PI on android app at step 5 on previous section.(Don’t remove &) – Please keep in mind that secret code is a kind of the password for your camera.

  • (Optional) if you don’t need to connect via ssh, skip this part: Connect your RaspberryPI to your wifi router with Ethernet cable. You need to know the ip address of the raspberry. You can learn it from your modem interface (probably with entering something like to your browser). After you learn ip address use ssh like below

Password is “butterflypi”. If you still don’t know how to connect, try this way . Keep in mind that after you perform last way and edit the, you need to restore the cmdline.txt file.

  • (Optional) If you try to record sound as well, please plug a USB audio adapter to Raspberry PI.  Like this one or that one.
  • We are almost done. You need to connect to Raspberry to network via wi-fi or cable. If you use wi-fi, consider buying one of them. To learn how to configure wi-fi you can visit here. If you use an ethernet cable, just plug into Raspberry PI. Make sure that ethernet cable or wi-fi connection is connected to internet. If you want to use wi-fi, after configuring your wifi using Ethernet Cable, plug out the Ethernet Cable and restart the RaspberryPI. Now it will use wi-fi.
  • If you wish you can also put Raspberry PI to a case and it is better if you use a case with fan or use heatsink to get better performance. Lastly, Here are some Butterfly PI’s with different cases


  • Plug the power adapter to raspberry and let it boot. When it is connected to network. Your camera gets online on Butterfly TV.
  • Click start button and wait then the screen becomes like below. To watch it just click the Play button.


  • So you have a mobile app controlled security cam, you can mount Butterfly PI anywhere you want. You can use this case to make mounting easy.

Lastly, welcome to your feedbacks and questions, keep in touch via & @butterfly_tv

Written By:

About me


  1. ogah January 23, 2016 Reply
    • mekyaAuthor January 25, 2016 Reply

Add a Comment

Your email address will not be published. Required fields are marked *