Skip to content

Latest commit

 

History

History
74 lines (40 loc) · 3.56 KB

README.md

File metadata and controls

74 lines (40 loc) · 3.56 KB

Cockpit Cam

This module sends a live video stream from the cockpit of the robotrain and lets you experience the ride from the driver's point of view.

It is using a Raspberry Pi Zero W with an RaspiCam module. The operating system is PiCore Linux (a port of TinyCore Linux for Raspberry Pi) which runs entirely in RAM to avoid failures to wear and tear on the SD card (which the RasPi is prone for).

Setup RasPi

Follow the instructions in this repository to get your RasPi up and running.

Prepare PiCore Linux

Download the latest stable release for Raspberry Pi from the TinyCore website. This tutorial is based on version 9.0.3.

The ZIP file contains a README file which explains the concept of TinyCore Linux in more detail.

Write the SD card

The ZIP file also contains an .img file which you need to write to an Micro SD card using your favourite image writing tool. On Ubuntu Desktop you can use Startup Disk Creator for example.

After you have written the image to the SD card, put it into your RasPi. You also have to connect a monitor and a keyboard to the RasPi for the setup, as WiFi and SSH need to be configured via the command line.

First startup

The README file gives you instructions how to save your auto-generated ssh keys and how to expand the file system to use the whole size of the SD card at first startup via the command line.

Please note that your keyboard layout isn't configured yet. Keys might not be where you expect them!

Configure WiFi

Turn off the RasPi (just unplug the power source), take the SD card and put it back into your computer.

We need to manually download a couple of TinyCore modules as the package manager that comes with TinyCore can't connect to the internet yet - obviously.

There's a very good tutorial on how to do this here. The tutorial suggests to copy the packages to the SD card before first boot in the RasPi, but as I tried it the partition was too small to hold all modules. Therefore we resize it first, then do this step.

Configure the PiCam

Enable the camera follow these instructions. You might need to look into this tutorial and follow the steps in the section 'Longhand method—using standard Linux commands' to understand how to edit the config.txt mentioned in the instructions.

Streaming options

  • This page gives an overview over the different ways to stream video from the RasPi.

raspivid and netcat (latency-free)

First, on the receiving device, run:

Requires NetCat and mplayer

netcat -l -p 5000 | mplayer -fps 30 -cache 1024 -framedrop -

Then, on the RasPi, run:

Requires RaspiVid and NetCat

$ raspivid -hf -vf -t 0 -w 640 -h 480 -fl -o - | nc 192.168.178.51 500
0

Tutorial

Pros
  • nearly latency-free
  • works with simple standard packages in piCore
Cons
  • Due to the use of netcat, the RasPi is sending the stream to one specific device. So it needs to know the IP of the device that wants to receive the stream. This could be handled via MQTT, but still each recipient would require a distinct stream that consumes ressources on the RasPi (if it is even possible).