Sign inSign up

randysimpson/pi-iot

By randysimpson

•Updated over 5 years ago

Rasberry Pi IOT for host, DHT22 or DHT11 temp, HC-SRO distance, SSM-1 sound, HC-SR501 PIR motion.

Image
0

10K+

randysimpson/pi-iot repository overview

Please visit https://github.com/randysimpson/pi-iot⁠ for more details.

⁠Host Metrics

To view more information about how this container can be used to get host metrics please look at Run Pi-Iot on Kubernetes - Host metrics⁠

To gather raspberry pi 3 host metrics:

docker run -ti randysimpson/pi-iot:latest

To send the metrics to a wavefront proxy add the -e "output=WF" environment variable and the webhook location.

docker run -ti -e "webhook=https://wavefrontproxy:3878/" -e "output=WF" randysimpson/pi-iot:latest

⁠DHT 22 Temperature Sensor

To follow a blog on how to setup the temperature sensors, please look at Run Pi-Iot on Kubernetes - DHT 22 or DHT 11⁠

For docker to be able to access the GPIO pins the container must be run with the --privileged argument.

docker run -ti --privileged -e "pin=23" -e "type=DHT22" -e "source=backyard" -e "format=f" randysimpson/pi-iot:latest

To send the metrics to a wavefront proxy add the -e "output=WF" environment variable and the webhook location.

docker run -ti --privileged -e "pin=23" -e "type=DHT22" -e "source=backyard" -e "format=f" -e "webhook=https://wavefrontproxy:3878/" -e "output=WF" randysimpson/pi-iot:latest

To run on Kubernetes an example of the yaml file for a pod to run on a node that has the tag location=backyard:

apiVersion: v1
kind: Pod
metadata:
  name: iot
  labels:
    env: test
spec:
  containers:
  - name: pi-iot
    image: randysimpson/pi-iot:latest
    imagePullPolicy: IfNotPresent
    env:
    - name: pin
      value: "23"
    - name: source
      value: "backyard"
    - name: type
      value: "DHT22"
    - name: webhook
      value: "http://ingestor:4545/api/v1/data"
    - name: format
      value: "f"
    securityContext:
      privileged: true
  nodeSelector:
    location: backyard

⁠HC-SRO Distance Sensor

For docker to be able to access the GPIO pins the container must be run with the --privileged argument.

The pin variable must consist of the trigger pin followed by the echo pin comma separated as seen in the following example:

docker run -ti --privileged -e "pin=24,26" -e "type=HC-SRO" -e "source=garage" -e "format=f" randysimpson/pi-iot:latest

To send the metrics to a wavefront proxy add the -e "output=WF" environment variable and the webhook location.

docker run -ti -e "pin=24,26" -e "type=HC-SRO" -e "source=garage" -e "format=f" -e "webhook=https://wavefrontproxy:3878/" -e "output=WF" randysimpson/pi-iot:latest

To run on Kubernetes an example of the yaml file for a pod to run on a node that has the tag location=garage:

apiVersion: v1
kind: Pod
metadata:
  name: iot
  labels:
    env: test
spec:
  containers:
  - name: pi-iot
    image: randysimpson/pi-iot:latest
    imagePullPolicy: IfNotPresent
    env:
    - name: pin
      value: "24,26"
    - name: source
      value: "garage"
    - name: type
      value: "HC-SRO"
    - name: webhook
      value: "http://ingestor:4545/api/v1/data"
    - name: format
      value: "f"
    securityContext:
      privileged: true
  nodeSelector:
    location: garage

⁠SSM-1 Sound Sensor Module

For docker to be able to access the GPIO pins the container must be run with the --privileged argument.

The pin variable is the pin number on the raspberry pi 3 board that the sensor is plugged into, therefore if the sensor is on pin 15, it is GPIO 22. Please see the following example:

docker run -ti --privileged -e "pin=15" -e "type=SSM-1" -e "source=room" randysimpson/pi-iot:latest

To send the metrics to a wavefront proxy add the -e "output=WF" environment variable and the webhook location.

docker run -ti -e "pin=15" -e "type=SSM-1" -e "source=room" -e "webhook=https://wavefrontproxy:3878/" -e "output=WF" randysimpson/pi-iot:latest

To run on Kubernetes an example of the yaml file for a pod to run on a node that has the tag location=room:

apiVersion: v1
kind: Pod
metadata:
  name: iot
  labels:
    env: test
spec:
  containers:
  - name: pi-iot
    image: randysimpson/pi-iot:latest
    imagePullPolicy: IfNotPresent
    env:
    - name: pin
      value: "15"
    - name: source
      value: "room"
    - name: type
      value: "SSM-1"
    - name: webhook
      value: "http://ingestor:4545/api/v1/data"
    securityContext:
      privileged: true
  nodeSelector:
    location: room

⁠HC-SR501 PIR Motion Sensor Module

For docker to be able to access the GPIO pins the container must be run with the --privileged argument.

The pin variable is the pin number on the raspberry pi 3 board that the sensor is plugged into, therefore if the sensor is on pin 15, it is GPIO 22. Please see the following example:

docker run -ti --privileged -e "pin=15" -e "type=HC-SR501" -e "source=room" randysimpson/pi-iot:latest

To send the metrics to a wavefront proxy add the -e "output=WF" environment variable and the webhook location.

docker run -ti -e "pin=15" -e "type=HC-SR501" -e "source=room" -e "webhook=https://wavefrontproxy:3878/" -e "output=WF" randysimpson/pi-iot:latest

To run on Kubernetes an example of the yaml file for a pod to run on a node that has the tag location=room:

apiVersion: v1
kind: Pod
metadata:
  name: iot
  labels:
    env: test
spec:
  containers:
  - name: pi-iot
    image: randysimpson/pi-iot:latest
    imagePullPolicy: IfNotPresent
    env:
    - name: pin
      value: "15"
    - name: source
      value: "room"
    - name: type
      value: "HC-SR501"
    - name: webhook
      value: "http://ingestor:4545/api/v1/data"
    securityContext:
      privileged: true
  nodeSelector:
    location: room

Tag summary

Content type

Image

Digest

Size

82.1 MB

Last updated

over 5 years ago

docker pull randysimpson/pi-iot