Skip to content

Latest commit

 

History

History
81 lines (49 loc) · 2.32 KB

README.md

File metadata and controls

81 lines (49 loc) · 2.32 KB

Temperature Mapper

Description

Temperature Mapper contains code to collect temperature from a temperature sensor which connected to a raspberry Pi through gpio.

The following diagram has been followed to make the connection with the temperature sensor in this case :-

Depending on the expected state of the temperature sensor, the program collect the temperature.

Prerequisites

Hardware Prerequisites

  1. RaspBerry-Pi (RaspBerry-Pi 3/4 has been used for this demo)
  2. GPIO
  3. Temperature sensor (DHT11)

Software Prerequisites

  1. Golang 1.14+
  2. KubeEdge 1.5+

Steps to reproduce

  1. Connect the temperature sensor to the RaspBerry-Pi using the GPIO as shown in the circuit diagram above.

  2. Clone and run KubeEdge.

  3. Clone the kubeedge/examples repository.

$ git clone https://github.com/kubeedge/examples.git $GOPATH/src/github.com/kubeedge/examples
  1. Create the temperature device model and device instance.
$ cd $GOPATH/src/github.com/kubeedge/examples/temperature-demo/crds
$ kubectl apply -f devicemodel.yaml
$ sed -i "s#edge-node#<your-edge-node-name>#g" instance.yaml
$ kubectl apply -f device.yaml
  1. Build the mapper to run in RaspBerry-Pi.
cd $GOPATH/src/github.com/kubeedge/examples/temperature-demo
docker build -t <your_dockerhub_username>/kubeedge-temperature-mapper:<your_tag> .
docker push <your_dockerhub_username>/kubeedge-temperature-mapper:<your_tag>

# Note: Before trying to push the docker image to the remote repository please ensure that you have signed into docker from your node, if not please type the followig command to #
  1. Deploy the temperature mapper.
cd $GOPATH/src/github.com/kubeedge/examples/temperature-demo/

# Please enter the following details in the deployment.yaml :-
#    1. Replace "edge-node" with the name of your edge node at spec.template.spec.nodeSelector.name
#    2. Replace "kubeedge/temperature-mapper-demo:arm32" with your own image at spec.template.spec.containers.image

kubectl create -f deployment.yaml
  1. The mapper will report back the temperature to cloud after updating. Observe the temperature in the cloud side.
kubectl get device temperature -oyaml -w