{"id":13480899,"url":"https://github.com/androidthings/weatherstation","last_synced_at":"2025-03-27T11:31:07.857Z","repository":{"id":97075531,"uuid":"76376292","full_name":"androidthings/weatherstation","owner":"androidthings","description":"Sensor-based peripheral sample using Android Things","archived":false,"fork":false,"pushed_at":"2021-05-26T17:54:28.000Z","size":5299,"stargazers_count":212,"open_issues_count":4,"forks_count":78,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-10-30T14:42:44.226Z","etag":null,"topics":["android-things","google-cloud-pubsub"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/androidthings.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-12-13T16:14:58.000Z","updated_at":"2024-10-02T20:08:44.000Z","dependencies_parsed_at":"2023-10-20T17:26:29.683Z","dependency_job_id":null,"html_url":"https://github.com/androidthings/weatherstation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fweatherstation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fweatherstation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fweatherstation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androidthings%2Fweatherstation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/androidthings","download_url":"https://codeload.github.com/androidthings/weatherstation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245836058,"owners_count":20680310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-things","google-cloud-pubsub"],"created_at":"2024-07-31T17:00:46.376Z","updated_at":"2025-03-27T11:31:07.270Z","avatar_url":"https://github.com/androidthings.png","language":"Java","funding_links":[],"categories":["Useful links"],"sub_categories":["Sample apps and libraries"],"readme":"# Weather Station\n\nThis sample integrates multiple Android Things peripheral drivers together to\nbuild a connected Weather Station.\n\n\u003e **Note:** The Android Things Console will be turned down for non-commercial\n\u003e use on January 5, 2022. For more details, see the\n\u003e [FAQ page](https://developer.android.com/things/faq).\n\n## Screenshots\n\n![Weather Station sample demo][demo-gif]\n\n[(Watch the demo on YouTube)][demo-yt]\n\n## Pre-requisites\n\n- Android Things compatible board\n- Android Studio 2.2+\n- [Rainbow Hat for Android Things](https://shop.pimoroni.com/products/rainbow-hat-for-android-things) or the following individual components:\n    - 1 [bmp280 temperature sensor](https://www.adafruit.com/product/2651)\n    - 1 [segment display with I2C backpack](https://www.adafruit.com/product/879)\n    - 1 push button\n    - 1 resistor\n    - jumper wires\n    - 1 breadboard\n    - (optional) 1 [APA102 compatible RGB Led strip](https://www.adafruit.com/product/2241)\n    - (optional) 1 [Piezo Buzzer](https://www.adafruit.com/products/160)\n    - (optional) [Google Cloud Platform](https://cloud.google.com/) project\n\n## Schematics\n\nIf you have the Raspberry Pi [Rainbow Hat for Android Things](https://shop.pimoroni.com/products/rainbow-hat-for-android-things), just plug it onto your Raspberry Pi 3.\n\n![Schematics for Raspberry Pi 3](rpi3_schematics.png)\n\n## Build and install\n\nOn Android Studio, click on the \"Run\" button.\nIf you prefer to run on the command line, type\n```bash\n./gradlew installDebug\nadb shell am start com.example.androidthings.weatherstation/.WeatherStationActivity\n```\n\nIf you have everything set up correctly:\n- The segment display will show the current temperature.\n- If the button is pressed, the display will show the current pressure.\n- If a Piezo Buzzer is connected, it will plays a funny sound on startup.\n- If a APA102 RGB Led strip is connected, it will display a rainbow of 7 pixels indicating the current pressure.\n- If a Google Cloud Platform project is configured (see instruction below), it will publish the sensor data to Google Cloud PubSub.\n\n## Google Cloud Platform configuration (optional)\n\n1. Go to your project in the [Google Cloud Platform console](https://console.cloud.google.com/)\n1. Under *API Manager*, enable the following APIs: Cloud Pub/Sub\n1. Under *IAM \u0026 Admin*, create a new Service Account, provision a new private key and save the generated json credentials.\n1. Under *Pub/Sub*: create a new topic and in the *Permissions* add the service account created in the previous step with the role *Pub/Sub Publisher*.\n1. Under *Pub/Sub*: create a new *Pull subscription* on your new topic.\n1. Import the project into Android Studio. Add a file named `credentials.json` inside `app/src/main/res/raw/` with the contents of the credentials you downloaded in the previous steps.\n1. In `app/build.gradle`, replace the `buildConfigField` values with values from your project setup.\n\nAfter running the sample, you can check that your data is ingested in Google Cloud Pub/Sub by running the following command:\n```\ngcloud --project \u003cCLOUD_PROJECT_ID\u003e beta pubsub subscriptions pull \u003cPULL_SUBSCRIBTION_NAME\u003e\n```\n\nNote: If there is no `credentials.json` file in `app/src/main/res/raw`, the app will\n run offline and will not send sensor data to the [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/).\n\n## Next steps\n\nNow your weather sensor data is continuously being published to [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/):\n- process weather data with [Google Cloud Dataflow](https://cloud.google.com/dataflow/) or [Google Cloud Functions](https://cloud.google.com/functions/)\n- persist weather data in [Google Cloud Bigtable](https://cloud.google.com/bigtable/) or [BigQuery](https://cloud.google.com/bigquery/)\n- create some weather visualization with [Google Cloud Datalab](https://cloud.google.com/datalab/)\n- build weather prediction model with [Google Cloud Machine Learning](https://cloud.google.com/ml/)\n\n## Enable auto-launch behavior\n\nThis sample app is currently configured to launch only when deployed from your\ndevelopment machine. To enable the main activity to launch automatically on boot,\nadd the following `intent-filter` to the app's manifest file:\n\n```xml\n\u003cactivity ...\u003e\n\n    \u003cintent-filter\u003e\n        \u003caction android:name=\"android.intent.action.MAIN\"/\u003e\n        \u003ccategory android:name=\"android.intent.category.HOME\"/\u003e\n        \u003ccategory android:name=\"android.intent.category.DEFAULT\"/\u003e\n    \u003c/intent-filter\u003e\n\n\u003c/activity\u003e\n```\n\n## License\n\nCopyright 2016 The Android Open Source Project, Inc.\n\nLicensed to the Apache Software Foundation (ASF) under one or more contributor\nlicense agreements.  See the NOTICE file distributed with this work for\nadditional information regarding copyright ownership.  The ASF licenses this\nfile to you under the Apache License, Version 2.0 (the \"License\"); you may not\nuse this file except in compliance with the License.  You may obtain a copy of\nthe License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\nWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the\nLicense for the specific language governing permissions and limitations under\nthe License.\n\n[demo-yt]: https://www.youtube.com/watch?v=FcdwfKehX_0\u0026list=PLWz5rJ2EKKc-GjpNkFe9q3DhE2voJscDT\u0026index=14\n[demo-gif]: demo1.gif\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroidthings%2Fweatherstation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandroidthings%2Fweatherstation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroidthings%2Fweatherstation/lists"}