Skip to content

Commit

Permalink
Merge pull request #802 from LoSk-p/master
Browse files Browse the repository at this point in the history
add esp32 datalog demo
  • Loading branch information
positivecrash authored Mar 11, 2024
2 parents 6605731 + 1ac9e15 commit 9a7ee86
Show file tree
Hide file tree
Showing 5 changed files with 30,710 additions and 20 deletions.
2 changes: 2 additions & 0 deletions data/sidebar_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
link: /docs/sds-sensor-connect
- title_en: How to Add SDS011 Sensor to Home Assistant
link: /docs/sds-sensor-hass
- title_en: How to send extrinsic from ESP
link: /docs/esp32-datalog-demo
#- title_en: Configure Metrics With Prometheus And Grafana
# link: /docs/robonomics-prometheus-grafana
- title_en: How to Edit Wiki
Expand Down
Binary file added docs/docsCovers/esp32-datalog-demo-es.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 84 additions & 0 deletions docs/esp32-datalog-demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: How to Send Extrinsic from ESP32

contributors: [LoSk-p]
---

Send Datalog extrinsic in Robonomics Network on ESP32 using [robonomics-client-cpp](https://github.com/airalab/robonomics-client-cpp). The code of the demo you can find [here](https://github.com/LoSk-p/esp32-datalog-demo).

### Requirements

* Platformio core ([installation instructions](https://docs.platformio.org/en/latest/core/installation/methods/installer-script.html)).
* Any serial client for your OS (`tio` for Linux, for example). You can install `tio` with the following command
```bash
sudo apt install tio
```
### Installation
Clone the repo:
```bash
git clone https://github.com/LoSk-p/esp32-datalog-demo.git
```
### Configuration
Create file `Private.h` in `src` folder with the following content:
```
#pragma once
// Set up real keys and addresses instead of dummy values
#define PRIV_KEY ""
#define SS58_ADR ""
// WiFi
#ifndef STASSID
#define STASSID ""
#define STAPSK ""
#endif
```
and fill it with the information about your Robonomics account and WiFi Network. `PRIV_KEY` is the private key of your Robonomics account, `SS58_ADR` is its address.

<robo-wiki-note type="warning">This demo works only for ED25519 accounts!</robo-wiki-note>


To get the private key from your account seed phrase you can use [get-private-key.py](https://github.com/LoSk-p/esp32-datalog-demo/blob/main/get-private-key.py) script. Just run it and follow instructions:
```bash
python3 get-private-key.py
```

### Upload
Connect ESP32 to the computer using USB cable and build the project:
```bash
cd esp32-datalog-demo
platformio run -t upload
```
This command will build binary files for esp and upload them, so in the end you will see following
```
Writing at 0x000b9def... (84 %)
Writing at 0x000bf4c2... (87 %)
Writing at 0x000c56bf... (90 %)
Writing at 0x000cc6df... (93 %)
Writing at 0x000d1dec... (96 %)
Writing at 0x000d71b0... (100 %)
Wrote 836160 bytes (538555 compressed) at 0x00010000 in 12.2 seconds (effective 548.7 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
=========================== [SUCCESS] Took 24.08 seconds ===========================
```

### Run

After uploading reconnect ESP to the computer aand run your Serial Client (tio with the port `/dev/ttyACM0` in this example):
```bash
tio /dev/ttyACM0
```
And write the text for Datalog record extrinsic.

You can find out the port in the logs arter `platformio run -t upload` command in the previous section. Look for something like this:
```
Auto-detected: /dev/ttyACM0
Uploading .pio/build/nodemcu-32s/firmware.bin
esptool.py v4.5.1
Serial port /dev/ttyACM0
Connecting.......
```
Loading

0 comments on commit 9a7ee86

Please sign in to comment.