How to setup Wi-Fi on Raspberry Pi


When your computer doesn’t have monitor, keyboard, mouse, or you can’t use cables, the task to get online via Wifi looks difficult and practically impossible. Now you can take your Raspberry Pi – a tiny programmable and affordable computer used for… almost anything – and connect it to a wireless network anywhere you need. DataArt DeviceHive team prepared a special app that helps to link the single-board device to a Wifi point.

With the closure of two contacts on the Raspberry bus-bar, Wifi switches into access point mode. After that, the user connects the Raspberry Pi with a cell-phone or other mobile device, selects the network’s interface and enters the required password. With the contact disjunction, Raspberry Pi automatically connects to the selected network.

All hardware needed and sequence of steps - in this post.


The system consists of three devices:

  • Raspberry Pi rev 2
  • USB WiFi dongle (please refer to to make the right choice)
  • 1 female-female connection cord as a jumper

System software setup

USB WiFi dongle Driver

Please visit your dongle manufacturer’s site to get the appropriate driver (or build it by yourself, as we are not ones who looking for easy ways and follow the path).

  • sudo apt-get install g++
Wireless Tools
  • wget
  • tar xvfz wireless_tools.29.tar.gz
  • cd wireless_tools.29
  • make
  • sudo make install


  • sudo apt-get install hostapd
  • /etc/hostapd/hostapd.conf:
  • /etc/default/hostapd:
  • sudo apt-get install udhcpd
  • /etc/udhcpd.conf:
  • /etc/udhcpd.conf:
    interface wlan0
    remaining yes
    opt subnet
    opt router
    opt lease 864000
  • /etc/default/udhcpd:
    comment out DHCPD_ENABLED="no"
  • /etc/network/interfaces:
    auto lo
    iface lo inet loopback
    iface eth0 inet dhcp
    auto wlan0
    iface wlan0 inet static
    start-up script
  • /etc/rc.local:
    service hostapd start
    service udhcpd start

Work sequence

From technical details to practice:

  1. Place the server binary file in any folder along with index.html.
  2. Install the USB wifi dongle and drivers.
  3. Perform software setup.
  4. Shut down RPi.
  5. Short pins 3 and 6 on the GPIO port.
  6. Power on. In 2-3 minutes the open WiFi network RASP_NET should appear.
  7. Connect to it via laptop/smartphone/whatever.
  8. Go to
  9. Chose the desired wireless network, its encryption type and the enter key.
  10. Press the submit button.
  11. Remove the shorting wire from the GPIO.
  12. WiFi network RASP_NET should disappear.

Your RaspberryPi now is connected to selected network. And it’s your turn to take advantage of the new features.

Sign Up for Updates!

Subscribe now to receive industry-related articles and updates

Choose industries of interest
Thank You for Joining!

You will receive regular updates based on your interests. No spam guaranteed

Add another email address
Read more
Sign Up for Updates!
Choose industries of interest
Thank You for Joining!

You will receive regular updates based on your interests. No spam guaranteed

Add another email address
We are glad you found us
Please explore our services and find out how we can support your business goals.
Get in Touch
Download the white paper Glancing Forward into 2021: An Industry by Industry Outlook

Explore digital trends and unanticipated benefits engendered by the pandemic, which are likely to last in 2021.