Wilson Mar bio photo

Wilson Mar

Hello. Hire me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Youtube

Github Stackoverflow Pinterest

A board by any other name is just as sweet


Overview

This is a list of physical hardware categorized by basics and optional.


Specs

Spec Arduino RPi 2 RPi 3
Address space 8-bit 32-bit 64-bit
CPU speed 900 MHz 16 MHz 16 MHz
RAM 32K 512 MB 1 GB
Voltage 5V 3.3V 3.3V

Basics

  1. Raspberry Pi 3 B+ $35

    The Raspberry Pi 3 has a 1.2 GHz quad-core ARMv8 chip with 1 GB of RAM.

  2. Risers on the board so its metal doesn’t touch the table. Or a static-resistent mat to put a naked board.

  3. Heat sink and fan for disspating heat better when seated on top of the CPU chip

    PROTIP: Running above 80 degrees F shortens life of the board. In data centers, for every 50 kW of power fed to an aisle of server, the same facilities typically apply 100-150 kW of cooling.

    PROTIP: Measure board temperature over time. The little alumininum heat sink reduces heat by 2 degrees F. Get a large heatsink and fan from an old desktop computer. The larger the sink the better. 30 degrees cooler with a large copper sink on held in place by a clear plastic layer. The sink sits on top of a 3 mill copper plate on top of the chip. Attach using Artic MX-4 thermal compound.

    45 degrees using a Molex connector used by the fan is powered by a box that may be hard to find now. It’s loud.

    Water cooling

    Pi 3’s thermal governor (see later) does not appear to be active, leading to an inherently unstable, overheating machine.

  4. Micro SD card (8+ GB, up to 32 GB), class 10. Several of them, for backup and as a base to build others.

    PROTIP: Windows 10 IoT does not support class 4 SD cards. An SD card’s “class” rating refers to its sustained write speed. A class 4 card writes at 4MB/s (4 megabytes per second). A class 10 card writes at 10M/s, achievedPhotographers prefer SD cards with a class 10 rating because to them Get a large heatsink from an old desktop computer. at the cost of read speed and increased seek times. fast write speed is more important.

    https://www.youtube.com/watch?v=1AYGnw6MwFM PROTIP: This is the same one used on many smart phones and cameras. So this detailed analysis with benchmarks from a photographer is useful. The ones from Costco are a good buy: SanDisk Ultra MicroSDHC 32GB UHS-I Class 10 Memory Card With Adapter (Upto 80mbps Speed).



    Devices reading the cards must be made to accept larger capacity chips. But can accept smaller capacities. SDHC (Secure Digital High Capacity of 4GB to 32GB).
    SHXC (Secure Digital eXtended Capacity of 64GB to 2TB)

    Cheap SD cards may not last long.

    PROTIP: There is SD card containing pre-installed NOOBS (New Out Of Box Software) promoted as “the easiest to work with”.

    But this tutorial focuses on industrial-grade components for maximum flexibility, power, and security.

  5. 32 GB of disk space on a Mac or Windows machine.

    The size of hard disk drives have similar issues as SD drives.

    Windows operating systems can format drives using NTFS rather than FAT32.

    Natively Mac OSX does not know how to read NTFS drives.

  6. DVD blank disk (R+ or R-) to hold image so as to not use up laptop hard disk space.

    Power hardware

  7. 2.5A micro-USB 5V DC power - two-prong plug in the US market.

    You can re-use those provided with Android smartphones.

    NOTE: Consumption of electrical voltage is measured in Amprage, which draws down voltage.

    Even though US electricity is rated at 120V AC (60 Hz), the rating for the plug says 110V - 240V (50 - 60 Hz) so a mechanical adapter can use used in other countries.

  8. Alternately, the PiPo add-on board draws power from an Ethernet cable, so you don’t need to buy a micro-USB power supply.

    QUESTION: Can it be combined with a fan?

    Not headless

  9. HDMI cable connected to a monitor (input selected to the correct HDMI).

  10. A special cable - $4.95 from Adafruit connects the 3.5 mm male plug to RCA composite plugs on older TVs.

  11. A USB keyboard.

Off signal button

Abruptly unplugging the power source can damage the SD card.

Preferrable is a physical switch that temporarily connects two GPIO pins on the board, which a program recognizes and sends the proper shutdown command to the operating system software.

$5.95 gets you 15 switches to solder.

A power button (SW4), recovery button (SW2), and Uboot button (SW3) is provided by the (now-defunct) organgepi.org.

