Archive for the ‘raspberrypi’ Category

No Comments

4 ways to connect your Raspberry Pi 4 to the internet

Wednesday, June 26th, 2019

The just introduced Raspberry Pi 4 has delivered some much wished features: faster internet/network, a gigabit Ethernet connection, and faster USB, 2 USB 3.0 ports. This will open the door to a Raspberry Pi driven NAS solution that will offer high speed in combination with the new USB3 ports.

This post is about exploring the USB OTG  (On The Go) feature of the Raspberry Pi 4. We will find out if it’s possible to power and connect a RPI4 with just a USB cable.

Ethernet is easiest way to connect internet, the second is wireless, using WiFi. The new RPI4 offers dual-band 802.11ac wireless networking. Not as fast as the gigabit Ethernet internet, but it will offer speeds like 100 Mbps, around a 100Mb Ethernet connection. That’s quite speedy too.

The third way is using Bluetooth. Like connecting your laptop to a Bluetooth hot-spot on your phone. That will be a bit slower. Will try that later.

The fourth way is using a trick we know from the smallest Raspberry Pi, the Raspberry Zero. The Raspberry Pi 4 has a USB-C power connector, but that USB-C port is also an USB OTG connector, so the Raspberry Pi can be used as a USB Gadget: the USB port can switch USB states (MASTER/SLAVE or HOST/DEVICE) and be used like a keyboard or mouse, or USB Ethernet modem.

Actually you can power and connect to a Raspberry Pi 4 with just an USB-cable. I tried it with the new Raspbian Buster and it’s working fine. I used the same Samsung cable I used for my Zero (and phone), added an 1 euro micro-USB to USB-C adapter, and it’s just working fine. It seems my laptop is offering enough power for a headless, and armless Pi.

To enable OTG networking, add this to `/boot/config.txt`:

# enable USB OTG
dtoverlay=dwc2

Then add this to `/boot/cmdline.txt` after rootwait:

modules-load=dwc2,g_ether

Reboot your Raspberry pi and convert the new wired connection to `shared` in the connection manager on your laptop (e.g. Ubuntu 18.04), and connect to your new Raspberry Pi 4.

It will have an IP like: 10.42.0.xxx.

If you have added  a empty file `ssh` to the boot sector of your SD card touch /boot/ssh, the Pi will start with SSH enabled.

So you can connect from your laptop with:

ssh pi@raspberrypi.local

For more details, see these posts Connecting to a Raspberry Pi Zero with just an USB cable (I) or Connecting to a Raspberry Pi Zero with just an USB cable (II)

I wonder if it will be possible to boot the Raspberry Pi 4 entirely over USB, without a SD card, like the RPI Zero. Not at the moment though.

No Comments

How to Make the Music Player Daemon (MPD) Autoplay on a Raspberry Pi

Tuesday, November 13th, 2018

Music Player Daemon (MPD) is a terrific open source music player and maintains a good organized library of your music in an efficient database. MPD is a server so you need a client. That can be your laptop, to your phone, your browser, your whatever, or you can run a client on your Rpi locally (mpc). Or all together.

It does run fine on the cheapest raspberry pi, so your ready to go for 5 euro. The Pi only has a high quality HDMI output, for older Hifi systems with analogue connections  you need something like the HifiBerry.

MPD uses much less CPU then running Kodi, 4% instead of 40% on the original Raspberry Pi.

Furthermore you can put your music on an external USB stick or  NAS with Linux NFS or the slightly inferior Microsoft Windows Samba shares.

If you haven’t installed MPC yet, do that first:

sudo apt install mpc

Normally MPD will resume play after shutting down, but to make MPD auto-play always simply add this to your systemd.service  file:

ExecStartPost=/usr/bin/mpc play

How to do that? Just edit the file:

sudo vi  /etc/systemd/system/multi-user.target.wants/mpd.service

And add it under the line starting with `ExecStart`

...
[Service]
EnvironmentFile=/etc/default/mpd
ExecStart=/usr/bin/mpd --no-daemon $MPDCONF
ExecStartPost=/usr/bin/mpc play
....

Save it, stop MPD, and reboot your pi. And the music will play 😉

30 Comments

How to run or boot Raspbian on a Raspberry Pi Zero without an SD-card.

Thursday, March 22nd, 2018

In an earlier post I explained how you can run and connect to a Raspberry Pi Zero with just an USB cable. Still the RPI Zero was using a micro SD card.

Luckily the great minds of the Raspberry Pi Foundation developed new boot modes: ethernet boot and USB Mass Storage Device (MSD) boot for the Raspberry Pi 3.

Now they came up with USBBoot, a tiny program that pushes the bootcode over the USB to the Raspberry Pi Zero (Raspberry Pi model A, Compute Module, Compute module 3 and Raspberry Pi Zero and Raspberry Pi Zero W), so it can boot without a micro SD-card.

Boot a RPI Zero from your laptop without SD card

In this post we will boot the Zero with the latest Raspbian Stretch (lite) from an common Ubuntu laptop, running 16.04LTS. It is surprisingly comfortable once you’ve set it up. And remember we’re running the Zero without any SD card, which costs are higher then a Raspberry Pi Zero. You do not need an SD card at all.

Yes, we use a standard USB cable to power,  connect, provide internet-access, an OS and storage for the Pi Zero.

So we gonna run the poor Raspberry Pi headless (=no monitor), armless (=no keyboard or mouse) and brainless (=no memorycard). And you know what? Back to the basics make the little gem shine!!

(more…)

8 Comments

Connecting to a Raspberry Pi Zero with just an USB cable (II)

Monday, October 2nd, 2017

This tutorial assumes you’re using Raspbian Strectch, and a Linux (16.04LTS) laptop, but it should also work on Raspbian Jesse for the Zero and any Linux Laptop. So it’s for everybody. Nearly every laptop can run Linux freely, (that’s not the case with Windows (Microsoft) or MacOS/OSX (Apple) that’s paid and not free software). You can always run Linux in a virtual machine, if you’re afraid to dump proprietary stuff or install Linux side a side.

In part 1 we explained how you can connect to a Raspberry Zero computer with an ordinary USB cable to power, connect (SSH) and provide internet access for the Pi with higher speeds than most WIFI connections.

That’s all been made possible with the smart USB OTG functionality that enables the Pi Zero to switch USB host/device mode and mimic an ethernet device (or webcam, or keyboard).

We showed you how to connect from a Linux laptop to the Pi by setting the connection type to Link-Local only. (more…)

6 Comments

Connecting to a Raspberry Pi Zero with just an USB cable (I)

Monday, October 2nd, 2017

The goal of this post is to explain how you can power, connect  and share internet with your Raspberry Pi Zero from your laptop with just one USB cable. After you’ve set it up correctly, connect the cable, let the Pi boot,  ssh to your Pi with this simple command ssh pi0 or update your pi with this oneliner ssh pi0 "sudo apt update && sudo apt dist-upgrade -y".Your Raspberry Pi Zero will have internet access over USB with higher speeds than most WIFI connections. (more…)