Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Network speedtest for Raspberry Pi with Lambda API and simple data preview

License

Notifications You must be signed in to change notification settings

ivarprudnikov/rpi-speedtest

Repository files navigation

rpi-speedtest

Actions Status

Network speedtest script to be run on Raspberry Pi

On Raspberry

Installation

Assumes you have API server deployed already.

Verify it works

$ node bin/index.js
91.40834570638205
ok 200

Setup CRON

  • Open editor mode crontab -e
  • Add something like 15 * * * * /usr/local/bin/node /home/pi/rpi-speedtest/bin/index.js to run the script every 15th minute. Safest way is to puth full path to node installation.

Caveats

  • I was testing on Raspbian which has cron logs disabled by default, make your call, for me it is not necessary.
  • I did have node and npm preinstalled on Raspbian, make sure you have those installed and available in PATH.

API server

Running locally

AWS credentials

Export AWS credentials for DynamoDB queries/inserts to work locally:

  • Use profile:
$ export AWS_PROFILE=myprofilename
  • or use key/secret
$ export AWS_ACCESS_KEY_ID=xxx
$ export AWS_SECRET_ACCESS_KEY=yyy
  • or whatever else AWS tells you to use with its SDKs

API server

To start locally $ npm start

Testing

To test $ npm test which will run eslint and any tests present

Deployment

  • Modify config file
  • To deploy to production run $ up production

Uses up to set up AWS Lambda, config lives in up.json. Refer to their docs for further usage info in docs apex.sh/docs/up/ or in their repo github.com/apex/up

DynamoDB

Expecting simple table holding deviceId as a main partition key combined with a sort key timestamp and actual data sitting in payload column which expects Map structure.

Primary partition key
	deviceId (String)
Primary sort key
	timestamp (Number)
Read/write capacity mode
	On-Demand