Posted on

How to disable WiFi on Raspberry Pi 3

Raspberry Pi 3 is a great addition to the Raspberry Pi family. It comes with inbuilt WiFi and Bluetooth chips. Making it easier for anyone to develop internet connected things (so-called IoT devices).

However, sometimes you don’t need any WiFi on your Raspberry Pi. Like, recently, I was designing an industrial security solution and the primary interface I wanted was ethernet, not WiFi. It is very difficult for any industrial plant to have WiFi coverage while ethernet is commonplace among internet and intranet connected industries. One of the reasons of not using WiFi is the sensitivity of the connected devices in an industrial setting. You would certainly not want someone to take over the WiFi and switch that turbine or boiler off. Similarly, there are strong electric and magnetic fields in an industrial plant that can interfere with WiFi signals, rendering it useless at the end! So, the ethernet remains only sane choice at the end.

With Raspberry Pi, it’s not simply the case of not connecting to WiFi and just using ethernet, as for some weird reason my Pi kept on rejecting the IP for ethernet while WiFi was active.

I came around to shutting the WiFi off, permanently, just to get my ethernet working.

Solution for disabling WiFi on boot

Enter the following command in the terminal window:

Now, add the following code before exit:

Short and simple, this will stop WiFi interface from getting active at the boot time. I tried several other solutions as well, but none of them worked except the above one! So, no need for you to go into the blacklist config file etc. You can use your ethernet connection for building your solution!

Congratulations! Now, you can use your ethernet connection for building your solution!

All the best!

Posted on

How to view web stream of USB Camera through Raspberry Pi 3

In this tutorial, you will learn about installing and using USB camera on Raspberry Pi 3. We will also explore the option of using USB camera instead Raspberry Pi Camera module in robot RC cars.

Recently, I was playing around to view the live feed of Raspberry Pi camera module by installing RPI Cam Web Interface package. The task was to see the live cam video through WiFi. Unfortunately, it kept on crashing and I had to abandon my efforts after some time. At that moment, my mind went towards installing and using a USB camera instead of Raspberry Pi camera module. The RPI Cam package can not be used for USB cameras.

Again, unfortunately, the RPI Cam package can not be used for USB cameras. Luckily, there is another package for it and it is called “Motion”.

Motion installs itself as a server and live cam feed can be viewed through Raspberry Pi’s IP address.

Let’s go through the steps of installing motion as a webcam server:

Step 1: Upgrade and Update your OS

Before installing, make sure you have the latest version of NOOBS OS installed.

Input these two commands in Pi’s terminal:

Step 2: Install Motion

Install motion through this command:

Step 3: Copy the Config file

You can open and edit the config file through this command:

This file is used for config parameters such as whether you need to save JPEGs, or whether only localhost can view the cam feed or you want anybody from the network (internet) to access it etc. The file also contains parameters for quality of the stream etc.

Make following changes:

The complete config file is pasted below, you can compare your config file with file below if you run into any problems (or can also replace your config file with following code).

Step 4: Enable the service

Now, execute following command:

and set start_motion_daemon to yes as:

Step 5: Start the motion server

To start the server, enter this command:

To stop the server, enter as following:

Step 5: See the cam feed in browser

Its fun time! Go over to your other laptop or mobile phone, open the browser (make sure all machines are connected to the same WiFi network) and give the IP address of the Raspberry Pi along with motion’s port number.

My URL to see the browser was:

Step 6: Start motion at boot time

Now, open the crontab:

and at the end, add this:

This will start motion at reboot. Press Ctrl+O, hit enter and again enter, then Ctrl+X to come out of nano.

Step 7: Add Camera Feed into another web page

If you want to add camera feed into another web page, iframe HTML tag is your friend! Enter following HTML code into your web page:

Congratulations! You can now see your USB camera feed from anywhere in your home/office!

Hint: If you want to see the cam feed through internet, you will need to port forwarding on your router.

All the best!