Skip to content

Commit a35bb50

Browse files
cleanup README, reference USAGE.md and SETUP.md, related to brainelectronics#16
1 parent da65d3d commit a35bb50

File tree

1 file changed

+31
-65
lines changed

1 file changed

+31
-65
lines changed

README.md

Lines changed: 31 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ become a powerfull MicroPython library
1818

1919
<!-- MarkdownTOC -->
2020

21-
- [Installation](#installation)
22-
- [Install required tools](#install-required-tools)
23-
- [Setup](#setup)
24-
- [Install package with pip](#install-package-with-pip)
25-
- [Manually](#manually)
26-
- [Upload files to board](#upload-files-to-board)
21+
- [Quickstart](#quickstart)
22+
- [Install package on board with pip](#install-package-on-board-with-pip)
2723
- [Install additional MicroPython packages](#install-additional-micropython-packages)
2824
- [Usage](#usage)
2925
- [Master implementation](#master-implementation)
@@ -34,82 +30,50 @@ become a powerfull MicroPython library
3430

3531
<!-- /MarkdownTOC -->
3632

37-
## Installation
33+
## Quickstart
3834

39-
<!--
40-
The current implementation does only run on a board with external SPI RAM. As
41-
of now up to 300kB of RAM are required. This is more than an ESP32-D4 Pico
42-
provides by default.
35+
This is a quickstart to install the `micropython-modbus` library on a
36+
MicroPython board.
4337

44-
`esp32spiram-20220117-v1.18.bin` is used as MicroPython firmware
45-
-->
46-
47-
### Install required tools
48-
49-
Python3 must be installed on your system. Check the current Python version
50-
with the following command
51-
52-
```bash
53-
python --version
54-
python3 --version
55-
```
56-
57-
Depending on which command `Python 3.x.y` (with x.y as some numbers) is
58-
returned, use that command to proceed.
38+
A more detailed guide of the development environment can be found in
39+
[SETUP](SETUP.md)
5940

6041
```bash
6142
python3 -m venv .venv
6243
source .venv/bin/activate
6344

64-
pip install -r requirements.txt
65-
```
66-
67-
## Setup
68-
69-
### Install package with pip
70-
71-
Connect to a network
72-
73-
```python
74-
import network
75-
station = network.WLAN(network.STA_IF)
76-
station.connect('SSID', 'PASSWORD')
77-
station.isconnected()
78-
```
79-
80-
and install this lib on the MicroPython device like this
81-
82-
```python
83-
import upip
84-
upip.install('micropython-modbus')
45+
pip install 'rshell>=0.0.30,<1.0.0'
8546
```
8647

87-
### Manually
88-
89-
#### Upload files to board
90-
91-
Copy the module to the MicroPython board and import them as shown below
92-
using [Remote MicroPython shell][ref-remote-upy-shell]
93-
94-
Open the remote shell with the following command. Additionally use `-b 115200`
95-
in case no CP210x is used but a CH34x.
48+
### Install package on board with pip
9649

9750
```bash
9851
rshell -p /dev/tty.SLAB_USBtoUART --editor nano
9952
```
10053

101-
Perform the following command to copy all files and folders to the device
54+
Inside the rshell
10255

10356
```bash
104-
mkdir /pyboard/lib
105-
mkdir /pyboard/lib/umodbus
106-
mkdir /pyboard/registers
107-
108-
cp registers/modbusRegisters-MyEVSE.json /pyboard/registers/
109-
cp umodbus/* /pyboard/lib/umodbus
110-
11157
cp main.py /pyboard
11258
cp boot.py /pyboard
59+
repl
60+
```
61+
62+
Inside the REPL
63+
64+
```python
65+
import machine
66+
import network
67+
import time
68+
import upip
69+
station = network.WLAN(network.STA_IF)
70+
station.active(True)
71+
station.connect('SSID', 'PASSWORD')
72+
time.sleep(1)
73+
print('Device connected to network: {}'.format(station.isconnected()))
74+
upip.install('micropython-modbus')
75+
print('Installation completed')
76+
machine.soft_reset()
11377
```
11478

11579
### Install additional MicroPython packages
@@ -129,6 +93,8 @@ or check the README of the
12993

13094
## Usage
13195

96+
See also [USAGE](USAGE.md)
97+
13298
Start a REPL (may perform a soft reboot), wait for network connection and
13399
start performing Modbus requests to the device.
134100

@@ -229,7 +195,7 @@ Use the provided example scripts [read RTU](examples/read_registers_rtu.sh) or
229195
[read TCP](examples/read_registers_tcp.sh) to read the data from the devices.
230196
This requires the [modules submodule][ref-github-be-python-modules] to be
231197
cloned as well and the required packages being installed as described in the
232-
modules README file.
198+
modules README file. For further details read the [SETUP](SETUP.md) guide.
233199

234200
### Register configuration
235201

0 commit comments

Comments
 (0)