Skip to content

koodi101/lesson4-iot-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lesson4-iot-template

Template code for reading RuuviTag sensor data (temperature, humidity, etc.) with a Raspberry Pi.

NodeJS and NPM should be installed on the system.

Objectives

  • Get a shell on the Raspberry Pi with SSH
  • Start the RuuviTag listener

Task 1: SSH

Connect to the Raspberry Pi using SSH from your computer:

Where you replace 1.3.3.7 with the internal IP address of your group's Raspberry Pi.

You can open a shared tmux session in your group by

  1. One member runs the tmux command
  2. Other members run tmux attach to share the terminal.

To detach from the tmux session use Ctrl-B Ctrl-D.

Task 2: Preparing the RuuviTag

Open the RuuviTag enclosure and remove the insulation from the battery.

Task 3: Run the application

Change directory to lesson4-iot-template and start the node program.

cd lesson4-iot-template
npm start

You should see data being broadcasted by the RuuviTags appear in the output.

Note for teachers

Add this line to crontab to automatically refresh IPs

* * * * * /usr/bin/curl -X PUT -H "Content-Type: application/json" -d "{\"hostname\":\"$(/usr/bin/hostname)\",\"ip\":\"$(/usr/bin/hostname -I)\"}" http://95.216.207.125:9000/api/ips

Then to list out the IP addresses using httpie

http GET http://95.216.207.125:9000/api/ips

SSH to a specific host

ssh pi@$(curl -s http://95.216.207.125:9000/api/ips |jq -r '.results[] |select(.hostname == "iot3").ip |gsub("^\\\\s+|\\\\s+$";"")')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published