Skip to content

Commit

Permalink
Merge pull request #2 from boboshko/develop
Browse files Browse the repository at this point in the history
Changed JSON object in sketch.js and updated README
  • Loading branch information
boboshko authored Oct 12, 2020
2 parents f8e0eee + 290bfcd commit 6e18e46
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 30 deletions.
43 changes: 21 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
![Platform](https://img.shields.io/badge/platform-Iskra%20JS-brightgreen.svg?style=for-the-badge)
![Version](https://img.shields.io/badge/version-0.2.0-brightgreen.svg?style=for-the-badge)
![Maintenance](https://img.shields.io/maintenance/yes/2019.svg?style=for-the-badge)
![Version](https://img.shields.io/badge/version-0.2.1-brightgreen.svg?style=flat-square)
[![Community Chat](https://img.shields.io/badge/Community-Chat-blueChat?style=flat-square&logo=telegram)](https://t.me/codeque)

# Iskra JS based home meteo-station
# Zarya Meteostation

A homebrew meteo-station based on [Iskra JS](http://wiki.amperka.ru/js:iskra_js) (in Russian) shield, able of collecting weather data and sending it to server. Works with a [specific API](https://github.com/boboshko/Meteostations-API).

Expand All @@ -15,18 +14,18 @@ Buy and build a station from the list below. [Update its firmware](http://wiki.a
### Components
| Component | Cost in rubles |
|:--------------------------------------------------------------------------------------------------------------------------------|:-------------------|
| [Iskra JS](http://amperka.ru/product/iskra-js) | 1 390|
| [Slot Shield](http://amperka.ru/product/arduino-troyka-slot-shield) | 590|
| [Wi-Fi (ESP8266)](http://amperka.ru/product/troyka-wi-fi) | 590|
| [Analog thermometer (TMP36)](http://amperka.ru/product/troyka-temperature-sensor) | 240|
| [Real-time clock (DS1307)](http://amperka.ru/product/troyka-rtc) + [Battery (CR1225)](http://amperka.ru/product/battery-cr1225) | 390 ₽ + 60|
| [Barometer (LPS331AP)](http://amperka.ru/product/troyka-barometer) | 490|
| **Total** | **3 750** |
| [Iskra JS](http://amperka.ru/product/iskra-js) | 1 490|
| [Slot Shield](http://amperka.ru/product/arduino-troyka-slot-shield) | 580|
| [Wi-Fi (ESP8266)](http://amperka.ru/product/troyka-wi-fi) | 850|
| [Analog thermometer (TMP36)](http://amperka.ru/product/troyka-temperature-sensor) | 310|
| [Real-time clock (DS1307)](http://amperka.ru/product/troyka-rtc) + [Battery (CR1225)](http://amperka.ru/product/battery-cr1225) | 470 ₽ + 90|
| [Barometer (LPS331AP)](http://amperka.ru/product/troyka-barometer) | 840|
| **Total** | **4 630** |


## Quick start

Launch [Espruino Web IDE](https://chrome.google.com/webstore/detail/espruino-web-ide/bleoifhkdalbjfbobjackfdifdneehpo) и and copy all the `Sketch.js` contents. Config the firmware as described below. Delete all the unnecessary comments and upload it to Iskra JS.
Launch [Espruino Web IDE](https://chrome.google.com/webstore/detail/espruino-web-ide/bleoifhkdalbjfbobjackfdifdneehpo) и and copy all the `sketch.js` contents. Config the firmware as described below. Delete all the unnecessary comments and upload it to Iskra JS.

Use the *table of values* at the end of this readme if you have trouble understanding the key-value pairs.

Expand All @@ -53,8 +52,8 @@ TG9naW46UGFzc3dvcmQ=
```
A list of services that can help to encode in `Base64`:

* [base64encode.org](https://www.base64encode.org/)
* [base64encode.net](https://www.base64encode.net/)
* [base64encode.org](https://www.base64encode.org/)
* [utilities-online.info](http://www.utilities-online.info/base64/)

#### Geolocation
Expand All @@ -67,15 +66,15 @@ The weather station sends request once a minute (60000 ms) and redirects receive

## Table of parameters

This table explains what the main variables from `Sketch.js` actually are.
This table explains what the main variables from `sketch.js` actually are.

| Key | Value |
|:----------------|:---------------------------------------------------------|
| `SSID` | Wi-Fi network id |
| Key | Value |
|:----------------|:---------------------------------------------------|
| `SSID` | Wi-Fi network id |
| `PSWD` | Wi-Fi password |
| `host` | IP or URL of an API server |
| `port` | API server’s port |
| `path` | URL of an API request |
| `host` | IP or URL of an API server |
| `port` | API server’s port |
| `path` | URL of an API request |
| `Authorization` | Login and password to access API server (`Base64`) |
| `City` | Station’s home town |
| `Street` | Street address |
| `City` | Station’s home town |
| `Street` | Street address |
14 changes: 6 additions & 8 deletions Sketch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Delete all comments before using
// v 0.2.0
// v 0.2.1

// Setting up UART for Wi-Fi
PrimarySerial.setup(115200);
Expand Down Expand Up @@ -63,21 +63,19 @@ var setupWifi = wifi.setup(PrimarySerial, function(err){
function sendData() {

// Poll sensors
// Change: City and Street
var sensorsData = JSON.stringify({
Date: rtc.getTime('iso'),
City: 'Your city here',
Street: 'Your street here',
Temperature: Math.round((thermometer.read('C') * 10)) / 10,
Pressure: Math.round((barometer.read('mmHg') * 10)) / 10
station_id: 0,
date_count: rtc.getTime('unixtime'),
temperature: Math.round((thermometer.read('C') * 10)) / 10,
pressure: Math.round((barometer.read('mmHg') * 10)) / 10
});

// Connect to API server
// Set up: host, port, path, and authorization
var options = {
host: '000.00.00.000',
port: '3012',
path: '/your/secret/path',
path: '/zarya/add',
protocol: 'http:',
method: 'POST',
headers: {
Expand Down

0 comments on commit 6e18e46

Please sign in to comment.