diff options
Diffstat (limited to 'Readme.md')
-rw-r--r-- | Readme.md | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..5bd405f --- /dev/null +++ b/Readme.md @@ -0,0 +1,47 @@ +Micropython project for Raspberry Pi Pico. +Collects data from a onewire temperature sensor +and feeds it to MQTT on a wireless connection. + +Before you can use it you need to: +- connect onewire sensor to Pico, +- set up MQTT broker on a server uneder your control, +- optionally, but highly advisable, setup ntpd server in local network, +- set up certificates, +- provide settings in config.py. Skeleton in config.py.example + +Notes: + +In order to test Pico, best use Thonny. +At the time of writing this (Jun 2024), you won't be able to see live +interpreter in PyCharm +Device path is /dev/ttyACM0 +To connect to it, add your user to dialout group. +Alternatively change permissions on that device to something like: +chmod o+rw /dev/ttyACM0 +Or change owner on that device to your user + +To address pin 25 with LED use "LED": +from machine import Pin +led = Pin("LED", Pin.OUT) + +Before using tls (mosquitto, requests) you'll need to set time, for instance: +import ntptime +ntptime.settime() +Be aware that default timeout on a socket there is 1 second, which may not be enough. +I'm using usocket directly so that I can set timeout to a larger value. +The hard part is to deal with timeout from ntp server. +I managed to cut down timeouts drastically by running my own ntp server on local network. + +Another hard part is setting up certificates so that umqttsimple can use them. +TLDR, do it like that: https://github.com/JustinS-B/Mosquitto_CA_and_Certs/blob/main/client_maker + +Update: +Script from that link, now dead, provided here as client_maker.sh + +For background information: https://github.com/orgs/micropython/discussions/10559 + +Script for server running MQTT reading data from MQTT and updating rrd database +in separate project, with Bash script generating rrd database and +generating graph from this database. + +Controlling temperature with PID not tested. |