Compiled C option

  1. Navigate to Adafruit’s C program code and compile the native program on the board.

    
    cd Adafruit-GPIO-Halt
    make
    sudo make install
    
  2. Copy the gpio-halt executable file to folder:

    sudo cp gpio-halt  /usr/local/bin/
    

    That folder is also where ansible and easy_install are stored.

  3. Use a text editor to open the device boot-up configuration file:

    
    sudo nano /etc/rc.local
    
  4. Cursor to just before final “exit 0” line, insert this line:

    /usr/local/bin/gpio-halt 21 &
    

    Change the 21 (port number) to whatever GPIO pin your shutdown button is connected to – see GPIO pins.

Python option

A Python program running in the background is started using this command:


   rpi-shutdown-button.py &
   

To have it execute automatically upon restart, move the script to folder:

/storage/.config/autostart.sh

It has a dependency which requires installation to within /usr/lib/python2.7/dist-packages:

sudo pip install -U RPi.GPIO

GPIO pins on headers

iot rpi pins gpio v01-575x459.png

Physical pins are numbered in pairs, starting from 3.3V and 5V at 1 and 2. Pins marked in red provide (output) power via wires to devices. There are 5V pins in positions 2 and 4. Generally, older sensors and actuators tend to use 5V, whereas newer ones use 3.3V in positions 1 and 17.

DNC means “Do Not Connect”.

CAUTION: Connecting two 5V pins together (at the edge of the board) destroys the board.

On older Pi 2 A models have a shorter 26-pin header. Newer Pi 3 B+ models have 40 pins.

Broadcom, the maker of the chip, defined GPIO (General Purpose Input Output) pin numbers in its library for software code to listen for connections between a physical pin with a ground pin (marked GND in black). Ground pins are always 6, 9, 14, 20, 30, 39.

DotStar is used by Adafruit’s 5V LED light strips

The program listening for shutdown default to two pins next to each other: GPIO 21 (pin 40) with GND pin 39. Alternately, on older boards, the program would listen for GPIO 7 (pin 26) with GND pin 25 because that pin is next to the ground (GND) pin.

The connection can be made with anything conductive (such as a metal paperclip, sissors, or flat screwdriver). There are wires and switches made to connect.

https://learn.adafruit.com/adafruit-dotstar-leds/overview

Physical Button

But a physical button is more user-friendly and safer.

PROTIP: Salvage from old PC tower cases their physical button, wires, and pin plugs: iot pc switch salvage-650x324-196kb

QUESTION: Put a 1K resistor to positive?

PROTIP: If you are using a wire to connect the switch, set the program to listen on GPIO 17 (pin 11) because that pin is soley a GPIO pin and does not double up as something else. This may be more reliable.

Enclosure

Case (enclosure) that accomodates heat dissipation contraptions.

Embed a Raspberry Pi inside a Tweeting Babbage Bear

A) You can make a free case by cutting and folding the Punnet pdf printed on paper or thin plastic.

This uses a 3D printer to create an enclosure that has a fan. His blueprints contains parametric variables for changing wall thickness, height, etc. and everything automatically adjusts accordingly.

iot raspberry-pi-3-overclock-case-400x337

B) The top of this clear case holds a resistive touch overlay to a $35 Adafruit PiTFT 2.8” display with 320x240 16-bit color pixels.

It also has 4 buttons the app can recognize, for use by a music playing app.

The $19 case or $20 case can hold the $44.95 480x320 3.5” TFT+Touchscreen.

QUESTION: Is there enough air flow through the case to dissipate heat, yet keep dust from forming on the board?

C) Case with external fan
This article comparing the running temp of 12 cases identified the best cooling from $8.99 JBTek Transparent Acrylic Raspberry Pi B+ / Raspberry Pi 2 Case with External Fan. One user of this rig said he was able to overclock the CPU to 1.35Ghz running Raspbian Jessie processor temp. at 48.7 degrees Celcius (119.66 Fahrenheit).

iot jbtek cool case 371x209

This is cheaper than the $14.95 Case with fan. The Eleduino Acrylic also has a 25mm fan.

PROTIP: Most fans carry 12v. Make sure your fan can run plugged into the 5V, albeit slower and quieter. This is actually be a good thing to run nearly silent.

D) The $25 Smarti Pi Touch is a Pi case that holds a 5” display.

https://www.youtube.com/watch?v=yOHws0qBBmI

$19.99 cover does not accomododate a fan for the $68 for a 7-inch Touch-screen for Pi powered by the GPIO or USB.

