RPI-PWR

From Land Boards Wiki
Revision as of 11:44, 10 January 2020 by Blwikiadmin (talk | contribs) (Created page with "== Custom power card for the Raspberry Pi == File:RPI-PWR-Mtd-Diag-pi2-P1010164-640px.jpg == Features == * Purpose is to recess the USB Power cable connection inside th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Custom power card for the Raspberry Pi

RPI-PWR-Mtd-Diag-pi2-P1010164-640px.jpg

Features

  • Purpose is to recess the USB Power cable connection inside the volume of the Pi
  • Pi Power via GPIO 5V pins
  • Fuse protection
    • 1A Polyswitch
  • LED on GPIO25
    • Allows program control of LED for visual effects
  • USB-Micro Power Connector
    • Mounted on the bottom of the card for lower profile
  • 26 pin connector works in any version of the Pi

Layout

RPI-PWR.PNG

Example Code

Single Processor LED blink

import RPi.GPIO as GPIO
import os
import time

def blinkLED(channel):
	GPIO.output(channel,1)
	time.sleep(1)
	GPIO.output(channel,0)
	time.sleep(1)

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.OUT)

while 1:
	blinkLED(25)

Multi-Processing LED blink

  • blinkD25LED.py - Multiprocessing Blink LEDs
  • Run with:
mpirun.openmpi -np 8 -machinefile /home/pi/mpi_testing/machinefile python blinkD25LED.py

Source Code listing

#!/usr/bin/env python

'''blinkD25LED.py

Code to blink D25 LED on the RPI-PWR card.

Run by typing on the main processor -

mpirun.openmpi -np 8 -machinefile /home/pi/mpi_testing/machinefile python blinkD25LED.py

Where -np 8 = Run on 8 processors
machinefile contains a list of the IP addresses of the cards

============
Dependencies
============

Need to: 

* sudo apt-get install python-dev
* sudo apt-get install python-pip python2.7-dev
* sudo apt-get install python-rpi.gpio
* sudo pip install flask

====
Code
====
'''

import RPi.GPIO as GPIO
import os
import time
from mpi4py import MPI

comm = MPI.COMM_WORLD
myRank = comm.rank

#print 'Hi my rank is:', comm.rank

def blinkLED(channel):
	'''Function to blink an LED attached to an output channel.
	Blink time is a function of the processor rank.
	'''
	GPIO.output(channel, 1)
	time.sleep((float(myRank)*0.25) + 0.25)
	GPIO.output(channel, 0)
	time.sleep(0.25)

GPIO.setwarnings(False)	# remove warnings about pre-assigned channels
GPIO.setmode(GPIO.BCM)	# setup GPIO using Board numbering
GPIO.setup(25, GPIO.OUT)# Set pin to output

# Blink the LEDs one at a time forever
# CTRL-C to exit which is not a particularly elegant exit strategy, but this is a demo program

while 1:
	blinkLED(25)

X1 Rework

  • Ground (LED) to ground plane