
Raspberry Pi
Overview

Ok you heard about a $35 computer. Well depends on how many spare parts you have lying around. So technically, its $35 and some parts.
- Notes:
- Identify how you are going to use it. You may need a 32 GB Class 10 SDHC. The SD card is your hard drive (HDD), unless you mount an external via USB.
- You will have to understand another operating system (OS). This is not Windows or Ubuntu. You will have to use command line interface.
- You may have to install the OS more than once. Persistance wins. This is a do it yourself project.
Parts for Raspberry Pi 2 Model B

- The raspberry pi. I bought the Raspberry Pi Model B Programmers Kit from Micro Center, If they were in stock I would have bought the Raspberry Pi Model B Starter Kit. Both are above the $35 but you will need a power supply and a SDHC card.
- SD card. Don't buy any 8GB, use this list. You will want a Class 10 and I recommend 16GB.
- Power supply
- USB wired keyboard. You can go wireless, results may vary.
- USB wired mouse. You can go wireless, results may vary.
- Display / monitor.
- Cable to connect your display to the HDMI input on the pi.
- Speakers, if you need sound.
- Cable to connect your speakers to the 3.5mm input on the pi.
- Network cable.
- If you do not have all of these parts lying around, then you may want to consider Raspberry Pi HDMI Cable Accessory Kit
- USB Powered Hub, depending on what you are going to plug into it. You may want to use this list.
Install OS

