code examples for EMAR391 009 Smart Environments SP22
Software:
Hardware:
- BLE Sensor Tags event-triggered acceleration, door opening, temperature and humidity
- IoT Gateway relaying BLE and other sensor signals
- Particle Photon wireless IoT board to do sensors and actuators over wifi
- Respeaker circular and linear mic arrays (4-6 mics). can also play audio with an attached speaker.
- e-Ink electronic ink displays as "quiet" outputs.
- NFC tags Near Field Communication as passive sensor readings.
- Raspberry Pi media playback controlled by MQTT.
- Coral Board edge inference (mobilenet, yolo, face detection, etc.)
- Robots xArm7 co-robotic arm for posing and replaying action.
MQTT Platforms:
- We are exploring shiftr.io as our mqtt broker. We can use the eclipse mqtt server instead. You can view a live visualization of their public broker here: https://www.shiftr.io/try/.
AI inference at the edge. Computer vision and speech recognition.
Can do a lot. We will primarily use it as an output device (audio, video, etc.)
Reading BLE esensor tags and streaming data to MQTT broker or other cloud system. Minew G1 IoT Gateway
Reads BLE advertising packets to parse accelerometer (and other) data. Transmit these to a mqtt broker (shiftr.io). Runs as a service on the Raspbery Pi.
- see files here ble/
We are exploring shiftr.io as our mqtt broker. You can view a live visualization of their public broker here: https://www.shiftr.io/try/
These examples explore sending (publishing), receiving (subscribing) and doing other things with the mqtt messages. They require you to be in a room with the G1 gateway in order to function and transmit data to the cloud.
This sketch lets you type in an address ("topic"), and send a message. It is great for testing things out:
Use the G1 Iot gateway to read tags. Work with accelerometer data.
- tagPublisher_slider: https://editor.p5js.org/robert.twomey/sketches/lkXZ4-Aa8
- (uses sliders to simluate accelerometers)
- tagSubscriber_bargraph: https://editor.p5js.org/robert.twomey/sketches/dA6aKcBpu9
- (receives data and displays accelerometer as a bar graph)
Figure out which side of the tag is facing up:
- tagSubscriber_conditional: https://editor.p5js.org/robert.twomey/sketches/rPfv9jPlM
- (uses if statements to decide which edge the tag is oriented on)
Move a teapot:
- tagSubscriber_teapot: https://editor.p5js.org/robert.twomey/sketches/cA0f-c5y0
- (receives data and uses accelerometer to rotate teapot. the 3DOF accel to pitch/roll is somewhat buggy, so this is inexact)
Use the tag to trigger events:
- tag_triggered_relay: https://editor.p5js.org/robert.twomey/sketches/EPNmEcFlJ
- (triggers an action everytime the tag is moved. resets after some interval)
- tag_triggerd_video: https://editor.p5js.org/robert.twomey/sketches/W8ZmOREYX
- (play video when tag moves)
- tempSubscriber_mqtt: https://editor.p5js.org/robert.twomey/sketches/z4lshxu06
- (reads and displays values from temp/humidity sensor)
- doorSubscriber_mqtt: https://editor.p5js.org/robert.twomey/sketches/UWiFQoxSg
- (reads and displays open/shut, uninstalled, changed from door sensor)
Tests
- mqttPublisher_JSON: https://editor.p5js.org/robert.twomey/sketches/uaCayQRDB
- (sends a static data packet in JSON format, as it were the G1 gateway)
- mqttSubscriber_G1: https://editor.p5js.org/robert.twomey/sketches/-djHYLWZy
- (receives data in JSON format from G1 gateway)
Old Sketches (v1) These do not use the G1 gateway, and do not send messages as JSON:
- mqtt publisher: https://editor.p5js.org/robert.twomey/sketches/CEXVmsCBS
- mqtt subscriber: https://editor.p5js.org/robert.twomey/sketches/dojZRNiSP
- mqtt logger: https://editor.p5js.org/robert.twomey/sketches/pZNnpo2GOD