Skip to content

Commit

Permalink
Merge pull request #1 from davecrump/master
Browse files Browse the repository at this point in the history
Initial BATC Load
  • Loading branch information
davecrump authored Dec 20, 2016
2 parents 91545ad + 2cd0994 commit 2c0c405
Show file tree
Hide file tree
Showing 57 changed files with 3,364 additions and 775 deletions.
95 changes: 28 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,42 @@
![rpidatv banner](/doc/img/spectreiq.jpg)
# rpidatv
**rpidatv** is a digital television transmitter for Raspberry Pi (B,B+,PI2,PI3,Pizero) which output directly to GPIO.
**rpidatv** is a digital television transmitter for Raspberry Pi (B,B+,PI2,PI3,Pizero) which outputs directly to GPIO. This version has been developed for use with an external synthesized oscillator and modulator/filter board.
*(Created by Evariste Courjaud F5OEO. Code is GPL)*

# Installation
Install a Raspbian Lite : ([Raspbian Lite](http://www.raspberrypi.org/downloads/raspbian/))
# Installation for BATC Version

```sh
$ wget https://raw.githubusercontent.com/F5OEO/rpidatv/master/install.sh
$ chmod +x install.sh
$ ./install.sh
```
The preferred installation method only needs a Windows PC connected to the same (internet-connected) network as your Raspberry Pi.

# Hardware
Plug a wire on GPIO 12, means Pin 32 of the GPIO header : this act as the antenna. Length depend on transmit frequency, but with few centimeters it works for local testing.
- First download the November 2016 release of Raspbian Jessie Lite on to your Windows PC from here http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2016-11-29/.

# Modulator
**rpidatv** is located in rpidatv/bin folder
```
rpidatv -2.0.0
Usage:
rpidatv -i File Input -s Symbolrate -c Fec [-o OutputMode] [-f frequency output] [-l] [-p Power] [-h]
-i path to Transport File Input
-s SymbolRate in KS (125-4000)
-c Fec : 1/2 or 3/4 or 5/6 or 7/8
-m OutputMode
{RF(Modulate QSK in RF need -f option to set frequency)}
{IQ(Output QPSK I/Q}
{PARALLEL(Output parallel (DTX1,MINIMOD..)}
{IQWITHCLK(Output I/Q with CLK (F5LGJ)}
{DIGITHIN (Output I/Q for Digithin)}
-f Frequency to output in RF Mode in MHZ
-l loop file input
-p Power on output 1..7
-x GPIO Pin output for I or RF {12,18,40}
-y GPIO Pin output for Q {13,19,41,45}
-h help (print this help).
Example : sudo ./rpidatv -i sample.ts -s 250 -c 1/2 -o RF -f 437.5 -l
```
# Transport stream
**rpidatv** needs a DVB transport stream in input. In the past, ffmpeg was used to generate transport stream. Because ffmpeg is not completely DVB compliant and induces latency, an other tool is proposed : **avc2ts**
- Unzip the image and then transfer it to a Micro-SD Card using Win32diskimager https://sourceforge.net/projects/win32diskimager/

# H264 encoder and transport stream encapsulator
**avc2ts** is located in rpidatv/bin folder
```
avc2ts -1.0.0
Usage:
rpi-avc2ts -o OutputFile -b BitrateVideo -m BitrateMux -x VideoWidth -y VideoHeight -f Framerate -n MulticastGroup [-d PTS/PCR][-v][-h]
-o path to Transport File Output
-b VideoBitrate in bit/s
-m Multiplex Bitrate (should be around 1.4 VideoBitrate)
-x VideoWidth (should be 16 pixel aligned)
-y VideoHeight (should be 16 pixel aligned)
-f Framerate (25 for example)
-n Multicast group (optionnal) example 230.0.0.1:10000
-d Delay PTS/PCR in ms
-v Enable Motion vectors
-i IDR Period
-t TypeInput {0=Picamera,1=InternalPatern,2=USB Camera,3=Rpi Display,4=VNC}
-e Extra Arg:
- For usb camera name of device (/dev/video0)
- For VNC : IP address of VNC Server. Password must be datv
-p Set the PidStart: Set PMT=PIDStart,Pidvideo=PidStart+1,PidAudio=PidStart+2
-s Set Servicename : Typically CALL
-h help (print this help).
Example : ./rpi-avc2ts -o result.ts -b 1000000 -m 1400000 -x 640 -y 480 -f 25 -n 230.0.0.1:1000
```
- Before you remove the card from your Windows PC, look at the card with windows explorer and go to the \boot directory. Create a new empty file called ssh in the \boot directory by right-clicking, selecting New, Text Document, and then change the name to ssh (not ssh.txt). You should get a window warning about changing the filename extension. Click OK. If you do not get this warning, you have created a file called ssh.txt and you need to rename it ssh.

- If you have a Pi Camera and/or touchscreen display, you can connect them now. Power up the Pi with the new card inserted, and a network connection. No keyboard or HDMI display are required.

- Find the IP address of your Raspberry Pi using an IP Scanner (such as Advanced IP Scanner http://filehippo.com/download_advanced_ip_scanner/ for Windows, or Fing on an iPhone) to get the Pi's IP address

- From your windows PC use Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) to log in to the IP address that you noted earlier.

- Log in (user: pi/password: raspberry) then cut and paste the following code in, one line at a time:

# Console interface
A console interface is provided under rpidatv/scripts
```sh
$ /home/pi/rpidatv/scripts/gbmenu.sh
wget https://raw.githubusercontent.com/davecrump/rpidatv/master/install.sh
chmod +x install.sh
./install.sh
```
# Touchscreen interface
![Rpidatvgui](/doc/img/rpidatvgui.jpg)
A graphical interface is provided under rpidatv/bin/ folder
- For French menus and keyboard, replace the last line above with
```sh
$ /home/pi/rpidatv/bin/rpidatvgui
./install.sh fr
```

- When it has finished, accept the reboot offered or type "sudo reboot now", log in again and the console menu should be displayed. If not, you can start the software by typing:

```sh
/home/pi/rpidatv/scripts/menu.sh menu
```

You can now explore the menu options and play.

I succeeded in generating a direct RF output (from GPIO pin 32) on 437 MHz at 333KS using the on-board camera as the source; it would not work reliably at higher SRs. The big win for me is that I could feed the I and Q signals from pins 32 and 33 directly into the LC filter on my old DigiLite modulator and generate a 2MS QPSK H264 DVB-S signal from the on-board camera. Some adjustment of the bias is required as the I and Q signals from the Pi are 3.3v, not 5v as provided by the DigiLite encoder.
Binary file added bin/adf4351
Binary file not shown.
Binary file added bin/leandvb
Binary file not shown.
Binary file added bin/rpidatvgui
Binary file not shown.
Binary file added bin/tcanim
Binary file not shown.
116 changes: 66 additions & 50 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,86 +1,91 @@
#!/bin/bash

set -e
# Updated by davecrump on 20161208

set -e # Don't report errors....

# Update the package manager, then install the packages we need
sudo dpkg --configure -a
sudo apt-get clean
sudo apt-get update
sudo apt-get -y install apt-transport-https git rpi-update
sudo apt-get -y install cmake libusb-1.0-0-dev g++ libx11-dev buffer libjpeg-dev indent libfreetype6-dev ttf-dejavu-core bc usbmount fftw3-dev wiringpi libvncserver-dev

#rpi-update to get latest firmware
# rpi-update to get latest firmware
sudo rpi-update

# ---------- install rpidatv -----------

# Get the source software and copy to the Pi
cd /home/pi
#git clone git://github.com/F5OEO/rpidatv -> BUG IN QEMU : Go to download method
wget https://github.com/F5OEO/rpidatv/archive/master.zip
wget https://github.com/davecrump/rpidatv/archive/master.zip
unzip -o master.zip
mv rpidatv-master rpidatv
rm master.zip

#rpidatv core
# Compile rpidatv core
cd rpidatv/src
make
sudo make install
#rpidatv gui

# Compile rpidatv gui
cd gui
make
sudo make install
cd ../
#avc2ts
cd avc2ts

#git clone git://github.com/kierank/libmpegts
# Get libmpegts and compile
cd avc2ts
wget https://github.com/kierank/libmpegts/archive/master.zip
unzip master.zip
mv libmpegts-master libmpegts
rm master.zip

cd libmpegts
./configure
make
#make avc2ts

# Compile avc2ts
cd ../
make
sudo make install

# Compile adf4351
cd /home/pi/rpidatv/src/adf4351
make
cp adf4351 ../../bin/


#install rtl_sdr
# Get rtl_sdr
cd /home/pi
#git clone https://github.com/keenerd/rtl-sdr
wget https://github.com/keenerd/rtl-sdr/archive/master.zip
unzip master.zip
mv rtl-sdr-master rtl-sdr
rm master.zip

# Compile and install rtl-sdr
cd rtl-sdr/ && mkdir build && cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make && sudo make install && sudo ldconfig
sudo bash -c 'echo -e "\n# for RTL-SDR:\nblacklist dvb_usb_rtl28xxu\n" >> /etc/modprobe.d/blacklist.conf'
cd ../../

#install leandvb
# Get leandvb
cd /home/pi/rpidatv/src
#git clone git://github.com/pabr/leansdr
wget https://github.com/pabr/leansdr/archive/master.zip
unzip master.zip
mv leansdr-master leansdr
rm master.zip

# Compile leandvb
cd leansdr/src/apps
make
cp leandvb ../../../../bin/


#install tstools
# Get tstools
cd /home/pi/rpidatv/src
wget https://github.com/F5OEO/tstools/archive/master.zip
unzip master.zip
mv tstools-master tstools
rm master.zip

# Compile tstools
cd tstools
make
cp bin/ts2es ../../bin/
Expand All @@ -94,15 +99,15 @@ cd /home/pi/rpidatv/src/hello_video
make
cp hello_video.bin ../../bin/


# TouchScreen GUI
# FBCP : Duplicate Framebuffer 0 -> 1
cd /home/pi/
wget https://github.com/tasanakorn/rpi-fbcp/archive/master.zip
unzip master.zip
mv rpi-fbcp-master rpi-fbcp
rm master.zip
#git clone https://github.com/tasanakorn/rpi-fbcp

# Compile fbcp
cd rpi-fbcp/
mkdir build
cd build/
Expand All @@ -111,46 +116,57 @@ make
sudo install fbcp /usr/local/bin/fbcp
cd ../../

#Install Waveshare DTOVERLAY
# Install Waveshare DTOVERLAY
cd /home/pi/rpidatv/scripts/
sudo cp ./waveshare35a.dtbo /boot/overlays/


#Fallback IP to 192.168.1.60
# Fallback IP to 192.168.1.60
sudo bash -c 'echo -e "\nprofile static_eth0\nstatic ip_address=192.168.1.60/24\nstatic routers=192.168.1.1\nstatic domain_name_servers=192.168.1.1\ninterface eth0\nfallback static_eth0" >> /etc/dhcpcd.conf'

#enable camera
# Enable camera
sudo bash -c 'echo -e "\n##Enable Pi Camera" >> /boot/config.txt'
sudo bash -c 'echo -e "\ngpu_mem=128\nstart_x=1\n" >> /boot/config.txt'

#disable sync option for usbmount
# Disable sync option for usbmount
sudo sed -i 's/sync,//g' /etc/usbmount/usbmount.conf

# Install executable for hardware shutdown button
wget 'https://github.com/philcrump/pi-sdn/releases/download/v1.0/pi-sdn' -O /home/pi/pi-sdn
chmod +x /home/pi/pi-sdn

if [ "$1" == "Autostart" ];
then
echo "Doing autostart..."
##Menu autostart
# Create directory for Autologin link
sudo mkdir -p /etc/systemd/system/getty.target.wants

# Show console menu at first user log-in
cp /home/pi/rpidatv/scripts/configs/console.bashrc" /home/pi/.bashrc
# Record Version Number
cd /home/pi/rpidatv/scripts/
##make kayboard in french
sudo cp keyfr /etc/default/keyboard
##do Menu as auto install
bash install_autostart.sh

#change hostname
CURRENT_HOSTNAME=`sudo cat /etc/hostname | sudo tr -d " \t\n\r"`
NEW_HOSTNAME="rpidatv"
if [ $? -eq 0 ]; then
sudo sh -c "echo '$NEW_HOSTNAME' > /etc/hostname"
sudo sed -i "s/127.0.1.1.*$CURRENT_HOSTNAME/127.0.1.1\t$NEW_HOSTNAME/g" /etc/hosts
fi
#change password to tv
echo "pi:tv" | sudo chpasswd
cp latest_version.txt installed_version.txt
cd /home/pi
# Switch to French if required
if [ "$1" == "fr" ];
then
echo "Installing French Language and Keyboard"
cd /home/pi/rpidatv/scripts/
sudo cp configs/keyfr /etc/default/keyboard
cp configs/rpidatvconfig.fr rpidatvconfig.txt
cd /home/pi
echo "Completed French Install"
else
echo "completed without autostart"
echo "Completed English Install"
fi
# Offer reboot
printf "A reboot will be required before using the software."
printf "Do you want to reboot now? (y/n)\n"
read -n 1
printf "\n"
if [[ "$REPLY" = "y" || "$REPLY" = "Y" ]]; then
echo "rebooting"
sudo reboot now
fi
#always enable HDMI at 720p
#sudo bash -c 'echo -e "\nhdmi_force_hotplug=1\nhdmi_drive=2\nhdmi_group=1\nhdmi_mode=4\n" >> /boot/config.txt'
exit
#remove script that starts raspi config on first boot
#sudo rm -rf /etc/profile.d/raspi-config.sh
Loading

0 comments on commit 2c0c405

Please sign in to comment.