What you'll need for this:
- An AWS account https://console.aws.amazon.com
- A RuuviTag device https://shop.ruuvi.com
- A Raspberry Pi device. I have tested the setup with Raspberry Pi Zero W 2 which has WiFi and Bluetooth connectivity https://www.raspberrypi.com/products/raspberry-pi-zero-2-w/
Just unbox the Ruuvitag and verify the functionality with RuuviStation mobile application.
Check out the headless setup instructions https://www.raspberrypi.com/documentation/computers/configuration.html#set-up-a-headless-raspberry-pi.
Note: You might want to login using SSH keys instead of the default username/password combo.
-
Install Node.js
-
git clone https://github.com/markusl/ruuvitag-aws-iot-monitoring.git
-
Install the prerequisites:
cd app-v2/ sudo apt-get install libudev-dev libusb-1.0-0-dev npm install
-
Enable bluetooth access without sudo (https://github.com/sandeepmistry/noble#running-on-linux)
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
-
(Optional) Enable automatic startup on boot:
sudo nano /etc/rc.local
and addPATH=$PATH:/home/pi/.nvm/versions/node/v20.11.0/bin && cd /home/pi/ruuvitag-aws-iot-monitoring/app-v2 && sh start-monitoring.sh &
Open awsiot/bin/awsiot.ts
and configure the relevant RuuviTag id's for AWS IoT event rules.
Then deploy the AWS IoT cloud infrastructure:
cd awsiot/
npm i -g aws-cdk
npm install
# Deploy the IoT device configuration
cdk deploy AwsIotStack # Note the IotEndpointAddress in outputs
# Deploy the CloudWatch dashboard
cdk deploy AwsIotDashboardStack
- Go to AWS Secrets Manager in AWS Console and look for
RaspberryPi-Credentials
. - Use the Retrieve Secret Value button to get
certificatePem
,privateKey
andpublicKey
. - Configure proper keys under
keys
. - Update proper endpoint (output from
AwsIotStack
deployment) and client id instart-monitoring.sh
Run the application:
sudo apt-get install screen
screen app-v2/start-monitoring.sh
You can share the created dashboard publicly in the AWS CloudWatch console.