<a target=_blank” href=”https://www.amazon.com/800x480-Resolution-iUniker-Raspberry-Display/dp/B01LX526QA/ref=wilsonslifenotes/”> $49.99 3.5 inch 800x480 TFT Display with case</a> for 60+ fps video at 900:1 contrast ratio vieweable at 160 degrees. Uses 3V. See this.

On-board Camera

The CSI (Camera Serial Interface) Type-2 connector (next to the HDMI) received video one-way to the Broadcom BCM2835 processor on the Pi. via a ZIF 15 ribbon cable.

iot-csi-zif-cable-411x180

The CSI interface was developed by the MIPI Alliance and is common to almost all Android mobile phones. MIPI CSI-2 version 1.01 supports up to four data lanes, where each lane has a maximum of 1 Gbps bandwidth, to provide a total bandwidth of 4 Gbps.

A $25 NoIR Camera V2 is IR sensitive for low-light situations. Its 8MP Sony image sensor takes 3280 x 2464 pixel images and captures video at 1080p30, 720p60 and 640x480p90 resolutions.

Powered USB 2.0 hub.

USB provides power as well as provide a conduit for communicating data, but for USB devices drawing more than 100 mA, voltage drops.

USB 1.1 standards offers a theoretical maximum signaling rate of
12 MB/s over 4 wires using up to 500mA.
USB 2.0 standards offers a theoretical maximum signaling rate of
480 MB/s over 4 wires using up to 500mA.
USB 3.0 has two asychronous unidirectional data paths for max. rate of
5 GB/s over 9 wires using up to 900mA. It’s 10x faster due to its blue color. (OK I’m kidding)
USB 3.1 “SUPERSPEED” was released in 2014.

  1. USB hard drive provides extra storage. convenient to easily add photos, videos, or other media the Pi displays.

    The Passport drive has 250 GB.

    Western Digital’s “WD PiDrive” is available in kit form that includes cables and an enclosure. The 314 Gbyte drive retails at $45.81. They also have a 1 Terabyte version. The WD PiDrive kit includes a 4-headed “hydra cable” for connecting the Raspberry Pi’s two USB ports (one for power and the other provides access to the drive).

    It supports the http://www.berryterminal.com/doku.php/berryboot loader.

    $24.99 USB 2.0 to SATA Converter Stackable Expansion Board from Ableconn (Taiwan) connects SATA drives to the Pi. The drive requires a 300 Watt ATX power supply for the drive from an old PC tower case:

  2. USB to UART serial cable. It’s an alternative to using Ethernet and plugging a monitor and keyboard into the Pi. The USB plugs into laptop or computer. The other end plugs into the UART posts on the Pi: red = 5V, black = Ground, white = TX, green = RX.

    This powers the board as well, so the Pi doesn’t need to be plugged into the wall?

    $6 from https://shop.pimoroni.com/products/usb-to-uart-serial-console-cable and https://learn.pimoroni.com/tutorial/hacks/add-a-serial-breakout-to-your-pi

    Get the drivers for each specific version of Mac or Windows.

  3. Boards for ZigBee communication

Power controls

Untethered Power

  1. A $1.80 board to keep incoming Voltage below 3V.

  2. You’ll need batteries even if want to use solar power.

    http://www.instructables.com/id/Raspberry-Pi-powered-by-battery/

  3. A regulator is needed to not over-charge the batteries.

  4. A solar panel needs to be large enough to generate what the unit needs and also cover lower power during overcast days.

  5. Low-power mode on the device.

    Control AC power

  6. Control AC power plug $19.70 IoT Relay controls a power outlet which listens for signals from a Pi.

Resources on Python

  • Automate the Boring Stuff with Python book is provided free on-line.

  • http://inventwithpython.com/ provides on-line books about Python free.

  • http://legacy.python.org/dev/peps/pep-0008/ Style Guide for Python Code

More on IoT

This is one of a series on IoT:

  1. IoT Acronymns and Abbreviations

  2. IoT Apprentice school curriculum
  3. IoT use cases
  4. IoT reminders prevent dead mobile battery
  5. IoT ceiling dumper

  6. IoT text to speech synthesis
  7. IoT AWS button
  8. Intel IoT
  9. IoT Raspberry hardware
  10. IoT Raspberry installation

  11. IoT Clouds
  12. Samsung IoT Cloud

  13. Predix basics
  14. Predix installation
  15. Predix services
  16. Predix programming