- Do not plug it in, not yet. You do not have an OS and you should never power up any device until you ensure it is not on a network until you have changed the default passwords.
- If you did not buy SDHC card with the OS preinstalled, then you have to choose an OS.
- Raspian - recommend this for newbies unless you are setting up a media server. It has a larger user community, which means you are more likely to find answers to your questions on the internet.
- OSMC - media server. I have not tried this OS yet. I have been known to use Kodi on Raspian instead.
- Windows 10 IOT core - requires a computer runnning Windows 10. Unsure I would use this solution if I were creating IOT devices.
- Ubuntu Mate - run Ubuntu on your pi. If you are familiar with Ubuntu, this may be the best choice for you.
- Download Noobs.
- Follow the instructions in the INSTRUCTIONS-README.txt file.
Datadog
Your mileage may vary. This is how I did it.
- URLs that helped me
- Deploying the Agent on RaspberryPI
- Installing From Source
- DD_API_KEY=1ecaf73d942bc2a04c20cefxxxxxxxx sh -c "$(curl -L https://raw.githubusercontent.com/DataDog/dd-agent/master/packaging/datadog- agent/source/setup_agent.sh)"
DDNS
Your mileage may vary. This is how I did it. This is a no pay solution.
- You need Apache and PHP
- You need SSH
- You need a mail server. You can use the SMTP solution below.
- You need your WAN IP. I use http://ipecho.net/plain
- cd /var/www/, assuming that is where your DocumentRoot is located
- touch wan.txt, this is a placeholder to keep track of the wan ip. I use it for something else besides this.
- echo "0.0.0.0" > wan.txt, this will allow us to test the email gets sent once we run the script
- You need to copy the script
- rename wan.phps to wan.php
- edit wan.php
- Update the timezone, if you do not live in the east coast US.
- Update the $headers value. This is the sender.
- Update the $recipient value. This may be your gmail account.
If so, Let less secure apps use your account must be set. - Remove the comment in front of the mail statement towards the bottom
- Copy wan.php to your DocumentRoot
- php wan.php
- sudo crontab -e
- Assuming you want to check every 5 minutes and DocumentRoot is /var/www/. Add "* /5 * * * php /var/www/wan.php" without the quotes
- The script could be improved. This is a down and dirty.
Power Requirements
Product | Recommended PSU current capacity |
Maximum total USB peripheral current draw |
Typical bare-board active current consumption |
---|---|---|---|
Raspberry Pi Model A | 700mA | 500mA | 200mA |
Raspberry Pi Model B | 1.2A | 500mA | 500mA |
Raspberry Pi Model A+ | 700mA | 500mA | 180mA |
Raspberry Pi Model B+ | 1.8A | 600mA/1.2A (switchable) | 330mA |
Raspberry Pi 2 Model B | 1.8A | 600mA/1.2A (switchable) | 350mA |
Raspberry Pi 3 Model B | 2.5A | 1.2A | 400mA |
Raspberry Pi Zero W | 1.2A | Limited by PSU, board, and connector ratings only. | 150mA |
Raspberry Pi Zero | 1.2A | Limited by PSU, board, and connector ratings only | 100mA |
Remote Desktop Connection
SMTP
Your mileage may vary. This is how I did it.
- sudo apt-get update
- sudo apt-get install ssmtp
- sudo apt-get install mailutils
- sudo vi /etc/ssmtp/ssmtp.conf
root=postmaster mailhub=smtp.gmail.com:587 hostname=rasppi2 AuthUser=YourGmailUserName@gmail.com AuthPass=YourGmailPassword FromLineOverride=YES UseSTARTTLS=YES
- URLs that helped
- ssmtp to send emails
SNMP
Your mileage may vary. This is how I did it. If you follow the attached links, you will see they did it slightly different.
- sudo apt-get update
- sudo apt-get install snmpd
- sudo apt-get install snmp
- sudo apt-get install snmp-mibs-downloader
- sudo download-mibs
- sudo vi /etc/snmp/snmpd.conf
- agentAddress udp:161
ipv4 only, dont turn on ipv6 instance unless you have installed ipv6 already - rocommunity public localhost
gives localhost read access using a password of \"public\" w/o quotes - rocommunity something 10.0.0.0/8
gives anyone on 10 network read access using a password of \"something\" w/o quotes
- agentAddress udp:161
- sudo vi /etc/snmp/snmp.conf
- #mibs
add # symbol to mibs line as file states
- #mibs
- sudo service snmpd restart
- ps -A | grep snmp
- should yield pid and snmpd
if not, view /var/log/syslog for errors
- should yield pid and snmpd
- snmpwalk -v1 -c public localhost sysName.0
- assumes the password is public
- assumes you are on localhost
- returns your hostname, e.g. rasppi2
- URLs that helped me
- SNMP and the Raspberry Pi
- Why is SNMP broken?
- Timeseries plots
- SNMP and MIBs
- Adding SNMP support for CPU temperature monitoring
Safe mode / Recovery mode
Technically, there is was no safe mode for Raspbian. However, use these steps and you may recover your OS without wiping your existing one.
- Identify what is broken. It may be there right on the screen during the boot sequence. You may have to search on the www for an answer. If you cannot identify what needs fixed, then you really don't need to go into safe mode to fix it.
- During bootup, you should see a screen which states, \"Hold down shift to run recovery mode\". Do it.
- Press the edit config (e) icon. A popup occurs.
- Choose cmdline.txt in the Config editor.
- Example: dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p5 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
- Add "init=/bin/bash" without the quotes to the end of the line.
- Example: dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p5 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait init=/bin/bash
- Press OK
- Press Exit
- After boot sequence, you may need to press enter to get a command prompt. I did.
- bash
- mount -o remount,rw /dev/mmcblk0p5
- Go fix whatever is broke. In my case it was /etc/fstab.
- Reboot.
- Go back into Recovery mode like you did above.
- Remove "init=/bin/bash" from cmdline.txt.
- After boot sequence, if you fixed it, you will get in. Otherwise, you may need to repeat some of the previous steps.
VNC
Useful links
- Raspberry Pi home page
- Video
- Raspberry Pi: Amazon Prime, Netflix, etc. and a DRM solution
- Multicast TV Using Raspberry Pi 3 & WinTV-HVR-955Q
- TVHeadend on the Raspberry Pi
- XBMC Media Center
- The Unofficial Tutorial
- Add WiFi to the Raspberry Pi
- Kodi on Raspberry Pi 2
- Mame console
- NasBerryPi
- Installing LAMP with FastCGI, PHP-FPM and APC
- Graphing the Pi's CPU and GPU temperature
- CLI cpu temp - /bin/cat /sys/class/thermal/thermal_zone0/temp
- CLI gpu temp - /opt/vc/bin/vcgencmd measure_temp