Skip to content

zhezhang77/iot

Repository files navigation

iot

IoT example (GrovePi+/SenseHat)

Library Required

  • Sense Hat ( included in RASPBIAN STRETCH 2018-03-13 )
    sudo apt-get install sense-hat 
  • GrovePi
    sudo curl -kL dexterindustries.com/update_grovepi | bash
    sudo reboot
  • Paho
    sudo pip install paho-mqtt

Running

  • Use 'git clone' to get the whole folder to local
  • Run 'set_sense.sh' or 'set_grove.sh' accroding the type your sensor board
  • Run 'iot_pub.py' to publish data
    • The status of middle button of joystick will be published (Sense Hat)
  • Run 'iot_sub.py' to subscribe and display data
    • Use Up, Down, Left or Right to switch displayed info (Sense Hat)
    • Cover light sensor to switch displayed info (GrovePi+)
  • Press Ctrl+C on console to exit the program

Code

  • iot_pub.py
    • Publish sensor data to AWS broker.
    • Topic:
      iot/temperature/client_id     (GrovePi+/SenseHat)
      iot/humidity/client_id        (GrovePi+/SenseHat)
      iot/button/client_id          (GrovePi+/SenseHat)
      iot/potentiometer/client_id   (GrovePi+)
      iot/pressure/client_id        (SenseHat)
      iot/compass/client_id         (SenseHat)
      ...
  • iot_sub.py
    • Subscribe to iot/+/ to receive data from specific client

TLS certificates

All certificates should be placed in cert folder.

CARoot.pem CA file
**********-certificate.pem.crt Client Certificate file
**********-public.pem.key Client Public Key (unused for client)
**********-private.pem.key Client Private Key

Broker Info

Server a1zd8y5etgd1ze.iot.ap-northeast-1.amazonaws.com
Port 8883

MQTT.fx Settings

MQTT.fx Settings

About

iot assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published