Simple examples

Here are some examples what you can connect to steelsquid-kiss-os GPIO.
I now use Rev B+ for newer examples.

I use the command line in this examples, this is mostly for test purpuse, all logic should be made in the Steelsquid daemon (e.g. kiss_expand.py)






Connect Power on / Reset Button

Here I describe very briefly how you can connect a start / reset button to your Raspberry Pi.
If the Raspberry Pi is of it will power on and if it already is on witt will reset the power (restart).
It is not a clean shutdown of the system...
  • First solder pins on the P6 header pin 1 and 2.


  • If it is a Rev B+ solder pins to the RUN headers instead.


  • And then connect a button.



Connect shutdown Button (clean shutdown)

Here I describe how to connect a shutdown button to the raspberry Pi. 
It will shutdown the Raspberry Pi cleanly.
  • Connect the button to pin 14 och 16 (GND and GPIO23)
  • Boot the Raspberry and login
  • Enable the power of functionality:
    steelsquid power-gpio 23
  • Restart service
    steelsquid restart
Press the shutdown button, will shutdown cleanly...



Combined Power on and Shutdown button

Here I describe a simple circuit that makes it possible to Power on and Shutdown on the same button.
Steelsquid-kiss-os will shut down cleanly, not only power off.

What I have done is a circuit that sends a signal to RUN/P6 Header when the Raspberry is off. 
But if it is running (booted up), the signal will goto a gpio that trigger a shutdown.
  • What you need.
    1k, 10k Ohm resistors, two BC337 transistors, wires, button, PINs and a experiment board.


  • Solder PINs to Raspberry Pi P6 (RevB) or RUN (RevB+) Header


  • Create the circuit board


    PIN Description
    1 Signal from Raspberry that it is ON
    2 Send shutdown signal to Raspberry
    3 Connect to the button
    4 Connect to the button
    5 Ground
    6 Signal to the Raspberry Power on/Reset 

  • Connect to the Raspberry Pi.
    Circuit board PIN Raspberry
    PIN (GPIO)
    Raspberry
    Header
    1 18 (GPIO24) GPIO
    2 16 (GPIO23) GPIO
    3 Button  
    4 Button  
    5 Ground RUN/P6
    Reset RUN/P6


  • Test it
    If you press the button when the raspberry is off it will start to boot.
    If you press the button while booting it will reset.
    If you press the button when booted it will trigger a clean shutdown.


Test input (Connect button)

