Pi-oT Quickstart Guide

 

Analog to Digital Converter

Version 1 of the Pi-oT Module features an MCP3208/3008 Analog to Digital Converter (ADC) on the SPI0 channel. Documentation for the chip can be found here. 

A simple python script shown below can be used to interface with the ADC chip to print values read by the 8 inputs. 

 

import mcp3008
with mcp3008.MCP3008() as adc:
    print adc.read([mcp3008.CH0]) #prints raw data [CH0]

 

More information about the mcp3208 python library can be found here, and information on the mcp3008 library can be found here.

NOTE: The analog input range for the module is 0-3.3V. Do not apply more than 3.3v to any analog input or damage may occur.

 

On-Board Relays

The Commercial modules use Songle SRD model relays, and the Industrial modules use Panasonic JS1 model relays. The respective data sheets can be found here and here.

The control of the 5 on-board relays is accomplished simply by the use of GPIO pins 5,6,13,19, and 26. A sample python script below can be used to cycle through the relays.

import RPi.GPIO as GPIO
from time import sleep
GPIO.setwarnings(False)
 
GPIO.setmode(GPIO.BCM)
GPIO.setup(26, GPIO.OUT)
GPIO.setup(19, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(6, GPIO.OUT)
GPIO.setup(5, GPIO.OUT)
 
while True:
    GPIO.output(26, True)
    sleep(1)
    GPIO.output(26, False)
    sleep(1)
    
    GPIO.output(19, True)
    sleep(1)
    GPIO.output(19, False)
    sleep(1)
    
    GPIO.output(13, True)
    sleep(1)
    GPIO.output(13, False)
    sleep(1)
    
    GPIO.output(6, True)
    sleep(1)
    GPIO.output(6, False)
    sleep(1)
 
    GPIO.output(5, True)
    sleep(1)
    GPIO.output(5, False)
    sleep(4)


Selectable jumpers provided on the board allow the use of other GPIO pins. To change the relay control pins, simply remove the jumper and connect the male relay control pin to the desired GPIO pin.