Read the state of a GPIO (connected button=.
  • Connect the button to P1 header pin 1 and 7 (3.3V and GPIO 04).


  • Do not puth the button
  • Execute: pi gpio_get 4
    You should get: False

  • Press the button and hold pressed
  • Execute: pi gpio_get 4
    Response: True
The python scripts
https://github.com/steelsquid/steelsquid-kiss-os/blob/master/steelsquid_pi.py


Test Output (Connect LED)

A simple example how to connect a LED to the Raspberry Pi.
  • Connect the LED to P1 header pin 7 and 9 (GPIO 04 and ground)

    Connect the flat side/short pin of the LED to pin 9 (ground).
    You also must connect a resister (about 270 Ohm).

  • Light LED
    Execute: pi gpio_set 4 true

  • Turn off LED
    Execute: pi gpio_set 4 false
see https://github.com/steelsquid/steelsquid-kiss-os/blob/master/steelsquid_pi.py


Connect HDD44780 LCD

Print text on a HDD44780 compatible LCD connected to a Raspberry Pi.
This will connect the LCD directly to the GPIO pins, will use 7 pins.
You can use nearly any character LCD, it will work with 16x1, 16x2, 20x2, 20x4. 
But it will not work with 40x4 LCDs.

  • Solder pins to LCD


  • Wire the lcd.
    You will need 10k Ohms potentiometer, 1k Ohms resistor,  BC337 transistor, wires and a experiment board.


     LCD PIN
    Raspberry
    PIN (GPIO)
     1 22 (GPIO 25)
     2 18 (GPIO 24)
     3 16 (GPIO 23)
     4 11 (GPIO 17)
     5 13 (GPIO 27)
     6 15 (GPIO 22)
     7 6 (Ground)
     8 2 (5V)
     9 8 (GPIO 14)
    Optional: You can also connect LCD pin 9 to P5 header pin 5 (GPIO 30) of you do not want to use P1 header pin 8 (GPIO 14, UARTO_TXD).
    This only work on Rev 2 on steelsquid-kiss-pi and you need to solder a pin to the P5 header.

  • Write text to the LCD
    pi hdd44780 false "My name is\\Andreas"

Connect HDD44780 LCD via I2C

Print text on a HDD44780 compatible LCD connected to a Raspberry Pi.
Here I show how you can connect a HDD44780 compatible LCD that has I2C interface.
Then you just need to use two GPIO.
  • The LCD

  • Connect cables to the LCD


  • Connect the LCD to the Raspberry PI

    LCD PIN
    Raspberry
    PIN (GPIO)
     GND 6 (Ground)
     VCC 2 (5V)
     SDA 3 (GPIO 02)
     SCL 5 (GPIO 03)

  • Test it

    Execute:
    pi hdd44780 true "My name is\\Andreas"

Connect Nokia5110 LCD via SPI

Print text on a Nokia5110 LCD connected to a Raspberry Pi via SPI.
  • Connect the LCD like this

    LCD PIN
    Raspberry
    PIN (GPIO)
     RST 26 (GPIO 07)
     CE 24 (GPIO 08)
     DC 21 (GPIO 09)
     Din 19 (GPIO 10)
     Clk 23 (GOIO 11)
     VCC 1 (3v3)
     BL 1 (3v3)
     GND 6 (GND)

  • Write text: pi nokia5110 "My name is\\Andreas"


Connect ssd1306 OLED via I2C

Simple example how to connect a ssd1306 oled via I2C.
http://www.dx.com/p/0-96-oled-high-clear-module-board-for-arduino-red-335850#.Vgwx33XHlhE
  • Connect the OLED like this

    LCD PIN
    Raspberry
    PIN (GPIO)
     GND 6 (Ground)
     VCC 2 (5V)
     SDA 3 (GPIO 02)
     SCL 5 (GPIO 03)

  • Test it
    pi ssd1306 "hej hopp"



Connect HC-SR04 (Measure distance)

Here I describe how to connect a rangefinder for Raspberry Pi.
The rangefinder is a HC-SR04.
  • The HC-SR04

  • Connect HC-SR04 to Raspgerry
    You need four wires (5v, Trig, Echo (1k,2k), Ground).

     HC-SR04 
    PIN
    Raspberry
    PIN (GPIO)
     Vcc 2 (5V)
     Trig 11 (GPIO 17)
     Echo 13 (GPIO 27)
    through a voltage devider
     Gnd
     9 (Ground)


  • Test it
    Execute this: pi hcsr04 17 27
    Will print out the distance in cm or -1 (Out of range)


PIR Motion Sensor (Detect human movement)

Description how to connect a PIR motion sensor.
There are different types but most works equally.
  • Connect the PIR
    PIR PIN
    Raspberry
    PIN (GPIO)
     GND 6 (Ground)
     VCC 2 (5V)
     OUT 7 (GPIO 04)
    The pin description may be under the white lens.


  • Calibrate
    There may be knobs for sensitivity and delay.

  • Test it
    pi gpio_event 4
    On detection you should see this:
    2015-10-02 19:26:08 PIN: 4=False
    2015-10-02 19:26:12 PIN: 4=True
    2015-10-02 19:26:14 PIN: 4=False
    2015-10-02 19:26:17 PIN: 4=True



3v3 <-> 5v level converter
Here is a simple example how to connect a Adafruit 8-channel Bi-directional Logic Level Converter (TXB0108).
 TXB0108 
PIN
Raspberry
PIN (GPIO)
 VCCB 4 (+5V)
 GND 6 (GND)
 VCCA 1 (+3V3)
 A6
 11 (GPIO 17)
 B6 5V GPIO

In this example i have connected Raspberry GPIO 17 to A6 on the TXB0108.
Execute: pi gpio_set 17 true
And you should have 5V on the B6 pin


Connect ADC (Analog To Digital Converter)

Example howto connect a ADS1015 12-Bit ADC - 4 Channel with Programmable Gain Amplifier.
  • Connect the ADC to the Raspberry Pi like this
     ADC 
    PIN
    Raspberry
    PIN (GPIO)
     VDD 2 (5V)
     GND 6 (GND)
     SCL 5 (GPIO 03)
     SDA
     3 (GPIO 02)
  • Then connect the potentiometer signal PIN to the A3 pin on the ADC.
    The other pins on the potentiometer you connect to GND and +5V

  • See if the Raspberry can detect the ADC.
    Execute: i2cdetect -y 1

  • You should get this output:
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
    40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                         

  • Then execute: pi ads1015 48 3 
    to read the voltage level on the A3 pin on the ADC

  • Test by moving the potentiometer, you should be able to get values from 0 to 5V.
    For more info see:
    https://github.com/steelsquid/steelsquid-kiss-os/blob/master/steelsquid_pi.py


SparkFun MCP4725 (Digital-to-Analog Convertor)

Example how to connect a SparkFun I2C DAC Breakout (MCP4725) to Steelsquid Kiss OS
  • Connect the MCP4725 like this

     MCP 
    PIN
    Raspberry
    PIN (GPIO)
     VCC 2 (5V) or 1 (3v3)
     GND 6 (GND) and LED
     SCL 5 (GPIO 03)
     SDA
     3 (GPIO 02)
     ANALOG To LED (long pin)

  • You can connect either 5v or 3v3 to VCC   (0 to 5v or 0 to 3.3v)

  • See if the Raspberry can detect the ADC.
    Execute: i2cdetect -y 1

    You should get this output:
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                         

  • Test the output by execute this:
    pi mcp4725 60 1400

  • The LED should light slightly
    Use 1500 to get it to light more.

  • Experiment with the values.
    The values can be 0 and 4095
https://github.com/steelsquid/steelsquid-kiss-os/blob/master/steelsquid_pi.py


Proto Advantage MCP4728 (Digital-to-Analog Convertor)

Example how to connect a Proto Advantage MCP4728 Breakout Board to Steelsquid Kiss OS
MCP4728 is a quad 12-bit voltage output Digital-to-Analog Convertor (DAC).
  • Connect the MCP4728 like this

     MCP 
    PIN
    Raspberry
    PIN (GPIO)
     +5V 2 (5V) or 1 (3v3)
     GND 6 (GND) and LED
     SCL 5 (GPIO 03)
     SDA
     3 (GPIO 02)
     vo0 To LEDs (long pin)

  • You can connect either 5v or 3v3 to +5v   (0 to 5v or 0 to 3.3v)

  • See if the Raspberry can detect it.
    Execute: i2cdetect -y 1
  • You should get this output:
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- 61 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
  • Test the output by execute this:
    pi mcp4728 61 2000 1700 2000 2300

  • The LEDs should light up with different strength.

  • Experiment with the values.
    The values can be 0 and 4095

MCP23017 I2C GPIO Expander

How to connect a MCP23017 I2C Port Expander to Steelsquid Kiss OS.
The MCP23017 has 16 GPIO you can control.
  • Connect the MCP23017 like this

     MCP 
    PIN (GPIO)
    Raspberry
    PIN (GPIO)
    /LED/Button
     9 (VDD)
    18 (RESET)

     2 (5V) or 1 (3v3)
     10 (VSS)
     15 (A0)
     16 (A1)
     17 (A2)
     Button
    LED (short pin)
     6 (GND)
     12 (SCL) 5 (GPIO 03)
     13 (SDA)
     3 (GPIO 02)
     21 (GPA0) To LED (long pin)
     28 (GPA7) To Button

  • See if the Raspberry can detect the MCP.
    Execute: i2cdetect -y 1 

  • You should get this output:
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
  • Test the GPIO output.
    Turn on the LED: pi mcp23017_set 20 0 true
    Turn off the LED: pi mcp23017_set 0 false
  • Do not push the button
    Command: pi mcp23017_get 20 7
    Response: False
  • Push and hold button
    Command: pi mcp23017_get 20 7
    Response: True

Adafruit 16-Channel Servo Driver (PCA9685)

How to use a Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685
  • Connect is like this.

     PCA9685
    Raspberry
    PIN (GPIO) /Servo/Power
     V+ (Screw) +6V external  power
     GND (Screw) External power  GND
     VCC 2 (5V)
     GND 6 (GND)
     SCL 5 (GPIO 03)
     SDA
     3 (GPIO 02)
    Servo port 0To servo

  • See if the Raspberry can detect the PCA.
    Execute: i2cdetect -y 1 

  • You should get this output:
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- --                         

  • Move the servo
    pi pca9685 0 400

  • Test different values.
    min=150, max=600 (may differ between servos)

Dagu T'Rex Robot/Motor Controller

How to use a Dagu T'Rex Robot/Motor Controller
  • 6V -30V operation with built in solid state power switch
  • Programmable with the Arduino IDE (ATMega328P, 5V @ 16MHz)
  • Dual FET “H” bridge rated 18A with self resetting PTC fuses
  • Electronic braking and current monitoring for each motor
  • 3-axis accelerometer provides angle and impact detection
  • Auto-detects RC, BlueTooth, or I2C control
  • Voltage translation on I2C interface
  • 6x Servo Outputs
  • Connect it like this

     PCA9685
    Raspberry
    PIN (GPIO) /motor/power
    + Power to the motors (max 30V)
     - Power to the motors 
      Motor Left +
      Motor Left -
      Motor Right +
      Motor Right -
     VI 1 (3V3)
     GND 6 (GND)
     SCL 5 (GPIO 03)
     SDA
     3 (GPIO 02)
    Servo nr 5A servo

  • See if the Raspberry can detect the TREX.
    Execute: i2cdetect -y 1 
  • You should get this output:
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- 07 -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
  • Drive motors (trex motor <left> <right>)
    Left, right: -255 to 255
    pi trex_motor 30 30

  • Move servo (trex servo <servo_number> <position>)
    Servo number: 1 to 6
    Position: Typically the servo position should be a value between 1000 and 2000 although it will vary depending on the servos used
    pi trex_servo 5 1400

Sabertooth dual 25A motor driver

How to use a Sabertooth dual 25A motor driver
  • First set the DIP on the Sabertooth like this (2400 baud)


  • Connect like this

     Sabertooth
    Raspberry
    PIN (GPIO) /motor/power
     B+ Power to the  motors (max 30V)
     B- Power to the  motors 
     M1A Motor Left +
     M1B Motor Left -
     M2A Motor Right +
     M2B Motor Right -
     S1 8 (GPIO14)
     0V 6 (GND)

  • Drive the motors (sabertooth <port> <left> <right>)
    port: /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyAMA0, /dev/ttyS0
    left: Left speed from -100 to +100
    right: Right speed from -100 to +100
    pi sabertooth /dev/ttyAMA0 40 40


PiBorg Diable DC motor controller

How to use a PiBorg Diable DC motor controller
  • In this example i only connect one motor.
    First connect 3v3v, gnd, SDA and SCL to the Raspbery Pi
    Then the external power to the DC motor.
    And finally the DC motor.


  • Here is an explanation of the Diablo board


  • Then run: i2cdetect -y 1
    If you get this all i OK.
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- 37 -- -- -- UU -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                         

  • To test execute this: pi diablo 500 500
    The motor should go at half speed forward (If you connect 2 motors both should run).
  • pi diablo <left_motor> <right_motor>
    values can be: -1000 to 1000


Hobbytronics I2C 12 servo controller

How to use a 12 Channel Servo Controller IC from hobbytronics.
  • Connect the IC to Raspberry Pi

     Servo12C Raspberry Pi
     VDD 3v3
     VSS GND
     ADDRESS0 GND
     ADDRESS1 GND
     ADDRESS2 GND
     SDA SDA
     SCL SCL

    - Connect the black servo cable to GND
    - Connect the red servo cable to 5V
    - Connect the white Servo cable to Servo12C SERVO05 (pin 10)

  • Check I2C bus
    i2cdetect -y 1
    You should get this:
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
    20: -- -- -- -- -- -- -- -- 28 -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                         

  • Test it: pi servo12c 5 188
    The servo should move.
  • The value can be from 0 to 255 
    But some servos may not work on the whole range.


SparkFun Triple Axis Accelerometer and Gyro MPU-6050

How to use a SparkFun Triple Axis Accelerometer and Gyro MPU-6050.
https://www.sparkfun.com/products/11028
  • Connect the MPU-6050 to Raspberry Pi

     MPU-6050 Raspberry Pi
     VDD 3v3
     GND GND
     VIO 3v3
     SDA SDA
     SCL SCL

  • Check I2C bus
    i2cdetect -y 1
  • You should get this:
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                         

  • Test it: pi mpu6050_rotation
    Answer:  -1.73445819449, -9.16560152585 
    This is rotation angle in degrees for both the X & Y

    Test it by tilting the device...


PCF8591 Analog to Digital Converter

How to use PCF8591 from Steelsquid Kiss OS, i use a prebuild pre-assembled board from Deal Extreme (YL-40).
OBS! If you want to use the pin AIN0, AIN1  and AIN3 instead of the built in sensors remove the jumpers.
  • Connect it
    YL-40 Raspberry Pi
     VDD 3v3
     GND GND
     SDA SDA
     SCL SCL

  • Check I2C bus
    i2cdetect -y 1

  • You should get something like this
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                         

  • Read AIN0 (light sensor)
    pi pcf8591_read 0
    You will get a value between 0 and 255.
    255=super dark
    0 = Super bright

  • Read AIN1 (Temperatur sensor)
    pi pcf8591_read 1
    You will get a value between 0 and 255.
    255=Warm
    0 = Cold

  • Read AIN3 (Potentiometer)
    pi pcf8591_read 3
    You will get a value between 0 and 255.
    Experiment  by turning the pot...

  • Set voltage on AOUT
    Connect a LED to AOUT or you can watch the onboard led d2.
    pi pcf8591_write 190
    0 = 0V
    255 = 3.3V


HDC1008 Temperature + Humidity Sensor 

How to use HDC1008 from steelsquid Kiss OS.
  • Connect it
    HDC1008 Raspberry Pi
     VDD 3v3
     GND GND
     SDA SDA
     SCL SCL
  • Check I2C bus
    i2cdetect -y 1

  • You should get something like this
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --             

  • Read temperature and humidity
    pi hdc1008

  • You should get something like this:
    Temperature: 25.4C                                                             
    Humidity: 47.1%           


Adafruit's Raspberry-Pi Python Code Library

Copyright (c) 2012-2013 Limor Fried, Kevin Townsend and Mikey Sklar for Adafruit Industries.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the <organization> nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.