<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ca">
	<id>https://www.things.cat/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jordi+Binefa</id>
	<title>things.cat - Contribucions de l’usuari [ca]</title>
	<link rel="self" type="application/atom+xml" href="https://www.things.cat/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jordi+Binefa"/>
	<link rel="alternate" type="text/html" href="https://www.things.cat/index.php/Especial:Contribucions/Jordi_Binefa"/>
	<updated>2026-06-15T07:42:47Z</updated>
	<subtitle>Contribucions de l’usuari</subtitle>
	<generator>MediaWiki 1.31.3</generator>
	<entry>
		<id>https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47734</id>
		<title>Pàgina principal</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47734"/>
		<updated>2025-11-27T12:38:16Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* VPS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size:500%&amp;quot;&amp;gt;things.cat&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:300%&amp;quot;&amp;gt;Una pàgina pràctica sobre la Internet de les Coses&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Dispositius IoT. Maquinari i microprogramari =&lt;br /&gt;
Al '''maquinari''' li diem'' '''hardware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
Al '''microprogramari''' li diem'' '''firmware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
'''IoT''' és l'acrònim d'''Internet of Things''. En català abreujat li podríem dir '''IdC''' per a referir-nos a '''la Internet de les Coses'''. En el moment d'escriure aquest text, la comunitat catalanoparlant sembla haver optat per referir-se als '''dispositius de la Internet de les Coses''' com a '''dispositius IoT'''. Si el [https://www.termcat.cat/ca/neoloteca/ termcat] es pronuncia de manera diferent, provaré d'adaptar la terminologia.&lt;br /&gt;
&lt;br /&gt;
== Placa IoT-02 ==&lt;br /&gt;
[https://www.binefa.com/index.php/Placa_IoT-02 Placa_IoT-02]&lt;br /&gt;
&lt;br /&gt;
== Controladors ==&lt;br /&gt;
Als '''controladors''' els hi diem'' '''drivers''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
El xip '''FT232''' ha estat durant molt de temps el xip més comú per convertir d''''USB a UART'''. Fins al punt que se'n van fer còpies pirates. Una actualització del sistema operatiu privatiu Windows va explotar una característica dels xips pirates: els xips pirates tenien el registre d'identificació USB de lectura i escriptura i l'original era tan sols de lectura. L'actualització que va fer Windows provocava l'escriptura d'aquest registre i hi escrivia un zero, que feia que el sistema operatiu ho identifiqués com a concentrador USB i no com a controlador d'UART, fent que el maquinari quedés inservible. A l'any 2014 em vaig veure atrapat amb uns quants Arduino Nano que duien aquest xip pirata i vaig escriure [https://binefa.cat/blog/?p=80 How to recover bricked fake FT232] per a poder-los reprogramar i poder-los fer servir amb sistemes operatius lliures GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
A partir d'aquell moment, bona part de les plaques de fabricació xinesa van començar a dur, massivament, el xip '''CH340''' per a convertir d'USB a UART.&lt;br /&gt;
&lt;br /&gt;
[[Controlador CH340]]&lt;br /&gt;
&lt;br /&gt;
[[Controlador FT232]]&lt;br /&gt;
&lt;br /&gt;
== C / C++ ==&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-libraries Biblioteques per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes Codis per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
=== ESP8266 ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Afegint_la_targeta_ESP8266_a_l%27IDE_d%27Arduino Afegint la targeta ESP8266 a l'IDE d'Arduino] (NodeMCU1.0)&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp8266_udpServer_01b esp8266_udpServer_01.ino] Codi UDP per a ESP8266&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_a_l%27ESP8266 MQTT a l'ESP8266]&lt;br /&gt;
&lt;br /&gt;
=== ESP32 ===&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_udpServer_01b esp32_udpServer_01b] Codi UDP per a ESP32&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_i2cScanner_02 esp32_i2cScanner_02.ino Adreces de dispositius I2C connectats]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/modbus/rtu/esp32/ Exemple de ModBus RTU fent servir NodeRED i ESP32 (amb la placa IoT PLB)]&lt;br /&gt;
&lt;br /&gt;
[https://techtutorialsx.com/2017/05/06/esp32-arduino-creating-a-task/ ESP32 Arduino: Creating a FreeRTOS task]&lt;br /&gt;
&lt;br /&gt;
[https://savjee.be/2020/01/multitasking-esp32-arduino-freertos/ Multitasking on ESP32 with Arduino and FreeRTOS]&lt;br /&gt;
&lt;br /&gt;
==== Modbus ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#overview-of-rs485-specific-communication-options Overview of RS485 specific communication options]&lt;br /&gt;
&lt;br /&gt;
[https://pastebin.com/2PtWJvd6 Example setting RS485 at half duplex mode]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/IoT-02/tree/master/codes/IoT-02_11_modbus_bme280_02 Code IoT-02_11_modbus_bme280_02] using RS485 at half duplex mode&lt;br /&gt;
&lt;br /&gt;
==== ESP-IDF ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ Get Started]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html Get started with ESP-IDF and ESP32-DevKitC: debugging, unit testing, project analysis]&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
=== Accés al maquinari de la Raspberry Pi emprant Python ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Com_connectar-hi_pantalles_OLED_SSD1306_(128x64) Com connectar-hi pantalles OLED SSD1306 (128x64)]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=%C3%9As_d%27entrades_anal%C3%B2giques_amb_l%27ADS115_controlant_sortides_PWM Ús d'entrades analògiques amb l'ADS115 controlant sortides PWM]&lt;br /&gt;
&lt;br /&gt;
=== Micropython ===&lt;br /&gt;
[https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome Micropython and the Internet of Things]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp8266 MicroPython port to ESP8266]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp32 MicroPython port to the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://icircuit.net/esp32-micropython-getting-started/1999 ESP32 – Getting started with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-on-the-esp32-decdd32c4720 Get on the Good Foot with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-part-2-e1f2efaad50b Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor DS18B20 (One Wire Interface)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/gloveboxes/ESP32-MicroPython-BME280-MQTT-Sample Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor BME280 (I2C)]&lt;br /&gt;
&lt;br /&gt;
=== CircuitPython ===&lt;br /&gt;
[https://learn.adafruit.com/circuitpython-with-esp32-quick-start CircuitPython on ESP32 Quick Start]&lt;br /&gt;
&lt;br /&gt;
== Sistemes operatius encastats ==&lt;br /&gt;
=== Raspbian ===&lt;br /&gt;
[https://www.raspberrypi.org/documentation/computers/remote-access.html Remote Access]&lt;br /&gt;
&lt;br /&gt;
[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ How to Install Mosquitto Broker on Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Adaptaci%C3%B3_per_a_que_la_Raspberry_Pi_funcioni_com_a_punt_d%27acc%C3%A9s_donant_adreces_IP_de_classe_B Adaptació per a que la Raspberry Pi funcioni com a punt d'accés donant adreces IP de classe B]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_dels_nodes_node-red-contrib-ttn_i_node-red-contrib-modbustcp-no-pooling_a_la_Raspberry_Pi Instal·lació dels nodes node-red-contrib-ttn i node-red-contrib-modbustcp-no-pooling a la Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_de_l%27OPC-UA_a_la_Raspberry_Pi,_fent_servir_Python,_i_control_des_d%27Indusoft Instal·lació de l'OPC-UA a la Raspberry Pi, fent servir Python, i control des d'Indusoft]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Pr%C3%A0ctica_de_connexi%C3%B3_remota_a_una_Raspberry_Pi Pràctica de connexió remota a una Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://core-electronics.com.au/guides/read-only-raspberry-pi/ Read-Only Raspberry Pi - Never Corrupt your Micro-SD Card]&lt;br /&gt;
==== Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb ''docker'' ====&lt;br /&gt;
[[Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker]]&lt;br /&gt;
&lt;br /&gt;
=== Mongoose OS ===&lt;br /&gt;
[https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md Guia ràpida d'introducció a Mongoose OS][en]&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
[[Sensors de so]]&lt;br /&gt;
&lt;br /&gt;
= Control remot dels dispositius IoT. Programari =&lt;br /&gt;
Al '''programari''' li diuen'' '''software''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
[https://binefa.cat/IoT/teoria/ethernetTcpUdp_00.pdf TCP/UDP Capa de transport d'Ethernet]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació d'un servidor de sòcols web a un Debian amb Apache]]&lt;br /&gt;
&lt;br /&gt;
=== MQTT(S) ===&lt;br /&gt;
[https://binefa.cat/IoT/teoria/mqtt_00.pdf Introducció a MQTT]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt/ Beginners Guide To The MQTT Protocol] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[https://www.rs-online.com/designspark/mqtt MQTT] explained by Andy Stanford-Clark (co-inventor of MQTT). Article written in 2017, and refering to v3.1.1&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/mqtt-5/ MQTT 5 Essentials] by HiveMQ&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt-hosting-brokers-and-servers/ MQTT Brokers/Servers and Cloud Hosting Guide] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer] An all-round MQTT client that provides a structured topic overview&lt;br /&gt;
&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT a Snap!]&lt;br /&gt;
&lt;br /&gt;
==== Public MQTT(S) brokers ====&lt;br /&gt;
[http://test.mosquitto.org/ mosquitto]&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/public-mqtt-broker/ HiveMQ MQTT broker]&lt;br /&gt;
&lt;br /&gt;
[https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/ MQTT brokers online with a free offer to test and connect IoT to the internet]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) implementations ====&lt;br /&gt;
[http://binefa.com/index.php?title=MQTTS_y_NodeRED MQTTS y NodeRED]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations Comparison of MQTT implementations]&lt;br /&gt;
&lt;br /&gt;
[http://test.mosquitto.org/ test.mosquitto.org]&lt;br /&gt;
&lt;br /&gt;
[https://www.emqx.io/ emqx.io]&lt;br /&gt;
&lt;br /&gt;
[https://vernemq.com/ VerneMQ]&lt;br /&gt;
&lt;br /&gt;
=== Webhooks ===&lt;br /&gt;
[https://hookdeck.com/guides/webhooks/what-are-webhooks-how-they-work What Are Webhooks And How They Work]&lt;br /&gt;
&lt;br /&gt;
[[Exemple bàsic de funcionament de Webhooks. Servidor i client en node.js]]&lt;br /&gt;
&lt;br /&gt;
== Programació local (ordinadors d'escriptori i dispositius mòbils) ==&lt;br /&gt;
[https://binefa.cat/IoT/mqtt/MQTT_Dash/ Configuració de MQTT Dash (aplicació per Android)]&lt;br /&gt;
&lt;br /&gt;
=== Mosquitto local a l'ordinador ===&lt;br /&gt;
[https://www.vultr.com/docs/how-to-install-mosquitto-mqtt-broker-server-on-ubuntu-16-04 How to Install Mosquitto MQTT Broker/Server on Ubuntu 16.04]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/downloads/ Instal·lació de Mosquitto a Windows]&lt;br /&gt;
&lt;br /&gt;
Per a actualitzar les claus dels dipòsits de Debian:&lt;br /&gt;
 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key&lt;br /&gt;
 sudo apt-key add mosquitto-repo.gpg.key&lt;br /&gt;
&lt;br /&gt;
=== SCADA ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=SCADA_fent_servir_Python_QML_i_Arduino SCADA fent servir Python QML i Arduino]&lt;br /&gt;
&lt;br /&gt;
== Núvol ==&lt;br /&gt;
=== Instal·lació de Node.js i npm ===&lt;br /&gt;
[https://github.com/nodesource/distributions/blob/master/README.md Instal·lació de node i npm]&lt;br /&gt;
 ecat@iot-ecat:~$ '''sudo bash'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''curl -sL https://deb.nodesource.com/setup_14.x | bash -'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''apt install -y nodejs'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''exit'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''node --version'''&lt;br /&gt;
 v14.15.4&lt;br /&gt;
 ecat@iot-ecat:~$ '''npm -- version'''&lt;br /&gt;
 6.14.10&lt;br /&gt;
&lt;br /&gt;
=== Node-RED ===&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf Introducció al Node-RED]&lt;br /&gt;
&lt;br /&gt;
[[Gestió de Node-RED]]&lt;br /&gt;
&lt;br /&gt;
[https://www.aprendiendoarduino.com/cursos/node-red-developer-para-iot-nivel-i/ Node-RED Developer para IoT. Nivel I]&lt;br /&gt;
&lt;br /&gt;
==== Instal·lació i funcionament del NodeRed autònom ====&lt;br /&gt;
 ecat@iot-ecat:~$ '''mkdir bin'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''cd bin'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''sudo apt install unzip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''mkdir nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''cd nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''wget https://www.binefa.cat/IoT/nodeRed/node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''unzip node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''node node_modules/node-red/red.js --userDir node_modules/node-red/data --settings node_modules/node-red/settings.js -v --port 2222 --title elmeuTitol --safe flows_meuTitol.json'''&lt;br /&gt;
&lt;br /&gt;
==== UDP ====&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/udpServer/udpServer_nodered_code.txt Codi NodeRED per a esp8266_udpServer_01.ino i esp32_udpServer_01b]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_i_MQTTS MQTT i MQTTS]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex00/ Exemple amb MQTT i NodeRED emprant ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex01/ Exercici amb MQTT i NodeRED emprant ESP8266]&lt;br /&gt;
&lt;br /&gt;
[[Elevador en Snap! controlat remotament amb MQTT mitjançant NodeRED fent crides HTTP]]&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer]&lt;br /&gt;
&lt;br /&gt;
==== Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Un_exemple_d%27us_de_Telegram_amb_el_NodeRed Un exemple d'us de Telegram amb el NodeRed]&lt;br /&gt;
&lt;br /&gt;
==== Modbus TCP ====&lt;br /&gt;
[https://binefa.cat/IoT/modbus/ Arxius per treballar amb Modbus TCP] [https://www.binefa.cat/php/doc/modbus/ El segon vídeo explica i compara Modbus RTU i Modbus TCP] &lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/modbusCtrl/ ModBus TCP al NodeRED]&lt;br /&gt;
&lt;br /&gt;
==== Alguns nodes extra ====&lt;br /&gt;
[https://flows.nodered.org/node/node-red-contrib-google-sheets node-red-contrib-google-sheets]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/sammachin/node-red-contrib-google-sheets node-red-contrib-google-sheets al Github]&lt;br /&gt;
&lt;br /&gt;
=== Sistemes d'emmagatzematge i visualització ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=InfluxDB Base de dades de sèries temporals InfluxDB]&lt;br /&gt;
&lt;br /&gt;
[http://docs.grafana.org/installation/debian/ Instal·lació de Grafana a Debian][en]&lt;br /&gt;
&lt;br /&gt;
[[Sentilo]]&lt;br /&gt;
&lt;br /&gt;
=== Xarxes d'àrea estesa de baix consum (LPWAN) ===&lt;br /&gt;
==== Conceptes teòrics ====&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Xarxa_de_llarg_abast Xarxa de llarg abast (WAN)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Chirp_spread_spectrum Espectre eixamplat (Chirp Spread Spectrum)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_seq%C3%BC%C3%A8ncia_directa Espectre eixamplat per seqüència directa (DSSS)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_salt_de_freq%C3%BC%C3%A8ncia Espectre eixamplat per salt de freqüència (FHSS)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LPWAN What is LPWAN?]&lt;br /&gt;
&lt;br /&gt;
[https://cms.edn.com/ContentEETimes/Documents/EDN/LP%20WAN%20Comparison%20Table%20final.pdf Comparison table of Low Power WAN alternatives]&lt;br /&gt;
&lt;br /&gt;
==== LoRa ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
==== SigFox ====&lt;br /&gt;
[https://docs.pycom.io/chapter/tutorials/sipy/register.html Registering SiPy with Sigfox]&lt;br /&gt;
&lt;br /&gt;
[[Interacció amb SiPy1.0r de pycom]]&lt;br /&gt;
&lt;br /&gt;
==== Antenes ====&lt;br /&gt;
[https://youtu.be/CJNq2I_PDHQ Andreas Spiess video: &amp;quot;#182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge)&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Bots ===&lt;br /&gt;
==== Bot de Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Bot_de_Telegram Bot de Telegram]&lt;br /&gt;
&lt;br /&gt;
==== Bot de Mastodon ====&lt;br /&gt;
No totes les instàncies de [https://ca.wikipedia.org/wiki/Mastodon_(xarxa_social) Mastodon] faciliten la instal·lació de bots. Per a fer les primeres passes us recomano aquesta [https://botsin.space/ instància pensada per allotjar bots de Mastodon].&lt;br /&gt;
&lt;br /&gt;
[https://botsin.space/@siarq_sensors Exemple de bot de Mastodon] per a fer lectures de sensors cada hora.&lt;br /&gt;
&lt;br /&gt;
[https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26 Getting credentials for the Mastodon API with Mastodon.py, step by step]&lt;br /&gt;
&lt;br /&gt;
=== VPS ===&lt;br /&gt;
[[Introducció als contenidors docker]]&lt;br /&gt;
&lt;br /&gt;
[[Servidor intermediari invers]]&lt;br /&gt;
&lt;br /&gt;
[[Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[File Browser]]&lt;br /&gt;
&lt;br /&gt;
[[Apache i PHP]]&lt;br /&gt;
&lt;br /&gt;
[[Redireccions a subdomini]]&lt;br /&gt;
&lt;br /&gt;
[[Mastodon]]&lt;br /&gt;
&lt;br /&gt;
[https://medium.com/himinds/mqtt-broker-with-secure-websocket-using-traefik-docker-compose-and-lets-encrypt-2b8e32207555 MQTT broker with Secure WebSocket using Traefik, Docker Compose and Let’s Encrypt]&lt;br /&gt;
&lt;br /&gt;
[https://broker.binefa.cat/wordpressTraefik.html Guia completa: Instal·lació de Traefik + WordPress + PHP + MariaDB des de zero]&lt;br /&gt;
&lt;br /&gt;
[https://broker.binefa.cat/guia.html Guia completa: Instal·lació de Mosquitto MQTT amb Traefik en VPS]&lt;br /&gt;
&lt;br /&gt;
[[Moodle a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Node-RED a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Snap! a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[VPN WireGuard]]&lt;br /&gt;
&lt;br /&gt;
== Snap! ==&lt;br /&gt;
[https://github.com/jmoenig/Snap Snap! al GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''amb''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''sense''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
=== JavaScript per defecte ===&lt;br /&gt;
Per raons de seguretat, s'ha desactivat el JavaScript per defecte. Si us munteu el vostre propi servei al núvol, per a poder cridar programes vostres amb funcions amb JavaScript, heu d'afegir aquesta línia, en negreta, a l'arxiu ''[https://github.com/jmoenig/Snap/blob/master/snap.html snap.html]'':&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            '''Process.prototype.enableJS = true;''' // &amp;lt;-- Per a tenir seleccionat el JS per defecte&lt;br /&gt;
            var world;&lt;br /&gt;
            window.onload = function () {&lt;br /&gt;
                if ('serviceWorker' in navigator) {&lt;br /&gt;
                    navigator.serviceWorker.register('sw.js');&lt;br /&gt;
                }&lt;br /&gt;
                world = new WorldMorph(document.getElementById('world'));&lt;br /&gt;
                new IDE_Morph().openIn(world);&lt;br /&gt;
                loop();&lt;br /&gt;
            };&lt;br /&gt;
            function loop() {&lt;br /&gt;
                requestAnimationFrame(loop);&lt;br /&gt;
                world.doOneCycle();&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MQTT for Snap! ===&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT4Snap !], desenvolupat per en Xavier Pi.&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld.xml Hello World emprant MQTT '''amb''' SSL]&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html#open:http://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld_NoSSL.xml Hello World emprant MQTT '''sense''' SSL]&lt;br /&gt;
=== Intel·ligència Artificial ===&lt;br /&gt;
* [https://snap.berkeley.edu/snap/snap.html#open:https://xavierpi.com/ia/ia.xml Connexió amb Gemini] Cal una [https://aistudio.google.com/app/apikey clau d'API (API key)] ([https://ai.google.dev/gemini-api/docs/quickstart?lang=python Guia ràpida d'ús a l'API de Gemini])&lt;br /&gt;
&amp;lt;!-- AIzaSyBINpQKh7Sj8WyIV-PmNfo157Pg8LQr8JY --&amp;gt;&lt;br /&gt;
* [https://ecraft2learn.github.io/ai/AI-Teacher-Guide/chapter-2.html Reconeixement de veu amb Snap!] ([https://ecraft2learn.github.io/ai/snap/snap.html?project=listening&amp;amp;editMode Accés directe al projecte amb Snap!])&lt;br /&gt;
&lt;br /&gt;
= Una aproximació a OPC-UA =&lt;br /&gt;
&lt;br /&gt;
[[OPC-UA]]&lt;br /&gt;
&lt;br /&gt;
= Placa IoT-02 =&lt;br /&gt;
[[Placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
== Programació remota (OTA) ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Esp32Ota.png|center|Programacio OTA de la placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
=== Dos programes de prova de programació remota ===&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_01.zip IoT-02_OTAWebUpdater_01] (Fa pampallugues el led blanc) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_02.zip IoT-02_OTAWebUpdater_02] (Fa pampallugues el led verd) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
=== Programació a la vora (''edge'') ===&lt;br /&gt;
L'ordinador a la vora (''edge'') pot ser un ordinador normal, habitualment de poca potència, del tipus Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Per a tenir visibilitat externa de la pàgina web servida per la placa IoT-02 (per exemple amb la IP 192.168.1.151:80), ho redireccionarem a un port ( 192.168.1.151:80 --&amp;gt; localhost:5001 )&lt;br /&gt;
&lt;br /&gt;
Per a fer funcionar [https://www.binefa.cat/training/iot02/ota/edge/simple-port-forwarding.js simple-port-forwarding.js] caldrà haver afegit el paquet '''http-proxy''':&lt;br /&gt;
&lt;br /&gt;
 npm install http-proxy&lt;br /&gt;
&lt;br /&gt;
El codi nodejs de redireccionament (suposant que la placa IoT-02 ha adquirit l'adreça IP 192.168.1.151):&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '192.168.1.151';&lt;br /&gt;
 var portOrigen = 80;&lt;br /&gt;
 var portDesti = 5001;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
Per a fer aquest redireccionador sigui un servei, es copia [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service] a la carpeta '''/etc/systemd/system''' o el fem de nou amb un editor:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/systemd/system&lt;br /&gt;
 sudo nano [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service]&lt;br /&gt;
 sudo chmod 755 myForwardingService.service&lt;br /&gt;
 sudo systemctl daemon-reload&lt;br /&gt;
 sudo systemctl '''start''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
Per a veure l'estat del servei:&lt;br /&gt;
 systemctl '''status''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
I per a fer que el servei es posi en marxa al reiniciar l'ordinador a la vora:&lt;br /&gt;
 sudo systemctl '''enable''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
=== Programació al núvol ===&lt;br /&gt;
Mitjançant una xarxa virtual privada (VPN) de l'estil [https://www.zerotier.com/ ZeroTier] podem fer que l'ordinador a la vora i l'ordinador al núvol comparteixin la mateixa xarxa.&lt;br /&gt;
&lt;br /&gt;
Suposant que l'ordinador a la vora té la IP 10.242.156.158, podem redireccionar-hi 10.242.156.158:5001 --&amp;gt; localhost:7007 :&lt;br /&gt;
&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '10.242.156.158';&lt;br /&gt;
 var portOrigen = 5001;&lt;br /&gt;
 var portDesti = 7007;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
I així tenim accés remot des del núvol, connectant mitjançant l'ordinador a la vora que es connecta a la placa IoT-02. &lt;br /&gt;
&lt;br /&gt;
Per accedir-hi des del navegador, escriviu a la URL: &lt;br /&gt;
 &amp;lt;nom_de_domini&amp;gt;:7007&lt;br /&gt;
Això visualitzarà el que presenta l'ordinador a la vora (la IP és la VPN a l'ordinador a la vora):&lt;br /&gt;
 10.242.156.158:5001&lt;br /&gt;
Que al seu temps presenta el servei pel port 80 de la placa IOT-02 connectada a la mateixa xarxa local que l'ordinador a la vora:&lt;br /&gt;
 192.168.1.151&lt;br /&gt;
&lt;br /&gt;
=== Els tres mètodes de programació OTA de l'ESP32 ===&lt;br /&gt;
[https://www.programmersought.com/article/90864120754/ How to implement OTA online update of ESP32 firmware]&lt;br /&gt;
&lt;br /&gt;
== MicroPython ==&lt;br /&gt;
[https://www.digikey.es/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce MicroPython Basics: Load Files &amp;amp; Run Code]&lt;br /&gt;
&lt;br /&gt;
[https://warped3.substack.com/p/compiling-micropython-with-espressif Compiling microPython with espressif SDK 4.4 for ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://docs.micropython.org/en/latest/esp32/tutorial/intro.html Getting started with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython The MicroPython project]&lt;br /&gt;
&lt;br /&gt;
[https://cdn-learn.adafruit.com/downloads/pdf/micropython-basics-loading-modules.pdf MicroPython Basics: Loading Modules]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/robert-hh/FTP-Server-for-ESP8266-ESP32-and-PYBD uftpd: small FTP server for ESP8266, ESP32 and Pyboard D]&lt;br /&gt;
&lt;br /&gt;
[https://electronicsinnovation.com/connect-esp32-to-ubidots-using-micropython-over-mqtt-with-visual-studio-code/ Connect ESP32 to Ubidots using Micropython over MQTT with Visual Studio Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peterhinch Peter Hinch's GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://wolles-elektronikkiste.de/en/programming-the-esp32-with-micropython Programming the ESP32 with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://awesome-micropython.com/ A curated list of awesome MicroPython libraries, frameworks, software and resources]&lt;br /&gt;
=== asyncio ===&lt;br /&gt;
[https://www.youtube.com/watch?v=5VLvmA__2v0 How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics]&lt;br /&gt;
=== Threads ===&lt;br /&gt;
[https://github.com/kevinmcaleer/threads Micropython thread tutorial]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=QeDnjcdGrpY Video: Micropython Threads - Use Both Cores, on Raspberry Pi Pico and ESP32]&lt;br /&gt;
=== MQTT ===&lt;br /&gt;
[https://bhave.sh/micropython-mqtt/ Secrets of MicroPython: MQTT on ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://wokwi.com/projects/341892004923310676 Exemple MQTT sobre micropython funcionant al wokwi] ([https://wokwi.com/projects/341895401936257620 Un exemple més compacte])&lt;br /&gt;
&lt;br /&gt;
=== Modbus ===&lt;br /&gt;
==== Modifying source code ====&lt;br /&gt;
[https://github.com/brainelectronics/micropython-modbus MicroPython Modbus library]&lt;br /&gt;
&lt;br /&gt;
Modbus control signal able to send or receive messages can be controlled directly by UART. To do that, file [https://github.com/mrvelic/micropython/blob/master/ports/esp32/machine_uart.c machine_uart.c] should be changed.&lt;br /&gt;
&lt;br /&gt;
Changes to be able to use Tx/Rx MAX3485 pin: [https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Information about Modbus an MicroPython has been got from this forum: https://github.com/micropython/micropython/pull/5567&lt;br /&gt;
==== Based on pycom-modbus from pycom ====&lt;br /&gt;
[https://github.com/danjperron/micropython-modbus Modbus Master library for MicroPython ESP32 devices]&lt;br /&gt;
=== LoRa ===&lt;br /&gt;
[https://github.com/martynwheeler/u-lora This is a port of raspi-lora for micropython]&lt;br /&gt;
&lt;br /&gt;
= IoT-Vertebrae =&lt;br /&gt;
== Raspberry ==&lt;br /&gt;
[[Configuració de la WiFi a la Raspberry Pi emprant nmtui]]&lt;br /&gt;
&lt;br /&gt;
[[Reconnexió automàtica a la WiFi]]&lt;br /&gt;
&lt;br /&gt;
[[WireGuard VPN]]&lt;br /&gt;
&lt;br /&gt;
= Exemples pràctics =&lt;br /&gt;
== Sensor ModBus de temperatura i humitat CWT-TH03S ==&lt;br /&gt;
[https://www.aliexpress.com/item/1005001404952412.html CWT-TH03S a AliExpress]&lt;br /&gt;
&lt;br /&gt;
[[Accés ModBus al sensor de temperatura i humitat CWT-TH03S]]&lt;br /&gt;
&lt;br /&gt;
= SBC =&lt;br /&gt;
== PocketBeagle ==&lt;br /&gt;
=== Grove Kit ===&lt;br /&gt;
==== Visió general ====&lt;br /&gt;
[https://beagleboard.org/Kits/Grove Informació comercial del Grove Kit]&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/pocket Informació comercial de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki Wiki de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual System Reference Manual] &amp;lt;----&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/latest-images Darreres imatges per a les SD]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/capes/tree/master/pocketbeagle/Grove Disseny del Grove Cape]&lt;br /&gt;
&lt;br /&gt;
==== Primera connexió a la xarxa sense fils ====&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$ '''sudo connmanctl'''⏎&lt;br /&gt;
 [sudo] password for debian: temppwd⏎&lt;br /&gt;
 connmanctl&amp;gt; '''scan wifi'''⏎&lt;br /&gt;
 Scan completed for wifi&lt;br /&gt;
 connmanctl&amp;gt; '''services'''⏎&lt;br /&gt;
       MyWifi                  wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''agent on'''⏎&lt;br /&gt;
 Agent registered&lt;br /&gt;
 connmanctl&amp;gt; '''connect wifi_1234567890_1234567890123456_managed_psk'''⏎&lt;br /&gt;
 Agent RequestInput wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
       Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]&lt;br /&gt;
       WPS = [ Type=wpspin, Requirement=alternate ]&lt;br /&gt;
 Passphrase? '''MySecretPassphrase'''⏎&lt;br /&gt;
 Connected wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''quit'''⏎&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$&lt;br /&gt;
&lt;br /&gt;
==== Tutorials ====&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/blob/master/PocketBeagle/Grove/workshop-handouts.md Blink PocketBeagle on-board USRx LED]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/tree/master/PocketBeagle/Grove Exemples]&lt;br /&gt;
&lt;br /&gt;
= Formació =&lt;br /&gt;
[https://www.binefa.com/index.php/IoT_amb_Arduino_i_Raspberry_Pi._Microcontroladors_d%27%C3%BAs_professional._Curs_Presencial._Edici%C3%B3_de_mar%C3%A7_de_2022 IoT amb Arduino i Raspberry Pi. Microcontroladors d'ús professional. Curs Presencial. Edició de març de 2022] - [https://formacio.eic.cat/cursos/1123577 Formació al Col·legi d'Enginyers Industrials de Catalunya] (30 / març / 2022)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Sistemes_encastats_d%27escala_petita_i_mitjana._Edici%C3%B3_d%27octubre_2021 Sistemes encastats d'escala petita i mitjana. Edició d'octubre 2021] (20 / octubre / 2021)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways)_IoT_(22_de_mar%C3%A7_de_2022) Nodes sensors (motes) i passarel·les (gateways) IoT (22 de març de 2022)] pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2022) Tecnologías IoT, Hands on y MVP (2022)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Diada_de_la_Llibertat_del_Maquinari_(Edici%C3%B3_2021) Diada de la Llibertat del Maquinari (Edició 2021)] (17 d'abril de 2021)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2021) Tecnologías IoT, Hands on y MVP (2021)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways) Nodes sensors (motes) i passarel·les (gateways)]  pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria] (23 de març de 2021)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Monitoritzaci%C3%B3_de_la_qualitat_de_l%27aire_mesurant_CO2_i_VOC_amb_LoRa Monitorització de la qualitat de l'aire mesurant CO2 i VOC amb LoRa] (9 de gener de 2021)&lt;br /&gt;
&lt;br /&gt;
[[Curset introductori d'Internet de les Coses per ADTelecom]] (Comença el 5 de novembre de 2020)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=%C3%9As_de_les_dades_generades_pels_sensors_LoRaWAN_i_arquitectura_del_sistema._Rub%C3%AD_2020 Ús de les dades generades pels sensors LoRaWAN i arquitectura del sistema. Rubí, 17 de juny de 2020]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Curset_a_TE_Connectivity_del_4_de_mar%C3%A7_de_2020 Curset a TE Connectivity del 4 de març de 2020] a [https://www.te.com/ TE Connectivity]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] (Ajuntament de Viladecans, 19 de febrer de 2020)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://www.binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2020) Tecnologías IoT, Hands on y MVP (2020)]&lt;br /&gt;
&lt;br /&gt;
UPC-School - 21802500 - Màster Industria 4.0 [https://wiki.binefa.cat/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP Tecnologías IoT, Hands on y MVP] (2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] a l'[http://www.icm.csic.es/ Institut de Ciències del Mar] (27 / setembre / 2018 i 25 / setembre / 2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_a_Internet_de_les_Coses_-_juny_2018 Introducció a Internet de les Coses - juny 2018] (Curset de formació per a professors de CF realitzat a l'[https://agora.xtec.cat/iesramblaprim/ Institut Rambla Prim])&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Sunna LoRa RMM v3.0]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Xifratge =&lt;br /&gt;
[[Eines de xifratge en línia]]&lt;br /&gt;
&lt;br /&gt;
= Opinió =&lt;br /&gt;
[http://www.xavierpi.com/mi40/HaciaUnIoT_democraticoYEfectivo.pdf Hacia un Internet de las Cosas democrático y efectivo] per Xavier Pi (octubre 2018)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Auxiliar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;MediaWiki s'ha instal·lat.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consulteu la [https://meta.wikimedia.org/wiki/Help:Contents Guia d'Usuari] per a més informació sobre com utilitzar aquest programari wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Primers passos ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Llista de paràmetres configurables]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ PMF del MediaWiki]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce Llista de correu per a anuncis del MediaWiki]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Traducció de MediaWiki en la vostra llengua]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Aprengueu com combatre la brossa que pot atacar el vostre wiki]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47732</id>
		<title>Pàgina principal</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47732"/>
		<updated>2025-11-27T12:36:19Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* VPS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size:500%&amp;quot;&amp;gt;things.cat&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:300%&amp;quot;&amp;gt;Una pàgina pràctica sobre la Internet de les Coses&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Dispositius IoT. Maquinari i microprogramari =&lt;br /&gt;
Al '''maquinari''' li diem'' '''hardware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
Al '''microprogramari''' li diem'' '''firmware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
'''IoT''' és l'acrònim d'''Internet of Things''. En català abreujat li podríem dir '''IdC''' per a referir-nos a '''la Internet de les Coses'''. En el moment d'escriure aquest text, la comunitat catalanoparlant sembla haver optat per referir-se als '''dispositius de la Internet de les Coses''' com a '''dispositius IoT'''. Si el [https://www.termcat.cat/ca/neoloteca/ termcat] es pronuncia de manera diferent, provaré d'adaptar la terminologia.&lt;br /&gt;
&lt;br /&gt;
== Placa IoT-02 ==&lt;br /&gt;
[https://www.binefa.com/index.php/Placa_IoT-02 Placa_IoT-02]&lt;br /&gt;
&lt;br /&gt;
== Controladors ==&lt;br /&gt;
Als '''controladors''' els hi diem'' '''drivers''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
El xip '''FT232''' ha estat durant molt de temps el xip més comú per convertir d''''USB a UART'''. Fins al punt que se'n van fer còpies pirates. Una actualització del sistema operatiu privatiu Windows va explotar una característica dels xips pirates: els xips pirates tenien el registre d'identificació USB de lectura i escriptura i l'original era tan sols de lectura. L'actualització que va fer Windows provocava l'escriptura d'aquest registre i hi escrivia un zero, que feia que el sistema operatiu ho identifiqués com a concentrador USB i no com a controlador d'UART, fent que el maquinari quedés inservible. A l'any 2014 em vaig veure atrapat amb uns quants Arduino Nano que duien aquest xip pirata i vaig escriure [https://binefa.cat/blog/?p=80 How to recover bricked fake FT232] per a poder-los reprogramar i poder-los fer servir amb sistemes operatius lliures GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
A partir d'aquell moment, bona part de les plaques de fabricació xinesa van començar a dur, massivament, el xip '''CH340''' per a convertir d'USB a UART.&lt;br /&gt;
&lt;br /&gt;
[[Controlador CH340]]&lt;br /&gt;
&lt;br /&gt;
[[Controlador FT232]]&lt;br /&gt;
&lt;br /&gt;
== C / C++ ==&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-libraries Biblioteques per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes Codis per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
=== ESP8266 ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Afegint_la_targeta_ESP8266_a_l%27IDE_d%27Arduino Afegint la targeta ESP8266 a l'IDE d'Arduino] (NodeMCU1.0)&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp8266_udpServer_01b esp8266_udpServer_01.ino] Codi UDP per a ESP8266&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_a_l%27ESP8266 MQTT a l'ESP8266]&lt;br /&gt;
&lt;br /&gt;
=== ESP32 ===&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_udpServer_01b esp32_udpServer_01b] Codi UDP per a ESP32&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_i2cScanner_02 esp32_i2cScanner_02.ino Adreces de dispositius I2C connectats]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/modbus/rtu/esp32/ Exemple de ModBus RTU fent servir NodeRED i ESP32 (amb la placa IoT PLB)]&lt;br /&gt;
&lt;br /&gt;
[https://techtutorialsx.com/2017/05/06/esp32-arduino-creating-a-task/ ESP32 Arduino: Creating a FreeRTOS task]&lt;br /&gt;
&lt;br /&gt;
[https://savjee.be/2020/01/multitasking-esp32-arduino-freertos/ Multitasking on ESP32 with Arduino and FreeRTOS]&lt;br /&gt;
&lt;br /&gt;
==== Modbus ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#overview-of-rs485-specific-communication-options Overview of RS485 specific communication options]&lt;br /&gt;
&lt;br /&gt;
[https://pastebin.com/2PtWJvd6 Example setting RS485 at half duplex mode]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/IoT-02/tree/master/codes/IoT-02_11_modbus_bme280_02 Code IoT-02_11_modbus_bme280_02] using RS485 at half duplex mode&lt;br /&gt;
&lt;br /&gt;
==== ESP-IDF ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ Get Started]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html Get started with ESP-IDF and ESP32-DevKitC: debugging, unit testing, project analysis]&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
=== Accés al maquinari de la Raspberry Pi emprant Python ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Com_connectar-hi_pantalles_OLED_SSD1306_(128x64) Com connectar-hi pantalles OLED SSD1306 (128x64)]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=%C3%9As_d%27entrades_anal%C3%B2giques_amb_l%27ADS115_controlant_sortides_PWM Ús d'entrades analògiques amb l'ADS115 controlant sortides PWM]&lt;br /&gt;
&lt;br /&gt;
=== Micropython ===&lt;br /&gt;
[https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome Micropython and the Internet of Things]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp8266 MicroPython port to ESP8266]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp32 MicroPython port to the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://icircuit.net/esp32-micropython-getting-started/1999 ESP32 – Getting started with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-on-the-esp32-decdd32c4720 Get on the Good Foot with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-part-2-e1f2efaad50b Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor DS18B20 (One Wire Interface)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/gloveboxes/ESP32-MicroPython-BME280-MQTT-Sample Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor BME280 (I2C)]&lt;br /&gt;
&lt;br /&gt;
=== CircuitPython ===&lt;br /&gt;
[https://learn.adafruit.com/circuitpython-with-esp32-quick-start CircuitPython on ESP32 Quick Start]&lt;br /&gt;
&lt;br /&gt;
== Sistemes operatius encastats ==&lt;br /&gt;
=== Raspbian ===&lt;br /&gt;
[https://www.raspberrypi.org/documentation/computers/remote-access.html Remote Access]&lt;br /&gt;
&lt;br /&gt;
[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ How to Install Mosquitto Broker on Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Adaptaci%C3%B3_per_a_que_la_Raspberry_Pi_funcioni_com_a_punt_d%27acc%C3%A9s_donant_adreces_IP_de_classe_B Adaptació per a que la Raspberry Pi funcioni com a punt d'accés donant adreces IP de classe B]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_dels_nodes_node-red-contrib-ttn_i_node-red-contrib-modbustcp-no-pooling_a_la_Raspberry_Pi Instal·lació dels nodes node-red-contrib-ttn i node-red-contrib-modbustcp-no-pooling a la Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_de_l%27OPC-UA_a_la_Raspberry_Pi,_fent_servir_Python,_i_control_des_d%27Indusoft Instal·lació de l'OPC-UA a la Raspberry Pi, fent servir Python, i control des d'Indusoft]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Pr%C3%A0ctica_de_connexi%C3%B3_remota_a_una_Raspberry_Pi Pràctica de connexió remota a una Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://core-electronics.com.au/guides/read-only-raspberry-pi/ Read-Only Raspberry Pi - Never Corrupt your Micro-SD Card]&lt;br /&gt;
==== Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb ''docker'' ====&lt;br /&gt;
[[Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker]]&lt;br /&gt;
&lt;br /&gt;
=== Mongoose OS ===&lt;br /&gt;
[https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md Guia ràpida d'introducció a Mongoose OS][en]&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
[[Sensors de so]]&lt;br /&gt;
&lt;br /&gt;
= Control remot dels dispositius IoT. Programari =&lt;br /&gt;
Al '''programari''' li diuen'' '''software''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
[https://binefa.cat/IoT/teoria/ethernetTcpUdp_00.pdf TCP/UDP Capa de transport d'Ethernet]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació d'un servidor de sòcols web a un Debian amb Apache]]&lt;br /&gt;
&lt;br /&gt;
=== MQTT(S) ===&lt;br /&gt;
[https://binefa.cat/IoT/teoria/mqtt_00.pdf Introducció a MQTT]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt/ Beginners Guide To The MQTT Protocol] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[https://www.rs-online.com/designspark/mqtt MQTT] explained by Andy Stanford-Clark (co-inventor of MQTT). Article written in 2017, and refering to v3.1.1&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/mqtt-5/ MQTT 5 Essentials] by HiveMQ&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt-hosting-brokers-and-servers/ MQTT Brokers/Servers and Cloud Hosting Guide] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer] An all-round MQTT client that provides a structured topic overview&lt;br /&gt;
&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT a Snap!]&lt;br /&gt;
&lt;br /&gt;
==== Public MQTT(S) brokers ====&lt;br /&gt;
[http://test.mosquitto.org/ mosquitto]&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/public-mqtt-broker/ HiveMQ MQTT broker]&lt;br /&gt;
&lt;br /&gt;
[https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/ MQTT brokers online with a free offer to test and connect IoT to the internet]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) implementations ====&lt;br /&gt;
[http://binefa.com/index.php?title=MQTTS_y_NodeRED MQTTS y NodeRED]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations Comparison of MQTT implementations]&lt;br /&gt;
&lt;br /&gt;
[http://test.mosquitto.org/ test.mosquitto.org]&lt;br /&gt;
&lt;br /&gt;
[https://www.emqx.io/ emqx.io]&lt;br /&gt;
&lt;br /&gt;
[https://vernemq.com/ VerneMQ]&lt;br /&gt;
&lt;br /&gt;
=== Webhooks ===&lt;br /&gt;
[https://hookdeck.com/guides/webhooks/what-are-webhooks-how-they-work What Are Webhooks And How They Work]&lt;br /&gt;
&lt;br /&gt;
[[Exemple bàsic de funcionament de Webhooks. Servidor i client en node.js]]&lt;br /&gt;
&lt;br /&gt;
== Programació local (ordinadors d'escriptori i dispositius mòbils) ==&lt;br /&gt;
[https://binefa.cat/IoT/mqtt/MQTT_Dash/ Configuració de MQTT Dash (aplicació per Android)]&lt;br /&gt;
&lt;br /&gt;
=== Mosquitto local a l'ordinador ===&lt;br /&gt;
[https://www.vultr.com/docs/how-to-install-mosquitto-mqtt-broker-server-on-ubuntu-16-04 How to Install Mosquitto MQTT Broker/Server on Ubuntu 16.04]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/downloads/ Instal·lació de Mosquitto a Windows]&lt;br /&gt;
&lt;br /&gt;
Per a actualitzar les claus dels dipòsits de Debian:&lt;br /&gt;
 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key&lt;br /&gt;
 sudo apt-key add mosquitto-repo.gpg.key&lt;br /&gt;
&lt;br /&gt;
=== SCADA ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=SCADA_fent_servir_Python_QML_i_Arduino SCADA fent servir Python QML i Arduino]&lt;br /&gt;
&lt;br /&gt;
== Núvol ==&lt;br /&gt;
=== Instal·lació de Node.js i npm ===&lt;br /&gt;
[https://github.com/nodesource/distributions/blob/master/README.md Instal·lació de node i npm]&lt;br /&gt;
 ecat@iot-ecat:~$ '''sudo bash'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''curl -sL https://deb.nodesource.com/setup_14.x | bash -'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''apt install -y nodejs'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''exit'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''node --version'''&lt;br /&gt;
 v14.15.4&lt;br /&gt;
 ecat@iot-ecat:~$ '''npm -- version'''&lt;br /&gt;
 6.14.10&lt;br /&gt;
&lt;br /&gt;
=== Node-RED ===&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf Introducció al Node-RED]&lt;br /&gt;
&lt;br /&gt;
[[Gestió de Node-RED]]&lt;br /&gt;
&lt;br /&gt;
[https://www.aprendiendoarduino.com/cursos/node-red-developer-para-iot-nivel-i/ Node-RED Developer para IoT. Nivel I]&lt;br /&gt;
&lt;br /&gt;
==== Instal·lació i funcionament del NodeRed autònom ====&lt;br /&gt;
 ecat@iot-ecat:~$ '''mkdir bin'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''cd bin'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''sudo apt install unzip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''mkdir nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''cd nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''wget https://www.binefa.cat/IoT/nodeRed/node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''unzip node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''node node_modules/node-red/red.js --userDir node_modules/node-red/data --settings node_modules/node-red/settings.js -v --port 2222 --title elmeuTitol --safe flows_meuTitol.json'''&lt;br /&gt;
&lt;br /&gt;
==== UDP ====&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/udpServer/udpServer_nodered_code.txt Codi NodeRED per a esp8266_udpServer_01.ino i esp32_udpServer_01b]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_i_MQTTS MQTT i MQTTS]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex00/ Exemple amb MQTT i NodeRED emprant ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex01/ Exercici amb MQTT i NodeRED emprant ESP8266]&lt;br /&gt;
&lt;br /&gt;
[[Elevador en Snap! controlat remotament amb MQTT mitjançant NodeRED fent crides HTTP]]&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer]&lt;br /&gt;
&lt;br /&gt;
==== Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Un_exemple_d%27us_de_Telegram_amb_el_NodeRed Un exemple d'us de Telegram amb el NodeRed]&lt;br /&gt;
&lt;br /&gt;
==== Modbus TCP ====&lt;br /&gt;
[https://binefa.cat/IoT/modbus/ Arxius per treballar amb Modbus TCP] [https://www.binefa.cat/php/doc/modbus/ El segon vídeo explica i compara Modbus RTU i Modbus TCP] &lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/modbusCtrl/ ModBus TCP al NodeRED]&lt;br /&gt;
&lt;br /&gt;
==== Alguns nodes extra ====&lt;br /&gt;
[https://flows.nodered.org/node/node-red-contrib-google-sheets node-red-contrib-google-sheets]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/sammachin/node-red-contrib-google-sheets node-red-contrib-google-sheets al Github]&lt;br /&gt;
&lt;br /&gt;
=== Sistemes d'emmagatzematge i visualització ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=InfluxDB Base de dades de sèries temporals InfluxDB]&lt;br /&gt;
&lt;br /&gt;
[http://docs.grafana.org/installation/debian/ Instal·lació de Grafana a Debian][en]&lt;br /&gt;
&lt;br /&gt;
[[Sentilo]]&lt;br /&gt;
&lt;br /&gt;
=== Xarxes d'àrea estesa de baix consum (LPWAN) ===&lt;br /&gt;
==== Conceptes teòrics ====&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Xarxa_de_llarg_abast Xarxa de llarg abast (WAN)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Chirp_spread_spectrum Espectre eixamplat (Chirp Spread Spectrum)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_seq%C3%BC%C3%A8ncia_directa Espectre eixamplat per seqüència directa (DSSS)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_salt_de_freq%C3%BC%C3%A8ncia Espectre eixamplat per salt de freqüència (FHSS)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LPWAN What is LPWAN?]&lt;br /&gt;
&lt;br /&gt;
[https://cms.edn.com/ContentEETimes/Documents/EDN/LP%20WAN%20Comparison%20Table%20final.pdf Comparison table of Low Power WAN alternatives]&lt;br /&gt;
&lt;br /&gt;
==== LoRa ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
==== SigFox ====&lt;br /&gt;
[https://docs.pycom.io/chapter/tutorials/sipy/register.html Registering SiPy with Sigfox]&lt;br /&gt;
&lt;br /&gt;
[[Interacció amb SiPy1.0r de pycom]]&lt;br /&gt;
&lt;br /&gt;
==== Antenes ====&lt;br /&gt;
[https://youtu.be/CJNq2I_PDHQ Andreas Spiess video: &amp;quot;#182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge)&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Bots ===&lt;br /&gt;
==== Bot de Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Bot_de_Telegram Bot de Telegram]&lt;br /&gt;
&lt;br /&gt;
==== Bot de Mastodon ====&lt;br /&gt;
No totes les instàncies de [https://ca.wikipedia.org/wiki/Mastodon_(xarxa_social) Mastodon] faciliten la instal·lació de bots. Per a fer les primeres passes us recomano aquesta [https://botsin.space/ instància pensada per allotjar bots de Mastodon].&lt;br /&gt;
&lt;br /&gt;
[https://botsin.space/@siarq_sensors Exemple de bot de Mastodon] per a fer lectures de sensors cada hora.&lt;br /&gt;
&lt;br /&gt;
[https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26 Getting credentials for the Mastodon API with Mastodon.py, step by step]&lt;br /&gt;
&lt;br /&gt;
=== VPS ===&lt;br /&gt;
[[Introducció als contenidors docker]]&lt;br /&gt;
&lt;br /&gt;
[[Servidor intermediari invers]]&lt;br /&gt;
&lt;br /&gt;
[[Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[File Browser]]&lt;br /&gt;
&lt;br /&gt;
[[Apache i PHP]]&lt;br /&gt;
&lt;br /&gt;
[[Redireccions a subdomini]]&lt;br /&gt;
&lt;br /&gt;
[[Mastodon]]&lt;br /&gt;
&lt;br /&gt;
[https://medium.com/himinds/mqtt-broker-with-secure-websocket-using-traefik-docker-compose-and-lets-encrypt-2b8e32207555 MQTT broker with Secure WebSocket using Traefik, Docker Compose and Let’s Encrypt]&lt;br /&gt;
&lt;br /&gt;
[https://broker.binefa.cat/wordpressTraefik.html Guia completa: Instal·lació de Traefik + WordPress + PHP + MariaDB des de zero]&lt;br /&gt;
&lt;br /&gt;
[https://broker.binefa.cat/guia.html Guia completa: Instal·lació de Mosquitto MQTT amb Traefik en VPS]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació de Mosquitto MQTT amb Traefik en VPS]]&lt;br /&gt;
&lt;br /&gt;
[[Moodle a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Node-RED a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Snap! a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[VPN WireGuard]]&lt;br /&gt;
&lt;br /&gt;
== Snap! ==&lt;br /&gt;
[https://github.com/jmoenig/Snap Snap! al GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''amb''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''sense''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
=== JavaScript per defecte ===&lt;br /&gt;
Per raons de seguretat, s'ha desactivat el JavaScript per defecte. Si us munteu el vostre propi servei al núvol, per a poder cridar programes vostres amb funcions amb JavaScript, heu d'afegir aquesta línia, en negreta, a l'arxiu ''[https://github.com/jmoenig/Snap/blob/master/snap.html snap.html]'':&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            '''Process.prototype.enableJS = true;''' // &amp;lt;-- Per a tenir seleccionat el JS per defecte&lt;br /&gt;
            var world;&lt;br /&gt;
            window.onload = function () {&lt;br /&gt;
                if ('serviceWorker' in navigator) {&lt;br /&gt;
                    navigator.serviceWorker.register('sw.js');&lt;br /&gt;
                }&lt;br /&gt;
                world = new WorldMorph(document.getElementById('world'));&lt;br /&gt;
                new IDE_Morph().openIn(world);&lt;br /&gt;
                loop();&lt;br /&gt;
            };&lt;br /&gt;
            function loop() {&lt;br /&gt;
                requestAnimationFrame(loop);&lt;br /&gt;
                world.doOneCycle();&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MQTT for Snap! ===&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT4Snap !], desenvolupat per en Xavier Pi.&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld.xml Hello World emprant MQTT '''amb''' SSL]&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html#open:http://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld_NoSSL.xml Hello World emprant MQTT '''sense''' SSL]&lt;br /&gt;
=== Intel·ligència Artificial ===&lt;br /&gt;
* [https://snap.berkeley.edu/snap/snap.html#open:https://xavierpi.com/ia/ia.xml Connexió amb Gemini] Cal una [https://aistudio.google.com/app/apikey clau d'API (API key)] ([https://ai.google.dev/gemini-api/docs/quickstart?lang=python Guia ràpida d'ús a l'API de Gemini])&lt;br /&gt;
&amp;lt;!-- AIzaSyBINpQKh7Sj8WyIV-PmNfo157Pg8LQr8JY --&amp;gt;&lt;br /&gt;
* [https://ecraft2learn.github.io/ai/AI-Teacher-Guide/chapter-2.html Reconeixement de veu amb Snap!] ([https://ecraft2learn.github.io/ai/snap/snap.html?project=listening&amp;amp;editMode Accés directe al projecte amb Snap!])&lt;br /&gt;
&lt;br /&gt;
= Una aproximació a OPC-UA =&lt;br /&gt;
&lt;br /&gt;
[[OPC-UA]]&lt;br /&gt;
&lt;br /&gt;
= Placa IoT-02 =&lt;br /&gt;
[[Placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
== Programació remota (OTA) ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Esp32Ota.png|center|Programacio OTA de la placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
=== Dos programes de prova de programació remota ===&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_01.zip IoT-02_OTAWebUpdater_01] (Fa pampallugues el led blanc) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_02.zip IoT-02_OTAWebUpdater_02] (Fa pampallugues el led verd) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
=== Programació a la vora (''edge'') ===&lt;br /&gt;
L'ordinador a la vora (''edge'') pot ser un ordinador normal, habitualment de poca potència, del tipus Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Per a tenir visibilitat externa de la pàgina web servida per la placa IoT-02 (per exemple amb la IP 192.168.1.151:80), ho redireccionarem a un port ( 192.168.1.151:80 --&amp;gt; localhost:5001 )&lt;br /&gt;
&lt;br /&gt;
Per a fer funcionar [https://www.binefa.cat/training/iot02/ota/edge/simple-port-forwarding.js simple-port-forwarding.js] caldrà haver afegit el paquet '''http-proxy''':&lt;br /&gt;
&lt;br /&gt;
 npm install http-proxy&lt;br /&gt;
&lt;br /&gt;
El codi nodejs de redireccionament (suposant que la placa IoT-02 ha adquirit l'adreça IP 192.168.1.151):&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '192.168.1.151';&lt;br /&gt;
 var portOrigen = 80;&lt;br /&gt;
 var portDesti = 5001;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
Per a fer aquest redireccionador sigui un servei, es copia [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service] a la carpeta '''/etc/systemd/system''' o el fem de nou amb un editor:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/systemd/system&lt;br /&gt;
 sudo nano [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service]&lt;br /&gt;
 sudo chmod 755 myForwardingService.service&lt;br /&gt;
 sudo systemctl daemon-reload&lt;br /&gt;
 sudo systemctl '''start''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
Per a veure l'estat del servei:&lt;br /&gt;
 systemctl '''status''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
I per a fer que el servei es posi en marxa al reiniciar l'ordinador a la vora:&lt;br /&gt;
 sudo systemctl '''enable''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
=== Programació al núvol ===&lt;br /&gt;
Mitjançant una xarxa virtual privada (VPN) de l'estil [https://www.zerotier.com/ ZeroTier] podem fer que l'ordinador a la vora i l'ordinador al núvol comparteixin la mateixa xarxa.&lt;br /&gt;
&lt;br /&gt;
Suposant que l'ordinador a la vora té la IP 10.242.156.158, podem redireccionar-hi 10.242.156.158:5001 --&amp;gt; localhost:7007 :&lt;br /&gt;
&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '10.242.156.158';&lt;br /&gt;
 var portOrigen = 5001;&lt;br /&gt;
 var portDesti = 7007;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
I així tenim accés remot des del núvol, connectant mitjançant l'ordinador a la vora que es connecta a la placa IoT-02. &lt;br /&gt;
&lt;br /&gt;
Per accedir-hi des del navegador, escriviu a la URL: &lt;br /&gt;
 &amp;lt;nom_de_domini&amp;gt;:7007&lt;br /&gt;
Això visualitzarà el que presenta l'ordinador a la vora (la IP és la VPN a l'ordinador a la vora):&lt;br /&gt;
 10.242.156.158:5001&lt;br /&gt;
Que al seu temps presenta el servei pel port 80 de la placa IOT-02 connectada a la mateixa xarxa local que l'ordinador a la vora:&lt;br /&gt;
 192.168.1.151&lt;br /&gt;
&lt;br /&gt;
=== Els tres mètodes de programació OTA de l'ESP32 ===&lt;br /&gt;
[https://www.programmersought.com/article/90864120754/ How to implement OTA online update of ESP32 firmware]&lt;br /&gt;
&lt;br /&gt;
== MicroPython ==&lt;br /&gt;
[https://www.digikey.es/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce MicroPython Basics: Load Files &amp;amp; Run Code]&lt;br /&gt;
&lt;br /&gt;
[https://warped3.substack.com/p/compiling-micropython-with-espressif Compiling microPython with espressif SDK 4.4 for ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://docs.micropython.org/en/latest/esp32/tutorial/intro.html Getting started with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython The MicroPython project]&lt;br /&gt;
&lt;br /&gt;
[https://cdn-learn.adafruit.com/downloads/pdf/micropython-basics-loading-modules.pdf MicroPython Basics: Loading Modules]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/robert-hh/FTP-Server-for-ESP8266-ESP32-and-PYBD uftpd: small FTP server for ESP8266, ESP32 and Pyboard D]&lt;br /&gt;
&lt;br /&gt;
[https://electronicsinnovation.com/connect-esp32-to-ubidots-using-micropython-over-mqtt-with-visual-studio-code/ Connect ESP32 to Ubidots using Micropython over MQTT with Visual Studio Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peterhinch Peter Hinch's GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://wolles-elektronikkiste.de/en/programming-the-esp32-with-micropython Programming the ESP32 with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://awesome-micropython.com/ A curated list of awesome MicroPython libraries, frameworks, software and resources]&lt;br /&gt;
=== asyncio ===&lt;br /&gt;
[https://www.youtube.com/watch?v=5VLvmA__2v0 How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics]&lt;br /&gt;
=== Threads ===&lt;br /&gt;
[https://github.com/kevinmcaleer/threads Micropython thread tutorial]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=QeDnjcdGrpY Video: Micropython Threads - Use Both Cores, on Raspberry Pi Pico and ESP32]&lt;br /&gt;
=== MQTT ===&lt;br /&gt;
[https://bhave.sh/micropython-mqtt/ Secrets of MicroPython: MQTT on ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://wokwi.com/projects/341892004923310676 Exemple MQTT sobre micropython funcionant al wokwi] ([https://wokwi.com/projects/341895401936257620 Un exemple més compacte])&lt;br /&gt;
&lt;br /&gt;
=== Modbus ===&lt;br /&gt;
==== Modifying source code ====&lt;br /&gt;
[https://github.com/brainelectronics/micropython-modbus MicroPython Modbus library]&lt;br /&gt;
&lt;br /&gt;
Modbus control signal able to send or receive messages can be controlled directly by UART. To do that, file [https://github.com/mrvelic/micropython/blob/master/ports/esp32/machine_uart.c machine_uart.c] should be changed.&lt;br /&gt;
&lt;br /&gt;
Changes to be able to use Tx/Rx MAX3485 pin: [https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Information about Modbus an MicroPython has been got from this forum: https://github.com/micropython/micropython/pull/5567&lt;br /&gt;
==== Based on pycom-modbus from pycom ====&lt;br /&gt;
[https://github.com/danjperron/micropython-modbus Modbus Master library for MicroPython ESP32 devices]&lt;br /&gt;
=== LoRa ===&lt;br /&gt;
[https://github.com/martynwheeler/u-lora This is a port of raspi-lora for micropython]&lt;br /&gt;
&lt;br /&gt;
= IoT-Vertebrae =&lt;br /&gt;
== Raspberry ==&lt;br /&gt;
[[Configuració de la WiFi a la Raspberry Pi emprant nmtui]]&lt;br /&gt;
&lt;br /&gt;
[[Reconnexió automàtica a la WiFi]]&lt;br /&gt;
&lt;br /&gt;
[[WireGuard VPN]]&lt;br /&gt;
&lt;br /&gt;
= Exemples pràctics =&lt;br /&gt;
== Sensor ModBus de temperatura i humitat CWT-TH03S ==&lt;br /&gt;
[https://www.aliexpress.com/item/1005001404952412.html CWT-TH03S a AliExpress]&lt;br /&gt;
&lt;br /&gt;
[[Accés ModBus al sensor de temperatura i humitat CWT-TH03S]]&lt;br /&gt;
&lt;br /&gt;
= SBC =&lt;br /&gt;
== PocketBeagle ==&lt;br /&gt;
=== Grove Kit ===&lt;br /&gt;
==== Visió general ====&lt;br /&gt;
[https://beagleboard.org/Kits/Grove Informació comercial del Grove Kit]&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/pocket Informació comercial de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki Wiki de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual System Reference Manual] &amp;lt;----&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/latest-images Darreres imatges per a les SD]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/capes/tree/master/pocketbeagle/Grove Disseny del Grove Cape]&lt;br /&gt;
&lt;br /&gt;
==== Primera connexió a la xarxa sense fils ====&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$ '''sudo connmanctl'''⏎&lt;br /&gt;
 [sudo] password for debian: temppwd⏎&lt;br /&gt;
 connmanctl&amp;gt; '''scan wifi'''⏎&lt;br /&gt;
 Scan completed for wifi&lt;br /&gt;
 connmanctl&amp;gt; '''services'''⏎&lt;br /&gt;
       MyWifi                  wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''agent on'''⏎&lt;br /&gt;
 Agent registered&lt;br /&gt;
 connmanctl&amp;gt; '''connect wifi_1234567890_1234567890123456_managed_psk'''⏎&lt;br /&gt;
 Agent RequestInput wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
       Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]&lt;br /&gt;
       WPS = [ Type=wpspin, Requirement=alternate ]&lt;br /&gt;
 Passphrase? '''MySecretPassphrase'''⏎&lt;br /&gt;
 Connected wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''quit'''⏎&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$&lt;br /&gt;
&lt;br /&gt;
==== Tutorials ====&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/blob/master/PocketBeagle/Grove/workshop-handouts.md Blink PocketBeagle on-board USRx LED]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/tree/master/PocketBeagle/Grove Exemples]&lt;br /&gt;
&lt;br /&gt;
= Formació =&lt;br /&gt;
[https://www.binefa.com/index.php/IoT_amb_Arduino_i_Raspberry_Pi._Microcontroladors_d%27%C3%BAs_professional._Curs_Presencial._Edici%C3%B3_de_mar%C3%A7_de_2022 IoT amb Arduino i Raspberry Pi. Microcontroladors d'ús professional. Curs Presencial. Edició de març de 2022] - [https://formacio.eic.cat/cursos/1123577 Formació al Col·legi d'Enginyers Industrials de Catalunya] (30 / març / 2022)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Sistemes_encastats_d%27escala_petita_i_mitjana._Edici%C3%B3_d%27octubre_2021 Sistemes encastats d'escala petita i mitjana. Edició d'octubre 2021] (20 / octubre / 2021)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways)_IoT_(22_de_mar%C3%A7_de_2022) Nodes sensors (motes) i passarel·les (gateways) IoT (22 de març de 2022)] pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2022) Tecnologías IoT, Hands on y MVP (2022)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Diada_de_la_Llibertat_del_Maquinari_(Edici%C3%B3_2021) Diada de la Llibertat del Maquinari (Edició 2021)] (17 d'abril de 2021)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2021) Tecnologías IoT, Hands on y MVP (2021)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways) Nodes sensors (motes) i passarel·les (gateways)]  pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria] (23 de març de 2021)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Monitoritzaci%C3%B3_de_la_qualitat_de_l%27aire_mesurant_CO2_i_VOC_amb_LoRa Monitorització de la qualitat de l'aire mesurant CO2 i VOC amb LoRa] (9 de gener de 2021)&lt;br /&gt;
&lt;br /&gt;
[[Curset introductori d'Internet de les Coses per ADTelecom]] (Comença el 5 de novembre de 2020)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=%C3%9As_de_les_dades_generades_pels_sensors_LoRaWAN_i_arquitectura_del_sistema._Rub%C3%AD_2020 Ús de les dades generades pels sensors LoRaWAN i arquitectura del sistema. Rubí, 17 de juny de 2020]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Curset_a_TE_Connectivity_del_4_de_mar%C3%A7_de_2020 Curset a TE Connectivity del 4 de març de 2020] a [https://www.te.com/ TE Connectivity]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] (Ajuntament de Viladecans, 19 de febrer de 2020)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://www.binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2020) Tecnologías IoT, Hands on y MVP (2020)]&lt;br /&gt;
&lt;br /&gt;
UPC-School - 21802500 - Màster Industria 4.0 [https://wiki.binefa.cat/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP Tecnologías IoT, Hands on y MVP] (2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] a l'[http://www.icm.csic.es/ Institut de Ciències del Mar] (27 / setembre / 2018 i 25 / setembre / 2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_a_Internet_de_les_Coses_-_juny_2018 Introducció a Internet de les Coses - juny 2018] (Curset de formació per a professors de CF realitzat a l'[https://agora.xtec.cat/iesramblaprim/ Institut Rambla Prim])&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Sunna LoRa RMM v3.0]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Xifratge =&lt;br /&gt;
[[Eines de xifratge en línia]]&lt;br /&gt;
&lt;br /&gt;
= Opinió =&lt;br /&gt;
[http://www.xavierpi.com/mi40/HaciaUnIoT_democraticoYEfectivo.pdf Hacia un Internet de las Cosas democrático y efectivo] per Xavier Pi (octubre 2018)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Auxiliar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;MediaWiki s'ha instal·lat.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consulteu la [https://meta.wikimedia.org/wiki/Help:Contents Guia d'Usuari] per a més informació sobre com utilitzar aquest programari wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Primers passos ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Llista de paràmetres configurables]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ PMF del MediaWiki]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce Llista de correu per a anuncis del MediaWiki]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Traducció de MediaWiki en la vostra llengua]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Aprengueu com combatre la brossa que pot atacar el vostre wiki]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47731</id>
		<title>Pàgina principal</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47731"/>
		<updated>2025-11-27T12:16:18Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* VPS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size:500%&amp;quot;&amp;gt;things.cat&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:300%&amp;quot;&amp;gt;Una pàgina pràctica sobre la Internet de les Coses&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Dispositius IoT. Maquinari i microprogramari =&lt;br /&gt;
Al '''maquinari''' li diem'' '''hardware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
Al '''microprogramari''' li diem'' '''firmware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
'''IoT''' és l'acrònim d'''Internet of Things''. En català abreujat li podríem dir '''IdC''' per a referir-nos a '''la Internet de les Coses'''. En el moment d'escriure aquest text, la comunitat catalanoparlant sembla haver optat per referir-se als '''dispositius de la Internet de les Coses''' com a '''dispositius IoT'''. Si el [https://www.termcat.cat/ca/neoloteca/ termcat] es pronuncia de manera diferent, provaré d'adaptar la terminologia.&lt;br /&gt;
&lt;br /&gt;
== Placa IoT-02 ==&lt;br /&gt;
[https://www.binefa.com/index.php/Placa_IoT-02 Placa_IoT-02]&lt;br /&gt;
&lt;br /&gt;
== Controladors ==&lt;br /&gt;
Als '''controladors''' els hi diem'' '''drivers''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
El xip '''FT232''' ha estat durant molt de temps el xip més comú per convertir d''''USB a UART'''. Fins al punt que se'n van fer còpies pirates. Una actualització del sistema operatiu privatiu Windows va explotar una característica dels xips pirates: els xips pirates tenien el registre d'identificació USB de lectura i escriptura i l'original era tan sols de lectura. L'actualització que va fer Windows provocava l'escriptura d'aquest registre i hi escrivia un zero, que feia que el sistema operatiu ho identifiqués com a concentrador USB i no com a controlador d'UART, fent que el maquinari quedés inservible. A l'any 2014 em vaig veure atrapat amb uns quants Arduino Nano que duien aquest xip pirata i vaig escriure [https://binefa.cat/blog/?p=80 How to recover bricked fake FT232] per a poder-los reprogramar i poder-los fer servir amb sistemes operatius lliures GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
A partir d'aquell moment, bona part de les plaques de fabricació xinesa van començar a dur, massivament, el xip '''CH340''' per a convertir d'USB a UART.&lt;br /&gt;
&lt;br /&gt;
[[Controlador CH340]]&lt;br /&gt;
&lt;br /&gt;
[[Controlador FT232]]&lt;br /&gt;
&lt;br /&gt;
== C / C++ ==&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-libraries Biblioteques per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes Codis per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
=== ESP8266 ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Afegint_la_targeta_ESP8266_a_l%27IDE_d%27Arduino Afegint la targeta ESP8266 a l'IDE d'Arduino] (NodeMCU1.0)&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp8266_udpServer_01b esp8266_udpServer_01.ino] Codi UDP per a ESP8266&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_a_l%27ESP8266 MQTT a l'ESP8266]&lt;br /&gt;
&lt;br /&gt;
=== ESP32 ===&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_udpServer_01b esp32_udpServer_01b] Codi UDP per a ESP32&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_i2cScanner_02 esp32_i2cScanner_02.ino Adreces de dispositius I2C connectats]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/modbus/rtu/esp32/ Exemple de ModBus RTU fent servir NodeRED i ESP32 (amb la placa IoT PLB)]&lt;br /&gt;
&lt;br /&gt;
[https://techtutorialsx.com/2017/05/06/esp32-arduino-creating-a-task/ ESP32 Arduino: Creating a FreeRTOS task]&lt;br /&gt;
&lt;br /&gt;
[https://savjee.be/2020/01/multitasking-esp32-arduino-freertos/ Multitasking on ESP32 with Arduino and FreeRTOS]&lt;br /&gt;
&lt;br /&gt;
==== Modbus ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#overview-of-rs485-specific-communication-options Overview of RS485 specific communication options]&lt;br /&gt;
&lt;br /&gt;
[https://pastebin.com/2PtWJvd6 Example setting RS485 at half duplex mode]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/IoT-02/tree/master/codes/IoT-02_11_modbus_bme280_02 Code IoT-02_11_modbus_bme280_02] using RS485 at half duplex mode&lt;br /&gt;
&lt;br /&gt;
==== ESP-IDF ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ Get Started]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html Get started with ESP-IDF and ESP32-DevKitC: debugging, unit testing, project analysis]&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
=== Accés al maquinari de la Raspberry Pi emprant Python ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Com_connectar-hi_pantalles_OLED_SSD1306_(128x64) Com connectar-hi pantalles OLED SSD1306 (128x64)]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=%C3%9As_d%27entrades_anal%C3%B2giques_amb_l%27ADS115_controlant_sortides_PWM Ús d'entrades analògiques amb l'ADS115 controlant sortides PWM]&lt;br /&gt;
&lt;br /&gt;
=== Micropython ===&lt;br /&gt;
[https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome Micropython and the Internet of Things]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp8266 MicroPython port to ESP8266]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp32 MicroPython port to the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://icircuit.net/esp32-micropython-getting-started/1999 ESP32 – Getting started with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-on-the-esp32-decdd32c4720 Get on the Good Foot with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-part-2-e1f2efaad50b Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor DS18B20 (One Wire Interface)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/gloveboxes/ESP32-MicroPython-BME280-MQTT-Sample Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor BME280 (I2C)]&lt;br /&gt;
&lt;br /&gt;
=== CircuitPython ===&lt;br /&gt;
[https://learn.adafruit.com/circuitpython-with-esp32-quick-start CircuitPython on ESP32 Quick Start]&lt;br /&gt;
&lt;br /&gt;
== Sistemes operatius encastats ==&lt;br /&gt;
=== Raspbian ===&lt;br /&gt;
[https://www.raspberrypi.org/documentation/computers/remote-access.html Remote Access]&lt;br /&gt;
&lt;br /&gt;
[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ How to Install Mosquitto Broker on Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Adaptaci%C3%B3_per_a_que_la_Raspberry_Pi_funcioni_com_a_punt_d%27acc%C3%A9s_donant_adreces_IP_de_classe_B Adaptació per a que la Raspberry Pi funcioni com a punt d'accés donant adreces IP de classe B]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_dels_nodes_node-red-contrib-ttn_i_node-red-contrib-modbustcp-no-pooling_a_la_Raspberry_Pi Instal·lació dels nodes node-red-contrib-ttn i node-red-contrib-modbustcp-no-pooling a la Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_de_l%27OPC-UA_a_la_Raspberry_Pi,_fent_servir_Python,_i_control_des_d%27Indusoft Instal·lació de l'OPC-UA a la Raspberry Pi, fent servir Python, i control des d'Indusoft]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Pr%C3%A0ctica_de_connexi%C3%B3_remota_a_una_Raspberry_Pi Pràctica de connexió remota a una Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://core-electronics.com.au/guides/read-only-raspberry-pi/ Read-Only Raspberry Pi - Never Corrupt your Micro-SD Card]&lt;br /&gt;
==== Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb ''docker'' ====&lt;br /&gt;
[[Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker]]&lt;br /&gt;
&lt;br /&gt;
=== Mongoose OS ===&lt;br /&gt;
[https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md Guia ràpida d'introducció a Mongoose OS][en]&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
[[Sensors de so]]&lt;br /&gt;
&lt;br /&gt;
= Control remot dels dispositius IoT. Programari =&lt;br /&gt;
Al '''programari''' li diuen'' '''software''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
[https://binefa.cat/IoT/teoria/ethernetTcpUdp_00.pdf TCP/UDP Capa de transport d'Ethernet]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació d'un servidor de sòcols web a un Debian amb Apache]]&lt;br /&gt;
&lt;br /&gt;
=== MQTT(S) ===&lt;br /&gt;
[https://binefa.cat/IoT/teoria/mqtt_00.pdf Introducció a MQTT]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt/ Beginners Guide To The MQTT Protocol] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[https://www.rs-online.com/designspark/mqtt MQTT] explained by Andy Stanford-Clark (co-inventor of MQTT). Article written in 2017, and refering to v3.1.1&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/mqtt-5/ MQTT 5 Essentials] by HiveMQ&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt-hosting-brokers-and-servers/ MQTT Brokers/Servers and Cloud Hosting Guide] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer] An all-round MQTT client that provides a structured topic overview&lt;br /&gt;
&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT a Snap!]&lt;br /&gt;
&lt;br /&gt;
==== Public MQTT(S) brokers ====&lt;br /&gt;
[http://test.mosquitto.org/ mosquitto]&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/public-mqtt-broker/ HiveMQ MQTT broker]&lt;br /&gt;
&lt;br /&gt;
[https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/ MQTT brokers online with a free offer to test and connect IoT to the internet]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) implementations ====&lt;br /&gt;
[http://binefa.com/index.php?title=MQTTS_y_NodeRED MQTTS y NodeRED]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations Comparison of MQTT implementations]&lt;br /&gt;
&lt;br /&gt;
[http://test.mosquitto.org/ test.mosquitto.org]&lt;br /&gt;
&lt;br /&gt;
[https://www.emqx.io/ emqx.io]&lt;br /&gt;
&lt;br /&gt;
[https://vernemq.com/ VerneMQ]&lt;br /&gt;
&lt;br /&gt;
=== Webhooks ===&lt;br /&gt;
[https://hookdeck.com/guides/webhooks/what-are-webhooks-how-they-work What Are Webhooks And How They Work]&lt;br /&gt;
&lt;br /&gt;
[[Exemple bàsic de funcionament de Webhooks. Servidor i client en node.js]]&lt;br /&gt;
&lt;br /&gt;
== Programació local (ordinadors d'escriptori i dispositius mòbils) ==&lt;br /&gt;
[https://binefa.cat/IoT/mqtt/MQTT_Dash/ Configuració de MQTT Dash (aplicació per Android)]&lt;br /&gt;
&lt;br /&gt;
=== Mosquitto local a l'ordinador ===&lt;br /&gt;
[https://www.vultr.com/docs/how-to-install-mosquitto-mqtt-broker-server-on-ubuntu-16-04 How to Install Mosquitto MQTT Broker/Server on Ubuntu 16.04]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/downloads/ Instal·lació de Mosquitto a Windows]&lt;br /&gt;
&lt;br /&gt;
Per a actualitzar les claus dels dipòsits de Debian:&lt;br /&gt;
 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key&lt;br /&gt;
 sudo apt-key add mosquitto-repo.gpg.key&lt;br /&gt;
&lt;br /&gt;
=== SCADA ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=SCADA_fent_servir_Python_QML_i_Arduino SCADA fent servir Python QML i Arduino]&lt;br /&gt;
&lt;br /&gt;
== Núvol ==&lt;br /&gt;
=== Instal·lació de Node.js i npm ===&lt;br /&gt;
[https://github.com/nodesource/distributions/blob/master/README.md Instal·lació de node i npm]&lt;br /&gt;
 ecat@iot-ecat:~$ '''sudo bash'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''curl -sL https://deb.nodesource.com/setup_14.x | bash -'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''apt install -y nodejs'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''exit'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''node --version'''&lt;br /&gt;
 v14.15.4&lt;br /&gt;
 ecat@iot-ecat:~$ '''npm -- version'''&lt;br /&gt;
 6.14.10&lt;br /&gt;
&lt;br /&gt;
=== Node-RED ===&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf Introducció al Node-RED]&lt;br /&gt;
&lt;br /&gt;
[[Gestió de Node-RED]]&lt;br /&gt;
&lt;br /&gt;
[https://www.aprendiendoarduino.com/cursos/node-red-developer-para-iot-nivel-i/ Node-RED Developer para IoT. Nivel I]&lt;br /&gt;
&lt;br /&gt;
==== Instal·lació i funcionament del NodeRed autònom ====&lt;br /&gt;
 ecat@iot-ecat:~$ '''mkdir bin'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''cd bin'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''sudo apt install unzip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''mkdir nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''cd nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''wget https://www.binefa.cat/IoT/nodeRed/node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''unzip node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''node node_modules/node-red/red.js --userDir node_modules/node-red/data --settings node_modules/node-red/settings.js -v --port 2222 --title elmeuTitol --safe flows_meuTitol.json'''&lt;br /&gt;
&lt;br /&gt;
==== UDP ====&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/udpServer/udpServer_nodered_code.txt Codi NodeRED per a esp8266_udpServer_01.ino i esp32_udpServer_01b]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_i_MQTTS MQTT i MQTTS]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex00/ Exemple amb MQTT i NodeRED emprant ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex01/ Exercici amb MQTT i NodeRED emprant ESP8266]&lt;br /&gt;
&lt;br /&gt;
[[Elevador en Snap! controlat remotament amb MQTT mitjançant NodeRED fent crides HTTP]]&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer]&lt;br /&gt;
&lt;br /&gt;
==== Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Un_exemple_d%27us_de_Telegram_amb_el_NodeRed Un exemple d'us de Telegram amb el NodeRed]&lt;br /&gt;
&lt;br /&gt;
==== Modbus TCP ====&lt;br /&gt;
[https://binefa.cat/IoT/modbus/ Arxius per treballar amb Modbus TCP] [https://www.binefa.cat/php/doc/modbus/ El segon vídeo explica i compara Modbus RTU i Modbus TCP] &lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/modbusCtrl/ ModBus TCP al NodeRED]&lt;br /&gt;
&lt;br /&gt;
==== Alguns nodes extra ====&lt;br /&gt;
[https://flows.nodered.org/node/node-red-contrib-google-sheets node-red-contrib-google-sheets]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/sammachin/node-red-contrib-google-sheets node-red-contrib-google-sheets al Github]&lt;br /&gt;
&lt;br /&gt;
=== Sistemes d'emmagatzematge i visualització ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=InfluxDB Base de dades de sèries temporals InfluxDB]&lt;br /&gt;
&lt;br /&gt;
[http://docs.grafana.org/installation/debian/ Instal·lació de Grafana a Debian][en]&lt;br /&gt;
&lt;br /&gt;
[[Sentilo]]&lt;br /&gt;
&lt;br /&gt;
=== Xarxes d'àrea estesa de baix consum (LPWAN) ===&lt;br /&gt;
==== Conceptes teòrics ====&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Xarxa_de_llarg_abast Xarxa de llarg abast (WAN)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Chirp_spread_spectrum Espectre eixamplat (Chirp Spread Spectrum)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_seq%C3%BC%C3%A8ncia_directa Espectre eixamplat per seqüència directa (DSSS)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_salt_de_freq%C3%BC%C3%A8ncia Espectre eixamplat per salt de freqüència (FHSS)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LPWAN What is LPWAN?]&lt;br /&gt;
&lt;br /&gt;
[https://cms.edn.com/ContentEETimes/Documents/EDN/LP%20WAN%20Comparison%20Table%20final.pdf Comparison table of Low Power WAN alternatives]&lt;br /&gt;
&lt;br /&gt;
==== LoRa ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
==== SigFox ====&lt;br /&gt;
[https://docs.pycom.io/chapter/tutorials/sipy/register.html Registering SiPy with Sigfox]&lt;br /&gt;
&lt;br /&gt;
[[Interacció amb SiPy1.0r de pycom]]&lt;br /&gt;
&lt;br /&gt;
==== Antenes ====&lt;br /&gt;
[https://youtu.be/CJNq2I_PDHQ Andreas Spiess video: &amp;quot;#182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge)&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Bots ===&lt;br /&gt;
==== Bot de Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Bot_de_Telegram Bot de Telegram]&lt;br /&gt;
&lt;br /&gt;
==== Bot de Mastodon ====&lt;br /&gt;
No totes les instàncies de [https://ca.wikipedia.org/wiki/Mastodon_(xarxa_social) Mastodon] faciliten la instal·lació de bots. Per a fer les primeres passes us recomano aquesta [https://botsin.space/ instància pensada per allotjar bots de Mastodon].&lt;br /&gt;
&lt;br /&gt;
[https://botsin.space/@siarq_sensors Exemple de bot de Mastodon] per a fer lectures de sensors cada hora.&lt;br /&gt;
&lt;br /&gt;
[https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26 Getting credentials for the Mastodon API with Mastodon.py, step by step]&lt;br /&gt;
&lt;br /&gt;
=== VPS ===&lt;br /&gt;
[[Introducció als contenidors docker]]&lt;br /&gt;
&lt;br /&gt;
[[Servidor intermediari invers]]&lt;br /&gt;
&lt;br /&gt;
[[Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[File Browser]]&lt;br /&gt;
&lt;br /&gt;
[[Apache i PHP]]&lt;br /&gt;
&lt;br /&gt;
[[Redireccions a subdomini]]&lt;br /&gt;
&lt;br /&gt;
[[Mastodon]]&lt;br /&gt;
&lt;br /&gt;
[https://medium.com/himinds/mqtt-broker-with-secure-websocket-using-traefik-docker-compose-and-lets-encrypt-2b8e32207555 MQTT broker with Secure WebSocket using Traefik, Docker Compose and Let’s Encrypt]&lt;br /&gt;
&lt;br /&gt;
[https://broker.binefa.cat/wordpressTraefik.html Guia completa: Instal·lació de Traefik + WordPress + PHP + MariaDB des de zero]&lt;br /&gt;
&lt;br /&gt;
[https://broker.binefa.cat/guia.html Guia completa: Instal·lació de Mosquitto MQTT amb Traefik en VPS]&lt;br /&gt;
&lt;br /&gt;
[[Moodle a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Node-RED a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Snap! a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[VPN WireGuard]]&lt;br /&gt;
&lt;br /&gt;
== Snap! ==&lt;br /&gt;
[https://github.com/jmoenig/Snap Snap! al GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''amb''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''sense''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
=== JavaScript per defecte ===&lt;br /&gt;
Per raons de seguretat, s'ha desactivat el JavaScript per defecte. Si us munteu el vostre propi servei al núvol, per a poder cridar programes vostres amb funcions amb JavaScript, heu d'afegir aquesta línia, en negreta, a l'arxiu ''[https://github.com/jmoenig/Snap/blob/master/snap.html snap.html]'':&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            '''Process.prototype.enableJS = true;''' // &amp;lt;-- Per a tenir seleccionat el JS per defecte&lt;br /&gt;
            var world;&lt;br /&gt;
            window.onload = function () {&lt;br /&gt;
                if ('serviceWorker' in navigator) {&lt;br /&gt;
                    navigator.serviceWorker.register('sw.js');&lt;br /&gt;
                }&lt;br /&gt;
                world = new WorldMorph(document.getElementById('world'));&lt;br /&gt;
                new IDE_Morph().openIn(world);&lt;br /&gt;
                loop();&lt;br /&gt;
            };&lt;br /&gt;
            function loop() {&lt;br /&gt;
                requestAnimationFrame(loop);&lt;br /&gt;
                world.doOneCycle();&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MQTT for Snap! ===&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT4Snap !], desenvolupat per en Xavier Pi.&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld.xml Hello World emprant MQTT '''amb''' SSL]&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html#open:http://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld_NoSSL.xml Hello World emprant MQTT '''sense''' SSL]&lt;br /&gt;
=== Intel·ligència Artificial ===&lt;br /&gt;
* [https://snap.berkeley.edu/snap/snap.html#open:https://xavierpi.com/ia/ia.xml Connexió amb Gemini] Cal una [https://aistudio.google.com/app/apikey clau d'API (API key)] ([https://ai.google.dev/gemini-api/docs/quickstart?lang=python Guia ràpida d'ús a l'API de Gemini])&lt;br /&gt;
&amp;lt;!-- AIzaSyBINpQKh7Sj8WyIV-PmNfo157Pg8LQr8JY --&amp;gt;&lt;br /&gt;
* [https://ecraft2learn.github.io/ai/AI-Teacher-Guide/chapter-2.html Reconeixement de veu amb Snap!] ([https://ecraft2learn.github.io/ai/snap/snap.html?project=listening&amp;amp;editMode Accés directe al projecte amb Snap!])&lt;br /&gt;
&lt;br /&gt;
= Una aproximació a OPC-UA =&lt;br /&gt;
&lt;br /&gt;
[[OPC-UA]]&lt;br /&gt;
&lt;br /&gt;
= Placa IoT-02 =&lt;br /&gt;
[[Placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
== Programació remota (OTA) ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Esp32Ota.png|center|Programacio OTA de la placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
=== Dos programes de prova de programació remota ===&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_01.zip IoT-02_OTAWebUpdater_01] (Fa pampallugues el led blanc) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_02.zip IoT-02_OTAWebUpdater_02] (Fa pampallugues el led verd) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
=== Programació a la vora (''edge'') ===&lt;br /&gt;
L'ordinador a la vora (''edge'') pot ser un ordinador normal, habitualment de poca potència, del tipus Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Per a tenir visibilitat externa de la pàgina web servida per la placa IoT-02 (per exemple amb la IP 192.168.1.151:80), ho redireccionarem a un port ( 192.168.1.151:80 --&amp;gt; localhost:5001 )&lt;br /&gt;
&lt;br /&gt;
Per a fer funcionar [https://www.binefa.cat/training/iot02/ota/edge/simple-port-forwarding.js simple-port-forwarding.js] caldrà haver afegit el paquet '''http-proxy''':&lt;br /&gt;
&lt;br /&gt;
 npm install http-proxy&lt;br /&gt;
&lt;br /&gt;
El codi nodejs de redireccionament (suposant que la placa IoT-02 ha adquirit l'adreça IP 192.168.1.151):&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '192.168.1.151';&lt;br /&gt;
 var portOrigen = 80;&lt;br /&gt;
 var portDesti = 5001;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
Per a fer aquest redireccionador sigui un servei, es copia [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service] a la carpeta '''/etc/systemd/system''' o el fem de nou amb un editor:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/systemd/system&lt;br /&gt;
 sudo nano [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service]&lt;br /&gt;
 sudo chmod 755 myForwardingService.service&lt;br /&gt;
 sudo systemctl daemon-reload&lt;br /&gt;
 sudo systemctl '''start''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
Per a veure l'estat del servei:&lt;br /&gt;
 systemctl '''status''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
I per a fer que el servei es posi en marxa al reiniciar l'ordinador a la vora:&lt;br /&gt;
 sudo systemctl '''enable''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
=== Programació al núvol ===&lt;br /&gt;
Mitjançant una xarxa virtual privada (VPN) de l'estil [https://www.zerotier.com/ ZeroTier] podem fer que l'ordinador a la vora i l'ordinador al núvol comparteixin la mateixa xarxa.&lt;br /&gt;
&lt;br /&gt;
Suposant que l'ordinador a la vora té la IP 10.242.156.158, podem redireccionar-hi 10.242.156.158:5001 --&amp;gt; localhost:7007 :&lt;br /&gt;
&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '10.242.156.158';&lt;br /&gt;
 var portOrigen = 5001;&lt;br /&gt;
 var portDesti = 7007;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
I així tenim accés remot des del núvol, connectant mitjançant l'ordinador a la vora que es connecta a la placa IoT-02. &lt;br /&gt;
&lt;br /&gt;
Per accedir-hi des del navegador, escriviu a la URL: &lt;br /&gt;
 &amp;lt;nom_de_domini&amp;gt;:7007&lt;br /&gt;
Això visualitzarà el que presenta l'ordinador a la vora (la IP és la VPN a l'ordinador a la vora):&lt;br /&gt;
 10.242.156.158:5001&lt;br /&gt;
Que al seu temps presenta el servei pel port 80 de la placa IOT-02 connectada a la mateixa xarxa local que l'ordinador a la vora:&lt;br /&gt;
 192.168.1.151&lt;br /&gt;
&lt;br /&gt;
=== Els tres mètodes de programació OTA de l'ESP32 ===&lt;br /&gt;
[https://www.programmersought.com/article/90864120754/ How to implement OTA online update of ESP32 firmware]&lt;br /&gt;
&lt;br /&gt;
== MicroPython ==&lt;br /&gt;
[https://www.digikey.es/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce MicroPython Basics: Load Files &amp;amp; Run Code]&lt;br /&gt;
&lt;br /&gt;
[https://warped3.substack.com/p/compiling-micropython-with-espressif Compiling microPython with espressif SDK 4.4 for ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://docs.micropython.org/en/latest/esp32/tutorial/intro.html Getting started with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython The MicroPython project]&lt;br /&gt;
&lt;br /&gt;
[https://cdn-learn.adafruit.com/downloads/pdf/micropython-basics-loading-modules.pdf MicroPython Basics: Loading Modules]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/robert-hh/FTP-Server-for-ESP8266-ESP32-and-PYBD uftpd: small FTP server for ESP8266, ESP32 and Pyboard D]&lt;br /&gt;
&lt;br /&gt;
[https://electronicsinnovation.com/connect-esp32-to-ubidots-using-micropython-over-mqtt-with-visual-studio-code/ Connect ESP32 to Ubidots using Micropython over MQTT with Visual Studio Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peterhinch Peter Hinch's GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://wolles-elektronikkiste.de/en/programming-the-esp32-with-micropython Programming the ESP32 with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://awesome-micropython.com/ A curated list of awesome MicroPython libraries, frameworks, software and resources]&lt;br /&gt;
=== asyncio ===&lt;br /&gt;
[https://www.youtube.com/watch?v=5VLvmA__2v0 How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics]&lt;br /&gt;
=== Threads ===&lt;br /&gt;
[https://github.com/kevinmcaleer/threads Micropython thread tutorial]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=QeDnjcdGrpY Video: Micropython Threads - Use Both Cores, on Raspberry Pi Pico and ESP32]&lt;br /&gt;
=== MQTT ===&lt;br /&gt;
[https://bhave.sh/micropython-mqtt/ Secrets of MicroPython: MQTT on ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://wokwi.com/projects/341892004923310676 Exemple MQTT sobre micropython funcionant al wokwi] ([https://wokwi.com/projects/341895401936257620 Un exemple més compacte])&lt;br /&gt;
&lt;br /&gt;
=== Modbus ===&lt;br /&gt;
==== Modifying source code ====&lt;br /&gt;
[https://github.com/brainelectronics/micropython-modbus MicroPython Modbus library]&lt;br /&gt;
&lt;br /&gt;
Modbus control signal able to send or receive messages can be controlled directly by UART. To do that, file [https://github.com/mrvelic/micropython/blob/master/ports/esp32/machine_uart.c machine_uart.c] should be changed.&lt;br /&gt;
&lt;br /&gt;
Changes to be able to use Tx/Rx MAX3485 pin: [https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Information about Modbus an MicroPython has been got from this forum: https://github.com/micropython/micropython/pull/5567&lt;br /&gt;
==== Based on pycom-modbus from pycom ====&lt;br /&gt;
[https://github.com/danjperron/micropython-modbus Modbus Master library for MicroPython ESP32 devices]&lt;br /&gt;
=== LoRa ===&lt;br /&gt;
[https://github.com/martynwheeler/u-lora This is a port of raspi-lora for micropython]&lt;br /&gt;
&lt;br /&gt;
= IoT-Vertebrae =&lt;br /&gt;
== Raspberry ==&lt;br /&gt;
[[Configuració de la WiFi a la Raspberry Pi emprant nmtui]]&lt;br /&gt;
&lt;br /&gt;
[[Reconnexió automàtica a la WiFi]]&lt;br /&gt;
&lt;br /&gt;
[[WireGuard VPN]]&lt;br /&gt;
&lt;br /&gt;
= Exemples pràctics =&lt;br /&gt;
== Sensor ModBus de temperatura i humitat CWT-TH03S ==&lt;br /&gt;
[https://www.aliexpress.com/item/1005001404952412.html CWT-TH03S a AliExpress]&lt;br /&gt;
&lt;br /&gt;
[[Accés ModBus al sensor de temperatura i humitat CWT-TH03S]]&lt;br /&gt;
&lt;br /&gt;
= SBC =&lt;br /&gt;
== PocketBeagle ==&lt;br /&gt;
=== Grove Kit ===&lt;br /&gt;
==== Visió general ====&lt;br /&gt;
[https://beagleboard.org/Kits/Grove Informació comercial del Grove Kit]&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/pocket Informació comercial de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki Wiki de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual System Reference Manual] &amp;lt;----&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/latest-images Darreres imatges per a les SD]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/capes/tree/master/pocketbeagle/Grove Disseny del Grove Cape]&lt;br /&gt;
&lt;br /&gt;
==== Primera connexió a la xarxa sense fils ====&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$ '''sudo connmanctl'''⏎&lt;br /&gt;
 [sudo] password for debian: temppwd⏎&lt;br /&gt;
 connmanctl&amp;gt; '''scan wifi'''⏎&lt;br /&gt;
 Scan completed for wifi&lt;br /&gt;
 connmanctl&amp;gt; '''services'''⏎&lt;br /&gt;
       MyWifi                  wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''agent on'''⏎&lt;br /&gt;
 Agent registered&lt;br /&gt;
 connmanctl&amp;gt; '''connect wifi_1234567890_1234567890123456_managed_psk'''⏎&lt;br /&gt;
 Agent RequestInput wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
       Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]&lt;br /&gt;
       WPS = [ Type=wpspin, Requirement=alternate ]&lt;br /&gt;
 Passphrase? '''MySecretPassphrase'''⏎&lt;br /&gt;
 Connected wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''quit'''⏎&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$&lt;br /&gt;
&lt;br /&gt;
==== Tutorials ====&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/blob/master/PocketBeagle/Grove/workshop-handouts.md Blink PocketBeagle on-board USRx LED]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/tree/master/PocketBeagle/Grove Exemples]&lt;br /&gt;
&lt;br /&gt;
= Formació =&lt;br /&gt;
[https://www.binefa.com/index.php/IoT_amb_Arduino_i_Raspberry_Pi._Microcontroladors_d%27%C3%BAs_professional._Curs_Presencial._Edici%C3%B3_de_mar%C3%A7_de_2022 IoT amb Arduino i Raspberry Pi. Microcontroladors d'ús professional. Curs Presencial. Edició de març de 2022] - [https://formacio.eic.cat/cursos/1123577 Formació al Col·legi d'Enginyers Industrials de Catalunya] (30 / març / 2022)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Sistemes_encastats_d%27escala_petita_i_mitjana._Edici%C3%B3_d%27octubre_2021 Sistemes encastats d'escala petita i mitjana. Edició d'octubre 2021] (20 / octubre / 2021)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways)_IoT_(22_de_mar%C3%A7_de_2022) Nodes sensors (motes) i passarel·les (gateways) IoT (22 de març de 2022)] pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2022) Tecnologías IoT, Hands on y MVP (2022)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Diada_de_la_Llibertat_del_Maquinari_(Edici%C3%B3_2021) Diada de la Llibertat del Maquinari (Edició 2021)] (17 d'abril de 2021)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2021) Tecnologías IoT, Hands on y MVP (2021)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways) Nodes sensors (motes) i passarel·les (gateways)]  pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria] (23 de març de 2021)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Monitoritzaci%C3%B3_de_la_qualitat_de_l%27aire_mesurant_CO2_i_VOC_amb_LoRa Monitorització de la qualitat de l'aire mesurant CO2 i VOC amb LoRa] (9 de gener de 2021)&lt;br /&gt;
&lt;br /&gt;
[[Curset introductori d'Internet de les Coses per ADTelecom]] (Comença el 5 de novembre de 2020)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=%C3%9As_de_les_dades_generades_pels_sensors_LoRaWAN_i_arquitectura_del_sistema._Rub%C3%AD_2020 Ús de les dades generades pels sensors LoRaWAN i arquitectura del sistema. Rubí, 17 de juny de 2020]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Curset_a_TE_Connectivity_del_4_de_mar%C3%A7_de_2020 Curset a TE Connectivity del 4 de març de 2020] a [https://www.te.com/ TE Connectivity]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] (Ajuntament de Viladecans, 19 de febrer de 2020)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://www.binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2020) Tecnologías IoT, Hands on y MVP (2020)]&lt;br /&gt;
&lt;br /&gt;
UPC-School - 21802500 - Màster Industria 4.0 [https://wiki.binefa.cat/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP Tecnologías IoT, Hands on y MVP] (2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] a l'[http://www.icm.csic.es/ Institut de Ciències del Mar] (27 / setembre / 2018 i 25 / setembre / 2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_a_Internet_de_les_Coses_-_juny_2018 Introducció a Internet de les Coses - juny 2018] (Curset de formació per a professors de CF realitzat a l'[https://agora.xtec.cat/iesramblaprim/ Institut Rambla Prim])&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Sunna LoRa RMM v3.0]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Xifratge =&lt;br /&gt;
[[Eines de xifratge en línia]]&lt;br /&gt;
&lt;br /&gt;
= Opinió =&lt;br /&gt;
[http://www.xavierpi.com/mi40/HaciaUnIoT_democraticoYEfectivo.pdf Hacia un Internet de las Cosas democrático y efectivo] per Xavier Pi (octubre 2018)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Auxiliar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;MediaWiki s'ha instal·lat.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consulteu la [https://meta.wikimedia.org/wiki/Help:Contents Guia d'Usuari] per a més informació sobre com utilitzar aquest programari wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Primers passos ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Llista de paràmetres configurables]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ PMF del MediaWiki]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce Llista de correu per a anuncis del MediaWiki]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Traducció de MediaWiki en la vostra llengua]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Aprengueu com combatre la brossa que pot atacar el vostre wiki]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47729</id>
		<title>Pàgina principal</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47729"/>
		<updated>2025-02-10T13:00:18Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Intel·ligència Artificial */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size:500%&amp;quot;&amp;gt;things.cat&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:300%&amp;quot;&amp;gt;Una pàgina pràctica sobre la Internet de les Coses&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Dispositius IoT. Maquinari i microprogramari =&lt;br /&gt;
Al '''maquinari''' li diem'' '''hardware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
Al '''microprogramari''' li diem'' '''firmware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
'''IoT''' és l'acrònim d'''Internet of Things''. En català abreujat li podríem dir '''IdC''' per a referir-nos a '''la Internet de les Coses'''. En el moment d'escriure aquest text, la comunitat catalanoparlant sembla haver optat per referir-se als '''dispositius de la Internet de les Coses''' com a '''dispositius IoT'''. Si el [https://www.termcat.cat/ca/neoloteca/ termcat] es pronuncia de manera diferent, provaré d'adaptar la terminologia.&lt;br /&gt;
&lt;br /&gt;
== Placa IoT-02 ==&lt;br /&gt;
[https://www.binefa.com/index.php/Placa_IoT-02 Placa_IoT-02]&lt;br /&gt;
&lt;br /&gt;
== Controladors ==&lt;br /&gt;
Als '''controladors''' els hi diem'' '''drivers''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
El xip '''FT232''' ha estat durant molt de temps el xip més comú per convertir d''''USB a UART'''. Fins al punt que se'n van fer còpies pirates. Una actualització del sistema operatiu privatiu Windows va explotar una característica dels xips pirates: els xips pirates tenien el registre d'identificació USB de lectura i escriptura i l'original era tan sols de lectura. L'actualització que va fer Windows provocava l'escriptura d'aquest registre i hi escrivia un zero, que feia que el sistema operatiu ho identifiqués com a concentrador USB i no com a controlador d'UART, fent que el maquinari quedés inservible. A l'any 2014 em vaig veure atrapat amb uns quants Arduino Nano que duien aquest xip pirata i vaig escriure [https://binefa.cat/blog/?p=80 How to recover bricked fake FT232] per a poder-los reprogramar i poder-los fer servir amb sistemes operatius lliures GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
A partir d'aquell moment, bona part de les plaques de fabricació xinesa van començar a dur, massivament, el xip '''CH340''' per a convertir d'USB a UART.&lt;br /&gt;
&lt;br /&gt;
[[Controlador CH340]]&lt;br /&gt;
&lt;br /&gt;
[[Controlador FT232]]&lt;br /&gt;
&lt;br /&gt;
== C / C++ ==&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-libraries Biblioteques per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes Codis per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
=== ESP8266 ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Afegint_la_targeta_ESP8266_a_l%27IDE_d%27Arduino Afegint la targeta ESP8266 a l'IDE d'Arduino] (NodeMCU1.0)&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp8266_udpServer_01b esp8266_udpServer_01.ino] Codi UDP per a ESP8266&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_a_l%27ESP8266 MQTT a l'ESP8266]&lt;br /&gt;
&lt;br /&gt;
=== ESP32 ===&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_udpServer_01b esp32_udpServer_01b] Codi UDP per a ESP32&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_i2cScanner_02 esp32_i2cScanner_02.ino Adreces de dispositius I2C connectats]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/modbus/rtu/esp32/ Exemple de ModBus RTU fent servir NodeRED i ESP32 (amb la placa IoT PLB)]&lt;br /&gt;
&lt;br /&gt;
[https://techtutorialsx.com/2017/05/06/esp32-arduino-creating-a-task/ ESP32 Arduino: Creating a FreeRTOS task]&lt;br /&gt;
&lt;br /&gt;
[https://savjee.be/2020/01/multitasking-esp32-arduino-freertos/ Multitasking on ESP32 with Arduino and FreeRTOS]&lt;br /&gt;
&lt;br /&gt;
==== Modbus ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#overview-of-rs485-specific-communication-options Overview of RS485 specific communication options]&lt;br /&gt;
&lt;br /&gt;
[https://pastebin.com/2PtWJvd6 Example setting RS485 at half duplex mode]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/IoT-02/tree/master/codes/IoT-02_11_modbus_bme280_02 Code IoT-02_11_modbus_bme280_02] using RS485 at half duplex mode&lt;br /&gt;
&lt;br /&gt;
==== ESP-IDF ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ Get Started]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html Get started with ESP-IDF and ESP32-DevKitC: debugging, unit testing, project analysis]&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
=== Accés al maquinari de la Raspberry Pi emprant Python ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Com_connectar-hi_pantalles_OLED_SSD1306_(128x64) Com connectar-hi pantalles OLED SSD1306 (128x64)]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=%C3%9As_d%27entrades_anal%C3%B2giques_amb_l%27ADS115_controlant_sortides_PWM Ús d'entrades analògiques amb l'ADS115 controlant sortides PWM]&lt;br /&gt;
&lt;br /&gt;
=== Micropython ===&lt;br /&gt;
[https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome Micropython and the Internet of Things]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp8266 MicroPython port to ESP8266]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp32 MicroPython port to the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://icircuit.net/esp32-micropython-getting-started/1999 ESP32 – Getting started with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-on-the-esp32-decdd32c4720 Get on the Good Foot with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-part-2-e1f2efaad50b Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor DS18B20 (One Wire Interface)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/gloveboxes/ESP32-MicroPython-BME280-MQTT-Sample Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor BME280 (I2C)]&lt;br /&gt;
&lt;br /&gt;
=== CircuitPython ===&lt;br /&gt;
[https://learn.adafruit.com/circuitpython-with-esp32-quick-start CircuitPython on ESP32 Quick Start]&lt;br /&gt;
&lt;br /&gt;
== Sistemes operatius encastats ==&lt;br /&gt;
=== Raspbian ===&lt;br /&gt;
[https://www.raspberrypi.org/documentation/computers/remote-access.html Remote Access]&lt;br /&gt;
&lt;br /&gt;
[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ How to Install Mosquitto Broker on Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Adaptaci%C3%B3_per_a_que_la_Raspberry_Pi_funcioni_com_a_punt_d%27acc%C3%A9s_donant_adreces_IP_de_classe_B Adaptació per a que la Raspberry Pi funcioni com a punt d'accés donant adreces IP de classe B]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_dels_nodes_node-red-contrib-ttn_i_node-red-contrib-modbustcp-no-pooling_a_la_Raspberry_Pi Instal·lació dels nodes node-red-contrib-ttn i node-red-contrib-modbustcp-no-pooling a la Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_de_l%27OPC-UA_a_la_Raspberry_Pi,_fent_servir_Python,_i_control_des_d%27Indusoft Instal·lació de l'OPC-UA a la Raspberry Pi, fent servir Python, i control des d'Indusoft]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Pr%C3%A0ctica_de_connexi%C3%B3_remota_a_una_Raspberry_Pi Pràctica de connexió remota a una Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://core-electronics.com.au/guides/read-only-raspberry-pi/ Read-Only Raspberry Pi - Never Corrupt your Micro-SD Card]&lt;br /&gt;
==== Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb ''docker'' ====&lt;br /&gt;
[[Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker]]&lt;br /&gt;
&lt;br /&gt;
=== Mongoose OS ===&lt;br /&gt;
[https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md Guia ràpida d'introducció a Mongoose OS][en]&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
[[Sensors de so]]&lt;br /&gt;
&lt;br /&gt;
= Control remot dels dispositius IoT. Programari =&lt;br /&gt;
Al '''programari''' li diuen'' '''software''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
[https://binefa.cat/IoT/teoria/ethernetTcpUdp_00.pdf TCP/UDP Capa de transport d'Ethernet]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació d'un servidor de sòcols web a un Debian amb Apache]]&lt;br /&gt;
&lt;br /&gt;
=== MQTT(S) ===&lt;br /&gt;
[https://binefa.cat/IoT/teoria/mqtt_00.pdf Introducció a MQTT]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt/ Beginners Guide To The MQTT Protocol] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[https://www.rs-online.com/designspark/mqtt MQTT] explained by Andy Stanford-Clark (co-inventor of MQTT). Article written in 2017, and refering to v3.1.1&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/mqtt-5/ MQTT 5 Essentials] by HiveMQ&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt-hosting-brokers-and-servers/ MQTT Brokers/Servers and Cloud Hosting Guide] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer] An all-round MQTT client that provides a structured topic overview&lt;br /&gt;
&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT a Snap!]&lt;br /&gt;
&lt;br /&gt;
==== Public MQTT(S) brokers ====&lt;br /&gt;
[http://test.mosquitto.org/ mosquitto]&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/public-mqtt-broker/ HiveMQ MQTT broker]&lt;br /&gt;
&lt;br /&gt;
[https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/ MQTT brokers online with a free offer to test and connect IoT to the internet]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) implementations ====&lt;br /&gt;
[http://binefa.com/index.php?title=MQTTS_y_NodeRED MQTTS y NodeRED]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations Comparison of MQTT implementations]&lt;br /&gt;
&lt;br /&gt;
[http://test.mosquitto.org/ test.mosquitto.org]&lt;br /&gt;
&lt;br /&gt;
[https://www.emqx.io/ emqx.io]&lt;br /&gt;
&lt;br /&gt;
[https://vernemq.com/ VerneMQ]&lt;br /&gt;
&lt;br /&gt;
=== Webhooks ===&lt;br /&gt;
[https://hookdeck.com/guides/webhooks/what-are-webhooks-how-they-work What Are Webhooks And How They Work]&lt;br /&gt;
&lt;br /&gt;
[[Exemple bàsic de funcionament de Webhooks. Servidor i client en node.js]]&lt;br /&gt;
&lt;br /&gt;
== Programació local (ordinadors d'escriptori i dispositius mòbils) ==&lt;br /&gt;
[https://binefa.cat/IoT/mqtt/MQTT_Dash/ Configuració de MQTT Dash (aplicació per Android)]&lt;br /&gt;
&lt;br /&gt;
=== Mosquitto local a l'ordinador ===&lt;br /&gt;
[https://www.vultr.com/docs/how-to-install-mosquitto-mqtt-broker-server-on-ubuntu-16-04 How to Install Mosquitto MQTT Broker/Server on Ubuntu 16.04]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/downloads/ Instal·lació de Mosquitto a Windows]&lt;br /&gt;
&lt;br /&gt;
Per a actualitzar les claus dels dipòsits de Debian:&lt;br /&gt;
 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key&lt;br /&gt;
 sudo apt-key add mosquitto-repo.gpg.key&lt;br /&gt;
&lt;br /&gt;
=== SCADA ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=SCADA_fent_servir_Python_QML_i_Arduino SCADA fent servir Python QML i Arduino]&lt;br /&gt;
&lt;br /&gt;
== Núvol ==&lt;br /&gt;
=== Instal·lació de Node.js i npm ===&lt;br /&gt;
[https://github.com/nodesource/distributions/blob/master/README.md Instal·lació de node i npm]&lt;br /&gt;
 ecat@iot-ecat:~$ '''sudo bash'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''curl -sL https://deb.nodesource.com/setup_14.x | bash -'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''apt install -y nodejs'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''exit'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''node --version'''&lt;br /&gt;
 v14.15.4&lt;br /&gt;
 ecat@iot-ecat:~$ '''npm -- version'''&lt;br /&gt;
 6.14.10&lt;br /&gt;
&lt;br /&gt;
=== Node-RED ===&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf Introducció al Node-RED]&lt;br /&gt;
&lt;br /&gt;
[[Gestió de Node-RED]]&lt;br /&gt;
&lt;br /&gt;
[https://www.aprendiendoarduino.com/cursos/node-red-developer-para-iot-nivel-i/ Node-RED Developer para IoT. Nivel I]&lt;br /&gt;
&lt;br /&gt;
==== Instal·lació i funcionament del NodeRed autònom ====&lt;br /&gt;
 ecat@iot-ecat:~$ '''mkdir bin'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''cd bin'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''sudo apt install unzip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''mkdir nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''cd nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''wget https://www.binefa.cat/IoT/nodeRed/node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''unzip node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''node node_modules/node-red/red.js --userDir node_modules/node-red/data --settings node_modules/node-red/settings.js -v --port 2222 --title elmeuTitol --safe flows_meuTitol.json'''&lt;br /&gt;
&lt;br /&gt;
==== UDP ====&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/udpServer/udpServer_nodered_code.txt Codi NodeRED per a esp8266_udpServer_01.ino i esp32_udpServer_01b]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_i_MQTTS MQTT i MQTTS]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex00/ Exemple amb MQTT i NodeRED emprant ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex01/ Exercici amb MQTT i NodeRED emprant ESP8266]&lt;br /&gt;
&lt;br /&gt;
[[Elevador en Snap! controlat remotament amb MQTT mitjançant NodeRED fent crides HTTP]]&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer]&lt;br /&gt;
&lt;br /&gt;
==== Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Un_exemple_d%27us_de_Telegram_amb_el_NodeRed Un exemple d'us de Telegram amb el NodeRed]&lt;br /&gt;
&lt;br /&gt;
==== Modbus TCP ====&lt;br /&gt;
[https://binefa.cat/IoT/modbus/ Arxius per treballar amb Modbus TCP] [https://www.binefa.cat/php/doc/modbus/ El segon vídeo explica i compara Modbus RTU i Modbus TCP] &lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/modbusCtrl/ ModBus TCP al NodeRED]&lt;br /&gt;
&lt;br /&gt;
==== Alguns nodes extra ====&lt;br /&gt;
[https://flows.nodered.org/node/node-red-contrib-google-sheets node-red-contrib-google-sheets]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/sammachin/node-red-contrib-google-sheets node-red-contrib-google-sheets al Github]&lt;br /&gt;
&lt;br /&gt;
=== Sistemes d'emmagatzematge i visualització ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=InfluxDB Base de dades de sèries temporals InfluxDB]&lt;br /&gt;
&lt;br /&gt;
[http://docs.grafana.org/installation/debian/ Instal·lació de Grafana a Debian][en]&lt;br /&gt;
&lt;br /&gt;
[[Sentilo]]&lt;br /&gt;
&lt;br /&gt;
=== Xarxes d'àrea estesa de baix consum (LPWAN) ===&lt;br /&gt;
==== Conceptes teòrics ====&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Xarxa_de_llarg_abast Xarxa de llarg abast (WAN)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Chirp_spread_spectrum Espectre eixamplat (Chirp Spread Spectrum)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_seq%C3%BC%C3%A8ncia_directa Espectre eixamplat per seqüència directa (DSSS)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_salt_de_freq%C3%BC%C3%A8ncia Espectre eixamplat per salt de freqüència (FHSS)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LPWAN What is LPWAN?]&lt;br /&gt;
&lt;br /&gt;
[https://cms.edn.com/ContentEETimes/Documents/EDN/LP%20WAN%20Comparison%20Table%20final.pdf Comparison table of Low Power WAN alternatives]&lt;br /&gt;
&lt;br /&gt;
==== LoRa ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
==== SigFox ====&lt;br /&gt;
[https://docs.pycom.io/chapter/tutorials/sipy/register.html Registering SiPy with Sigfox]&lt;br /&gt;
&lt;br /&gt;
[[Interacció amb SiPy1.0r de pycom]]&lt;br /&gt;
&lt;br /&gt;
==== Antenes ====&lt;br /&gt;
[https://youtu.be/CJNq2I_PDHQ Andreas Spiess video: &amp;quot;#182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge)&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Bots ===&lt;br /&gt;
==== Bot de Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Bot_de_Telegram Bot de Telegram]&lt;br /&gt;
&lt;br /&gt;
==== Bot de Mastodon ====&lt;br /&gt;
No totes les instàncies de [https://ca.wikipedia.org/wiki/Mastodon_(xarxa_social) Mastodon] faciliten la instal·lació de bots. Per a fer les primeres passes us recomano aquesta [https://botsin.space/ instància pensada per allotjar bots de Mastodon].&lt;br /&gt;
&lt;br /&gt;
[https://botsin.space/@siarq_sensors Exemple de bot de Mastodon] per a fer lectures de sensors cada hora.&lt;br /&gt;
&lt;br /&gt;
[https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26 Getting credentials for the Mastodon API with Mastodon.py, step by step]&lt;br /&gt;
&lt;br /&gt;
=== VPS ===&lt;br /&gt;
[[Introducció als contenidors docker]]&lt;br /&gt;
&lt;br /&gt;
[[Servidor intermediari invers]]&lt;br /&gt;
&lt;br /&gt;
[[Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[File Browser]]&lt;br /&gt;
&lt;br /&gt;
[[Apache i PHP]]&lt;br /&gt;
&lt;br /&gt;
[[Redireccions a subdomini]]&lt;br /&gt;
&lt;br /&gt;
[[Mastodon]]&lt;br /&gt;
&lt;br /&gt;
[https://medium.com/himinds/mqtt-broker-with-secure-websocket-using-traefik-docker-compose-and-lets-encrypt-2b8e32207555 MQTT broker with Secure WebSocket using Traefik, Docker Compose and Let’s Encrypt]&lt;br /&gt;
&lt;br /&gt;
[[Moodle a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Node-RED a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Snap! a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[VPN WireGuard]]&lt;br /&gt;
&lt;br /&gt;
== Snap! ==&lt;br /&gt;
[https://github.com/jmoenig/Snap Snap! al GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''amb''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''sense''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
=== JavaScript per defecte ===&lt;br /&gt;
Per raons de seguretat, s'ha desactivat el JavaScript per defecte. Si us munteu el vostre propi servei al núvol, per a poder cridar programes vostres amb funcions amb JavaScript, heu d'afegir aquesta línia, en negreta, a l'arxiu ''[https://github.com/jmoenig/Snap/blob/master/snap.html snap.html]'':&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            '''Process.prototype.enableJS = true;''' // &amp;lt;-- Per a tenir seleccionat el JS per defecte&lt;br /&gt;
            var world;&lt;br /&gt;
            window.onload = function () {&lt;br /&gt;
                if ('serviceWorker' in navigator) {&lt;br /&gt;
                    navigator.serviceWorker.register('sw.js');&lt;br /&gt;
                }&lt;br /&gt;
                world = new WorldMorph(document.getElementById('world'));&lt;br /&gt;
                new IDE_Morph().openIn(world);&lt;br /&gt;
                loop();&lt;br /&gt;
            };&lt;br /&gt;
            function loop() {&lt;br /&gt;
                requestAnimationFrame(loop);&lt;br /&gt;
                world.doOneCycle();&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MQTT for Snap! ===&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT4Snap !], desenvolupat per en Xavier Pi.&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld.xml Hello World emprant MQTT '''amb''' SSL]&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html#open:http://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld_NoSSL.xml Hello World emprant MQTT '''sense''' SSL]&lt;br /&gt;
=== Intel·ligència Artificial ===&lt;br /&gt;
* [https://snap.berkeley.edu/snap/snap.html#open:https://xavierpi.com/ia/ia.xml Connexió amb Gemini] Cal una [https://aistudio.google.com/app/apikey clau d'API (API key)] ([https://ai.google.dev/gemini-api/docs/quickstart?lang=python Guia ràpida d'ús a l'API de Gemini])&lt;br /&gt;
&amp;lt;!-- AIzaSyBINpQKh7Sj8WyIV-PmNfo157Pg8LQr8JY --&amp;gt;&lt;br /&gt;
* [https://ecraft2learn.github.io/ai/AI-Teacher-Guide/chapter-2.html Reconeixement de veu amb Snap!] ([https://ecraft2learn.github.io/ai/snap/snap.html?project=listening&amp;amp;editMode Accés directe al projecte amb Snap!])&lt;br /&gt;
&lt;br /&gt;
= Una aproximació a OPC-UA =&lt;br /&gt;
&lt;br /&gt;
[[OPC-UA]]&lt;br /&gt;
&lt;br /&gt;
= Placa IoT-02 =&lt;br /&gt;
[[Placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
== Programació remota (OTA) ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Esp32Ota.png|center|Programacio OTA de la placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
=== Dos programes de prova de programació remota ===&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_01.zip IoT-02_OTAWebUpdater_01] (Fa pampallugues el led blanc) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_02.zip IoT-02_OTAWebUpdater_02] (Fa pampallugues el led verd) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
=== Programació a la vora (''edge'') ===&lt;br /&gt;
L'ordinador a la vora (''edge'') pot ser un ordinador normal, habitualment de poca potència, del tipus Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Per a tenir visibilitat externa de la pàgina web servida per la placa IoT-02 (per exemple amb la IP 192.168.1.151:80), ho redireccionarem a un port ( 192.168.1.151:80 --&amp;gt; localhost:5001 )&lt;br /&gt;
&lt;br /&gt;
Per a fer funcionar [https://www.binefa.cat/training/iot02/ota/edge/simple-port-forwarding.js simple-port-forwarding.js] caldrà haver afegit el paquet '''http-proxy''':&lt;br /&gt;
&lt;br /&gt;
 npm install http-proxy&lt;br /&gt;
&lt;br /&gt;
El codi nodejs de redireccionament (suposant que la placa IoT-02 ha adquirit l'adreça IP 192.168.1.151):&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '192.168.1.151';&lt;br /&gt;
 var portOrigen = 80;&lt;br /&gt;
 var portDesti = 5001;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
Per a fer aquest redireccionador sigui un servei, es copia [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service] a la carpeta '''/etc/systemd/system''' o el fem de nou amb un editor:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/systemd/system&lt;br /&gt;
 sudo nano [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service]&lt;br /&gt;
 sudo chmod 755 myForwardingService.service&lt;br /&gt;
 sudo systemctl daemon-reload&lt;br /&gt;
 sudo systemctl '''start''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
Per a veure l'estat del servei:&lt;br /&gt;
 systemctl '''status''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
I per a fer que el servei es posi en marxa al reiniciar l'ordinador a la vora:&lt;br /&gt;
 sudo systemctl '''enable''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
=== Programació al núvol ===&lt;br /&gt;
Mitjançant una xarxa virtual privada (VPN) de l'estil [https://www.zerotier.com/ ZeroTier] podem fer que l'ordinador a la vora i l'ordinador al núvol comparteixin la mateixa xarxa.&lt;br /&gt;
&lt;br /&gt;
Suposant que l'ordinador a la vora té la IP 10.242.156.158, podem redireccionar-hi 10.242.156.158:5001 --&amp;gt; localhost:7007 :&lt;br /&gt;
&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '10.242.156.158';&lt;br /&gt;
 var portOrigen = 5001;&lt;br /&gt;
 var portDesti = 7007;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
I així tenim accés remot des del núvol, connectant mitjançant l'ordinador a la vora que es connecta a la placa IoT-02. &lt;br /&gt;
&lt;br /&gt;
Per accedir-hi des del navegador, escriviu a la URL: &lt;br /&gt;
 &amp;lt;nom_de_domini&amp;gt;:7007&lt;br /&gt;
Això visualitzarà el que presenta l'ordinador a la vora (la IP és la VPN a l'ordinador a la vora):&lt;br /&gt;
 10.242.156.158:5001&lt;br /&gt;
Que al seu temps presenta el servei pel port 80 de la placa IOT-02 connectada a la mateixa xarxa local que l'ordinador a la vora:&lt;br /&gt;
 192.168.1.151&lt;br /&gt;
&lt;br /&gt;
=== Els tres mètodes de programació OTA de l'ESP32 ===&lt;br /&gt;
[https://www.programmersought.com/article/90864120754/ How to implement OTA online update of ESP32 firmware]&lt;br /&gt;
&lt;br /&gt;
== MicroPython ==&lt;br /&gt;
[https://www.digikey.es/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce MicroPython Basics: Load Files &amp;amp; Run Code]&lt;br /&gt;
&lt;br /&gt;
[https://warped3.substack.com/p/compiling-micropython-with-espressif Compiling microPython with espressif SDK 4.4 for ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://docs.micropython.org/en/latest/esp32/tutorial/intro.html Getting started with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython The MicroPython project]&lt;br /&gt;
&lt;br /&gt;
[https://cdn-learn.adafruit.com/downloads/pdf/micropython-basics-loading-modules.pdf MicroPython Basics: Loading Modules]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/robert-hh/FTP-Server-for-ESP8266-ESP32-and-PYBD uftpd: small FTP server for ESP8266, ESP32 and Pyboard D]&lt;br /&gt;
&lt;br /&gt;
[https://electronicsinnovation.com/connect-esp32-to-ubidots-using-micropython-over-mqtt-with-visual-studio-code/ Connect ESP32 to Ubidots using Micropython over MQTT with Visual Studio Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peterhinch Peter Hinch's GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://wolles-elektronikkiste.de/en/programming-the-esp32-with-micropython Programming the ESP32 with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://awesome-micropython.com/ A curated list of awesome MicroPython libraries, frameworks, software and resources]&lt;br /&gt;
=== asyncio ===&lt;br /&gt;
[https://www.youtube.com/watch?v=5VLvmA__2v0 How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics]&lt;br /&gt;
=== Threads ===&lt;br /&gt;
[https://github.com/kevinmcaleer/threads Micropython thread tutorial]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=QeDnjcdGrpY Video: Micropython Threads - Use Both Cores, on Raspberry Pi Pico and ESP32]&lt;br /&gt;
=== MQTT ===&lt;br /&gt;
[https://bhave.sh/micropython-mqtt/ Secrets of MicroPython: MQTT on ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://wokwi.com/projects/341892004923310676 Exemple MQTT sobre micropython funcionant al wokwi] ([https://wokwi.com/projects/341895401936257620 Un exemple més compacte])&lt;br /&gt;
&lt;br /&gt;
=== Modbus ===&lt;br /&gt;
==== Modifying source code ====&lt;br /&gt;
[https://github.com/brainelectronics/micropython-modbus MicroPython Modbus library]&lt;br /&gt;
&lt;br /&gt;
Modbus control signal able to send or receive messages can be controlled directly by UART. To do that, file [https://github.com/mrvelic/micropython/blob/master/ports/esp32/machine_uart.c machine_uart.c] should be changed.&lt;br /&gt;
&lt;br /&gt;
Changes to be able to use Tx/Rx MAX3485 pin: [https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Information about Modbus an MicroPython has been got from this forum: https://github.com/micropython/micropython/pull/5567&lt;br /&gt;
==== Based on pycom-modbus from pycom ====&lt;br /&gt;
[https://github.com/danjperron/micropython-modbus Modbus Master library for MicroPython ESP32 devices]&lt;br /&gt;
=== LoRa ===&lt;br /&gt;
[https://github.com/martynwheeler/u-lora This is a port of raspi-lora for micropython]&lt;br /&gt;
&lt;br /&gt;
= IoT-Vertebrae =&lt;br /&gt;
== Raspberry ==&lt;br /&gt;
[[Configuració de la WiFi a la Raspberry Pi emprant nmtui]]&lt;br /&gt;
&lt;br /&gt;
[[Reconnexió automàtica a la WiFi]]&lt;br /&gt;
&lt;br /&gt;
[[WireGuard VPN]]&lt;br /&gt;
&lt;br /&gt;
= Exemples pràctics =&lt;br /&gt;
== Sensor ModBus de temperatura i humitat CWT-TH03S ==&lt;br /&gt;
[https://www.aliexpress.com/item/1005001404952412.html CWT-TH03S a AliExpress]&lt;br /&gt;
&lt;br /&gt;
[[Accés ModBus al sensor de temperatura i humitat CWT-TH03S]]&lt;br /&gt;
&lt;br /&gt;
= SBC =&lt;br /&gt;
== PocketBeagle ==&lt;br /&gt;
=== Grove Kit ===&lt;br /&gt;
==== Visió general ====&lt;br /&gt;
[https://beagleboard.org/Kits/Grove Informació comercial del Grove Kit]&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/pocket Informació comercial de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki Wiki de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual System Reference Manual] &amp;lt;----&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/latest-images Darreres imatges per a les SD]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/capes/tree/master/pocketbeagle/Grove Disseny del Grove Cape]&lt;br /&gt;
&lt;br /&gt;
==== Primera connexió a la xarxa sense fils ====&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$ '''sudo connmanctl'''⏎&lt;br /&gt;
 [sudo] password for debian: temppwd⏎&lt;br /&gt;
 connmanctl&amp;gt; '''scan wifi'''⏎&lt;br /&gt;
 Scan completed for wifi&lt;br /&gt;
 connmanctl&amp;gt; '''services'''⏎&lt;br /&gt;
       MyWifi                  wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''agent on'''⏎&lt;br /&gt;
 Agent registered&lt;br /&gt;
 connmanctl&amp;gt; '''connect wifi_1234567890_1234567890123456_managed_psk'''⏎&lt;br /&gt;
 Agent RequestInput wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
       Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]&lt;br /&gt;
       WPS = [ Type=wpspin, Requirement=alternate ]&lt;br /&gt;
 Passphrase? '''MySecretPassphrase'''⏎&lt;br /&gt;
 Connected wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''quit'''⏎&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$&lt;br /&gt;
&lt;br /&gt;
==== Tutorials ====&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/blob/master/PocketBeagle/Grove/workshop-handouts.md Blink PocketBeagle on-board USRx LED]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/tree/master/PocketBeagle/Grove Exemples]&lt;br /&gt;
&lt;br /&gt;
= Formació =&lt;br /&gt;
[https://www.binefa.com/index.php/IoT_amb_Arduino_i_Raspberry_Pi._Microcontroladors_d%27%C3%BAs_professional._Curs_Presencial._Edici%C3%B3_de_mar%C3%A7_de_2022 IoT amb Arduino i Raspberry Pi. Microcontroladors d'ús professional. Curs Presencial. Edició de març de 2022] - [https://formacio.eic.cat/cursos/1123577 Formació al Col·legi d'Enginyers Industrials de Catalunya] (30 / març / 2022)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Sistemes_encastats_d%27escala_petita_i_mitjana._Edici%C3%B3_d%27octubre_2021 Sistemes encastats d'escala petita i mitjana. Edició d'octubre 2021] (20 / octubre / 2021)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways)_IoT_(22_de_mar%C3%A7_de_2022) Nodes sensors (motes) i passarel·les (gateways) IoT (22 de març de 2022)] pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2022) Tecnologías IoT, Hands on y MVP (2022)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Diada_de_la_Llibertat_del_Maquinari_(Edici%C3%B3_2021) Diada de la Llibertat del Maquinari (Edició 2021)] (17 d'abril de 2021)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2021) Tecnologías IoT, Hands on y MVP (2021)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways) Nodes sensors (motes) i passarel·les (gateways)]  pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria] (23 de març de 2021)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Monitoritzaci%C3%B3_de_la_qualitat_de_l%27aire_mesurant_CO2_i_VOC_amb_LoRa Monitorització de la qualitat de l'aire mesurant CO2 i VOC amb LoRa] (9 de gener de 2021)&lt;br /&gt;
&lt;br /&gt;
[[Curset introductori d'Internet de les Coses per ADTelecom]] (Comença el 5 de novembre de 2020)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=%C3%9As_de_les_dades_generades_pels_sensors_LoRaWAN_i_arquitectura_del_sistema._Rub%C3%AD_2020 Ús de les dades generades pels sensors LoRaWAN i arquitectura del sistema. Rubí, 17 de juny de 2020]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Curset_a_TE_Connectivity_del_4_de_mar%C3%A7_de_2020 Curset a TE Connectivity del 4 de març de 2020] a [https://www.te.com/ TE Connectivity]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] (Ajuntament de Viladecans, 19 de febrer de 2020)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://www.binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2020) Tecnologías IoT, Hands on y MVP (2020)]&lt;br /&gt;
&lt;br /&gt;
UPC-School - 21802500 - Màster Industria 4.0 [https://wiki.binefa.cat/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP Tecnologías IoT, Hands on y MVP] (2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] a l'[http://www.icm.csic.es/ Institut de Ciències del Mar] (27 / setembre / 2018 i 25 / setembre / 2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_a_Internet_de_les_Coses_-_juny_2018 Introducció a Internet de les Coses - juny 2018] (Curset de formació per a professors de CF realitzat a l'[https://agora.xtec.cat/iesramblaprim/ Institut Rambla Prim])&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Sunna LoRa RMM v3.0]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Xifratge =&lt;br /&gt;
[[Eines de xifratge en línia]]&lt;br /&gt;
&lt;br /&gt;
= Opinió =&lt;br /&gt;
[http://www.xavierpi.com/mi40/HaciaUnIoT_democraticoYEfectivo.pdf Hacia un Internet de las Cosas democrático y efectivo] per Xavier Pi (octubre 2018)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Auxiliar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;MediaWiki s'ha instal·lat.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consulteu la [https://meta.wikimedia.org/wiki/Help:Contents Guia d'Usuari] per a més informació sobre com utilitzar aquest programari wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Primers passos ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Llista de paràmetres configurables]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ PMF del MediaWiki]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce Llista de correu per a anuncis del MediaWiki]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Traducció de MediaWiki en la vostra llengua]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Aprengueu com combatre la brossa que pot atacar el vostre wiki]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47728</id>
		<title>Pàgina principal</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47728"/>
		<updated>2025-02-10T12:59:09Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Intel·ligència Artificial */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size:500%&amp;quot;&amp;gt;things.cat&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:300%&amp;quot;&amp;gt;Una pàgina pràctica sobre la Internet de les Coses&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Dispositius IoT. Maquinari i microprogramari =&lt;br /&gt;
Al '''maquinari''' li diem'' '''hardware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
Al '''microprogramari''' li diem'' '''firmware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
'''IoT''' és l'acrònim d'''Internet of Things''. En català abreujat li podríem dir '''IdC''' per a referir-nos a '''la Internet de les Coses'''. En el moment d'escriure aquest text, la comunitat catalanoparlant sembla haver optat per referir-se als '''dispositius de la Internet de les Coses''' com a '''dispositius IoT'''. Si el [https://www.termcat.cat/ca/neoloteca/ termcat] es pronuncia de manera diferent, provaré d'adaptar la terminologia.&lt;br /&gt;
&lt;br /&gt;
== Placa IoT-02 ==&lt;br /&gt;
[https://www.binefa.com/index.php/Placa_IoT-02 Placa_IoT-02]&lt;br /&gt;
&lt;br /&gt;
== Controladors ==&lt;br /&gt;
Als '''controladors''' els hi diem'' '''drivers''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
El xip '''FT232''' ha estat durant molt de temps el xip més comú per convertir d''''USB a UART'''. Fins al punt que se'n van fer còpies pirates. Una actualització del sistema operatiu privatiu Windows va explotar una característica dels xips pirates: els xips pirates tenien el registre d'identificació USB de lectura i escriptura i l'original era tan sols de lectura. L'actualització que va fer Windows provocava l'escriptura d'aquest registre i hi escrivia un zero, que feia que el sistema operatiu ho identifiqués com a concentrador USB i no com a controlador d'UART, fent que el maquinari quedés inservible. A l'any 2014 em vaig veure atrapat amb uns quants Arduino Nano que duien aquest xip pirata i vaig escriure [https://binefa.cat/blog/?p=80 How to recover bricked fake FT232] per a poder-los reprogramar i poder-los fer servir amb sistemes operatius lliures GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
A partir d'aquell moment, bona part de les plaques de fabricació xinesa van començar a dur, massivament, el xip '''CH340''' per a convertir d'USB a UART.&lt;br /&gt;
&lt;br /&gt;
[[Controlador CH340]]&lt;br /&gt;
&lt;br /&gt;
[[Controlador FT232]]&lt;br /&gt;
&lt;br /&gt;
== C / C++ ==&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-libraries Biblioteques per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes Codis per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
=== ESP8266 ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Afegint_la_targeta_ESP8266_a_l%27IDE_d%27Arduino Afegint la targeta ESP8266 a l'IDE d'Arduino] (NodeMCU1.0)&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp8266_udpServer_01b esp8266_udpServer_01.ino] Codi UDP per a ESP8266&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_a_l%27ESP8266 MQTT a l'ESP8266]&lt;br /&gt;
&lt;br /&gt;
=== ESP32 ===&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_udpServer_01b esp32_udpServer_01b] Codi UDP per a ESP32&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_i2cScanner_02 esp32_i2cScanner_02.ino Adreces de dispositius I2C connectats]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/modbus/rtu/esp32/ Exemple de ModBus RTU fent servir NodeRED i ESP32 (amb la placa IoT PLB)]&lt;br /&gt;
&lt;br /&gt;
[https://techtutorialsx.com/2017/05/06/esp32-arduino-creating-a-task/ ESP32 Arduino: Creating a FreeRTOS task]&lt;br /&gt;
&lt;br /&gt;
[https://savjee.be/2020/01/multitasking-esp32-arduino-freertos/ Multitasking on ESP32 with Arduino and FreeRTOS]&lt;br /&gt;
&lt;br /&gt;
==== Modbus ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#overview-of-rs485-specific-communication-options Overview of RS485 specific communication options]&lt;br /&gt;
&lt;br /&gt;
[https://pastebin.com/2PtWJvd6 Example setting RS485 at half duplex mode]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/IoT-02/tree/master/codes/IoT-02_11_modbus_bme280_02 Code IoT-02_11_modbus_bme280_02] using RS485 at half duplex mode&lt;br /&gt;
&lt;br /&gt;
==== ESP-IDF ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ Get Started]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html Get started with ESP-IDF and ESP32-DevKitC: debugging, unit testing, project analysis]&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
=== Accés al maquinari de la Raspberry Pi emprant Python ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Com_connectar-hi_pantalles_OLED_SSD1306_(128x64) Com connectar-hi pantalles OLED SSD1306 (128x64)]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=%C3%9As_d%27entrades_anal%C3%B2giques_amb_l%27ADS115_controlant_sortides_PWM Ús d'entrades analògiques amb l'ADS115 controlant sortides PWM]&lt;br /&gt;
&lt;br /&gt;
=== Micropython ===&lt;br /&gt;
[https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome Micropython and the Internet of Things]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp8266 MicroPython port to ESP8266]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp32 MicroPython port to the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://icircuit.net/esp32-micropython-getting-started/1999 ESP32 – Getting started with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-on-the-esp32-decdd32c4720 Get on the Good Foot with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-part-2-e1f2efaad50b Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor DS18B20 (One Wire Interface)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/gloveboxes/ESP32-MicroPython-BME280-MQTT-Sample Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor BME280 (I2C)]&lt;br /&gt;
&lt;br /&gt;
=== CircuitPython ===&lt;br /&gt;
[https://learn.adafruit.com/circuitpython-with-esp32-quick-start CircuitPython on ESP32 Quick Start]&lt;br /&gt;
&lt;br /&gt;
== Sistemes operatius encastats ==&lt;br /&gt;
=== Raspbian ===&lt;br /&gt;
[https://www.raspberrypi.org/documentation/computers/remote-access.html Remote Access]&lt;br /&gt;
&lt;br /&gt;
[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ How to Install Mosquitto Broker on Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Adaptaci%C3%B3_per_a_que_la_Raspberry_Pi_funcioni_com_a_punt_d%27acc%C3%A9s_donant_adreces_IP_de_classe_B Adaptació per a que la Raspberry Pi funcioni com a punt d'accés donant adreces IP de classe B]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_dels_nodes_node-red-contrib-ttn_i_node-red-contrib-modbustcp-no-pooling_a_la_Raspberry_Pi Instal·lació dels nodes node-red-contrib-ttn i node-red-contrib-modbustcp-no-pooling a la Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_de_l%27OPC-UA_a_la_Raspberry_Pi,_fent_servir_Python,_i_control_des_d%27Indusoft Instal·lació de l'OPC-UA a la Raspberry Pi, fent servir Python, i control des d'Indusoft]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Pr%C3%A0ctica_de_connexi%C3%B3_remota_a_una_Raspberry_Pi Pràctica de connexió remota a una Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://core-electronics.com.au/guides/read-only-raspberry-pi/ Read-Only Raspberry Pi - Never Corrupt your Micro-SD Card]&lt;br /&gt;
==== Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb ''docker'' ====&lt;br /&gt;
[[Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker]]&lt;br /&gt;
&lt;br /&gt;
=== Mongoose OS ===&lt;br /&gt;
[https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md Guia ràpida d'introducció a Mongoose OS][en]&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
[[Sensors de so]]&lt;br /&gt;
&lt;br /&gt;
= Control remot dels dispositius IoT. Programari =&lt;br /&gt;
Al '''programari''' li diuen'' '''software''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
[https://binefa.cat/IoT/teoria/ethernetTcpUdp_00.pdf TCP/UDP Capa de transport d'Ethernet]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació d'un servidor de sòcols web a un Debian amb Apache]]&lt;br /&gt;
&lt;br /&gt;
=== MQTT(S) ===&lt;br /&gt;
[https://binefa.cat/IoT/teoria/mqtt_00.pdf Introducció a MQTT]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt/ Beginners Guide To The MQTT Protocol] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[https://www.rs-online.com/designspark/mqtt MQTT] explained by Andy Stanford-Clark (co-inventor of MQTT). Article written in 2017, and refering to v3.1.1&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/mqtt-5/ MQTT 5 Essentials] by HiveMQ&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt-hosting-brokers-and-servers/ MQTT Brokers/Servers and Cloud Hosting Guide] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer] An all-round MQTT client that provides a structured topic overview&lt;br /&gt;
&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT a Snap!]&lt;br /&gt;
&lt;br /&gt;
==== Public MQTT(S) brokers ====&lt;br /&gt;
[http://test.mosquitto.org/ mosquitto]&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/public-mqtt-broker/ HiveMQ MQTT broker]&lt;br /&gt;
&lt;br /&gt;
[https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/ MQTT brokers online with a free offer to test and connect IoT to the internet]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) implementations ====&lt;br /&gt;
[http://binefa.com/index.php?title=MQTTS_y_NodeRED MQTTS y NodeRED]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations Comparison of MQTT implementations]&lt;br /&gt;
&lt;br /&gt;
[http://test.mosquitto.org/ test.mosquitto.org]&lt;br /&gt;
&lt;br /&gt;
[https://www.emqx.io/ emqx.io]&lt;br /&gt;
&lt;br /&gt;
[https://vernemq.com/ VerneMQ]&lt;br /&gt;
&lt;br /&gt;
=== Webhooks ===&lt;br /&gt;
[https://hookdeck.com/guides/webhooks/what-are-webhooks-how-they-work What Are Webhooks And How They Work]&lt;br /&gt;
&lt;br /&gt;
[[Exemple bàsic de funcionament de Webhooks. Servidor i client en node.js]]&lt;br /&gt;
&lt;br /&gt;
== Programació local (ordinadors d'escriptori i dispositius mòbils) ==&lt;br /&gt;
[https://binefa.cat/IoT/mqtt/MQTT_Dash/ Configuració de MQTT Dash (aplicació per Android)]&lt;br /&gt;
&lt;br /&gt;
=== Mosquitto local a l'ordinador ===&lt;br /&gt;
[https://www.vultr.com/docs/how-to-install-mosquitto-mqtt-broker-server-on-ubuntu-16-04 How to Install Mosquitto MQTT Broker/Server on Ubuntu 16.04]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/downloads/ Instal·lació de Mosquitto a Windows]&lt;br /&gt;
&lt;br /&gt;
Per a actualitzar les claus dels dipòsits de Debian:&lt;br /&gt;
 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key&lt;br /&gt;
 sudo apt-key add mosquitto-repo.gpg.key&lt;br /&gt;
&lt;br /&gt;
=== SCADA ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=SCADA_fent_servir_Python_QML_i_Arduino SCADA fent servir Python QML i Arduino]&lt;br /&gt;
&lt;br /&gt;
== Núvol ==&lt;br /&gt;
=== Instal·lació de Node.js i npm ===&lt;br /&gt;
[https://github.com/nodesource/distributions/blob/master/README.md Instal·lació de node i npm]&lt;br /&gt;
 ecat@iot-ecat:~$ '''sudo bash'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''curl -sL https://deb.nodesource.com/setup_14.x | bash -'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''apt install -y nodejs'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''exit'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''node --version'''&lt;br /&gt;
 v14.15.4&lt;br /&gt;
 ecat@iot-ecat:~$ '''npm -- version'''&lt;br /&gt;
 6.14.10&lt;br /&gt;
&lt;br /&gt;
=== Node-RED ===&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf Introducció al Node-RED]&lt;br /&gt;
&lt;br /&gt;
[[Gestió de Node-RED]]&lt;br /&gt;
&lt;br /&gt;
[https://www.aprendiendoarduino.com/cursos/node-red-developer-para-iot-nivel-i/ Node-RED Developer para IoT. Nivel I]&lt;br /&gt;
&lt;br /&gt;
==== Instal·lació i funcionament del NodeRed autònom ====&lt;br /&gt;
 ecat@iot-ecat:~$ '''mkdir bin'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''cd bin'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''sudo apt install unzip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''mkdir nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''cd nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''wget https://www.binefa.cat/IoT/nodeRed/node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''unzip node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''node node_modules/node-red/red.js --userDir node_modules/node-red/data --settings node_modules/node-red/settings.js -v --port 2222 --title elmeuTitol --safe flows_meuTitol.json'''&lt;br /&gt;
&lt;br /&gt;
==== UDP ====&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/udpServer/udpServer_nodered_code.txt Codi NodeRED per a esp8266_udpServer_01.ino i esp32_udpServer_01b]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_i_MQTTS MQTT i MQTTS]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex00/ Exemple amb MQTT i NodeRED emprant ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex01/ Exercici amb MQTT i NodeRED emprant ESP8266]&lt;br /&gt;
&lt;br /&gt;
[[Elevador en Snap! controlat remotament amb MQTT mitjançant NodeRED fent crides HTTP]]&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer]&lt;br /&gt;
&lt;br /&gt;
==== Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Un_exemple_d%27us_de_Telegram_amb_el_NodeRed Un exemple d'us de Telegram amb el NodeRed]&lt;br /&gt;
&lt;br /&gt;
==== Modbus TCP ====&lt;br /&gt;
[https://binefa.cat/IoT/modbus/ Arxius per treballar amb Modbus TCP] [https://www.binefa.cat/php/doc/modbus/ El segon vídeo explica i compara Modbus RTU i Modbus TCP] &lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/modbusCtrl/ ModBus TCP al NodeRED]&lt;br /&gt;
&lt;br /&gt;
==== Alguns nodes extra ====&lt;br /&gt;
[https://flows.nodered.org/node/node-red-contrib-google-sheets node-red-contrib-google-sheets]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/sammachin/node-red-contrib-google-sheets node-red-contrib-google-sheets al Github]&lt;br /&gt;
&lt;br /&gt;
=== Sistemes d'emmagatzematge i visualització ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=InfluxDB Base de dades de sèries temporals InfluxDB]&lt;br /&gt;
&lt;br /&gt;
[http://docs.grafana.org/installation/debian/ Instal·lació de Grafana a Debian][en]&lt;br /&gt;
&lt;br /&gt;
[[Sentilo]]&lt;br /&gt;
&lt;br /&gt;
=== Xarxes d'àrea estesa de baix consum (LPWAN) ===&lt;br /&gt;
==== Conceptes teòrics ====&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Xarxa_de_llarg_abast Xarxa de llarg abast (WAN)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Chirp_spread_spectrum Espectre eixamplat (Chirp Spread Spectrum)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_seq%C3%BC%C3%A8ncia_directa Espectre eixamplat per seqüència directa (DSSS)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_salt_de_freq%C3%BC%C3%A8ncia Espectre eixamplat per salt de freqüència (FHSS)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LPWAN What is LPWAN?]&lt;br /&gt;
&lt;br /&gt;
[https://cms.edn.com/ContentEETimes/Documents/EDN/LP%20WAN%20Comparison%20Table%20final.pdf Comparison table of Low Power WAN alternatives]&lt;br /&gt;
&lt;br /&gt;
==== LoRa ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
==== SigFox ====&lt;br /&gt;
[https://docs.pycom.io/chapter/tutorials/sipy/register.html Registering SiPy with Sigfox]&lt;br /&gt;
&lt;br /&gt;
[[Interacció amb SiPy1.0r de pycom]]&lt;br /&gt;
&lt;br /&gt;
==== Antenes ====&lt;br /&gt;
[https://youtu.be/CJNq2I_PDHQ Andreas Spiess video: &amp;quot;#182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge)&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Bots ===&lt;br /&gt;
==== Bot de Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Bot_de_Telegram Bot de Telegram]&lt;br /&gt;
&lt;br /&gt;
==== Bot de Mastodon ====&lt;br /&gt;
No totes les instàncies de [https://ca.wikipedia.org/wiki/Mastodon_(xarxa_social) Mastodon] faciliten la instal·lació de bots. Per a fer les primeres passes us recomano aquesta [https://botsin.space/ instància pensada per allotjar bots de Mastodon].&lt;br /&gt;
&lt;br /&gt;
[https://botsin.space/@siarq_sensors Exemple de bot de Mastodon] per a fer lectures de sensors cada hora.&lt;br /&gt;
&lt;br /&gt;
[https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26 Getting credentials for the Mastodon API with Mastodon.py, step by step]&lt;br /&gt;
&lt;br /&gt;
=== VPS ===&lt;br /&gt;
[[Introducció als contenidors docker]]&lt;br /&gt;
&lt;br /&gt;
[[Servidor intermediari invers]]&lt;br /&gt;
&lt;br /&gt;
[[Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[File Browser]]&lt;br /&gt;
&lt;br /&gt;
[[Apache i PHP]]&lt;br /&gt;
&lt;br /&gt;
[[Redireccions a subdomini]]&lt;br /&gt;
&lt;br /&gt;
[[Mastodon]]&lt;br /&gt;
&lt;br /&gt;
[https://medium.com/himinds/mqtt-broker-with-secure-websocket-using-traefik-docker-compose-and-lets-encrypt-2b8e32207555 MQTT broker with Secure WebSocket using Traefik, Docker Compose and Let’s Encrypt]&lt;br /&gt;
&lt;br /&gt;
[[Moodle a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Node-RED a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Snap! a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[VPN WireGuard]]&lt;br /&gt;
&lt;br /&gt;
== Snap! ==&lt;br /&gt;
[https://github.com/jmoenig/Snap Snap! al GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''amb''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''sense''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
=== JavaScript per defecte ===&lt;br /&gt;
Per raons de seguretat, s'ha desactivat el JavaScript per defecte. Si us munteu el vostre propi servei al núvol, per a poder cridar programes vostres amb funcions amb JavaScript, heu d'afegir aquesta línia, en negreta, a l'arxiu ''[https://github.com/jmoenig/Snap/blob/master/snap.html snap.html]'':&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            '''Process.prototype.enableJS = true;''' // &amp;lt;-- Per a tenir seleccionat el JS per defecte&lt;br /&gt;
            var world;&lt;br /&gt;
            window.onload = function () {&lt;br /&gt;
                if ('serviceWorker' in navigator) {&lt;br /&gt;
                    navigator.serviceWorker.register('sw.js');&lt;br /&gt;
                }&lt;br /&gt;
                world = new WorldMorph(document.getElementById('world'));&lt;br /&gt;
                new IDE_Morph().openIn(world);&lt;br /&gt;
                loop();&lt;br /&gt;
            };&lt;br /&gt;
            function loop() {&lt;br /&gt;
                requestAnimationFrame(loop);&lt;br /&gt;
                world.doOneCycle();&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MQTT for Snap! ===&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT4Snap !], desenvolupat per en Xavier Pi.&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld.xml Hello World emprant MQTT '''amb''' SSL]&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html#open:http://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld_NoSSL.xml Hello World emprant MQTT '''sense''' SSL]&lt;br /&gt;
=== Intel·ligència Artificial ===&lt;br /&gt;
* [https://snap.berkeley.edu/snap/snap.html#open:https://xavierpi.com/ia/ia.xml Connexió amb Gemini] Cal una [https://aistudio.google.com/app/apikey clau d'API (API key)] ([https://ai.google.dev/gemini-api/docs/quickstart?lang=python Guia ràpida d'ús a l'API de Gemini])&lt;br /&gt;
&amp;lt;!-- AIzaSyBINpQKh7Sj8WyIV-PmNfo157Pg8LQr8JY --&amp;gt;&lt;br /&gt;
* [https://ecraft2learn.github.io/ai/AI-Teacher-Guide/chapter-2.html Reconeixement de veu amb Snap!]&lt;br /&gt;
&lt;br /&gt;
= Una aproximació a OPC-UA =&lt;br /&gt;
&lt;br /&gt;
[[OPC-UA]]&lt;br /&gt;
&lt;br /&gt;
= Placa IoT-02 =&lt;br /&gt;
[[Placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
== Programació remota (OTA) ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Esp32Ota.png|center|Programacio OTA de la placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
=== Dos programes de prova de programació remota ===&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_01.zip IoT-02_OTAWebUpdater_01] (Fa pampallugues el led blanc) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_02.zip IoT-02_OTAWebUpdater_02] (Fa pampallugues el led verd) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
=== Programació a la vora (''edge'') ===&lt;br /&gt;
L'ordinador a la vora (''edge'') pot ser un ordinador normal, habitualment de poca potència, del tipus Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Per a tenir visibilitat externa de la pàgina web servida per la placa IoT-02 (per exemple amb la IP 192.168.1.151:80), ho redireccionarem a un port ( 192.168.1.151:80 --&amp;gt; localhost:5001 )&lt;br /&gt;
&lt;br /&gt;
Per a fer funcionar [https://www.binefa.cat/training/iot02/ota/edge/simple-port-forwarding.js simple-port-forwarding.js] caldrà haver afegit el paquet '''http-proxy''':&lt;br /&gt;
&lt;br /&gt;
 npm install http-proxy&lt;br /&gt;
&lt;br /&gt;
El codi nodejs de redireccionament (suposant que la placa IoT-02 ha adquirit l'adreça IP 192.168.1.151):&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '192.168.1.151';&lt;br /&gt;
 var portOrigen = 80;&lt;br /&gt;
 var portDesti = 5001;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
Per a fer aquest redireccionador sigui un servei, es copia [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service] a la carpeta '''/etc/systemd/system''' o el fem de nou amb un editor:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/systemd/system&lt;br /&gt;
 sudo nano [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service]&lt;br /&gt;
 sudo chmod 755 myForwardingService.service&lt;br /&gt;
 sudo systemctl daemon-reload&lt;br /&gt;
 sudo systemctl '''start''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
Per a veure l'estat del servei:&lt;br /&gt;
 systemctl '''status''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
I per a fer que el servei es posi en marxa al reiniciar l'ordinador a la vora:&lt;br /&gt;
 sudo systemctl '''enable''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
=== Programació al núvol ===&lt;br /&gt;
Mitjançant una xarxa virtual privada (VPN) de l'estil [https://www.zerotier.com/ ZeroTier] podem fer que l'ordinador a la vora i l'ordinador al núvol comparteixin la mateixa xarxa.&lt;br /&gt;
&lt;br /&gt;
Suposant que l'ordinador a la vora té la IP 10.242.156.158, podem redireccionar-hi 10.242.156.158:5001 --&amp;gt; localhost:7007 :&lt;br /&gt;
&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '10.242.156.158';&lt;br /&gt;
 var portOrigen = 5001;&lt;br /&gt;
 var portDesti = 7007;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
I així tenim accés remot des del núvol, connectant mitjançant l'ordinador a la vora que es connecta a la placa IoT-02. &lt;br /&gt;
&lt;br /&gt;
Per accedir-hi des del navegador, escriviu a la URL: &lt;br /&gt;
 &amp;lt;nom_de_domini&amp;gt;:7007&lt;br /&gt;
Això visualitzarà el que presenta l'ordinador a la vora (la IP és la VPN a l'ordinador a la vora):&lt;br /&gt;
 10.242.156.158:5001&lt;br /&gt;
Que al seu temps presenta el servei pel port 80 de la placa IOT-02 connectada a la mateixa xarxa local que l'ordinador a la vora:&lt;br /&gt;
 192.168.1.151&lt;br /&gt;
&lt;br /&gt;
=== Els tres mètodes de programació OTA de l'ESP32 ===&lt;br /&gt;
[https://www.programmersought.com/article/90864120754/ How to implement OTA online update of ESP32 firmware]&lt;br /&gt;
&lt;br /&gt;
== MicroPython ==&lt;br /&gt;
[https://www.digikey.es/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce MicroPython Basics: Load Files &amp;amp; Run Code]&lt;br /&gt;
&lt;br /&gt;
[https://warped3.substack.com/p/compiling-micropython-with-espressif Compiling microPython with espressif SDK 4.4 for ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://docs.micropython.org/en/latest/esp32/tutorial/intro.html Getting started with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython The MicroPython project]&lt;br /&gt;
&lt;br /&gt;
[https://cdn-learn.adafruit.com/downloads/pdf/micropython-basics-loading-modules.pdf MicroPython Basics: Loading Modules]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/robert-hh/FTP-Server-for-ESP8266-ESP32-and-PYBD uftpd: small FTP server for ESP8266, ESP32 and Pyboard D]&lt;br /&gt;
&lt;br /&gt;
[https://electronicsinnovation.com/connect-esp32-to-ubidots-using-micropython-over-mqtt-with-visual-studio-code/ Connect ESP32 to Ubidots using Micropython over MQTT with Visual Studio Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peterhinch Peter Hinch's GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://wolles-elektronikkiste.de/en/programming-the-esp32-with-micropython Programming the ESP32 with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://awesome-micropython.com/ A curated list of awesome MicroPython libraries, frameworks, software and resources]&lt;br /&gt;
=== asyncio ===&lt;br /&gt;
[https://www.youtube.com/watch?v=5VLvmA__2v0 How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics]&lt;br /&gt;
=== Threads ===&lt;br /&gt;
[https://github.com/kevinmcaleer/threads Micropython thread tutorial]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=QeDnjcdGrpY Video: Micropython Threads - Use Both Cores, on Raspberry Pi Pico and ESP32]&lt;br /&gt;
=== MQTT ===&lt;br /&gt;
[https://bhave.sh/micropython-mqtt/ Secrets of MicroPython: MQTT on ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://wokwi.com/projects/341892004923310676 Exemple MQTT sobre micropython funcionant al wokwi] ([https://wokwi.com/projects/341895401936257620 Un exemple més compacte])&lt;br /&gt;
&lt;br /&gt;
=== Modbus ===&lt;br /&gt;
==== Modifying source code ====&lt;br /&gt;
[https://github.com/brainelectronics/micropython-modbus MicroPython Modbus library]&lt;br /&gt;
&lt;br /&gt;
Modbus control signal able to send or receive messages can be controlled directly by UART. To do that, file [https://github.com/mrvelic/micropython/blob/master/ports/esp32/machine_uart.c machine_uart.c] should be changed.&lt;br /&gt;
&lt;br /&gt;
Changes to be able to use Tx/Rx MAX3485 pin: [https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Information about Modbus an MicroPython has been got from this forum: https://github.com/micropython/micropython/pull/5567&lt;br /&gt;
==== Based on pycom-modbus from pycom ====&lt;br /&gt;
[https://github.com/danjperron/micropython-modbus Modbus Master library for MicroPython ESP32 devices]&lt;br /&gt;
=== LoRa ===&lt;br /&gt;
[https://github.com/martynwheeler/u-lora This is a port of raspi-lora for micropython]&lt;br /&gt;
&lt;br /&gt;
= IoT-Vertebrae =&lt;br /&gt;
== Raspberry ==&lt;br /&gt;
[[Configuració de la WiFi a la Raspberry Pi emprant nmtui]]&lt;br /&gt;
&lt;br /&gt;
[[Reconnexió automàtica a la WiFi]]&lt;br /&gt;
&lt;br /&gt;
[[WireGuard VPN]]&lt;br /&gt;
&lt;br /&gt;
= Exemples pràctics =&lt;br /&gt;
== Sensor ModBus de temperatura i humitat CWT-TH03S ==&lt;br /&gt;
[https://www.aliexpress.com/item/1005001404952412.html CWT-TH03S a AliExpress]&lt;br /&gt;
&lt;br /&gt;
[[Accés ModBus al sensor de temperatura i humitat CWT-TH03S]]&lt;br /&gt;
&lt;br /&gt;
= SBC =&lt;br /&gt;
== PocketBeagle ==&lt;br /&gt;
=== Grove Kit ===&lt;br /&gt;
==== Visió general ====&lt;br /&gt;
[https://beagleboard.org/Kits/Grove Informació comercial del Grove Kit]&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/pocket Informació comercial de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki Wiki de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual System Reference Manual] &amp;lt;----&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/latest-images Darreres imatges per a les SD]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/capes/tree/master/pocketbeagle/Grove Disseny del Grove Cape]&lt;br /&gt;
&lt;br /&gt;
==== Primera connexió a la xarxa sense fils ====&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$ '''sudo connmanctl'''⏎&lt;br /&gt;
 [sudo] password for debian: temppwd⏎&lt;br /&gt;
 connmanctl&amp;gt; '''scan wifi'''⏎&lt;br /&gt;
 Scan completed for wifi&lt;br /&gt;
 connmanctl&amp;gt; '''services'''⏎&lt;br /&gt;
       MyWifi                  wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''agent on'''⏎&lt;br /&gt;
 Agent registered&lt;br /&gt;
 connmanctl&amp;gt; '''connect wifi_1234567890_1234567890123456_managed_psk'''⏎&lt;br /&gt;
 Agent RequestInput wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
       Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]&lt;br /&gt;
       WPS = [ Type=wpspin, Requirement=alternate ]&lt;br /&gt;
 Passphrase? '''MySecretPassphrase'''⏎&lt;br /&gt;
 Connected wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''quit'''⏎&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$&lt;br /&gt;
&lt;br /&gt;
==== Tutorials ====&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/blob/master/PocketBeagle/Grove/workshop-handouts.md Blink PocketBeagle on-board USRx LED]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/tree/master/PocketBeagle/Grove Exemples]&lt;br /&gt;
&lt;br /&gt;
= Formació =&lt;br /&gt;
[https://www.binefa.com/index.php/IoT_amb_Arduino_i_Raspberry_Pi._Microcontroladors_d%27%C3%BAs_professional._Curs_Presencial._Edici%C3%B3_de_mar%C3%A7_de_2022 IoT amb Arduino i Raspberry Pi. Microcontroladors d'ús professional. Curs Presencial. Edició de març de 2022] - [https://formacio.eic.cat/cursos/1123577 Formació al Col·legi d'Enginyers Industrials de Catalunya] (30 / març / 2022)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Sistemes_encastats_d%27escala_petita_i_mitjana._Edici%C3%B3_d%27octubre_2021 Sistemes encastats d'escala petita i mitjana. Edició d'octubre 2021] (20 / octubre / 2021)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways)_IoT_(22_de_mar%C3%A7_de_2022) Nodes sensors (motes) i passarel·les (gateways) IoT (22 de març de 2022)] pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2022) Tecnologías IoT, Hands on y MVP (2022)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Diada_de_la_Llibertat_del_Maquinari_(Edici%C3%B3_2021) Diada de la Llibertat del Maquinari (Edició 2021)] (17 d'abril de 2021)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2021) Tecnologías IoT, Hands on y MVP (2021)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways) Nodes sensors (motes) i passarel·les (gateways)]  pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria] (23 de març de 2021)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Monitoritzaci%C3%B3_de_la_qualitat_de_l%27aire_mesurant_CO2_i_VOC_amb_LoRa Monitorització de la qualitat de l'aire mesurant CO2 i VOC amb LoRa] (9 de gener de 2021)&lt;br /&gt;
&lt;br /&gt;
[[Curset introductori d'Internet de les Coses per ADTelecom]] (Comença el 5 de novembre de 2020)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=%C3%9As_de_les_dades_generades_pels_sensors_LoRaWAN_i_arquitectura_del_sistema._Rub%C3%AD_2020 Ús de les dades generades pels sensors LoRaWAN i arquitectura del sistema. Rubí, 17 de juny de 2020]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Curset_a_TE_Connectivity_del_4_de_mar%C3%A7_de_2020 Curset a TE Connectivity del 4 de març de 2020] a [https://www.te.com/ TE Connectivity]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] (Ajuntament de Viladecans, 19 de febrer de 2020)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://www.binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2020) Tecnologías IoT, Hands on y MVP (2020)]&lt;br /&gt;
&lt;br /&gt;
UPC-School - 21802500 - Màster Industria 4.0 [https://wiki.binefa.cat/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP Tecnologías IoT, Hands on y MVP] (2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] a l'[http://www.icm.csic.es/ Institut de Ciències del Mar] (27 / setembre / 2018 i 25 / setembre / 2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_a_Internet_de_les_Coses_-_juny_2018 Introducció a Internet de les Coses - juny 2018] (Curset de formació per a professors de CF realitzat a l'[https://agora.xtec.cat/iesramblaprim/ Institut Rambla Prim])&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Sunna LoRa RMM v3.0]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Xifratge =&lt;br /&gt;
[[Eines de xifratge en línia]]&lt;br /&gt;
&lt;br /&gt;
= Opinió =&lt;br /&gt;
[http://www.xavierpi.com/mi40/HaciaUnIoT_democraticoYEfectivo.pdf Hacia un Internet de las Cosas democrático y efectivo] per Xavier Pi (octubre 2018)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Auxiliar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;MediaWiki s'ha instal·lat.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consulteu la [https://meta.wikimedia.org/wiki/Help:Contents Guia d'Usuari] per a més informació sobre com utilitzar aquest programari wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Primers passos ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Llista de paràmetres configurables]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ PMF del MediaWiki]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce Llista de correu per a anuncis del MediaWiki]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Traducció de MediaWiki en la vostra llengua]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Aprengueu com combatre la brossa que pot atacar el vostre wiki]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47727</id>
		<title>Pàgina principal</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47727"/>
		<updated>2025-02-10T12:57:16Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Intel·ligència Artificial */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size:500%&amp;quot;&amp;gt;things.cat&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:300%&amp;quot;&amp;gt;Una pàgina pràctica sobre la Internet de les Coses&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Dispositius IoT. Maquinari i microprogramari =&lt;br /&gt;
Al '''maquinari''' li diem'' '''hardware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
Al '''microprogramari''' li diem'' '''firmware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
'''IoT''' és l'acrònim d'''Internet of Things''. En català abreujat li podríem dir '''IdC''' per a referir-nos a '''la Internet de les Coses'''. En el moment d'escriure aquest text, la comunitat catalanoparlant sembla haver optat per referir-se als '''dispositius de la Internet de les Coses''' com a '''dispositius IoT'''. Si el [https://www.termcat.cat/ca/neoloteca/ termcat] es pronuncia de manera diferent, provaré d'adaptar la terminologia.&lt;br /&gt;
&lt;br /&gt;
== Placa IoT-02 ==&lt;br /&gt;
[https://www.binefa.com/index.php/Placa_IoT-02 Placa_IoT-02]&lt;br /&gt;
&lt;br /&gt;
== Controladors ==&lt;br /&gt;
Als '''controladors''' els hi diem'' '''drivers''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
El xip '''FT232''' ha estat durant molt de temps el xip més comú per convertir d''''USB a UART'''. Fins al punt que se'n van fer còpies pirates. Una actualització del sistema operatiu privatiu Windows va explotar una característica dels xips pirates: els xips pirates tenien el registre d'identificació USB de lectura i escriptura i l'original era tan sols de lectura. L'actualització que va fer Windows provocava l'escriptura d'aquest registre i hi escrivia un zero, que feia que el sistema operatiu ho identifiqués com a concentrador USB i no com a controlador d'UART, fent que el maquinari quedés inservible. A l'any 2014 em vaig veure atrapat amb uns quants Arduino Nano que duien aquest xip pirata i vaig escriure [https://binefa.cat/blog/?p=80 How to recover bricked fake FT232] per a poder-los reprogramar i poder-los fer servir amb sistemes operatius lliures GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
A partir d'aquell moment, bona part de les plaques de fabricació xinesa van començar a dur, massivament, el xip '''CH340''' per a convertir d'USB a UART.&lt;br /&gt;
&lt;br /&gt;
[[Controlador CH340]]&lt;br /&gt;
&lt;br /&gt;
[[Controlador FT232]]&lt;br /&gt;
&lt;br /&gt;
== C / C++ ==&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-libraries Biblioteques per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes Codis per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
=== ESP8266 ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Afegint_la_targeta_ESP8266_a_l%27IDE_d%27Arduino Afegint la targeta ESP8266 a l'IDE d'Arduino] (NodeMCU1.0)&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp8266_udpServer_01b esp8266_udpServer_01.ino] Codi UDP per a ESP8266&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_a_l%27ESP8266 MQTT a l'ESP8266]&lt;br /&gt;
&lt;br /&gt;
=== ESP32 ===&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_udpServer_01b esp32_udpServer_01b] Codi UDP per a ESP32&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_i2cScanner_02 esp32_i2cScanner_02.ino Adreces de dispositius I2C connectats]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/modbus/rtu/esp32/ Exemple de ModBus RTU fent servir NodeRED i ESP32 (amb la placa IoT PLB)]&lt;br /&gt;
&lt;br /&gt;
[https://techtutorialsx.com/2017/05/06/esp32-arduino-creating-a-task/ ESP32 Arduino: Creating a FreeRTOS task]&lt;br /&gt;
&lt;br /&gt;
[https://savjee.be/2020/01/multitasking-esp32-arduino-freertos/ Multitasking on ESP32 with Arduino and FreeRTOS]&lt;br /&gt;
&lt;br /&gt;
==== Modbus ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#overview-of-rs485-specific-communication-options Overview of RS485 specific communication options]&lt;br /&gt;
&lt;br /&gt;
[https://pastebin.com/2PtWJvd6 Example setting RS485 at half duplex mode]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/IoT-02/tree/master/codes/IoT-02_11_modbus_bme280_02 Code IoT-02_11_modbus_bme280_02] using RS485 at half duplex mode&lt;br /&gt;
&lt;br /&gt;
==== ESP-IDF ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ Get Started]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html Get started with ESP-IDF and ESP32-DevKitC: debugging, unit testing, project analysis]&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
=== Accés al maquinari de la Raspberry Pi emprant Python ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Com_connectar-hi_pantalles_OLED_SSD1306_(128x64) Com connectar-hi pantalles OLED SSD1306 (128x64)]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=%C3%9As_d%27entrades_anal%C3%B2giques_amb_l%27ADS115_controlant_sortides_PWM Ús d'entrades analògiques amb l'ADS115 controlant sortides PWM]&lt;br /&gt;
&lt;br /&gt;
=== Micropython ===&lt;br /&gt;
[https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome Micropython and the Internet of Things]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp8266 MicroPython port to ESP8266]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp32 MicroPython port to the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://icircuit.net/esp32-micropython-getting-started/1999 ESP32 – Getting started with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-on-the-esp32-decdd32c4720 Get on the Good Foot with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-part-2-e1f2efaad50b Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor DS18B20 (One Wire Interface)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/gloveboxes/ESP32-MicroPython-BME280-MQTT-Sample Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor BME280 (I2C)]&lt;br /&gt;
&lt;br /&gt;
=== CircuitPython ===&lt;br /&gt;
[https://learn.adafruit.com/circuitpython-with-esp32-quick-start CircuitPython on ESP32 Quick Start]&lt;br /&gt;
&lt;br /&gt;
== Sistemes operatius encastats ==&lt;br /&gt;
=== Raspbian ===&lt;br /&gt;
[https://www.raspberrypi.org/documentation/computers/remote-access.html Remote Access]&lt;br /&gt;
&lt;br /&gt;
[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ How to Install Mosquitto Broker on Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Adaptaci%C3%B3_per_a_que_la_Raspberry_Pi_funcioni_com_a_punt_d%27acc%C3%A9s_donant_adreces_IP_de_classe_B Adaptació per a que la Raspberry Pi funcioni com a punt d'accés donant adreces IP de classe B]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_dels_nodes_node-red-contrib-ttn_i_node-red-contrib-modbustcp-no-pooling_a_la_Raspberry_Pi Instal·lació dels nodes node-red-contrib-ttn i node-red-contrib-modbustcp-no-pooling a la Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_de_l%27OPC-UA_a_la_Raspberry_Pi,_fent_servir_Python,_i_control_des_d%27Indusoft Instal·lació de l'OPC-UA a la Raspberry Pi, fent servir Python, i control des d'Indusoft]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Pr%C3%A0ctica_de_connexi%C3%B3_remota_a_una_Raspberry_Pi Pràctica de connexió remota a una Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://core-electronics.com.au/guides/read-only-raspberry-pi/ Read-Only Raspberry Pi - Never Corrupt your Micro-SD Card]&lt;br /&gt;
==== Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb ''docker'' ====&lt;br /&gt;
[[Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker]]&lt;br /&gt;
&lt;br /&gt;
=== Mongoose OS ===&lt;br /&gt;
[https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md Guia ràpida d'introducció a Mongoose OS][en]&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
[[Sensors de so]]&lt;br /&gt;
&lt;br /&gt;
= Control remot dels dispositius IoT. Programari =&lt;br /&gt;
Al '''programari''' li diuen'' '''software''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
[https://binefa.cat/IoT/teoria/ethernetTcpUdp_00.pdf TCP/UDP Capa de transport d'Ethernet]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació d'un servidor de sòcols web a un Debian amb Apache]]&lt;br /&gt;
&lt;br /&gt;
=== MQTT(S) ===&lt;br /&gt;
[https://binefa.cat/IoT/teoria/mqtt_00.pdf Introducció a MQTT]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt/ Beginners Guide To The MQTT Protocol] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[https://www.rs-online.com/designspark/mqtt MQTT] explained by Andy Stanford-Clark (co-inventor of MQTT). Article written in 2017, and refering to v3.1.1&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/mqtt-5/ MQTT 5 Essentials] by HiveMQ&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt-hosting-brokers-and-servers/ MQTT Brokers/Servers and Cloud Hosting Guide] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer] An all-round MQTT client that provides a structured topic overview&lt;br /&gt;
&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT a Snap!]&lt;br /&gt;
&lt;br /&gt;
==== Public MQTT(S) brokers ====&lt;br /&gt;
[http://test.mosquitto.org/ mosquitto]&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/public-mqtt-broker/ HiveMQ MQTT broker]&lt;br /&gt;
&lt;br /&gt;
[https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/ MQTT brokers online with a free offer to test and connect IoT to the internet]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) implementations ====&lt;br /&gt;
[http://binefa.com/index.php?title=MQTTS_y_NodeRED MQTTS y NodeRED]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations Comparison of MQTT implementations]&lt;br /&gt;
&lt;br /&gt;
[http://test.mosquitto.org/ test.mosquitto.org]&lt;br /&gt;
&lt;br /&gt;
[https://www.emqx.io/ emqx.io]&lt;br /&gt;
&lt;br /&gt;
[https://vernemq.com/ VerneMQ]&lt;br /&gt;
&lt;br /&gt;
=== Webhooks ===&lt;br /&gt;
[https://hookdeck.com/guides/webhooks/what-are-webhooks-how-they-work What Are Webhooks And How They Work]&lt;br /&gt;
&lt;br /&gt;
[[Exemple bàsic de funcionament de Webhooks. Servidor i client en node.js]]&lt;br /&gt;
&lt;br /&gt;
== Programació local (ordinadors d'escriptori i dispositius mòbils) ==&lt;br /&gt;
[https://binefa.cat/IoT/mqtt/MQTT_Dash/ Configuració de MQTT Dash (aplicació per Android)]&lt;br /&gt;
&lt;br /&gt;
=== Mosquitto local a l'ordinador ===&lt;br /&gt;
[https://www.vultr.com/docs/how-to-install-mosquitto-mqtt-broker-server-on-ubuntu-16-04 How to Install Mosquitto MQTT Broker/Server on Ubuntu 16.04]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/downloads/ Instal·lació de Mosquitto a Windows]&lt;br /&gt;
&lt;br /&gt;
Per a actualitzar les claus dels dipòsits de Debian:&lt;br /&gt;
 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key&lt;br /&gt;
 sudo apt-key add mosquitto-repo.gpg.key&lt;br /&gt;
&lt;br /&gt;
=== SCADA ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=SCADA_fent_servir_Python_QML_i_Arduino SCADA fent servir Python QML i Arduino]&lt;br /&gt;
&lt;br /&gt;
== Núvol ==&lt;br /&gt;
=== Instal·lació de Node.js i npm ===&lt;br /&gt;
[https://github.com/nodesource/distributions/blob/master/README.md Instal·lació de node i npm]&lt;br /&gt;
 ecat@iot-ecat:~$ '''sudo bash'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''curl -sL https://deb.nodesource.com/setup_14.x | bash -'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''apt install -y nodejs'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''exit'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''node --version'''&lt;br /&gt;
 v14.15.4&lt;br /&gt;
 ecat@iot-ecat:~$ '''npm -- version'''&lt;br /&gt;
 6.14.10&lt;br /&gt;
&lt;br /&gt;
=== Node-RED ===&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf Introducció al Node-RED]&lt;br /&gt;
&lt;br /&gt;
[[Gestió de Node-RED]]&lt;br /&gt;
&lt;br /&gt;
[https://www.aprendiendoarduino.com/cursos/node-red-developer-para-iot-nivel-i/ Node-RED Developer para IoT. Nivel I]&lt;br /&gt;
&lt;br /&gt;
==== Instal·lació i funcionament del NodeRed autònom ====&lt;br /&gt;
 ecat@iot-ecat:~$ '''mkdir bin'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''cd bin'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''sudo apt install unzip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''mkdir nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''cd nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''wget https://www.binefa.cat/IoT/nodeRed/node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''unzip node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''node node_modules/node-red/red.js --userDir node_modules/node-red/data --settings node_modules/node-red/settings.js -v --port 2222 --title elmeuTitol --safe flows_meuTitol.json'''&lt;br /&gt;
&lt;br /&gt;
==== UDP ====&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/udpServer/udpServer_nodered_code.txt Codi NodeRED per a esp8266_udpServer_01.ino i esp32_udpServer_01b]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_i_MQTTS MQTT i MQTTS]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex00/ Exemple amb MQTT i NodeRED emprant ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex01/ Exercici amb MQTT i NodeRED emprant ESP8266]&lt;br /&gt;
&lt;br /&gt;
[[Elevador en Snap! controlat remotament amb MQTT mitjançant NodeRED fent crides HTTP]]&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer]&lt;br /&gt;
&lt;br /&gt;
==== Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Un_exemple_d%27us_de_Telegram_amb_el_NodeRed Un exemple d'us de Telegram amb el NodeRed]&lt;br /&gt;
&lt;br /&gt;
==== Modbus TCP ====&lt;br /&gt;
[https://binefa.cat/IoT/modbus/ Arxius per treballar amb Modbus TCP] [https://www.binefa.cat/php/doc/modbus/ El segon vídeo explica i compara Modbus RTU i Modbus TCP] &lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/modbusCtrl/ ModBus TCP al NodeRED]&lt;br /&gt;
&lt;br /&gt;
==== Alguns nodes extra ====&lt;br /&gt;
[https://flows.nodered.org/node/node-red-contrib-google-sheets node-red-contrib-google-sheets]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/sammachin/node-red-contrib-google-sheets node-red-contrib-google-sheets al Github]&lt;br /&gt;
&lt;br /&gt;
=== Sistemes d'emmagatzematge i visualització ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=InfluxDB Base de dades de sèries temporals InfluxDB]&lt;br /&gt;
&lt;br /&gt;
[http://docs.grafana.org/installation/debian/ Instal·lació de Grafana a Debian][en]&lt;br /&gt;
&lt;br /&gt;
[[Sentilo]]&lt;br /&gt;
&lt;br /&gt;
=== Xarxes d'àrea estesa de baix consum (LPWAN) ===&lt;br /&gt;
==== Conceptes teòrics ====&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Xarxa_de_llarg_abast Xarxa de llarg abast (WAN)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Chirp_spread_spectrum Espectre eixamplat (Chirp Spread Spectrum)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_seq%C3%BC%C3%A8ncia_directa Espectre eixamplat per seqüència directa (DSSS)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_salt_de_freq%C3%BC%C3%A8ncia Espectre eixamplat per salt de freqüència (FHSS)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LPWAN What is LPWAN?]&lt;br /&gt;
&lt;br /&gt;
[https://cms.edn.com/ContentEETimes/Documents/EDN/LP%20WAN%20Comparison%20Table%20final.pdf Comparison table of Low Power WAN alternatives]&lt;br /&gt;
&lt;br /&gt;
==== LoRa ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
==== SigFox ====&lt;br /&gt;
[https://docs.pycom.io/chapter/tutorials/sipy/register.html Registering SiPy with Sigfox]&lt;br /&gt;
&lt;br /&gt;
[[Interacció amb SiPy1.0r de pycom]]&lt;br /&gt;
&lt;br /&gt;
==== Antenes ====&lt;br /&gt;
[https://youtu.be/CJNq2I_PDHQ Andreas Spiess video: &amp;quot;#182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge)&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Bots ===&lt;br /&gt;
==== Bot de Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Bot_de_Telegram Bot de Telegram]&lt;br /&gt;
&lt;br /&gt;
==== Bot de Mastodon ====&lt;br /&gt;
No totes les instàncies de [https://ca.wikipedia.org/wiki/Mastodon_(xarxa_social) Mastodon] faciliten la instal·lació de bots. Per a fer les primeres passes us recomano aquesta [https://botsin.space/ instància pensada per allotjar bots de Mastodon].&lt;br /&gt;
&lt;br /&gt;
[https://botsin.space/@siarq_sensors Exemple de bot de Mastodon] per a fer lectures de sensors cada hora.&lt;br /&gt;
&lt;br /&gt;
[https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26 Getting credentials for the Mastodon API with Mastodon.py, step by step]&lt;br /&gt;
&lt;br /&gt;
=== VPS ===&lt;br /&gt;
[[Introducció als contenidors docker]]&lt;br /&gt;
&lt;br /&gt;
[[Servidor intermediari invers]]&lt;br /&gt;
&lt;br /&gt;
[[Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[File Browser]]&lt;br /&gt;
&lt;br /&gt;
[[Apache i PHP]]&lt;br /&gt;
&lt;br /&gt;
[[Redireccions a subdomini]]&lt;br /&gt;
&lt;br /&gt;
[[Mastodon]]&lt;br /&gt;
&lt;br /&gt;
[https://medium.com/himinds/mqtt-broker-with-secure-websocket-using-traefik-docker-compose-and-lets-encrypt-2b8e32207555 MQTT broker with Secure WebSocket using Traefik, Docker Compose and Let’s Encrypt]&lt;br /&gt;
&lt;br /&gt;
[[Moodle a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Node-RED a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Snap! a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[VPN WireGuard]]&lt;br /&gt;
&lt;br /&gt;
== Snap! ==&lt;br /&gt;
[https://github.com/jmoenig/Snap Snap! al GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''amb''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''sense''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
=== JavaScript per defecte ===&lt;br /&gt;
Per raons de seguretat, s'ha desactivat el JavaScript per defecte. Si us munteu el vostre propi servei al núvol, per a poder cridar programes vostres amb funcions amb JavaScript, heu d'afegir aquesta línia, en negreta, a l'arxiu ''[https://github.com/jmoenig/Snap/blob/master/snap.html snap.html]'':&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            '''Process.prototype.enableJS = true;''' // &amp;lt;-- Per a tenir seleccionat el JS per defecte&lt;br /&gt;
            var world;&lt;br /&gt;
            window.onload = function () {&lt;br /&gt;
                if ('serviceWorker' in navigator) {&lt;br /&gt;
                    navigator.serviceWorker.register('sw.js');&lt;br /&gt;
                }&lt;br /&gt;
                world = new WorldMorph(document.getElementById('world'));&lt;br /&gt;
                new IDE_Morph().openIn(world);&lt;br /&gt;
                loop();&lt;br /&gt;
            };&lt;br /&gt;
            function loop() {&lt;br /&gt;
                requestAnimationFrame(loop);&lt;br /&gt;
                world.doOneCycle();&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MQTT for Snap! ===&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT4Snap !], desenvolupat per en Xavier Pi.&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld.xml Hello World emprant MQTT '''amb''' SSL]&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html#open:http://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld_NoSSL.xml Hello World emprant MQTT '''sense''' SSL]&lt;br /&gt;
=== Intel·ligència Artificial ===&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://xavierpi.com/ia/ia.xml Connexió amb Gemini] Cal una [https://aistudio.google.com/app/apikey clau d'API (API key)] ([https://ai.google.dev/gemini-api/docs/quickstart?lang=python Guia ràpida d'ús a l'API de Gemini])&lt;br /&gt;
&amp;lt;!-- AIzaSyBINpQKh7Sj8WyIV-PmNfo157Pg8LQr8JY --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Una aproximació a OPC-UA =&lt;br /&gt;
&lt;br /&gt;
[[OPC-UA]]&lt;br /&gt;
&lt;br /&gt;
= Placa IoT-02 =&lt;br /&gt;
[[Placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
== Programació remota (OTA) ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Esp32Ota.png|center|Programacio OTA de la placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
=== Dos programes de prova de programació remota ===&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_01.zip IoT-02_OTAWebUpdater_01] (Fa pampallugues el led blanc) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_02.zip IoT-02_OTAWebUpdater_02] (Fa pampallugues el led verd) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
=== Programació a la vora (''edge'') ===&lt;br /&gt;
L'ordinador a la vora (''edge'') pot ser un ordinador normal, habitualment de poca potència, del tipus Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Per a tenir visibilitat externa de la pàgina web servida per la placa IoT-02 (per exemple amb la IP 192.168.1.151:80), ho redireccionarem a un port ( 192.168.1.151:80 --&amp;gt; localhost:5001 )&lt;br /&gt;
&lt;br /&gt;
Per a fer funcionar [https://www.binefa.cat/training/iot02/ota/edge/simple-port-forwarding.js simple-port-forwarding.js] caldrà haver afegit el paquet '''http-proxy''':&lt;br /&gt;
&lt;br /&gt;
 npm install http-proxy&lt;br /&gt;
&lt;br /&gt;
El codi nodejs de redireccionament (suposant que la placa IoT-02 ha adquirit l'adreça IP 192.168.1.151):&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '192.168.1.151';&lt;br /&gt;
 var portOrigen = 80;&lt;br /&gt;
 var portDesti = 5001;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
Per a fer aquest redireccionador sigui un servei, es copia [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service] a la carpeta '''/etc/systemd/system''' o el fem de nou amb un editor:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/systemd/system&lt;br /&gt;
 sudo nano [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service]&lt;br /&gt;
 sudo chmod 755 myForwardingService.service&lt;br /&gt;
 sudo systemctl daemon-reload&lt;br /&gt;
 sudo systemctl '''start''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
Per a veure l'estat del servei:&lt;br /&gt;
 systemctl '''status''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
I per a fer que el servei es posi en marxa al reiniciar l'ordinador a la vora:&lt;br /&gt;
 sudo systemctl '''enable''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
=== Programació al núvol ===&lt;br /&gt;
Mitjançant una xarxa virtual privada (VPN) de l'estil [https://www.zerotier.com/ ZeroTier] podem fer que l'ordinador a la vora i l'ordinador al núvol comparteixin la mateixa xarxa.&lt;br /&gt;
&lt;br /&gt;
Suposant que l'ordinador a la vora té la IP 10.242.156.158, podem redireccionar-hi 10.242.156.158:5001 --&amp;gt; localhost:7007 :&lt;br /&gt;
&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '10.242.156.158';&lt;br /&gt;
 var portOrigen = 5001;&lt;br /&gt;
 var portDesti = 7007;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
I així tenim accés remot des del núvol, connectant mitjançant l'ordinador a la vora que es connecta a la placa IoT-02. &lt;br /&gt;
&lt;br /&gt;
Per accedir-hi des del navegador, escriviu a la URL: &lt;br /&gt;
 &amp;lt;nom_de_domini&amp;gt;:7007&lt;br /&gt;
Això visualitzarà el que presenta l'ordinador a la vora (la IP és la VPN a l'ordinador a la vora):&lt;br /&gt;
 10.242.156.158:5001&lt;br /&gt;
Que al seu temps presenta el servei pel port 80 de la placa IOT-02 connectada a la mateixa xarxa local que l'ordinador a la vora:&lt;br /&gt;
 192.168.1.151&lt;br /&gt;
&lt;br /&gt;
=== Els tres mètodes de programació OTA de l'ESP32 ===&lt;br /&gt;
[https://www.programmersought.com/article/90864120754/ How to implement OTA online update of ESP32 firmware]&lt;br /&gt;
&lt;br /&gt;
== MicroPython ==&lt;br /&gt;
[https://www.digikey.es/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce MicroPython Basics: Load Files &amp;amp; Run Code]&lt;br /&gt;
&lt;br /&gt;
[https://warped3.substack.com/p/compiling-micropython-with-espressif Compiling microPython with espressif SDK 4.4 for ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://docs.micropython.org/en/latest/esp32/tutorial/intro.html Getting started with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython The MicroPython project]&lt;br /&gt;
&lt;br /&gt;
[https://cdn-learn.adafruit.com/downloads/pdf/micropython-basics-loading-modules.pdf MicroPython Basics: Loading Modules]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/robert-hh/FTP-Server-for-ESP8266-ESP32-and-PYBD uftpd: small FTP server for ESP8266, ESP32 and Pyboard D]&lt;br /&gt;
&lt;br /&gt;
[https://electronicsinnovation.com/connect-esp32-to-ubidots-using-micropython-over-mqtt-with-visual-studio-code/ Connect ESP32 to Ubidots using Micropython over MQTT with Visual Studio Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peterhinch Peter Hinch's GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://wolles-elektronikkiste.de/en/programming-the-esp32-with-micropython Programming the ESP32 with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://awesome-micropython.com/ A curated list of awesome MicroPython libraries, frameworks, software and resources]&lt;br /&gt;
=== asyncio ===&lt;br /&gt;
[https://www.youtube.com/watch?v=5VLvmA__2v0 How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics]&lt;br /&gt;
=== Threads ===&lt;br /&gt;
[https://github.com/kevinmcaleer/threads Micropython thread tutorial]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=QeDnjcdGrpY Video: Micropython Threads - Use Both Cores, on Raspberry Pi Pico and ESP32]&lt;br /&gt;
=== MQTT ===&lt;br /&gt;
[https://bhave.sh/micropython-mqtt/ Secrets of MicroPython: MQTT on ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://wokwi.com/projects/341892004923310676 Exemple MQTT sobre micropython funcionant al wokwi] ([https://wokwi.com/projects/341895401936257620 Un exemple més compacte])&lt;br /&gt;
&lt;br /&gt;
=== Modbus ===&lt;br /&gt;
==== Modifying source code ====&lt;br /&gt;
[https://github.com/brainelectronics/micropython-modbus MicroPython Modbus library]&lt;br /&gt;
&lt;br /&gt;
Modbus control signal able to send or receive messages can be controlled directly by UART. To do that, file [https://github.com/mrvelic/micropython/blob/master/ports/esp32/machine_uart.c machine_uart.c] should be changed.&lt;br /&gt;
&lt;br /&gt;
Changes to be able to use Tx/Rx MAX3485 pin: [https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Information about Modbus an MicroPython has been got from this forum: https://github.com/micropython/micropython/pull/5567&lt;br /&gt;
==== Based on pycom-modbus from pycom ====&lt;br /&gt;
[https://github.com/danjperron/micropython-modbus Modbus Master library for MicroPython ESP32 devices]&lt;br /&gt;
=== LoRa ===&lt;br /&gt;
[https://github.com/martynwheeler/u-lora This is a port of raspi-lora for micropython]&lt;br /&gt;
&lt;br /&gt;
= IoT-Vertebrae =&lt;br /&gt;
== Raspberry ==&lt;br /&gt;
[[Configuració de la WiFi a la Raspberry Pi emprant nmtui]]&lt;br /&gt;
&lt;br /&gt;
[[Reconnexió automàtica a la WiFi]]&lt;br /&gt;
&lt;br /&gt;
[[WireGuard VPN]]&lt;br /&gt;
&lt;br /&gt;
= Exemples pràctics =&lt;br /&gt;
== Sensor ModBus de temperatura i humitat CWT-TH03S ==&lt;br /&gt;
[https://www.aliexpress.com/item/1005001404952412.html CWT-TH03S a AliExpress]&lt;br /&gt;
&lt;br /&gt;
[[Accés ModBus al sensor de temperatura i humitat CWT-TH03S]]&lt;br /&gt;
&lt;br /&gt;
= SBC =&lt;br /&gt;
== PocketBeagle ==&lt;br /&gt;
=== Grove Kit ===&lt;br /&gt;
==== Visió general ====&lt;br /&gt;
[https://beagleboard.org/Kits/Grove Informació comercial del Grove Kit]&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/pocket Informació comercial de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki Wiki de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual System Reference Manual] &amp;lt;----&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/latest-images Darreres imatges per a les SD]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/capes/tree/master/pocketbeagle/Grove Disseny del Grove Cape]&lt;br /&gt;
&lt;br /&gt;
==== Primera connexió a la xarxa sense fils ====&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$ '''sudo connmanctl'''⏎&lt;br /&gt;
 [sudo] password for debian: temppwd⏎&lt;br /&gt;
 connmanctl&amp;gt; '''scan wifi'''⏎&lt;br /&gt;
 Scan completed for wifi&lt;br /&gt;
 connmanctl&amp;gt; '''services'''⏎&lt;br /&gt;
       MyWifi                  wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''agent on'''⏎&lt;br /&gt;
 Agent registered&lt;br /&gt;
 connmanctl&amp;gt; '''connect wifi_1234567890_1234567890123456_managed_psk'''⏎&lt;br /&gt;
 Agent RequestInput wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
       Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]&lt;br /&gt;
       WPS = [ Type=wpspin, Requirement=alternate ]&lt;br /&gt;
 Passphrase? '''MySecretPassphrase'''⏎&lt;br /&gt;
 Connected wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''quit'''⏎&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$&lt;br /&gt;
&lt;br /&gt;
==== Tutorials ====&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/blob/master/PocketBeagle/Grove/workshop-handouts.md Blink PocketBeagle on-board USRx LED]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/tree/master/PocketBeagle/Grove Exemples]&lt;br /&gt;
&lt;br /&gt;
= Formació =&lt;br /&gt;
[https://www.binefa.com/index.php/IoT_amb_Arduino_i_Raspberry_Pi._Microcontroladors_d%27%C3%BAs_professional._Curs_Presencial._Edici%C3%B3_de_mar%C3%A7_de_2022 IoT amb Arduino i Raspberry Pi. Microcontroladors d'ús professional. Curs Presencial. Edició de març de 2022] - [https://formacio.eic.cat/cursos/1123577 Formació al Col·legi d'Enginyers Industrials de Catalunya] (30 / març / 2022)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Sistemes_encastats_d%27escala_petita_i_mitjana._Edici%C3%B3_d%27octubre_2021 Sistemes encastats d'escala petita i mitjana. Edició d'octubre 2021] (20 / octubre / 2021)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways)_IoT_(22_de_mar%C3%A7_de_2022) Nodes sensors (motes) i passarel·les (gateways) IoT (22 de març de 2022)] pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2022) Tecnologías IoT, Hands on y MVP (2022)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Diada_de_la_Llibertat_del_Maquinari_(Edici%C3%B3_2021) Diada de la Llibertat del Maquinari (Edició 2021)] (17 d'abril de 2021)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2021) Tecnologías IoT, Hands on y MVP (2021)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways) Nodes sensors (motes) i passarel·les (gateways)]  pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria] (23 de març de 2021)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Monitoritzaci%C3%B3_de_la_qualitat_de_l%27aire_mesurant_CO2_i_VOC_amb_LoRa Monitorització de la qualitat de l'aire mesurant CO2 i VOC amb LoRa] (9 de gener de 2021)&lt;br /&gt;
&lt;br /&gt;
[[Curset introductori d'Internet de les Coses per ADTelecom]] (Comença el 5 de novembre de 2020)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=%C3%9As_de_les_dades_generades_pels_sensors_LoRaWAN_i_arquitectura_del_sistema._Rub%C3%AD_2020 Ús de les dades generades pels sensors LoRaWAN i arquitectura del sistema. Rubí, 17 de juny de 2020]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Curset_a_TE_Connectivity_del_4_de_mar%C3%A7_de_2020 Curset a TE Connectivity del 4 de març de 2020] a [https://www.te.com/ TE Connectivity]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] (Ajuntament de Viladecans, 19 de febrer de 2020)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://www.binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2020) Tecnologías IoT, Hands on y MVP (2020)]&lt;br /&gt;
&lt;br /&gt;
UPC-School - 21802500 - Màster Industria 4.0 [https://wiki.binefa.cat/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP Tecnologías IoT, Hands on y MVP] (2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] a l'[http://www.icm.csic.es/ Institut de Ciències del Mar] (27 / setembre / 2018 i 25 / setembre / 2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_a_Internet_de_les_Coses_-_juny_2018 Introducció a Internet de les Coses - juny 2018] (Curset de formació per a professors de CF realitzat a l'[https://agora.xtec.cat/iesramblaprim/ Institut Rambla Prim])&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Sunna LoRa RMM v3.0]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Xifratge =&lt;br /&gt;
[[Eines de xifratge en línia]]&lt;br /&gt;
&lt;br /&gt;
= Opinió =&lt;br /&gt;
[http://www.xavierpi.com/mi40/HaciaUnIoT_democraticoYEfectivo.pdf Hacia un Internet de las Cosas democrático y efectivo] per Xavier Pi (octubre 2018)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Auxiliar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;MediaWiki s'ha instal·lat.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consulteu la [https://meta.wikimedia.org/wiki/Help:Contents Guia d'Usuari] per a més informació sobre com utilitzar aquest programari wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Primers passos ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Llista de paràmetres configurables]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ PMF del MediaWiki]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce Llista de correu per a anuncis del MediaWiki]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Traducció de MediaWiki en la vostra llengua]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Aprengueu com combatre la brossa que pot atacar el vostre wiki]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47726</id>
		<title>Pàgina principal</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47726"/>
		<updated>2025-02-10T12:56:04Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Intel·ligència Artificial */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size:500%&amp;quot;&amp;gt;things.cat&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:300%&amp;quot;&amp;gt;Una pàgina pràctica sobre la Internet de les Coses&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Dispositius IoT. Maquinari i microprogramari =&lt;br /&gt;
Al '''maquinari''' li diem'' '''hardware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
Al '''microprogramari''' li diem'' '''firmware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
'''IoT''' és l'acrònim d'''Internet of Things''. En català abreujat li podríem dir '''IdC''' per a referir-nos a '''la Internet de les Coses'''. En el moment d'escriure aquest text, la comunitat catalanoparlant sembla haver optat per referir-se als '''dispositius de la Internet de les Coses''' com a '''dispositius IoT'''. Si el [https://www.termcat.cat/ca/neoloteca/ termcat] es pronuncia de manera diferent, provaré d'adaptar la terminologia.&lt;br /&gt;
&lt;br /&gt;
== Placa IoT-02 ==&lt;br /&gt;
[https://www.binefa.com/index.php/Placa_IoT-02 Placa_IoT-02]&lt;br /&gt;
&lt;br /&gt;
== Controladors ==&lt;br /&gt;
Als '''controladors''' els hi diem'' '''drivers''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
El xip '''FT232''' ha estat durant molt de temps el xip més comú per convertir d''''USB a UART'''. Fins al punt que se'n van fer còpies pirates. Una actualització del sistema operatiu privatiu Windows va explotar una característica dels xips pirates: els xips pirates tenien el registre d'identificació USB de lectura i escriptura i l'original era tan sols de lectura. L'actualització que va fer Windows provocava l'escriptura d'aquest registre i hi escrivia un zero, que feia que el sistema operatiu ho identifiqués com a concentrador USB i no com a controlador d'UART, fent que el maquinari quedés inservible. A l'any 2014 em vaig veure atrapat amb uns quants Arduino Nano que duien aquest xip pirata i vaig escriure [https://binefa.cat/blog/?p=80 How to recover bricked fake FT232] per a poder-los reprogramar i poder-los fer servir amb sistemes operatius lliures GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
A partir d'aquell moment, bona part de les plaques de fabricació xinesa van començar a dur, massivament, el xip '''CH340''' per a convertir d'USB a UART.&lt;br /&gt;
&lt;br /&gt;
[[Controlador CH340]]&lt;br /&gt;
&lt;br /&gt;
[[Controlador FT232]]&lt;br /&gt;
&lt;br /&gt;
== C / C++ ==&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-libraries Biblioteques per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes Codis per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
=== ESP8266 ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Afegint_la_targeta_ESP8266_a_l%27IDE_d%27Arduino Afegint la targeta ESP8266 a l'IDE d'Arduino] (NodeMCU1.0)&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp8266_udpServer_01b esp8266_udpServer_01.ino] Codi UDP per a ESP8266&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_a_l%27ESP8266 MQTT a l'ESP8266]&lt;br /&gt;
&lt;br /&gt;
=== ESP32 ===&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_udpServer_01b esp32_udpServer_01b] Codi UDP per a ESP32&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_i2cScanner_02 esp32_i2cScanner_02.ino Adreces de dispositius I2C connectats]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/modbus/rtu/esp32/ Exemple de ModBus RTU fent servir NodeRED i ESP32 (amb la placa IoT PLB)]&lt;br /&gt;
&lt;br /&gt;
[https://techtutorialsx.com/2017/05/06/esp32-arduino-creating-a-task/ ESP32 Arduino: Creating a FreeRTOS task]&lt;br /&gt;
&lt;br /&gt;
[https://savjee.be/2020/01/multitasking-esp32-arduino-freertos/ Multitasking on ESP32 with Arduino and FreeRTOS]&lt;br /&gt;
&lt;br /&gt;
==== Modbus ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#overview-of-rs485-specific-communication-options Overview of RS485 specific communication options]&lt;br /&gt;
&lt;br /&gt;
[https://pastebin.com/2PtWJvd6 Example setting RS485 at half duplex mode]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/IoT-02/tree/master/codes/IoT-02_11_modbus_bme280_02 Code IoT-02_11_modbus_bme280_02] using RS485 at half duplex mode&lt;br /&gt;
&lt;br /&gt;
==== ESP-IDF ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ Get Started]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html Get started with ESP-IDF and ESP32-DevKitC: debugging, unit testing, project analysis]&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
=== Accés al maquinari de la Raspberry Pi emprant Python ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Com_connectar-hi_pantalles_OLED_SSD1306_(128x64) Com connectar-hi pantalles OLED SSD1306 (128x64)]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=%C3%9As_d%27entrades_anal%C3%B2giques_amb_l%27ADS115_controlant_sortides_PWM Ús d'entrades analògiques amb l'ADS115 controlant sortides PWM]&lt;br /&gt;
&lt;br /&gt;
=== Micropython ===&lt;br /&gt;
[https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome Micropython and the Internet of Things]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp8266 MicroPython port to ESP8266]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp32 MicroPython port to the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://icircuit.net/esp32-micropython-getting-started/1999 ESP32 – Getting started with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-on-the-esp32-decdd32c4720 Get on the Good Foot with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-part-2-e1f2efaad50b Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor DS18B20 (One Wire Interface)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/gloveboxes/ESP32-MicroPython-BME280-MQTT-Sample Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor BME280 (I2C)]&lt;br /&gt;
&lt;br /&gt;
=== CircuitPython ===&lt;br /&gt;
[https://learn.adafruit.com/circuitpython-with-esp32-quick-start CircuitPython on ESP32 Quick Start]&lt;br /&gt;
&lt;br /&gt;
== Sistemes operatius encastats ==&lt;br /&gt;
=== Raspbian ===&lt;br /&gt;
[https://www.raspberrypi.org/documentation/computers/remote-access.html Remote Access]&lt;br /&gt;
&lt;br /&gt;
[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ How to Install Mosquitto Broker on Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Adaptaci%C3%B3_per_a_que_la_Raspberry_Pi_funcioni_com_a_punt_d%27acc%C3%A9s_donant_adreces_IP_de_classe_B Adaptació per a que la Raspberry Pi funcioni com a punt d'accés donant adreces IP de classe B]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_dels_nodes_node-red-contrib-ttn_i_node-red-contrib-modbustcp-no-pooling_a_la_Raspberry_Pi Instal·lació dels nodes node-red-contrib-ttn i node-red-contrib-modbustcp-no-pooling a la Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_de_l%27OPC-UA_a_la_Raspberry_Pi,_fent_servir_Python,_i_control_des_d%27Indusoft Instal·lació de l'OPC-UA a la Raspberry Pi, fent servir Python, i control des d'Indusoft]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Pr%C3%A0ctica_de_connexi%C3%B3_remota_a_una_Raspberry_Pi Pràctica de connexió remota a una Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://core-electronics.com.au/guides/read-only-raspberry-pi/ Read-Only Raspberry Pi - Never Corrupt your Micro-SD Card]&lt;br /&gt;
==== Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb ''docker'' ====&lt;br /&gt;
[[Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker]]&lt;br /&gt;
&lt;br /&gt;
=== Mongoose OS ===&lt;br /&gt;
[https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md Guia ràpida d'introducció a Mongoose OS][en]&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
[[Sensors de so]]&lt;br /&gt;
&lt;br /&gt;
= Control remot dels dispositius IoT. Programari =&lt;br /&gt;
Al '''programari''' li diuen'' '''software''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
[https://binefa.cat/IoT/teoria/ethernetTcpUdp_00.pdf TCP/UDP Capa de transport d'Ethernet]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació d'un servidor de sòcols web a un Debian amb Apache]]&lt;br /&gt;
&lt;br /&gt;
=== MQTT(S) ===&lt;br /&gt;
[https://binefa.cat/IoT/teoria/mqtt_00.pdf Introducció a MQTT]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt/ Beginners Guide To The MQTT Protocol] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[https://www.rs-online.com/designspark/mqtt MQTT] explained by Andy Stanford-Clark (co-inventor of MQTT). Article written in 2017, and refering to v3.1.1&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/mqtt-5/ MQTT 5 Essentials] by HiveMQ&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt-hosting-brokers-and-servers/ MQTT Brokers/Servers and Cloud Hosting Guide] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer] An all-round MQTT client that provides a structured topic overview&lt;br /&gt;
&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT a Snap!]&lt;br /&gt;
&lt;br /&gt;
==== Public MQTT(S) brokers ====&lt;br /&gt;
[http://test.mosquitto.org/ mosquitto]&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/public-mqtt-broker/ HiveMQ MQTT broker]&lt;br /&gt;
&lt;br /&gt;
[https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/ MQTT brokers online with a free offer to test and connect IoT to the internet]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) implementations ====&lt;br /&gt;
[http://binefa.com/index.php?title=MQTTS_y_NodeRED MQTTS y NodeRED]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations Comparison of MQTT implementations]&lt;br /&gt;
&lt;br /&gt;
[http://test.mosquitto.org/ test.mosquitto.org]&lt;br /&gt;
&lt;br /&gt;
[https://www.emqx.io/ emqx.io]&lt;br /&gt;
&lt;br /&gt;
[https://vernemq.com/ VerneMQ]&lt;br /&gt;
&lt;br /&gt;
=== Webhooks ===&lt;br /&gt;
[https://hookdeck.com/guides/webhooks/what-are-webhooks-how-they-work What Are Webhooks And How They Work]&lt;br /&gt;
&lt;br /&gt;
[[Exemple bàsic de funcionament de Webhooks. Servidor i client en node.js]]&lt;br /&gt;
&lt;br /&gt;
== Programació local (ordinadors d'escriptori i dispositius mòbils) ==&lt;br /&gt;
[https://binefa.cat/IoT/mqtt/MQTT_Dash/ Configuració de MQTT Dash (aplicació per Android)]&lt;br /&gt;
&lt;br /&gt;
=== Mosquitto local a l'ordinador ===&lt;br /&gt;
[https://www.vultr.com/docs/how-to-install-mosquitto-mqtt-broker-server-on-ubuntu-16-04 How to Install Mosquitto MQTT Broker/Server on Ubuntu 16.04]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/downloads/ Instal·lació de Mosquitto a Windows]&lt;br /&gt;
&lt;br /&gt;
Per a actualitzar les claus dels dipòsits de Debian:&lt;br /&gt;
 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key&lt;br /&gt;
 sudo apt-key add mosquitto-repo.gpg.key&lt;br /&gt;
&lt;br /&gt;
=== SCADA ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=SCADA_fent_servir_Python_QML_i_Arduino SCADA fent servir Python QML i Arduino]&lt;br /&gt;
&lt;br /&gt;
== Núvol ==&lt;br /&gt;
=== Instal·lació de Node.js i npm ===&lt;br /&gt;
[https://github.com/nodesource/distributions/blob/master/README.md Instal·lació de node i npm]&lt;br /&gt;
 ecat@iot-ecat:~$ '''sudo bash'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''curl -sL https://deb.nodesource.com/setup_14.x | bash -'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''apt install -y nodejs'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''exit'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''node --version'''&lt;br /&gt;
 v14.15.4&lt;br /&gt;
 ecat@iot-ecat:~$ '''npm -- version'''&lt;br /&gt;
 6.14.10&lt;br /&gt;
&lt;br /&gt;
=== Node-RED ===&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf Introducció al Node-RED]&lt;br /&gt;
&lt;br /&gt;
[[Gestió de Node-RED]]&lt;br /&gt;
&lt;br /&gt;
[https://www.aprendiendoarduino.com/cursos/node-red-developer-para-iot-nivel-i/ Node-RED Developer para IoT. Nivel I]&lt;br /&gt;
&lt;br /&gt;
==== Instal·lació i funcionament del NodeRed autònom ====&lt;br /&gt;
 ecat@iot-ecat:~$ '''mkdir bin'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''cd bin'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''sudo apt install unzip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''mkdir nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''cd nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''wget https://www.binefa.cat/IoT/nodeRed/node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''unzip node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''node node_modules/node-red/red.js --userDir node_modules/node-red/data --settings node_modules/node-red/settings.js -v --port 2222 --title elmeuTitol --safe flows_meuTitol.json'''&lt;br /&gt;
&lt;br /&gt;
==== UDP ====&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/udpServer/udpServer_nodered_code.txt Codi NodeRED per a esp8266_udpServer_01.ino i esp32_udpServer_01b]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_i_MQTTS MQTT i MQTTS]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex00/ Exemple amb MQTT i NodeRED emprant ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex01/ Exercici amb MQTT i NodeRED emprant ESP8266]&lt;br /&gt;
&lt;br /&gt;
[[Elevador en Snap! controlat remotament amb MQTT mitjançant NodeRED fent crides HTTP]]&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer]&lt;br /&gt;
&lt;br /&gt;
==== Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Un_exemple_d%27us_de_Telegram_amb_el_NodeRed Un exemple d'us de Telegram amb el NodeRed]&lt;br /&gt;
&lt;br /&gt;
==== Modbus TCP ====&lt;br /&gt;
[https://binefa.cat/IoT/modbus/ Arxius per treballar amb Modbus TCP] [https://www.binefa.cat/php/doc/modbus/ El segon vídeo explica i compara Modbus RTU i Modbus TCP] &lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/modbusCtrl/ ModBus TCP al NodeRED]&lt;br /&gt;
&lt;br /&gt;
==== Alguns nodes extra ====&lt;br /&gt;
[https://flows.nodered.org/node/node-red-contrib-google-sheets node-red-contrib-google-sheets]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/sammachin/node-red-contrib-google-sheets node-red-contrib-google-sheets al Github]&lt;br /&gt;
&lt;br /&gt;
=== Sistemes d'emmagatzematge i visualització ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=InfluxDB Base de dades de sèries temporals InfluxDB]&lt;br /&gt;
&lt;br /&gt;
[http://docs.grafana.org/installation/debian/ Instal·lació de Grafana a Debian][en]&lt;br /&gt;
&lt;br /&gt;
[[Sentilo]]&lt;br /&gt;
&lt;br /&gt;
=== Xarxes d'àrea estesa de baix consum (LPWAN) ===&lt;br /&gt;
==== Conceptes teòrics ====&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Xarxa_de_llarg_abast Xarxa de llarg abast (WAN)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Chirp_spread_spectrum Espectre eixamplat (Chirp Spread Spectrum)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_seq%C3%BC%C3%A8ncia_directa Espectre eixamplat per seqüència directa (DSSS)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_salt_de_freq%C3%BC%C3%A8ncia Espectre eixamplat per salt de freqüència (FHSS)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LPWAN What is LPWAN?]&lt;br /&gt;
&lt;br /&gt;
[https://cms.edn.com/ContentEETimes/Documents/EDN/LP%20WAN%20Comparison%20Table%20final.pdf Comparison table of Low Power WAN alternatives]&lt;br /&gt;
&lt;br /&gt;
==== LoRa ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
==== SigFox ====&lt;br /&gt;
[https://docs.pycom.io/chapter/tutorials/sipy/register.html Registering SiPy with Sigfox]&lt;br /&gt;
&lt;br /&gt;
[[Interacció amb SiPy1.0r de pycom]]&lt;br /&gt;
&lt;br /&gt;
==== Antenes ====&lt;br /&gt;
[https://youtu.be/CJNq2I_PDHQ Andreas Spiess video: &amp;quot;#182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge)&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Bots ===&lt;br /&gt;
==== Bot de Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Bot_de_Telegram Bot de Telegram]&lt;br /&gt;
&lt;br /&gt;
==== Bot de Mastodon ====&lt;br /&gt;
No totes les instàncies de [https://ca.wikipedia.org/wiki/Mastodon_(xarxa_social) Mastodon] faciliten la instal·lació de bots. Per a fer les primeres passes us recomano aquesta [https://botsin.space/ instància pensada per allotjar bots de Mastodon].&lt;br /&gt;
&lt;br /&gt;
[https://botsin.space/@siarq_sensors Exemple de bot de Mastodon] per a fer lectures de sensors cada hora.&lt;br /&gt;
&lt;br /&gt;
[https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26 Getting credentials for the Mastodon API with Mastodon.py, step by step]&lt;br /&gt;
&lt;br /&gt;
=== VPS ===&lt;br /&gt;
[[Introducció als contenidors docker]]&lt;br /&gt;
&lt;br /&gt;
[[Servidor intermediari invers]]&lt;br /&gt;
&lt;br /&gt;
[[Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[File Browser]]&lt;br /&gt;
&lt;br /&gt;
[[Apache i PHP]]&lt;br /&gt;
&lt;br /&gt;
[[Redireccions a subdomini]]&lt;br /&gt;
&lt;br /&gt;
[[Mastodon]]&lt;br /&gt;
&lt;br /&gt;
[https://medium.com/himinds/mqtt-broker-with-secure-websocket-using-traefik-docker-compose-and-lets-encrypt-2b8e32207555 MQTT broker with Secure WebSocket using Traefik, Docker Compose and Let’s Encrypt]&lt;br /&gt;
&lt;br /&gt;
[[Moodle a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Node-RED a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Snap! a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[VPN WireGuard]]&lt;br /&gt;
&lt;br /&gt;
== Snap! ==&lt;br /&gt;
[https://github.com/jmoenig/Snap Snap! al GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''amb''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''sense''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
=== JavaScript per defecte ===&lt;br /&gt;
Per raons de seguretat, s'ha desactivat el JavaScript per defecte. Si us munteu el vostre propi servei al núvol, per a poder cridar programes vostres amb funcions amb JavaScript, heu d'afegir aquesta línia, en negreta, a l'arxiu ''[https://github.com/jmoenig/Snap/blob/master/snap.html snap.html]'':&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            '''Process.prototype.enableJS = true;''' // &amp;lt;-- Per a tenir seleccionat el JS per defecte&lt;br /&gt;
            var world;&lt;br /&gt;
            window.onload = function () {&lt;br /&gt;
                if ('serviceWorker' in navigator) {&lt;br /&gt;
                    navigator.serviceWorker.register('sw.js');&lt;br /&gt;
                }&lt;br /&gt;
                world = new WorldMorph(document.getElementById('world'));&lt;br /&gt;
                new IDE_Morph().openIn(world);&lt;br /&gt;
                loop();&lt;br /&gt;
            };&lt;br /&gt;
            function loop() {&lt;br /&gt;
                requestAnimationFrame(loop);&lt;br /&gt;
                world.doOneCycle();&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MQTT for Snap! ===&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT4Snap !], desenvolupat per en Xavier Pi.&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld.xml Hello World emprant MQTT '''amb''' SSL]&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html#open:http://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld_NoSSL.xml Hello World emprant MQTT '''sense''' SSL]&lt;br /&gt;
=== Intel·ligència Artificial ===&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://xavierpi.com/ia/ia.xml Connexió amb Gemini] Cal una [https://aistudio.google.com/app/apikey clau d'API (API key)]&lt;br /&gt;
&amp;lt;!-- AIzaSyBINpQKh7Sj8WyIV-PmNfo157Pg8LQr8JY --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Una aproximació a OPC-UA =&lt;br /&gt;
&lt;br /&gt;
[[OPC-UA]]&lt;br /&gt;
&lt;br /&gt;
= Placa IoT-02 =&lt;br /&gt;
[[Placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
== Programació remota (OTA) ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Esp32Ota.png|center|Programacio OTA de la placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
=== Dos programes de prova de programació remota ===&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_01.zip IoT-02_OTAWebUpdater_01] (Fa pampallugues el led blanc) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_02.zip IoT-02_OTAWebUpdater_02] (Fa pampallugues el led verd) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
=== Programació a la vora (''edge'') ===&lt;br /&gt;
L'ordinador a la vora (''edge'') pot ser un ordinador normal, habitualment de poca potència, del tipus Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Per a tenir visibilitat externa de la pàgina web servida per la placa IoT-02 (per exemple amb la IP 192.168.1.151:80), ho redireccionarem a un port ( 192.168.1.151:80 --&amp;gt; localhost:5001 )&lt;br /&gt;
&lt;br /&gt;
Per a fer funcionar [https://www.binefa.cat/training/iot02/ota/edge/simple-port-forwarding.js simple-port-forwarding.js] caldrà haver afegit el paquet '''http-proxy''':&lt;br /&gt;
&lt;br /&gt;
 npm install http-proxy&lt;br /&gt;
&lt;br /&gt;
El codi nodejs de redireccionament (suposant que la placa IoT-02 ha adquirit l'adreça IP 192.168.1.151):&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '192.168.1.151';&lt;br /&gt;
 var portOrigen = 80;&lt;br /&gt;
 var portDesti = 5001;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
Per a fer aquest redireccionador sigui un servei, es copia [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service] a la carpeta '''/etc/systemd/system''' o el fem de nou amb un editor:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/systemd/system&lt;br /&gt;
 sudo nano [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service]&lt;br /&gt;
 sudo chmod 755 myForwardingService.service&lt;br /&gt;
 sudo systemctl daemon-reload&lt;br /&gt;
 sudo systemctl '''start''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
Per a veure l'estat del servei:&lt;br /&gt;
 systemctl '''status''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
I per a fer que el servei es posi en marxa al reiniciar l'ordinador a la vora:&lt;br /&gt;
 sudo systemctl '''enable''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
=== Programació al núvol ===&lt;br /&gt;
Mitjançant una xarxa virtual privada (VPN) de l'estil [https://www.zerotier.com/ ZeroTier] podem fer que l'ordinador a la vora i l'ordinador al núvol comparteixin la mateixa xarxa.&lt;br /&gt;
&lt;br /&gt;
Suposant que l'ordinador a la vora té la IP 10.242.156.158, podem redireccionar-hi 10.242.156.158:5001 --&amp;gt; localhost:7007 :&lt;br /&gt;
&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '10.242.156.158';&lt;br /&gt;
 var portOrigen = 5001;&lt;br /&gt;
 var portDesti = 7007;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
I així tenim accés remot des del núvol, connectant mitjançant l'ordinador a la vora que es connecta a la placa IoT-02. &lt;br /&gt;
&lt;br /&gt;
Per accedir-hi des del navegador, escriviu a la URL: &lt;br /&gt;
 &amp;lt;nom_de_domini&amp;gt;:7007&lt;br /&gt;
Això visualitzarà el que presenta l'ordinador a la vora (la IP és la VPN a l'ordinador a la vora):&lt;br /&gt;
 10.242.156.158:5001&lt;br /&gt;
Que al seu temps presenta el servei pel port 80 de la placa IOT-02 connectada a la mateixa xarxa local que l'ordinador a la vora:&lt;br /&gt;
 192.168.1.151&lt;br /&gt;
&lt;br /&gt;
=== Els tres mètodes de programació OTA de l'ESP32 ===&lt;br /&gt;
[https://www.programmersought.com/article/90864120754/ How to implement OTA online update of ESP32 firmware]&lt;br /&gt;
&lt;br /&gt;
== MicroPython ==&lt;br /&gt;
[https://www.digikey.es/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce MicroPython Basics: Load Files &amp;amp; Run Code]&lt;br /&gt;
&lt;br /&gt;
[https://warped3.substack.com/p/compiling-micropython-with-espressif Compiling microPython with espressif SDK 4.4 for ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://docs.micropython.org/en/latest/esp32/tutorial/intro.html Getting started with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython The MicroPython project]&lt;br /&gt;
&lt;br /&gt;
[https://cdn-learn.adafruit.com/downloads/pdf/micropython-basics-loading-modules.pdf MicroPython Basics: Loading Modules]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/robert-hh/FTP-Server-for-ESP8266-ESP32-and-PYBD uftpd: small FTP server for ESP8266, ESP32 and Pyboard D]&lt;br /&gt;
&lt;br /&gt;
[https://electronicsinnovation.com/connect-esp32-to-ubidots-using-micropython-over-mqtt-with-visual-studio-code/ Connect ESP32 to Ubidots using Micropython over MQTT with Visual Studio Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peterhinch Peter Hinch's GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://wolles-elektronikkiste.de/en/programming-the-esp32-with-micropython Programming the ESP32 with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://awesome-micropython.com/ A curated list of awesome MicroPython libraries, frameworks, software and resources]&lt;br /&gt;
=== asyncio ===&lt;br /&gt;
[https://www.youtube.com/watch?v=5VLvmA__2v0 How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics]&lt;br /&gt;
=== Threads ===&lt;br /&gt;
[https://github.com/kevinmcaleer/threads Micropython thread tutorial]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=QeDnjcdGrpY Video: Micropython Threads - Use Both Cores, on Raspberry Pi Pico and ESP32]&lt;br /&gt;
=== MQTT ===&lt;br /&gt;
[https://bhave.sh/micropython-mqtt/ Secrets of MicroPython: MQTT on ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://wokwi.com/projects/341892004923310676 Exemple MQTT sobre micropython funcionant al wokwi] ([https://wokwi.com/projects/341895401936257620 Un exemple més compacte])&lt;br /&gt;
&lt;br /&gt;
=== Modbus ===&lt;br /&gt;
==== Modifying source code ====&lt;br /&gt;
[https://github.com/brainelectronics/micropython-modbus MicroPython Modbus library]&lt;br /&gt;
&lt;br /&gt;
Modbus control signal able to send or receive messages can be controlled directly by UART. To do that, file [https://github.com/mrvelic/micropython/blob/master/ports/esp32/machine_uart.c machine_uart.c] should be changed.&lt;br /&gt;
&lt;br /&gt;
Changes to be able to use Tx/Rx MAX3485 pin: [https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Information about Modbus an MicroPython has been got from this forum: https://github.com/micropython/micropython/pull/5567&lt;br /&gt;
==== Based on pycom-modbus from pycom ====&lt;br /&gt;
[https://github.com/danjperron/micropython-modbus Modbus Master library for MicroPython ESP32 devices]&lt;br /&gt;
=== LoRa ===&lt;br /&gt;
[https://github.com/martynwheeler/u-lora This is a port of raspi-lora for micropython]&lt;br /&gt;
&lt;br /&gt;
= IoT-Vertebrae =&lt;br /&gt;
== Raspberry ==&lt;br /&gt;
[[Configuració de la WiFi a la Raspberry Pi emprant nmtui]]&lt;br /&gt;
&lt;br /&gt;
[[Reconnexió automàtica a la WiFi]]&lt;br /&gt;
&lt;br /&gt;
[[WireGuard VPN]]&lt;br /&gt;
&lt;br /&gt;
= Exemples pràctics =&lt;br /&gt;
== Sensor ModBus de temperatura i humitat CWT-TH03S ==&lt;br /&gt;
[https://www.aliexpress.com/item/1005001404952412.html CWT-TH03S a AliExpress]&lt;br /&gt;
&lt;br /&gt;
[[Accés ModBus al sensor de temperatura i humitat CWT-TH03S]]&lt;br /&gt;
&lt;br /&gt;
= SBC =&lt;br /&gt;
== PocketBeagle ==&lt;br /&gt;
=== Grove Kit ===&lt;br /&gt;
==== Visió general ====&lt;br /&gt;
[https://beagleboard.org/Kits/Grove Informació comercial del Grove Kit]&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/pocket Informació comercial de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki Wiki de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual System Reference Manual] &amp;lt;----&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/latest-images Darreres imatges per a les SD]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/capes/tree/master/pocketbeagle/Grove Disseny del Grove Cape]&lt;br /&gt;
&lt;br /&gt;
==== Primera connexió a la xarxa sense fils ====&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$ '''sudo connmanctl'''⏎&lt;br /&gt;
 [sudo] password for debian: temppwd⏎&lt;br /&gt;
 connmanctl&amp;gt; '''scan wifi'''⏎&lt;br /&gt;
 Scan completed for wifi&lt;br /&gt;
 connmanctl&amp;gt; '''services'''⏎&lt;br /&gt;
       MyWifi                  wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''agent on'''⏎&lt;br /&gt;
 Agent registered&lt;br /&gt;
 connmanctl&amp;gt; '''connect wifi_1234567890_1234567890123456_managed_psk'''⏎&lt;br /&gt;
 Agent RequestInput wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
       Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]&lt;br /&gt;
       WPS = [ Type=wpspin, Requirement=alternate ]&lt;br /&gt;
 Passphrase? '''MySecretPassphrase'''⏎&lt;br /&gt;
 Connected wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''quit'''⏎&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$&lt;br /&gt;
&lt;br /&gt;
==== Tutorials ====&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/blob/master/PocketBeagle/Grove/workshop-handouts.md Blink PocketBeagle on-board USRx LED]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/tree/master/PocketBeagle/Grove Exemples]&lt;br /&gt;
&lt;br /&gt;
= Formació =&lt;br /&gt;
[https://www.binefa.com/index.php/IoT_amb_Arduino_i_Raspberry_Pi._Microcontroladors_d%27%C3%BAs_professional._Curs_Presencial._Edici%C3%B3_de_mar%C3%A7_de_2022 IoT amb Arduino i Raspberry Pi. Microcontroladors d'ús professional. Curs Presencial. Edició de març de 2022] - [https://formacio.eic.cat/cursos/1123577 Formació al Col·legi d'Enginyers Industrials de Catalunya] (30 / març / 2022)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Sistemes_encastats_d%27escala_petita_i_mitjana._Edici%C3%B3_d%27octubre_2021 Sistemes encastats d'escala petita i mitjana. Edició d'octubre 2021] (20 / octubre / 2021)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways)_IoT_(22_de_mar%C3%A7_de_2022) Nodes sensors (motes) i passarel·les (gateways) IoT (22 de març de 2022)] pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2022) Tecnologías IoT, Hands on y MVP (2022)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Diada_de_la_Llibertat_del_Maquinari_(Edici%C3%B3_2021) Diada de la Llibertat del Maquinari (Edició 2021)] (17 d'abril de 2021)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2021) Tecnologías IoT, Hands on y MVP (2021)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways) Nodes sensors (motes) i passarel·les (gateways)]  pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria] (23 de març de 2021)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Monitoritzaci%C3%B3_de_la_qualitat_de_l%27aire_mesurant_CO2_i_VOC_amb_LoRa Monitorització de la qualitat de l'aire mesurant CO2 i VOC amb LoRa] (9 de gener de 2021)&lt;br /&gt;
&lt;br /&gt;
[[Curset introductori d'Internet de les Coses per ADTelecom]] (Comença el 5 de novembre de 2020)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=%C3%9As_de_les_dades_generades_pels_sensors_LoRaWAN_i_arquitectura_del_sistema._Rub%C3%AD_2020 Ús de les dades generades pels sensors LoRaWAN i arquitectura del sistema. Rubí, 17 de juny de 2020]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Curset_a_TE_Connectivity_del_4_de_mar%C3%A7_de_2020 Curset a TE Connectivity del 4 de març de 2020] a [https://www.te.com/ TE Connectivity]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] (Ajuntament de Viladecans, 19 de febrer de 2020)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://www.binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2020) Tecnologías IoT, Hands on y MVP (2020)]&lt;br /&gt;
&lt;br /&gt;
UPC-School - 21802500 - Màster Industria 4.0 [https://wiki.binefa.cat/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP Tecnologías IoT, Hands on y MVP] (2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] a l'[http://www.icm.csic.es/ Institut de Ciències del Mar] (27 / setembre / 2018 i 25 / setembre / 2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_a_Internet_de_les_Coses_-_juny_2018 Introducció a Internet de les Coses - juny 2018] (Curset de formació per a professors de CF realitzat a l'[https://agora.xtec.cat/iesramblaprim/ Institut Rambla Prim])&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Sunna LoRa RMM v3.0]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Xifratge =&lt;br /&gt;
[[Eines de xifratge en línia]]&lt;br /&gt;
&lt;br /&gt;
= Opinió =&lt;br /&gt;
[http://www.xavierpi.com/mi40/HaciaUnIoT_democraticoYEfectivo.pdf Hacia un Internet de las Cosas democrático y efectivo] per Xavier Pi (octubre 2018)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Auxiliar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;MediaWiki s'ha instal·lat.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consulteu la [https://meta.wikimedia.org/wiki/Help:Contents Guia d'Usuari] per a més informació sobre com utilitzar aquest programari wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Primers passos ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Llista de paràmetres configurables]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ PMF del MediaWiki]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce Llista de correu per a anuncis del MediaWiki]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Traducció de MediaWiki en la vostra llengua]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Aprengueu com combatre la brossa que pot atacar el vostre wiki]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47725</id>
		<title>Pàgina principal</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47725"/>
		<updated>2025-02-10T12:55:37Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Snap! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size:500%&amp;quot;&amp;gt;things.cat&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:300%&amp;quot;&amp;gt;Una pàgina pràctica sobre la Internet de les Coses&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Dispositius IoT. Maquinari i microprogramari =&lt;br /&gt;
Al '''maquinari''' li diem'' '''hardware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
Al '''microprogramari''' li diem'' '''firmware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
'''IoT''' és l'acrònim d'''Internet of Things''. En català abreujat li podríem dir '''IdC''' per a referir-nos a '''la Internet de les Coses'''. En el moment d'escriure aquest text, la comunitat catalanoparlant sembla haver optat per referir-se als '''dispositius de la Internet de les Coses''' com a '''dispositius IoT'''. Si el [https://www.termcat.cat/ca/neoloteca/ termcat] es pronuncia de manera diferent, provaré d'adaptar la terminologia.&lt;br /&gt;
&lt;br /&gt;
== Placa IoT-02 ==&lt;br /&gt;
[https://www.binefa.com/index.php/Placa_IoT-02 Placa_IoT-02]&lt;br /&gt;
&lt;br /&gt;
== Controladors ==&lt;br /&gt;
Als '''controladors''' els hi diem'' '''drivers''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
El xip '''FT232''' ha estat durant molt de temps el xip més comú per convertir d''''USB a UART'''. Fins al punt que se'n van fer còpies pirates. Una actualització del sistema operatiu privatiu Windows va explotar una característica dels xips pirates: els xips pirates tenien el registre d'identificació USB de lectura i escriptura i l'original era tan sols de lectura. L'actualització que va fer Windows provocava l'escriptura d'aquest registre i hi escrivia un zero, que feia que el sistema operatiu ho identifiqués com a concentrador USB i no com a controlador d'UART, fent que el maquinari quedés inservible. A l'any 2014 em vaig veure atrapat amb uns quants Arduino Nano que duien aquest xip pirata i vaig escriure [https://binefa.cat/blog/?p=80 How to recover bricked fake FT232] per a poder-los reprogramar i poder-los fer servir amb sistemes operatius lliures GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
A partir d'aquell moment, bona part de les plaques de fabricació xinesa van començar a dur, massivament, el xip '''CH340''' per a convertir d'USB a UART.&lt;br /&gt;
&lt;br /&gt;
[[Controlador CH340]]&lt;br /&gt;
&lt;br /&gt;
[[Controlador FT232]]&lt;br /&gt;
&lt;br /&gt;
== C / C++ ==&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-libraries Biblioteques per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes Codis per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
=== ESP8266 ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Afegint_la_targeta_ESP8266_a_l%27IDE_d%27Arduino Afegint la targeta ESP8266 a l'IDE d'Arduino] (NodeMCU1.0)&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp8266_udpServer_01b esp8266_udpServer_01.ino] Codi UDP per a ESP8266&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_a_l%27ESP8266 MQTT a l'ESP8266]&lt;br /&gt;
&lt;br /&gt;
=== ESP32 ===&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_udpServer_01b esp32_udpServer_01b] Codi UDP per a ESP32&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_i2cScanner_02 esp32_i2cScanner_02.ino Adreces de dispositius I2C connectats]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/modbus/rtu/esp32/ Exemple de ModBus RTU fent servir NodeRED i ESP32 (amb la placa IoT PLB)]&lt;br /&gt;
&lt;br /&gt;
[https://techtutorialsx.com/2017/05/06/esp32-arduino-creating-a-task/ ESP32 Arduino: Creating a FreeRTOS task]&lt;br /&gt;
&lt;br /&gt;
[https://savjee.be/2020/01/multitasking-esp32-arduino-freertos/ Multitasking on ESP32 with Arduino and FreeRTOS]&lt;br /&gt;
&lt;br /&gt;
==== Modbus ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#overview-of-rs485-specific-communication-options Overview of RS485 specific communication options]&lt;br /&gt;
&lt;br /&gt;
[https://pastebin.com/2PtWJvd6 Example setting RS485 at half duplex mode]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/IoT-02/tree/master/codes/IoT-02_11_modbus_bme280_02 Code IoT-02_11_modbus_bme280_02] using RS485 at half duplex mode&lt;br /&gt;
&lt;br /&gt;
==== ESP-IDF ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ Get Started]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html Get started with ESP-IDF and ESP32-DevKitC: debugging, unit testing, project analysis]&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
=== Accés al maquinari de la Raspberry Pi emprant Python ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Com_connectar-hi_pantalles_OLED_SSD1306_(128x64) Com connectar-hi pantalles OLED SSD1306 (128x64)]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=%C3%9As_d%27entrades_anal%C3%B2giques_amb_l%27ADS115_controlant_sortides_PWM Ús d'entrades analògiques amb l'ADS115 controlant sortides PWM]&lt;br /&gt;
&lt;br /&gt;
=== Micropython ===&lt;br /&gt;
[https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome Micropython and the Internet of Things]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp8266 MicroPython port to ESP8266]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp32 MicroPython port to the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://icircuit.net/esp32-micropython-getting-started/1999 ESP32 – Getting started with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-on-the-esp32-decdd32c4720 Get on the Good Foot with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-part-2-e1f2efaad50b Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor DS18B20 (One Wire Interface)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/gloveboxes/ESP32-MicroPython-BME280-MQTT-Sample Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor BME280 (I2C)]&lt;br /&gt;
&lt;br /&gt;
=== CircuitPython ===&lt;br /&gt;
[https://learn.adafruit.com/circuitpython-with-esp32-quick-start CircuitPython on ESP32 Quick Start]&lt;br /&gt;
&lt;br /&gt;
== Sistemes operatius encastats ==&lt;br /&gt;
=== Raspbian ===&lt;br /&gt;
[https://www.raspberrypi.org/documentation/computers/remote-access.html Remote Access]&lt;br /&gt;
&lt;br /&gt;
[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ How to Install Mosquitto Broker on Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Adaptaci%C3%B3_per_a_que_la_Raspberry_Pi_funcioni_com_a_punt_d%27acc%C3%A9s_donant_adreces_IP_de_classe_B Adaptació per a que la Raspberry Pi funcioni com a punt d'accés donant adreces IP de classe B]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_dels_nodes_node-red-contrib-ttn_i_node-red-contrib-modbustcp-no-pooling_a_la_Raspberry_Pi Instal·lació dels nodes node-red-contrib-ttn i node-red-contrib-modbustcp-no-pooling a la Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_de_l%27OPC-UA_a_la_Raspberry_Pi,_fent_servir_Python,_i_control_des_d%27Indusoft Instal·lació de l'OPC-UA a la Raspberry Pi, fent servir Python, i control des d'Indusoft]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Pr%C3%A0ctica_de_connexi%C3%B3_remota_a_una_Raspberry_Pi Pràctica de connexió remota a una Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://core-electronics.com.au/guides/read-only-raspberry-pi/ Read-Only Raspberry Pi - Never Corrupt your Micro-SD Card]&lt;br /&gt;
==== Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb ''docker'' ====&lt;br /&gt;
[[Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker]]&lt;br /&gt;
&lt;br /&gt;
=== Mongoose OS ===&lt;br /&gt;
[https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md Guia ràpida d'introducció a Mongoose OS][en]&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
[[Sensors de so]]&lt;br /&gt;
&lt;br /&gt;
= Control remot dels dispositius IoT. Programari =&lt;br /&gt;
Al '''programari''' li diuen'' '''software''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
[https://binefa.cat/IoT/teoria/ethernetTcpUdp_00.pdf TCP/UDP Capa de transport d'Ethernet]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació d'un servidor de sòcols web a un Debian amb Apache]]&lt;br /&gt;
&lt;br /&gt;
=== MQTT(S) ===&lt;br /&gt;
[https://binefa.cat/IoT/teoria/mqtt_00.pdf Introducció a MQTT]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt/ Beginners Guide To The MQTT Protocol] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[https://www.rs-online.com/designspark/mqtt MQTT] explained by Andy Stanford-Clark (co-inventor of MQTT). Article written in 2017, and refering to v3.1.1&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/mqtt-5/ MQTT 5 Essentials] by HiveMQ&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt-hosting-brokers-and-servers/ MQTT Brokers/Servers and Cloud Hosting Guide] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer] An all-round MQTT client that provides a structured topic overview&lt;br /&gt;
&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT a Snap!]&lt;br /&gt;
&lt;br /&gt;
==== Public MQTT(S) brokers ====&lt;br /&gt;
[http://test.mosquitto.org/ mosquitto]&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/public-mqtt-broker/ HiveMQ MQTT broker]&lt;br /&gt;
&lt;br /&gt;
[https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/ MQTT brokers online with a free offer to test and connect IoT to the internet]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) implementations ====&lt;br /&gt;
[http://binefa.com/index.php?title=MQTTS_y_NodeRED MQTTS y NodeRED]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations Comparison of MQTT implementations]&lt;br /&gt;
&lt;br /&gt;
[http://test.mosquitto.org/ test.mosquitto.org]&lt;br /&gt;
&lt;br /&gt;
[https://www.emqx.io/ emqx.io]&lt;br /&gt;
&lt;br /&gt;
[https://vernemq.com/ VerneMQ]&lt;br /&gt;
&lt;br /&gt;
=== Webhooks ===&lt;br /&gt;
[https://hookdeck.com/guides/webhooks/what-are-webhooks-how-they-work What Are Webhooks And How They Work]&lt;br /&gt;
&lt;br /&gt;
[[Exemple bàsic de funcionament de Webhooks. Servidor i client en node.js]]&lt;br /&gt;
&lt;br /&gt;
== Programació local (ordinadors d'escriptori i dispositius mòbils) ==&lt;br /&gt;
[https://binefa.cat/IoT/mqtt/MQTT_Dash/ Configuració de MQTT Dash (aplicació per Android)]&lt;br /&gt;
&lt;br /&gt;
=== Mosquitto local a l'ordinador ===&lt;br /&gt;
[https://www.vultr.com/docs/how-to-install-mosquitto-mqtt-broker-server-on-ubuntu-16-04 How to Install Mosquitto MQTT Broker/Server on Ubuntu 16.04]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/downloads/ Instal·lació de Mosquitto a Windows]&lt;br /&gt;
&lt;br /&gt;
Per a actualitzar les claus dels dipòsits de Debian:&lt;br /&gt;
 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key&lt;br /&gt;
 sudo apt-key add mosquitto-repo.gpg.key&lt;br /&gt;
&lt;br /&gt;
=== SCADA ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=SCADA_fent_servir_Python_QML_i_Arduino SCADA fent servir Python QML i Arduino]&lt;br /&gt;
&lt;br /&gt;
== Núvol ==&lt;br /&gt;
=== Instal·lació de Node.js i npm ===&lt;br /&gt;
[https://github.com/nodesource/distributions/blob/master/README.md Instal·lació de node i npm]&lt;br /&gt;
 ecat@iot-ecat:~$ '''sudo bash'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''curl -sL https://deb.nodesource.com/setup_14.x | bash -'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''apt install -y nodejs'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''exit'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''node --version'''&lt;br /&gt;
 v14.15.4&lt;br /&gt;
 ecat@iot-ecat:~$ '''npm -- version'''&lt;br /&gt;
 6.14.10&lt;br /&gt;
&lt;br /&gt;
=== Node-RED ===&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf Introducció al Node-RED]&lt;br /&gt;
&lt;br /&gt;
[[Gestió de Node-RED]]&lt;br /&gt;
&lt;br /&gt;
[https://www.aprendiendoarduino.com/cursos/node-red-developer-para-iot-nivel-i/ Node-RED Developer para IoT. Nivel I]&lt;br /&gt;
&lt;br /&gt;
==== Instal·lació i funcionament del NodeRed autònom ====&lt;br /&gt;
 ecat@iot-ecat:~$ '''mkdir bin'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''cd bin'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''sudo apt install unzip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''mkdir nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''cd nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''wget https://www.binefa.cat/IoT/nodeRed/node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''unzip node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''node node_modules/node-red/red.js --userDir node_modules/node-red/data --settings node_modules/node-red/settings.js -v --port 2222 --title elmeuTitol --safe flows_meuTitol.json'''&lt;br /&gt;
&lt;br /&gt;
==== UDP ====&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/udpServer/udpServer_nodered_code.txt Codi NodeRED per a esp8266_udpServer_01.ino i esp32_udpServer_01b]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_i_MQTTS MQTT i MQTTS]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex00/ Exemple amb MQTT i NodeRED emprant ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex01/ Exercici amb MQTT i NodeRED emprant ESP8266]&lt;br /&gt;
&lt;br /&gt;
[[Elevador en Snap! controlat remotament amb MQTT mitjançant NodeRED fent crides HTTP]]&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer]&lt;br /&gt;
&lt;br /&gt;
==== Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Un_exemple_d%27us_de_Telegram_amb_el_NodeRed Un exemple d'us de Telegram amb el NodeRed]&lt;br /&gt;
&lt;br /&gt;
==== Modbus TCP ====&lt;br /&gt;
[https://binefa.cat/IoT/modbus/ Arxius per treballar amb Modbus TCP] [https://www.binefa.cat/php/doc/modbus/ El segon vídeo explica i compara Modbus RTU i Modbus TCP] &lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/modbusCtrl/ ModBus TCP al NodeRED]&lt;br /&gt;
&lt;br /&gt;
==== Alguns nodes extra ====&lt;br /&gt;
[https://flows.nodered.org/node/node-red-contrib-google-sheets node-red-contrib-google-sheets]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/sammachin/node-red-contrib-google-sheets node-red-contrib-google-sheets al Github]&lt;br /&gt;
&lt;br /&gt;
=== Sistemes d'emmagatzematge i visualització ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=InfluxDB Base de dades de sèries temporals InfluxDB]&lt;br /&gt;
&lt;br /&gt;
[http://docs.grafana.org/installation/debian/ Instal·lació de Grafana a Debian][en]&lt;br /&gt;
&lt;br /&gt;
[[Sentilo]]&lt;br /&gt;
&lt;br /&gt;
=== Xarxes d'àrea estesa de baix consum (LPWAN) ===&lt;br /&gt;
==== Conceptes teòrics ====&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Xarxa_de_llarg_abast Xarxa de llarg abast (WAN)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Chirp_spread_spectrum Espectre eixamplat (Chirp Spread Spectrum)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_seq%C3%BC%C3%A8ncia_directa Espectre eixamplat per seqüència directa (DSSS)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_salt_de_freq%C3%BC%C3%A8ncia Espectre eixamplat per salt de freqüència (FHSS)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LPWAN What is LPWAN?]&lt;br /&gt;
&lt;br /&gt;
[https://cms.edn.com/ContentEETimes/Documents/EDN/LP%20WAN%20Comparison%20Table%20final.pdf Comparison table of Low Power WAN alternatives]&lt;br /&gt;
&lt;br /&gt;
==== LoRa ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
==== SigFox ====&lt;br /&gt;
[https://docs.pycom.io/chapter/tutorials/sipy/register.html Registering SiPy with Sigfox]&lt;br /&gt;
&lt;br /&gt;
[[Interacció amb SiPy1.0r de pycom]]&lt;br /&gt;
&lt;br /&gt;
==== Antenes ====&lt;br /&gt;
[https://youtu.be/CJNq2I_PDHQ Andreas Spiess video: &amp;quot;#182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge)&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Bots ===&lt;br /&gt;
==== Bot de Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Bot_de_Telegram Bot de Telegram]&lt;br /&gt;
&lt;br /&gt;
==== Bot de Mastodon ====&lt;br /&gt;
No totes les instàncies de [https://ca.wikipedia.org/wiki/Mastodon_(xarxa_social) Mastodon] faciliten la instal·lació de bots. Per a fer les primeres passes us recomano aquesta [https://botsin.space/ instància pensada per allotjar bots de Mastodon].&lt;br /&gt;
&lt;br /&gt;
[https://botsin.space/@siarq_sensors Exemple de bot de Mastodon] per a fer lectures de sensors cada hora.&lt;br /&gt;
&lt;br /&gt;
[https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26 Getting credentials for the Mastodon API with Mastodon.py, step by step]&lt;br /&gt;
&lt;br /&gt;
=== VPS ===&lt;br /&gt;
[[Introducció als contenidors docker]]&lt;br /&gt;
&lt;br /&gt;
[[Servidor intermediari invers]]&lt;br /&gt;
&lt;br /&gt;
[[Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[File Browser]]&lt;br /&gt;
&lt;br /&gt;
[[Apache i PHP]]&lt;br /&gt;
&lt;br /&gt;
[[Redireccions a subdomini]]&lt;br /&gt;
&lt;br /&gt;
[[Mastodon]]&lt;br /&gt;
&lt;br /&gt;
[https://medium.com/himinds/mqtt-broker-with-secure-websocket-using-traefik-docker-compose-and-lets-encrypt-2b8e32207555 MQTT broker with Secure WebSocket using Traefik, Docker Compose and Let’s Encrypt]&lt;br /&gt;
&lt;br /&gt;
[[Moodle a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Node-RED a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Snap! a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[VPN WireGuard]]&lt;br /&gt;
&lt;br /&gt;
== Snap! ==&lt;br /&gt;
[https://github.com/jmoenig/Snap Snap! al GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''amb''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''sense''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
=== JavaScript per defecte ===&lt;br /&gt;
Per raons de seguretat, s'ha desactivat el JavaScript per defecte. Si us munteu el vostre propi servei al núvol, per a poder cridar programes vostres amb funcions amb JavaScript, heu d'afegir aquesta línia, en negreta, a l'arxiu ''[https://github.com/jmoenig/Snap/blob/master/snap.html snap.html]'':&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            '''Process.prototype.enableJS = true;''' // &amp;lt;-- Per a tenir seleccionat el JS per defecte&lt;br /&gt;
            var world;&lt;br /&gt;
            window.onload = function () {&lt;br /&gt;
                if ('serviceWorker' in navigator) {&lt;br /&gt;
                    navigator.serviceWorker.register('sw.js');&lt;br /&gt;
                }&lt;br /&gt;
                world = new WorldMorph(document.getElementById('world'));&lt;br /&gt;
                new IDE_Morph().openIn(world);&lt;br /&gt;
                loop();&lt;br /&gt;
            };&lt;br /&gt;
            function loop() {&lt;br /&gt;
                requestAnimationFrame(loop);&lt;br /&gt;
                world.doOneCycle();&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MQTT for Snap! ===&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT4Snap !], desenvolupat per en Xavier Pi.&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld.xml Hello World emprant MQTT '''amb''' SSL]&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html#open:http://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld_NoSSL.xml Hello World emprant MQTT '''sense''' SSL]&lt;br /&gt;
=== Intel·ligència Artificial ===&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://xavierpi.com/ia/ia.xml Connexió amb Gemini] Cal una [https://aistudio.google.com/app/apikey clau d'API (API key)]&lt;br /&gt;
&lt;br /&gt;
= Una aproximació a OPC-UA =&lt;br /&gt;
&lt;br /&gt;
[[OPC-UA]]&lt;br /&gt;
&lt;br /&gt;
= Placa IoT-02 =&lt;br /&gt;
[[Placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
== Programació remota (OTA) ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Esp32Ota.png|center|Programacio OTA de la placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
=== Dos programes de prova de programació remota ===&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_01.zip IoT-02_OTAWebUpdater_01] (Fa pampallugues el led blanc) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_02.zip IoT-02_OTAWebUpdater_02] (Fa pampallugues el led verd) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
=== Programació a la vora (''edge'') ===&lt;br /&gt;
L'ordinador a la vora (''edge'') pot ser un ordinador normal, habitualment de poca potència, del tipus Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Per a tenir visibilitat externa de la pàgina web servida per la placa IoT-02 (per exemple amb la IP 192.168.1.151:80), ho redireccionarem a un port ( 192.168.1.151:80 --&amp;gt; localhost:5001 )&lt;br /&gt;
&lt;br /&gt;
Per a fer funcionar [https://www.binefa.cat/training/iot02/ota/edge/simple-port-forwarding.js simple-port-forwarding.js] caldrà haver afegit el paquet '''http-proxy''':&lt;br /&gt;
&lt;br /&gt;
 npm install http-proxy&lt;br /&gt;
&lt;br /&gt;
El codi nodejs de redireccionament (suposant que la placa IoT-02 ha adquirit l'adreça IP 192.168.1.151):&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '192.168.1.151';&lt;br /&gt;
 var portOrigen = 80;&lt;br /&gt;
 var portDesti = 5001;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
Per a fer aquest redireccionador sigui un servei, es copia [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service] a la carpeta '''/etc/systemd/system''' o el fem de nou amb un editor:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/systemd/system&lt;br /&gt;
 sudo nano [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service]&lt;br /&gt;
 sudo chmod 755 myForwardingService.service&lt;br /&gt;
 sudo systemctl daemon-reload&lt;br /&gt;
 sudo systemctl '''start''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
Per a veure l'estat del servei:&lt;br /&gt;
 systemctl '''status''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
I per a fer que el servei es posi en marxa al reiniciar l'ordinador a la vora:&lt;br /&gt;
 sudo systemctl '''enable''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
=== Programació al núvol ===&lt;br /&gt;
Mitjançant una xarxa virtual privada (VPN) de l'estil [https://www.zerotier.com/ ZeroTier] podem fer que l'ordinador a la vora i l'ordinador al núvol comparteixin la mateixa xarxa.&lt;br /&gt;
&lt;br /&gt;
Suposant que l'ordinador a la vora té la IP 10.242.156.158, podem redireccionar-hi 10.242.156.158:5001 --&amp;gt; localhost:7007 :&lt;br /&gt;
&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '10.242.156.158';&lt;br /&gt;
 var portOrigen = 5001;&lt;br /&gt;
 var portDesti = 7007;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
I així tenim accés remot des del núvol, connectant mitjançant l'ordinador a la vora que es connecta a la placa IoT-02. &lt;br /&gt;
&lt;br /&gt;
Per accedir-hi des del navegador, escriviu a la URL: &lt;br /&gt;
 &amp;lt;nom_de_domini&amp;gt;:7007&lt;br /&gt;
Això visualitzarà el que presenta l'ordinador a la vora (la IP és la VPN a l'ordinador a la vora):&lt;br /&gt;
 10.242.156.158:5001&lt;br /&gt;
Que al seu temps presenta el servei pel port 80 de la placa IOT-02 connectada a la mateixa xarxa local que l'ordinador a la vora:&lt;br /&gt;
 192.168.1.151&lt;br /&gt;
&lt;br /&gt;
=== Els tres mètodes de programació OTA de l'ESP32 ===&lt;br /&gt;
[https://www.programmersought.com/article/90864120754/ How to implement OTA online update of ESP32 firmware]&lt;br /&gt;
&lt;br /&gt;
== MicroPython ==&lt;br /&gt;
[https://www.digikey.es/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce MicroPython Basics: Load Files &amp;amp; Run Code]&lt;br /&gt;
&lt;br /&gt;
[https://warped3.substack.com/p/compiling-micropython-with-espressif Compiling microPython with espressif SDK 4.4 for ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://docs.micropython.org/en/latest/esp32/tutorial/intro.html Getting started with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython The MicroPython project]&lt;br /&gt;
&lt;br /&gt;
[https://cdn-learn.adafruit.com/downloads/pdf/micropython-basics-loading-modules.pdf MicroPython Basics: Loading Modules]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/robert-hh/FTP-Server-for-ESP8266-ESP32-and-PYBD uftpd: small FTP server for ESP8266, ESP32 and Pyboard D]&lt;br /&gt;
&lt;br /&gt;
[https://electronicsinnovation.com/connect-esp32-to-ubidots-using-micropython-over-mqtt-with-visual-studio-code/ Connect ESP32 to Ubidots using Micropython over MQTT with Visual Studio Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peterhinch Peter Hinch's GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://wolles-elektronikkiste.de/en/programming-the-esp32-with-micropython Programming the ESP32 with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://awesome-micropython.com/ A curated list of awesome MicroPython libraries, frameworks, software and resources]&lt;br /&gt;
=== asyncio ===&lt;br /&gt;
[https://www.youtube.com/watch?v=5VLvmA__2v0 How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics]&lt;br /&gt;
=== Threads ===&lt;br /&gt;
[https://github.com/kevinmcaleer/threads Micropython thread tutorial]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=QeDnjcdGrpY Video: Micropython Threads - Use Both Cores, on Raspberry Pi Pico and ESP32]&lt;br /&gt;
=== MQTT ===&lt;br /&gt;
[https://bhave.sh/micropython-mqtt/ Secrets of MicroPython: MQTT on ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://wokwi.com/projects/341892004923310676 Exemple MQTT sobre micropython funcionant al wokwi] ([https://wokwi.com/projects/341895401936257620 Un exemple més compacte])&lt;br /&gt;
&lt;br /&gt;
=== Modbus ===&lt;br /&gt;
==== Modifying source code ====&lt;br /&gt;
[https://github.com/brainelectronics/micropython-modbus MicroPython Modbus library]&lt;br /&gt;
&lt;br /&gt;
Modbus control signal able to send or receive messages can be controlled directly by UART. To do that, file [https://github.com/mrvelic/micropython/blob/master/ports/esp32/machine_uart.c machine_uart.c] should be changed.&lt;br /&gt;
&lt;br /&gt;
Changes to be able to use Tx/Rx MAX3485 pin: [https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Information about Modbus an MicroPython has been got from this forum: https://github.com/micropython/micropython/pull/5567&lt;br /&gt;
==== Based on pycom-modbus from pycom ====&lt;br /&gt;
[https://github.com/danjperron/micropython-modbus Modbus Master library for MicroPython ESP32 devices]&lt;br /&gt;
=== LoRa ===&lt;br /&gt;
[https://github.com/martynwheeler/u-lora This is a port of raspi-lora for micropython]&lt;br /&gt;
&lt;br /&gt;
= IoT-Vertebrae =&lt;br /&gt;
== Raspberry ==&lt;br /&gt;
[[Configuració de la WiFi a la Raspberry Pi emprant nmtui]]&lt;br /&gt;
&lt;br /&gt;
[[Reconnexió automàtica a la WiFi]]&lt;br /&gt;
&lt;br /&gt;
[[WireGuard VPN]]&lt;br /&gt;
&lt;br /&gt;
= Exemples pràctics =&lt;br /&gt;
== Sensor ModBus de temperatura i humitat CWT-TH03S ==&lt;br /&gt;
[https://www.aliexpress.com/item/1005001404952412.html CWT-TH03S a AliExpress]&lt;br /&gt;
&lt;br /&gt;
[[Accés ModBus al sensor de temperatura i humitat CWT-TH03S]]&lt;br /&gt;
&lt;br /&gt;
= SBC =&lt;br /&gt;
== PocketBeagle ==&lt;br /&gt;
=== Grove Kit ===&lt;br /&gt;
==== Visió general ====&lt;br /&gt;
[https://beagleboard.org/Kits/Grove Informació comercial del Grove Kit]&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/pocket Informació comercial de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki Wiki de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual System Reference Manual] &amp;lt;----&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/latest-images Darreres imatges per a les SD]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/capes/tree/master/pocketbeagle/Grove Disseny del Grove Cape]&lt;br /&gt;
&lt;br /&gt;
==== Primera connexió a la xarxa sense fils ====&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$ '''sudo connmanctl'''⏎&lt;br /&gt;
 [sudo] password for debian: temppwd⏎&lt;br /&gt;
 connmanctl&amp;gt; '''scan wifi'''⏎&lt;br /&gt;
 Scan completed for wifi&lt;br /&gt;
 connmanctl&amp;gt; '''services'''⏎&lt;br /&gt;
       MyWifi                  wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''agent on'''⏎&lt;br /&gt;
 Agent registered&lt;br /&gt;
 connmanctl&amp;gt; '''connect wifi_1234567890_1234567890123456_managed_psk'''⏎&lt;br /&gt;
 Agent RequestInput wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
       Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]&lt;br /&gt;
       WPS = [ Type=wpspin, Requirement=alternate ]&lt;br /&gt;
 Passphrase? '''MySecretPassphrase'''⏎&lt;br /&gt;
 Connected wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''quit'''⏎&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$&lt;br /&gt;
&lt;br /&gt;
==== Tutorials ====&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/blob/master/PocketBeagle/Grove/workshop-handouts.md Blink PocketBeagle on-board USRx LED]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/tree/master/PocketBeagle/Grove Exemples]&lt;br /&gt;
&lt;br /&gt;
= Formació =&lt;br /&gt;
[https://www.binefa.com/index.php/IoT_amb_Arduino_i_Raspberry_Pi._Microcontroladors_d%27%C3%BAs_professional._Curs_Presencial._Edici%C3%B3_de_mar%C3%A7_de_2022 IoT amb Arduino i Raspberry Pi. Microcontroladors d'ús professional. Curs Presencial. Edició de març de 2022] - [https://formacio.eic.cat/cursos/1123577 Formació al Col·legi d'Enginyers Industrials de Catalunya] (30 / març / 2022)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Sistemes_encastats_d%27escala_petita_i_mitjana._Edici%C3%B3_d%27octubre_2021 Sistemes encastats d'escala petita i mitjana. Edició d'octubre 2021] (20 / octubre / 2021)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways)_IoT_(22_de_mar%C3%A7_de_2022) Nodes sensors (motes) i passarel·les (gateways) IoT (22 de març de 2022)] pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2022) Tecnologías IoT, Hands on y MVP (2022)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Diada_de_la_Llibertat_del_Maquinari_(Edici%C3%B3_2021) Diada de la Llibertat del Maquinari (Edició 2021)] (17 d'abril de 2021)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2021) Tecnologías IoT, Hands on y MVP (2021)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways) Nodes sensors (motes) i passarel·les (gateways)]  pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria] (23 de març de 2021)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Monitoritzaci%C3%B3_de_la_qualitat_de_l%27aire_mesurant_CO2_i_VOC_amb_LoRa Monitorització de la qualitat de l'aire mesurant CO2 i VOC amb LoRa] (9 de gener de 2021)&lt;br /&gt;
&lt;br /&gt;
[[Curset introductori d'Internet de les Coses per ADTelecom]] (Comença el 5 de novembre de 2020)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=%C3%9As_de_les_dades_generades_pels_sensors_LoRaWAN_i_arquitectura_del_sistema._Rub%C3%AD_2020 Ús de les dades generades pels sensors LoRaWAN i arquitectura del sistema. Rubí, 17 de juny de 2020]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Curset_a_TE_Connectivity_del_4_de_mar%C3%A7_de_2020 Curset a TE Connectivity del 4 de març de 2020] a [https://www.te.com/ TE Connectivity]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] (Ajuntament de Viladecans, 19 de febrer de 2020)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://www.binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2020) Tecnologías IoT, Hands on y MVP (2020)]&lt;br /&gt;
&lt;br /&gt;
UPC-School - 21802500 - Màster Industria 4.0 [https://wiki.binefa.cat/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP Tecnologías IoT, Hands on y MVP] (2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] a l'[http://www.icm.csic.es/ Institut de Ciències del Mar] (27 / setembre / 2018 i 25 / setembre / 2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_a_Internet_de_les_Coses_-_juny_2018 Introducció a Internet de les Coses - juny 2018] (Curset de formació per a professors de CF realitzat a l'[https://agora.xtec.cat/iesramblaprim/ Institut Rambla Prim])&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Sunna LoRa RMM v3.0]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Xifratge =&lt;br /&gt;
[[Eines de xifratge en línia]]&lt;br /&gt;
&lt;br /&gt;
= Opinió =&lt;br /&gt;
[http://www.xavierpi.com/mi40/HaciaUnIoT_democraticoYEfectivo.pdf Hacia un Internet de las Cosas democrático y efectivo] per Xavier Pi (octubre 2018)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Auxiliar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;MediaWiki s'ha instal·lat.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consulteu la [https://meta.wikimedia.org/wiki/Help:Contents Guia d'Usuari] per a més informació sobre com utilitzar aquest programari wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Primers passos ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Llista de paràmetres configurables]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ PMF del MediaWiki]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce Llista de correu per a anuncis del MediaWiki]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Traducció de MediaWiki en la vostra llengua]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Aprengueu com combatre la brossa que pot atacar el vostre wiki]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=6a_sessi%C3%B3._Curset_introductori_d%27Internet_de_les_Coses._(23_/_desembre_/_2020)&amp;diff=47722</id>
		<title>6a sessió. Curset introductori d'Internet de les Coses. (23 / desembre / 2020)</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=6a_sessi%C3%B3._Curset_introductori_d%27Internet_de_les_Coses._(23_/_desembre_/_2020)&amp;diff=47722"/>
		<updated>2025-01-23T12:16:54Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= LoRa =&lt;br /&gt;
== Introducció ==&lt;br /&gt;
Informació sobre [https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/lora/ttncat/TTN%20-%20Presentaci%c3%b3%20-%20Llibertat%20Maquinari.pdf Presentació de The Things Network Catalunya] el [http://caliu.cat/blog/2019/03/16/dia-de-la-llibertat-del-maquinari-2019/ dia de la llibertat del maquinari - 2019]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/03_introLoRaWAN.pdf Introducció a LoRaWAN]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf LoRa, TTN i NodeRED]&lt;br /&gt;
&lt;br /&gt;
== Exemples de funcionament ==&lt;br /&gt;
[https://twitter.com/JordiBinefa/status/1110147206735122432 LoRaWAN connected Solar Streetlight - Sant Boi Police Station]&lt;br /&gt;
&lt;br /&gt;
[http://things.siarq.net:3000/d/OcxHLA3iz/policia-de-sant-boi?orgId=1&amp;amp;from=now-2d&amp;amp;to=now&amp;amp;refresh=1m Monitoring LoRaWAN connected Solar Streetlight - Sant Boi Police Station]&lt;br /&gt;
&lt;br /&gt;
[https://twitter.com/JordiBinefa/status/1080531165432418304 LoRaWAN connected Solar Streetlight - Metal·lúrgica de Camallera]&lt;br /&gt;
&lt;br /&gt;
[http://iot.siarq.net:3000/d/wJNT6ZUiz/camallera-influxdb?refresh=1m&amp;amp;orgId=1&amp;amp;from=now-2d&amp;amp;to=now Monitoring LoRaWAN connected Solar Streetlight - Metal·lúrgica de Camallera]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/IoT/fires/iots2018/ Sistema Lora bidireccional] presentat a la [https://www.iotsworldcongress.com/ Fira IoTWC - 2018] a l'estand d'[https://www.industrialshields.com/ Industrial Shields]. Documentat a [https://wiki.binefa.cat/index.php?title=Demostraci%C3%B3_d%27us_de_LoRaWAN_amb_un_PLC_d%27IndustrialShields_a_la_Fira_IOTS-2018 Demostració d'us de LoRaWAN amb un PLC d'IndustrialShields a la Fira IOTS-2018]&lt;br /&gt;
&lt;br /&gt;
== Exercici pràctic ==&lt;br /&gt;
Feu-vos les credencial d'accés a [https://www.thethingsnetwork.org/ The Things Network].&lt;br /&gt;
&lt;br /&gt;
Un cop les tingueu, us afegiré com a col·laboradors a una aplicació anomenada '''ad-telecom''' i de la passarel·la local. Les aplicacions tenen dispositius i ara n'afegirem un per placa.&lt;br /&gt;
&lt;br /&gt;
=== Donar d'alta un dispositiu a TTN ===&lt;br /&gt;
[https://binefa.cat/IoT/05_lorawan_usPractic.pdf Tutorial per a la connectivitat d'un node TTGO (fent servir ''lmic'') a The Things Network]&lt;br /&gt;
&lt;br /&gt;
=== Amb la placa IoT-02 ===&lt;br /&gt;
A un NodeRED funcionant des del terminal (no com a servei. Precisament com ho fem a aquest curset) dóna errors d'execució els nodes instal·lats com a '''node-red-contrib-ttn''' (nodes oficials de TheThingsNetwork o TTN). També es veu que des de fa dos anys no s'ha fet manteniment d'aquests nodes. Degut a això es tractaran les trames emeses pels dispositius LoRaWAN com a missatges MQTT.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A una aplicació anomenada '''ad-telecom''' hi ha un dispositiu anomenat '''adtelecom-0001'''. Al NodeRED caldrà introduir aquestes dades:&lt;br /&gt;
&lt;br /&gt;
Broker: '''eu.thethings.network'''&lt;br /&gt;
&lt;br /&gt;
Port: '''1883'''&lt;br /&gt;
&lt;br /&gt;
Security / Username: '''ad-telecom''' (el nom de l'aplicació a TTN)&lt;br /&gt;
&lt;br /&gt;
Security / Password: '''ttn-account-v2.LVh3FzICF-3yhHe__no__es__la__que__toca__yPaQ3kEJ9uiCNkyPkGM''' (default key d'ACCESS KEYS)&lt;br /&gt;
&lt;br /&gt;
Topic: '''ad-telecom'''/devices/'''adtelecom-0001'''/up (tema de pujada o ''uplink'')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
El [https://www.binefa.cat/training/adtelecom/20201223/exrebut.txt missatge arriba com a text], es converteix a json i hi ha els temes: ''app_id'', ''dev_id'', ''hardware_serial'', ''port'', ''counter'', ''payload_raw'' (codificat en base 64) i ''metadata''. Dins de ''metadata'': ''time'', ''frequency'', ''modulation'', ''data_rate'', ''airtime'', ''coding_rate'' i ''gateways''. Dins de ''gateways'': les passarel·les que han captat el missatge LoRa començant per ''0''. I dins de cada passarel·la: ''gtw_id'', ''timestamp''. ''time'', ''channel'', ''rssi'', ''snr'', ''rf_chain'', ''latitude'', ''longitude'' i ''altitude''.&lt;br /&gt;
&lt;br /&gt;
==== OTAA ====&lt;br /&gt;
[https://www.binefa.cat/training/adtelecom/20201223/IoT-02-22_ttn-otaa_adtelecom_01.zip Exemple de microprogramari per a la placa IoT-02 de comunicació LoRaWAN amb OTAA]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/training/adtelecom/20201223/uplinkOTAA.nodered.txt Codi de NodeRED per a rebre missatges LoRaWAN amb OTAA]&lt;br /&gt;
&lt;br /&gt;
==== ABP ====&lt;br /&gt;
Quan canvieu d'OTAA a ABP '''desactiveu la casella Frame Counter Check'''.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/adtelecom/20201223/IoT-02_ttn-abp_adtelecom_02.zip Exemple bàsic de microprogramari per a la placa IoT-02 de comunicació LoRaWAN amb ABP]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/adtelecom/20201223/uplinkABP.nodered.txt Codi de NodeRED per a rebre missatges LoRaWAN amb ABP]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/adtelecom/20201223/IoT-02_12_loraABP_modbus_bme280_adtelecom_03.zip Exemple de microprogramari per a la placa IoT-02 de comunicació LoRaWAN amb ABP trametent un nombre real]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/adtelecom/20201223/IoT-02_12_loraABP_modbus_bme280_adtelecom_04.zip Exemple de microprogramari per a la placa IoT-02 de comunicació LoRaWAN amb ABP trametent tres nombres reals]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/adtelecom/20201223/uplinkABP_bme280.nodered.txt Codi de NodeRED per a rebre tres nombres reals LoRaWAN amb ABP]&lt;br /&gt;
&lt;br /&gt;
===== Exercici amb ABP =====&lt;br /&gt;
Desxifreu els 3 floats des de NodeRED.&lt;br /&gt;
&lt;br /&gt;
=== Amb plaques de metacrilat ===&lt;br /&gt;
[https://www.binefa.cat/IoT/04_conjunt02.pdf Conjunt IoT. Prova de connectivitat a The Things Network]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/upcSchool/20190504/arrayFloat.js.txt Codi en JS per a convertir un array d'hexadecimales a float]&lt;br /&gt;
&lt;br /&gt;
Al NodeRED, a '''App''' va el nom de '''Application''' a TTN ([https://www.thethingsnetwork.org/ The Things Network])&lt;br /&gt;
&lt;br /&gt;
A l''''Access Key''' del NodeRED va el '''default key''' d''''ACCESS KEYS''' en TTN&lt;br /&gt;
&lt;br /&gt;
A la funció '''Cap a TTN''' del NodeRED al campo '''dev_id''' es posa el nom del dispositiu corresponent de la lista '''Devices''' a TTN&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/20180927_icm_csic/ Més informació per a posar-ho en funcionament]&lt;br /&gt;
&lt;br /&gt;
= Altres informacions =&lt;br /&gt;
[https://www.thethingsnetwork.org/forum/t/limitations-data-rate-packet-size-30-seconds-uplink-and-10-messages-downlink-per-day-fair-access-policy/1300 Fair Access Policy]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/IoT/04b_reflexionsTTN.pdf Algunes reflexions sobre l'ús real de The Things Network]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/IoT/lora/lorawan/telegramBot_01.pdf Exemple de monitorizació d'una passarel·la (''gateway'') LoRaWAN mitjançant un ''bot'' de Telegram]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=6a_sessi%C3%B3._Curset_introductori_d%27Internet_de_les_Coses._(23_/_desembre_/_2020)&amp;diff=47721</id>
		<title>6a sessió. Curset introductori d'Internet de les Coses. (23 / desembre / 2020)</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=6a_sessi%C3%B3._Curset_introductori_d%27Internet_de_les_Coses._(23_/_desembre_/_2020)&amp;diff=47721"/>
		<updated>2025-01-23T12:15:35Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Exemples de funcionament */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= LoRa =&lt;br /&gt;
== Introducció ==&lt;br /&gt;
Informació sobre [https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/lora/ttncat/TTN%20-%20Presentaci%c3%b3%20-%20Llibertat%20Maquinari.pdf Presentació de The Things Network Catalunya] el [http://caliu.cat/blog/2019/03/16/dia-de-la-llibertat-del-maquinari-2019/ dia de la llibertat del maquinari - 2019]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/03_introLoRaWAN.pdf Introducció a LoRaWAN]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf LoRa, TTN i NodeRED]&lt;br /&gt;
&lt;br /&gt;
== Exemples de funcionament ==&lt;br /&gt;
[https://twitter.com/JordiBinefa/status/1110147206735122432 LoRaWAN connected Solar Streetlight - Sant Boi Police Station]&lt;br /&gt;
&lt;br /&gt;
[http://things.siarq.net:3000/d/OcxHLA3iz/policia-de-sant-boi?orgId=1&amp;amp;from=now-2d&amp;amp;to=now&amp;amp;refresh=1m Monitoring LoRaWAN connected Solar Streetlight - Sant Boi Police Station]&lt;br /&gt;
&lt;br /&gt;
[https://twitter.com/JordiBinefa/status/1080531165432418304 LoRaWAN connected Solar Streetlight - Metal·lúrgica de Camallera]&lt;br /&gt;
&lt;br /&gt;
[http://iot.siarq.net:3000/d/wJNT6ZUiz/camallera-influxdb?refresh=1m&amp;amp;orgId=1&amp;amp;from=now-2d&amp;amp;to=now Monitoring LoRaWAN connected Solar Streetlight - Metal·lúrgica de Camallera]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/IoT/fires/iots2018/ Sistema Lora bidireccional] presentat a la [https://www.iotsworldcongress.com/ Fira IoTWC - 2018] a l'estand d'[https://www.industrialshields.com/ Industrial Shields]. Documentat a [https://wiki.binefa.cat/index.php?title=Demostraci%C3%B3_d%27us_de_LoRaWAN_amb_un_PLC_d%27IndustrialShields_a_la_Fira_IOTS-2018 Demostració d'us de LoRaWAN amb un PLC d'IndustrialShields a la Fira IOTS-2018]&lt;br /&gt;
&lt;br /&gt;
== Exercici pràctic ==&lt;br /&gt;
Feu-vos les credencial d'accés a [https://www.thethingsnetwork.org/ The Things Network].&lt;br /&gt;
&lt;br /&gt;
Un cop les tingueu, us afegiré com a col·laboradors a una aplicació anomenada '''ad-telecom''' i de la passarel·la local. Les aplicacions tenen dispositius i ara n'afegirem un per placa.&lt;br /&gt;
&lt;br /&gt;
=== Donar d'alta un dispositiu a TTN ===&lt;br /&gt;
[https://binefa.cat/IoT/05_lorawan_usPractic.pdf Tutorial per a la connectivitat d'un node TTGO (fent servir ''lmic'') a The Things Network]&lt;br /&gt;
&lt;br /&gt;
=== Amb la placa IoT-02 ===&lt;br /&gt;
A un NodeRED funcionant des del terminal (no com a servei. Precisament com ho fem a aquest curset) dóna errors d'execució els nodes instal·lats com a '''node-red-contrib-ttn''' (nodes oficials de TheThingsNetwork o TTN). També es veu que des de fa dos anys no s'ha fet manteniment d'aquests nodes. Degut a això es tractaran les trames emeses pels dispositius LoRaWAN com a missatges MQTT.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A una aplicació anomenada '''ad-telecom''' hi ha un dispositiu anomenat '''adtelecom-0001'''. Al NodeRED caldrà introduir aquestes dades:&lt;br /&gt;
&lt;br /&gt;
Broker: '''eu.thethings.network'''&lt;br /&gt;
&lt;br /&gt;
Port: '''1883'''&lt;br /&gt;
&lt;br /&gt;
Security / Username: '''ad-telecom''' (el nom de l'aplicació a TTN)&lt;br /&gt;
&lt;br /&gt;
Security / Password: '''ttn-account-v2.LVh3FzICF-3yhHe__no__es__la__que__toca__yPaQ3kEJ9uiCNkyPkGM''' (default key d'ACCESS KEYS)&lt;br /&gt;
&lt;br /&gt;
Topic: '''ad-telecom'''/devices/'''adtelecom-0001'''/up (tema de pujada o ''uplink'')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
El [https://binefa.cat/training/adtelecom/20201223/exrebut.txt missatge arriba com a text], es converteix a json i hi ha els temes: ''app_id'', ''dev_id'', ''hardware_serial'', ''port'', ''counter'', ''payload_raw'' (codificat en base 64) i ''metadata''. Dins de ''metadata'': ''time'', ''frequency'', ''modulation'', ''data_rate'', ''airtime'', ''coding_rate'' i ''gateways''. Dins de ''gateways'': les passarel·les que han captat el missatge LoRa començant per ''0''. I dins de cada passarel·la: ''gtw_id'', ''timestamp''. ''time'', ''channel'', ''rssi'', ''snr'', ''rf_chain'', ''latitude'', ''longitude'' i ''altitude''.&lt;br /&gt;
&lt;br /&gt;
==== OTAA ====&lt;br /&gt;
[https://binefa.cat/training/adtelecom/20201223/IoT-02-22_ttn-otaa_adtelecom_01.zip Exemple de microprogramari per a la placa IoT-02 de comunicació LoRaWAN amb OTAA]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/training/adtelecom/20201223/uplinkOTAA.nodered.txt Codi de NodeRED per a rebre missatges LoRaWAN amb OTAA]&lt;br /&gt;
&lt;br /&gt;
==== ABP ====&lt;br /&gt;
Quan canvieu d'OTAA a ABP '''desactiveu la casella Frame Counter Check'''.&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/training/adtelecom/20201223/IoT-02_ttn-abp_adtelecom_02.zip Exemple bàsic de microprogramari per a la placa IoT-02 de comunicació LoRaWAN amb ABP]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/training/adtelecom/20201223/uplinkABP.nodered.txt Codi de NodeRED per a rebre missatges LoRaWAN amb ABP]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/training/adtelecom/20201223/IoT-02_12_loraABP_modbus_bme280_adtelecom_03.zip Exemple de microprogramari per a la placa IoT-02 de comunicació LoRaWAN amb ABP trametent un nombre real]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/training/adtelecom/20201223/IoT-02_12_loraABP_modbus_bme280_adtelecom_04.zip Exemple de microprogramari per a la placa IoT-02 de comunicació LoRaWAN amb ABP trametent tres nombres reals]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/training/adtelecom/20201223/uplinkABP_bme280.nodered.txt Codi de NodeRED per a rebre tres nombres reals LoRaWAN amb ABP]&lt;br /&gt;
&lt;br /&gt;
===== Exercici amb ABP =====&lt;br /&gt;
Desxifreu els 3 floats des de NodeRED.&lt;br /&gt;
&lt;br /&gt;
=== Amb plaques de metacrilat ===&lt;br /&gt;
[https://binefa.cat/IoT/04_conjunt02.pdf Conjunt IoT. Prova de connectivitat a The Things Network]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/training/upcSchool/20190504/arrayFloat.js.txt Codi en JS per a convertir un array d'hexadecimales a float]&lt;br /&gt;
&lt;br /&gt;
Al NodeRED, a '''App''' va el nom de '''Application''' a TTN ([https://www.thethingsnetwork.org/ The Things Network])&lt;br /&gt;
&lt;br /&gt;
A l''''Access Key''' del NodeRED va el '''default key''' d''''ACCESS KEYS''' en TTN&lt;br /&gt;
&lt;br /&gt;
A la funció '''Cap a TTN''' del NodeRED al campo '''dev_id''' es posa el nom del dispositiu corresponent de la lista '''Devices''' a TTN&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/training/20180927_icm_csic/ Més informació per a posar-ho en funcionament]&lt;br /&gt;
&lt;br /&gt;
= Altres informacions =&lt;br /&gt;
[https://www.thethingsnetwork.org/forum/t/limitations-data-rate-packet-size-30-seconds-uplink-and-10-messages-downlink-per-day-fair-access-policy/1300 Fair Access Policy]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/04b_reflexionsTTN.pdf Algunes reflexions sobre l'ús real de The Things Network]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/lora/lorawan/telegramBot_01.pdf Exemple de monitorizació d'una passarel·la (''gateway'') LoRaWAN mitjançant un ''bot'' de Telegram]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47720</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47720"/>
		<updated>2025-01-21T13:07:46Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Idea */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Idea =&lt;br /&gt;
N'[https://www.linkedin.com/in/ulasdikme/ Ulas Dikme] ha desenvolupat un [https://github.com/PhysicsX/QTonRaspberryPi sistema amb docker per a fer la compilació creuada de Qt6 per a Raspberry Pi].&lt;br /&gt;
&lt;br /&gt;
Primer es crea un entorn de Raspbian per a emular la Raspberry Pi. Creació de la imatge:&lt;br /&gt;
 docker buildx build --platform linux/arm64 --load -f DockerFileRasp -t raspimage .&lt;br /&gt;
Es fa un contenidor amb aquesta imatge i s'extreu l'arxiu rasp.tar.gz que es farà servir per a la nova imatge per a fer la compilació creuada:&lt;br /&gt;
 docker create --name temp-arm raspimage&lt;br /&gt;
 docker cp temp-arm:/build/rasp.tar.gz ./rasp.tar.gz&lt;br /&gt;
&lt;br /&gt;
Es tracta de fer una imatge docker que contingui:&lt;br /&gt;
* Un Debian 12 sense interacció per a evitar preguntes al fer la instal·lació&lt;br /&gt;
* Les eines de compilació de la Raspberry Pi emulada fent servir rasp.tar.gz&lt;br /&gt;
* Es crea des de zero CMake&lt;br /&gt;
* Es compilen les Qt i les seves biblioteques&lt;br /&gt;
* Es compila creuadament el codi del nostre projecte&lt;br /&gt;
* Es generen els binaris de l'executable i les biblioteques&lt;br /&gt;
&lt;br /&gt;
Un cop feta aquesta imatge es crea un contenidor per a tenir-hi accés. S'extreuen les biblioteques i el binari executable per passar-ho a la Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
= Dockerfile =&lt;br /&gt;
Al [https://github.com/PhysicsX/QTonRaspberryPi/blob/main/Dockerfile Dockerfile] original s'inclouen les biblioteques:&lt;br /&gt;
* QtBase&lt;br /&gt;
* QtShaderTools&lt;br /&gt;
* QtDeclarative&lt;br /&gt;
I al [https://www.binefa.cat/qt/cross-compile/Dockerfile Dockerfile modificat] per a permetre la comunicaió mitjançant MQTT hi afegeixo:&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtnetworkauth-index.html QtNetworkAuth]&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtwebsockets-index.html QtWebSockets]&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtmqtt-index.html QtMqtt]&lt;br /&gt;
&lt;br /&gt;
= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''raspberry''.local:/home/''pi''/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
 ''pi''@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
És un procés prou ràpid (al voltant d'un minut) excepte quan hi ha actualitzacions del kernel als repositoris de Debian (que triga al voltant de quatre hores fer una nova imatge).&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode] desenvolupat per [https://www.linkedin.com/in/ulasdikme/ Ulas Dikme]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47719</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47719"/>
		<updated>2025-01-21T13:01:42Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Idea */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Idea =&lt;br /&gt;
N'[https://www.linkedin.com/in/ulasdikme/ Ulas Dikme] ha desenvolupat un [https://github.com/PhysicsX/QTonRaspberryPi sistema amb docker per a fer la compilació creuada de Qt6 per a Raspberry Pi].&lt;br /&gt;
&lt;br /&gt;
Primer es crea un entorn de Raspbian per a emular la Raspberry Pi. Creació de la imatge:&lt;br /&gt;
 docker buildx build --platform linux/arm64 --load -f DockerFileRasp -t raspimage .&lt;br /&gt;
Es fa un contenidor amb aquesta imatge i s'extreu l'arxiu rasp.tar.gz que es farà servir per a la nova imatge per a fer la compilació creuada:&lt;br /&gt;
 docker create --name temp-arm raspimage&lt;br /&gt;
 docker cp temp-arm:/build/rasp.tar.gz ./rasp.tar.gz&lt;br /&gt;
&lt;br /&gt;
Es tracta de fer una imatge docker que contingui:&lt;br /&gt;
* Un Debian 12 sense interacció per a evitar preguntes al fer la instal·lació&lt;br /&gt;
&lt;br /&gt;
= Dockerfile =&lt;br /&gt;
Al [https://github.com/PhysicsX/QTonRaspberryPi/blob/main/Dockerfile Dockerfile] original s'inclouen les biblioteques:&lt;br /&gt;
* QtBase&lt;br /&gt;
* QtShaderTools&lt;br /&gt;
* QtDeclarative&lt;br /&gt;
I al [https://www.binefa.cat/qt/cross-compile/Dockerfile Dockerfile modificat] per a permetre la comunicaió mitjançant MQTT hi afegeixo:&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtnetworkauth-index.html QtNetworkAuth]&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtwebsockets-index.html QtWebSockets]&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtmqtt-index.html QtMqtt]&lt;br /&gt;
&lt;br /&gt;
= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''raspberry''.local:/home/''pi''/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
 ''pi''@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
És un procés prou ràpid (al voltant d'un minut) excepte quan hi ha actualitzacions del kernel als repositoris de Debian (que triga al voltant de quatre hores fer una nova imatge).&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode] desenvolupat per [https://www.linkedin.com/in/ulasdikme/ Ulas Dikme]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47718</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47718"/>
		<updated>2025-01-21T12:47:12Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Idea */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Idea =&lt;br /&gt;
N'[https://www.linkedin.com/in/ulasdikme/ Ulas Dikme] ha desenvolupat un [https://github.com/PhysicsX/QTonRaspberryPi sistema amb docker per a fer la compilació creuada de Qt6 per a Raspberry Pi].&lt;br /&gt;
&lt;br /&gt;
= Dockerfile =&lt;br /&gt;
Al [https://github.com/PhysicsX/QTonRaspberryPi/blob/main/Dockerfile Dockerfile] original s'inclouen les biblioteques:&lt;br /&gt;
* QtBase&lt;br /&gt;
* QtShaderTools&lt;br /&gt;
* QtDeclarative&lt;br /&gt;
I al [https://www.binefa.cat/qt/cross-compile/Dockerfile Dockerfile modificat] per a permetre la comunicaió mitjançant MQTT hi afegeixo:&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtnetworkauth-index.html QtNetworkAuth]&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtwebsockets-index.html QtWebSockets]&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtmqtt-index.html QtMqtt]&lt;br /&gt;
&lt;br /&gt;
= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''raspberry''.local:/home/''pi''/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
 ''pi''@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
És un procés prou ràpid (al voltant d'un minut) excepte quan hi ha actualitzacions del kernel als repositoris de Debian (que triga al voltant de quatre hores fer una nova imatge).&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode] desenvolupat per [https://www.linkedin.com/in/ulasdikme/ Ulas Dikme]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47717</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47717"/>
		<updated>2025-01-21T12:46:22Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Idea */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Idea =&lt;br /&gt;
N'[https://www.linkedin.com/in/ulasdikme/ Ulas Dikme] ha desenvolupat un sistema per a fer la compilació creuada de Qt6 per a Raspberry Pi&lt;br /&gt;
&lt;br /&gt;
= Dockerfile =&lt;br /&gt;
Al [https://github.com/PhysicsX/QTonRaspberryPi/blob/main/Dockerfile Dockerfile] original s'inclouen les biblioteques:&lt;br /&gt;
* QtBase&lt;br /&gt;
* QtShaderTools&lt;br /&gt;
* QtDeclarative&lt;br /&gt;
I al [https://www.binefa.cat/qt/cross-compile/Dockerfile Dockerfile modificat] per a permetre la comunicaió mitjançant MQTT hi afegeixo:&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtnetworkauth-index.html QtNetworkAuth]&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtwebsockets-index.html QtWebSockets]&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtmqtt-index.html QtMqtt]&lt;br /&gt;
&lt;br /&gt;
= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''raspberry''.local:/home/''pi''/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
 ''pi''@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
És un procés prou ràpid (al voltant d'un minut) excepte quan hi ha actualitzacions del kernel als repositoris de Debian (que triga al voltant de quatre hores fer una nova imatge).&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode] desenvolupat per [https://www.linkedin.com/in/ulasdikme/ Ulas Dikme]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47716</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47716"/>
		<updated>2025-01-21T12:44:26Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Dockerfile */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Idea =&lt;br /&gt;
= Dockerfile =&lt;br /&gt;
Al [https://github.com/PhysicsX/QTonRaspberryPi/blob/main/Dockerfile Dockerfile] original s'inclouen les biblioteques:&lt;br /&gt;
* QtBase&lt;br /&gt;
* QtShaderTools&lt;br /&gt;
* QtDeclarative&lt;br /&gt;
I al [https://www.binefa.cat/qt/cross-compile/Dockerfile Dockerfile modificat] per a permetre la comunicaió mitjançant MQTT hi afegeixo:&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtnetworkauth-index.html QtNetworkAuth]&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtwebsockets-index.html QtWebSockets]&lt;br /&gt;
* [https://doc.qt.io/qt-6/qtmqtt-index.html QtMqtt]&lt;br /&gt;
&lt;br /&gt;
= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''raspberry''.local:/home/''pi''/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
 ''pi''@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
És un procés prou ràpid (al voltant d'un minut) excepte quan hi ha actualitzacions del kernel als repositoris de Debian (que triga al voltant de quatre hores fer una nova imatge).&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode] desenvolupat per [https://www.linkedin.com/in/ulasdikme/ Ulas Dikme]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47715</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47715"/>
		<updated>2025-01-21T12:42:10Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Dockerfile */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Idea =&lt;br /&gt;
= Dockerfile =&lt;br /&gt;
Al [https://github.com/PhysicsX/QTonRaspberryPi/blob/main/Dockerfile Dockerfile] original s'inclouen les biblioteques:&lt;br /&gt;
* QtBase&lt;br /&gt;
* QtShaderTools&lt;br /&gt;
* QtDeclarative&lt;br /&gt;
I al [https://www.binefa.cat/qt/cross-compile/Dockerfile Dockerfile modificat] per a permetre la comunicaió mitjançant MQTT hi afegeixo:&lt;br /&gt;
* QtNetworkauth&lt;br /&gt;
* QtWebSockets&lt;br /&gt;
* QtMqtt&lt;br /&gt;
&lt;br /&gt;
= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''raspberry''.local:/home/''pi''/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
 ''pi''@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
És un procés prou ràpid (al voltant d'un minut) excepte quan hi ha actualitzacions del kernel als repositoris de Debian (que triga al voltant de quatre hores fer una nova imatge).&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode] desenvolupat per [https://www.linkedin.com/in/ulasdikme/ Ulas Dikme]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47714</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47714"/>
		<updated>2025-01-21T12:37:14Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Idea =&lt;br /&gt;
= Dockerfile =&lt;br /&gt;
Al [https://github.com/PhysicsX/QTonRaspberryPi/blob/main/Dockerfile Dockerfile] original s'inclouen les biblioteques:&lt;br /&gt;
* QtBase&lt;br /&gt;
* QtShaderTools&lt;br /&gt;
* QtDeclarative&lt;br /&gt;
I a la modificació que n'he fet per a permetre la comunicaió mitjançant MQTT hi afegeixo:&lt;br /&gt;
* QtNetworkauth&lt;br /&gt;
* QtWebSockets&lt;br /&gt;
* QtMqtt&lt;br /&gt;
= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''raspberry''.local:/home/''pi''/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
 ''pi''@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
És un procés prou ràpid (al voltant d'un minut) excepte quan hi ha actualitzacions del kernel als repositoris de Debian (que triga al voltant de quatre hores fer una nova imatge).&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode] desenvolupat per [https://www.linkedin.com/in/ulasdikme/ Ulas Dikme]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47713</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47713"/>
		<updated>2025-01-21T12:29:07Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''raspberry''.local:/home/''pi''/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
 ''pi''@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
És un procés prou ràpid (al voltant d'un minut) excepte quan hi ha actualitzacions del kernel als repositoris de Debian (que triga al voltant de quatre hores fer una nova imatge).&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47712</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47712"/>
		<updated>2025-01-21T12:27:08Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''raspberry''.local:/home/''pi''/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
 ''pi''@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47711</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47711"/>
		<updated>2025-01-21T12:26:20Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''raspberry''.local:/home/''pi''/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ''pi''@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
pi@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47710</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47710"/>
		<updated>2025-01-21T12:25:18Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 pi@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
pi@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Un cop deseu el vostre codi dins de la carpeta ''project'' tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47709</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47709"/>
		<updated>2025-01-21T12:24:19Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 pi@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
pi@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable no us caldrà tornar a instal·lar les biblioteques. Tan sols haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47708</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47708"/>
		<updated>2025-01-21T12:23:29Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 pi@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
pi@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable, no us caldrà tornar a instal·lar les biblioteques i haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47707</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47707"/>
		<updated>2025-01-21T12:22:32Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 pi@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
pi@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes anteriors i tan sols esteu modificant el codi font de l'executable, no us caldrà tornar a instal·lar les biblioteques i haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47706</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47706"/>
		<updated>2025-01-21T12:22:12Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 pi@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
pi@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes i tan sols esteu modificant el codi font de l'executable, no us caldrà tornar a instal·lar les biblioteques i haureu de repetir aquest procés:&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47705</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47705"/>
		<updated>2025-01-21T12:18:29Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi (el darrer '''.''' és important. Indica que el ''Dockerfile'' i la carpeta ''project'' són al directori des d'on executa l'ordre ''docker build''):&lt;br /&gt;
 docker build -t '''qtcrossbuild''' .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 pi@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
pi@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes i tan sols esteu modificant el codi font de l'executable, haureu de repetir aquest procés:&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47704</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47704"/>
		<updated>2025-01-21T12:15:49Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi:&lt;br /&gt;
 docker build -t qtcrossbuild .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 pi@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
* Poseu en marxa l'executable generat a la Raspberry:&lt;br /&gt;
pi@''raspberrypi'':~ ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Un cop heu fet totes les passes i tan sols esteu modificant el codi font de l'executable, haureu de repetir aquest procés:&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47703</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47703"/>
		<updated>2025-01-21T12:12:52Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi:&lt;br /&gt;
 docker build -t qtcrossbuild .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''pi'' pel vostre usuari i ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp '''nom_arxiu_executable''' pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
* '''El primer cop''' que feu la compilació creuada també haureu de copiar a la Raspberry Pi les '''biblioteques''' necessàries per a que funcioni l'executable que heu compilat:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/qt-pi-binaries.tar.gz ./qt-pi-binaries.tar.gz&lt;br /&gt;
 scp qt-pi-binaries.tar.gz ''pi''@''192.168.1.XX'':/home/''pi''/&lt;br /&gt;
 ssh ''pi''@''192.168.1.XX''&lt;br /&gt;
 pi@''raspberrypi'':~ sudo mkdir /usr/local/qt6&lt;br /&gt;
 pi@''raspberrypi'':~ sudo tar -xvf qt-pi-binaries.tar.gz -C /usr/local/qt6&lt;br /&gt;
 ulas@raspberrypi:~ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/qt6/lib/&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47702</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47702"/>
		<updated>2025-01-21T12:04:08Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i '''deseu el codi a compilar dins de la carpeta ''project''''' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi:&lt;br /&gt;
 docker build -t qtcrossbuild .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp pales04 pi@''192.168.1.XX'':/home/pi/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp pales04 pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47701</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47701"/>
		<updated>2025-01-21T12:03:40Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i deseu el codi a compilar dins de la carpeta ''project'' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge de docker d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi:&lt;br /&gt;
 docker build -t qtcrossbuild .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp pales04 pi@''192.168.1.XX'':/home/pi/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp pales04 pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47700</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47700"/>
		<updated>2025-01-21T12:03:03Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* En marxa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i deseu el codi a compilar dins de la carpeta ''project'' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge d'un Debian 12, anomenada '''qtcrossbuild''', capaç de fer la compilació creuada per a Raspberry Pi:&lt;br /&gt;
 docker build -t qtcrossbuild .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
&lt;br /&gt;
* Feu un contenidor temporal de la imatge ''qtcrossbuild'' per a poder copiar l'executable generat per a Raspberry Pi:&lt;br /&gt;
 docker create --name '''contenidor_temporal''' qtcrossbuild&lt;br /&gt;
&lt;br /&gt;
* Copieu al vostre directori (si no ho heu canviat, seguiu al directori a on hi ha l'arxiu ''Dockerfile'') l'executable generat per a Raspberry Pi que és a dins del contenidor:&lt;br /&gt;
 docker cp '''contenidor_temporal''':/build/project/'''nom_arxiu_executable''' ./'''nom_arxiu_executable'''&lt;br /&gt;
&lt;br /&gt;
* Copieu l'arxiu executable generat a la Raspberry Pi (canvieu ''192.168.1.XX'' per la IP de la vostra Raspberry Pi):&lt;br /&gt;
 scp pales04 pi@''192.168.1.XX'':/home/pi/&lt;br /&gt;
o (canvieu ''raspberry'' pel ''hostname'' de la vostra Raspberry Pi):&lt;br /&gt;
 scp pales04 pi@''raspberry''.local:/home/pi/&lt;br /&gt;
&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47699</id>
		<title>Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Compilaci%C3%B3_creuada_de_Qt6.8.0_per_Raspberry_Pi_3/4/5_amb_docker&amp;diff=47699"/>
		<updated>2025-01-21T11:52:43Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : Es crea la pàgina amb «= En marxa = * Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i deseu el codi a compilar dins de la carpeta ''project'' (assegureu-vos de no copiar ''CMakeLists.t...».&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= En marxa =&lt;br /&gt;
* Aneu al directori a on hi ha l'arxiu ''Dockerfile'' i deseu el codi a compilar dins de la carpeta ''project'' (assegureu-vos de no copiar ''CMakeLists.txt.user'' ni la carpeta ''build'').&lt;br /&gt;
&lt;br /&gt;
* Identifiqueu el nom de l'arxiu executable. Dins l'arxiu ''CMakeLists.txt'' hi ha [https://doc.qt.io/qt-6/qt-add-executable.html qt_add_executable] amb el nom de l'arxiu executable ('''nom_arxiu_executable'''):&lt;br /&gt;
 qt_add_executable('''nom_arxiu_executable'''&lt;br /&gt;
    main.cpp&lt;br /&gt;
 )&lt;br /&gt;
&lt;br /&gt;
* Feu una imatge d'un Debian 12 capaç de fer la compilació creuada per a Raspberry Pi:&lt;br /&gt;
 docker build -t qtcrossbuild .&lt;br /&gt;
El '''primer cop''' a fer la imatge pot trigar '''al voltant de 4 hores'''. Un cop feta, '''el segon cop''' que es fa servir, habitualment canviant el contingut de la carpeta ''build'', trigarà '''al voltant d'un minut''', depenent de la complexitat del codi a compilar. '''Quan hi hagi actualitzacions del kernel''' al repositoris de Debian tornarà a trigar '''al voltant de 4 hores''' a fer-se la imatge.&lt;br /&gt;
= Font =&lt;br /&gt;
[https://github.com/PhysicsX/QTonRaspberryPi Cross compilation of Qt6.8.0 For Raspberry pi 3/4/5 with Docker(Base and QML packages) and Remote Debugging with Vscode]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47698</id>
		<title>Pàgina principal</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47698"/>
		<updated>2025-01-21T11:33:22Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Raspbian */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size:500%&amp;quot;&amp;gt;things.cat&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:300%&amp;quot;&amp;gt;Una pàgina pràctica sobre la Internet de les Coses&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Dispositius IoT. Maquinari i microprogramari =&lt;br /&gt;
Al '''maquinari''' li diem'' '''hardware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
Al '''microprogramari''' li diem'' '''firmware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
'''IoT''' és l'acrònim d'''Internet of Things''. En català abreujat li podríem dir '''IdC''' per a referir-nos a '''la Internet de les Coses'''. En el moment d'escriure aquest text, la comunitat catalanoparlant sembla haver optat per referir-se als '''dispositius de la Internet de les Coses''' com a '''dispositius IoT'''. Si el [https://www.termcat.cat/ca/neoloteca/ termcat] es pronuncia de manera diferent, provaré d'adaptar la terminologia.&lt;br /&gt;
&lt;br /&gt;
== Placa IoT-02 ==&lt;br /&gt;
[https://www.binefa.com/index.php/Placa_IoT-02 Placa_IoT-02]&lt;br /&gt;
&lt;br /&gt;
== Controladors ==&lt;br /&gt;
Als '''controladors''' els hi diem'' '''drivers''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
El xip '''FT232''' ha estat durant molt de temps el xip més comú per convertir d''''USB a UART'''. Fins al punt que se'n van fer còpies pirates. Una actualització del sistema operatiu privatiu Windows va explotar una característica dels xips pirates: els xips pirates tenien el registre d'identificació USB de lectura i escriptura i l'original era tan sols de lectura. L'actualització que va fer Windows provocava l'escriptura d'aquest registre i hi escrivia un zero, que feia que el sistema operatiu ho identifiqués com a concentrador USB i no com a controlador d'UART, fent que el maquinari quedés inservible. A l'any 2014 em vaig veure atrapat amb uns quants Arduino Nano que duien aquest xip pirata i vaig escriure [https://binefa.cat/blog/?p=80 How to recover bricked fake FT232] per a poder-los reprogramar i poder-los fer servir amb sistemes operatius lliures GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
A partir d'aquell moment, bona part de les plaques de fabricació xinesa van començar a dur, massivament, el xip '''CH340''' per a convertir d'USB a UART.&lt;br /&gt;
&lt;br /&gt;
[[Controlador CH340]]&lt;br /&gt;
&lt;br /&gt;
[[Controlador FT232]]&lt;br /&gt;
&lt;br /&gt;
== C / C++ ==&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-libraries Biblioteques per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes Codis per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
=== ESP8266 ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Afegint_la_targeta_ESP8266_a_l%27IDE_d%27Arduino Afegint la targeta ESP8266 a l'IDE d'Arduino] (NodeMCU1.0)&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp8266_udpServer_01b esp8266_udpServer_01.ino] Codi UDP per a ESP8266&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_a_l%27ESP8266 MQTT a l'ESP8266]&lt;br /&gt;
&lt;br /&gt;
=== ESP32 ===&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_udpServer_01b esp32_udpServer_01b] Codi UDP per a ESP32&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_i2cScanner_02 esp32_i2cScanner_02.ino Adreces de dispositius I2C connectats]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/modbus/rtu/esp32/ Exemple de ModBus RTU fent servir NodeRED i ESP32 (amb la placa IoT PLB)]&lt;br /&gt;
&lt;br /&gt;
[https://techtutorialsx.com/2017/05/06/esp32-arduino-creating-a-task/ ESP32 Arduino: Creating a FreeRTOS task]&lt;br /&gt;
&lt;br /&gt;
[https://savjee.be/2020/01/multitasking-esp32-arduino-freertos/ Multitasking on ESP32 with Arduino and FreeRTOS]&lt;br /&gt;
&lt;br /&gt;
==== Modbus ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#overview-of-rs485-specific-communication-options Overview of RS485 specific communication options]&lt;br /&gt;
&lt;br /&gt;
[https://pastebin.com/2PtWJvd6 Example setting RS485 at half duplex mode]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/IoT-02/tree/master/codes/IoT-02_11_modbus_bme280_02 Code IoT-02_11_modbus_bme280_02] using RS485 at half duplex mode&lt;br /&gt;
&lt;br /&gt;
==== ESP-IDF ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ Get Started]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html Get started with ESP-IDF and ESP32-DevKitC: debugging, unit testing, project analysis]&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
=== Accés al maquinari de la Raspberry Pi emprant Python ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Com_connectar-hi_pantalles_OLED_SSD1306_(128x64) Com connectar-hi pantalles OLED SSD1306 (128x64)]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=%C3%9As_d%27entrades_anal%C3%B2giques_amb_l%27ADS115_controlant_sortides_PWM Ús d'entrades analògiques amb l'ADS115 controlant sortides PWM]&lt;br /&gt;
&lt;br /&gt;
=== Micropython ===&lt;br /&gt;
[https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome Micropython and the Internet of Things]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp8266 MicroPython port to ESP8266]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp32 MicroPython port to the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://icircuit.net/esp32-micropython-getting-started/1999 ESP32 – Getting started with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-on-the-esp32-decdd32c4720 Get on the Good Foot with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-part-2-e1f2efaad50b Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor DS18B20 (One Wire Interface)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/gloveboxes/ESP32-MicroPython-BME280-MQTT-Sample Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor BME280 (I2C)]&lt;br /&gt;
&lt;br /&gt;
=== CircuitPython ===&lt;br /&gt;
[https://learn.adafruit.com/circuitpython-with-esp32-quick-start CircuitPython on ESP32 Quick Start]&lt;br /&gt;
&lt;br /&gt;
== Sistemes operatius encastats ==&lt;br /&gt;
=== Raspbian ===&lt;br /&gt;
[https://www.raspberrypi.org/documentation/computers/remote-access.html Remote Access]&lt;br /&gt;
&lt;br /&gt;
[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ How to Install Mosquitto Broker on Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Adaptaci%C3%B3_per_a_que_la_Raspberry_Pi_funcioni_com_a_punt_d%27acc%C3%A9s_donant_adreces_IP_de_classe_B Adaptació per a que la Raspberry Pi funcioni com a punt d'accés donant adreces IP de classe B]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_dels_nodes_node-red-contrib-ttn_i_node-red-contrib-modbustcp-no-pooling_a_la_Raspberry_Pi Instal·lació dels nodes node-red-contrib-ttn i node-red-contrib-modbustcp-no-pooling a la Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_de_l%27OPC-UA_a_la_Raspberry_Pi,_fent_servir_Python,_i_control_des_d%27Indusoft Instal·lació de l'OPC-UA a la Raspberry Pi, fent servir Python, i control des d'Indusoft]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Pr%C3%A0ctica_de_connexi%C3%B3_remota_a_una_Raspberry_Pi Pràctica de connexió remota a una Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://core-electronics.com.au/guides/read-only-raspberry-pi/ Read-Only Raspberry Pi - Never Corrupt your Micro-SD Card]&lt;br /&gt;
==== Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb ''docker'' ====&lt;br /&gt;
[[Compilació creuada de Qt6.8.0 per Raspberry Pi 3/4/5 amb docker]]&lt;br /&gt;
&lt;br /&gt;
=== Mongoose OS ===&lt;br /&gt;
[https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md Guia ràpida d'introducció a Mongoose OS][en]&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
[[Sensors de so]]&lt;br /&gt;
&lt;br /&gt;
= Control remot dels dispositius IoT. Programari =&lt;br /&gt;
Al '''programari''' li diuen'' '''software''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
[https://binefa.cat/IoT/teoria/ethernetTcpUdp_00.pdf TCP/UDP Capa de transport d'Ethernet]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació d'un servidor de sòcols web a un Debian amb Apache]]&lt;br /&gt;
&lt;br /&gt;
=== MQTT(S) ===&lt;br /&gt;
[https://binefa.cat/IoT/teoria/mqtt_00.pdf Introducció a MQTT]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt/ Beginners Guide To The MQTT Protocol] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[https://www.rs-online.com/designspark/mqtt MQTT] explained by Andy Stanford-Clark (co-inventor of MQTT). Article written in 2017, and refering to v3.1.1&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/mqtt-5/ MQTT 5 Essentials] by HiveMQ&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt-hosting-brokers-and-servers/ MQTT Brokers/Servers and Cloud Hosting Guide] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer] An all-round MQTT client that provides a structured topic overview&lt;br /&gt;
&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT a Snap!]&lt;br /&gt;
&lt;br /&gt;
==== Public MQTT(S) brokers ====&lt;br /&gt;
[http://test.mosquitto.org/ mosquitto]&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/public-mqtt-broker/ HiveMQ MQTT broker]&lt;br /&gt;
&lt;br /&gt;
[https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/ MQTT brokers online with a free offer to test and connect IoT to the internet]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) implementations ====&lt;br /&gt;
[http://binefa.com/index.php?title=MQTTS_y_NodeRED MQTTS y NodeRED]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations Comparison of MQTT implementations]&lt;br /&gt;
&lt;br /&gt;
[http://test.mosquitto.org/ test.mosquitto.org]&lt;br /&gt;
&lt;br /&gt;
[https://www.emqx.io/ emqx.io]&lt;br /&gt;
&lt;br /&gt;
[https://vernemq.com/ VerneMQ]&lt;br /&gt;
&lt;br /&gt;
=== Webhooks ===&lt;br /&gt;
[https://hookdeck.com/guides/webhooks/what-are-webhooks-how-they-work What Are Webhooks And How They Work]&lt;br /&gt;
&lt;br /&gt;
[[Exemple bàsic de funcionament de Webhooks. Servidor i client en node.js]]&lt;br /&gt;
&lt;br /&gt;
== Programació local (ordinadors d'escriptori i dispositius mòbils) ==&lt;br /&gt;
[https://binefa.cat/IoT/mqtt/MQTT_Dash/ Configuració de MQTT Dash (aplicació per Android)]&lt;br /&gt;
&lt;br /&gt;
=== Mosquitto local a l'ordinador ===&lt;br /&gt;
[https://www.vultr.com/docs/how-to-install-mosquitto-mqtt-broker-server-on-ubuntu-16-04 How to Install Mosquitto MQTT Broker/Server on Ubuntu 16.04]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/downloads/ Instal·lació de Mosquitto a Windows]&lt;br /&gt;
&lt;br /&gt;
Per a actualitzar les claus dels dipòsits de Debian:&lt;br /&gt;
 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key&lt;br /&gt;
 sudo apt-key add mosquitto-repo.gpg.key&lt;br /&gt;
&lt;br /&gt;
=== SCADA ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=SCADA_fent_servir_Python_QML_i_Arduino SCADA fent servir Python QML i Arduino]&lt;br /&gt;
&lt;br /&gt;
== Núvol ==&lt;br /&gt;
=== Instal·lació de Node.js i npm ===&lt;br /&gt;
[https://github.com/nodesource/distributions/blob/master/README.md Instal·lació de node i npm]&lt;br /&gt;
 ecat@iot-ecat:~$ '''sudo bash'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''curl -sL https://deb.nodesource.com/setup_14.x | bash -'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''apt install -y nodejs'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''exit'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''node --version'''&lt;br /&gt;
 v14.15.4&lt;br /&gt;
 ecat@iot-ecat:~$ '''npm -- version'''&lt;br /&gt;
 6.14.10&lt;br /&gt;
&lt;br /&gt;
=== Node-RED ===&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf Introducció al Node-RED]&lt;br /&gt;
&lt;br /&gt;
[[Gestió de Node-RED]]&lt;br /&gt;
&lt;br /&gt;
[https://www.aprendiendoarduino.com/cursos/node-red-developer-para-iot-nivel-i/ Node-RED Developer para IoT. Nivel I]&lt;br /&gt;
&lt;br /&gt;
==== Instal·lació i funcionament del NodeRed autònom ====&lt;br /&gt;
 ecat@iot-ecat:~$ '''mkdir bin'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''cd bin'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''sudo apt install unzip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''mkdir nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''cd nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''wget https://www.binefa.cat/IoT/nodeRed/node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''unzip node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''node node_modules/node-red/red.js --userDir node_modules/node-red/data --settings node_modules/node-red/settings.js -v --port 2222 --title elmeuTitol --safe flows_meuTitol.json'''&lt;br /&gt;
&lt;br /&gt;
==== UDP ====&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/udpServer/udpServer_nodered_code.txt Codi NodeRED per a esp8266_udpServer_01.ino i esp32_udpServer_01b]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_i_MQTTS MQTT i MQTTS]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex00/ Exemple amb MQTT i NodeRED emprant ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex01/ Exercici amb MQTT i NodeRED emprant ESP8266]&lt;br /&gt;
&lt;br /&gt;
[[Elevador en Snap! controlat remotament amb MQTT mitjançant NodeRED fent crides HTTP]]&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer]&lt;br /&gt;
&lt;br /&gt;
==== Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Un_exemple_d%27us_de_Telegram_amb_el_NodeRed Un exemple d'us de Telegram amb el NodeRed]&lt;br /&gt;
&lt;br /&gt;
==== Modbus TCP ====&lt;br /&gt;
[https://binefa.cat/IoT/modbus/ Arxius per treballar amb Modbus TCP] [https://www.binefa.cat/php/doc/modbus/ El segon vídeo explica i compara Modbus RTU i Modbus TCP] &lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/modbusCtrl/ ModBus TCP al NodeRED]&lt;br /&gt;
&lt;br /&gt;
==== Alguns nodes extra ====&lt;br /&gt;
[https://flows.nodered.org/node/node-red-contrib-google-sheets node-red-contrib-google-sheets]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/sammachin/node-red-contrib-google-sheets node-red-contrib-google-sheets al Github]&lt;br /&gt;
&lt;br /&gt;
=== Sistemes d'emmagatzematge i visualització ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=InfluxDB Base de dades de sèries temporals InfluxDB]&lt;br /&gt;
&lt;br /&gt;
[http://docs.grafana.org/installation/debian/ Instal·lació de Grafana a Debian][en]&lt;br /&gt;
&lt;br /&gt;
[[Sentilo]]&lt;br /&gt;
&lt;br /&gt;
=== Xarxes d'àrea estesa de baix consum (LPWAN) ===&lt;br /&gt;
==== Conceptes teòrics ====&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Xarxa_de_llarg_abast Xarxa de llarg abast (WAN)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Chirp_spread_spectrum Espectre eixamplat (Chirp Spread Spectrum)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_seq%C3%BC%C3%A8ncia_directa Espectre eixamplat per seqüència directa (DSSS)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_salt_de_freq%C3%BC%C3%A8ncia Espectre eixamplat per salt de freqüència (FHSS)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LPWAN What is LPWAN?]&lt;br /&gt;
&lt;br /&gt;
[https://cms.edn.com/ContentEETimes/Documents/EDN/LP%20WAN%20Comparison%20Table%20final.pdf Comparison table of Low Power WAN alternatives]&lt;br /&gt;
&lt;br /&gt;
==== LoRa ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
==== SigFox ====&lt;br /&gt;
[https://docs.pycom.io/chapter/tutorials/sipy/register.html Registering SiPy with Sigfox]&lt;br /&gt;
&lt;br /&gt;
[[Interacció amb SiPy1.0r de pycom]]&lt;br /&gt;
&lt;br /&gt;
==== Antenes ====&lt;br /&gt;
[https://youtu.be/CJNq2I_PDHQ Andreas Spiess video: &amp;quot;#182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge)&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Bots ===&lt;br /&gt;
==== Bot de Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Bot_de_Telegram Bot de Telegram]&lt;br /&gt;
&lt;br /&gt;
==== Bot de Mastodon ====&lt;br /&gt;
No totes les instàncies de [https://ca.wikipedia.org/wiki/Mastodon_(xarxa_social) Mastodon] faciliten la instal·lació de bots. Per a fer les primeres passes us recomano aquesta [https://botsin.space/ instància pensada per allotjar bots de Mastodon].&lt;br /&gt;
&lt;br /&gt;
[https://botsin.space/@siarq_sensors Exemple de bot de Mastodon] per a fer lectures de sensors cada hora.&lt;br /&gt;
&lt;br /&gt;
[https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26 Getting credentials for the Mastodon API with Mastodon.py, step by step]&lt;br /&gt;
&lt;br /&gt;
=== VPS ===&lt;br /&gt;
[[Introducció als contenidors docker]]&lt;br /&gt;
&lt;br /&gt;
[[Servidor intermediari invers]]&lt;br /&gt;
&lt;br /&gt;
[[Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[File Browser]]&lt;br /&gt;
&lt;br /&gt;
[[Apache i PHP]]&lt;br /&gt;
&lt;br /&gt;
[[Redireccions a subdomini]]&lt;br /&gt;
&lt;br /&gt;
[[Mastodon]]&lt;br /&gt;
&lt;br /&gt;
[https://medium.com/himinds/mqtt-broker-with-secure-websocket-using-traefik-docker-compose-and-lets-encrypt-2b8e32207555 MQTT broker with Secure WebSocket using Traefik, Docker Compose and Let’s Encrypt]&lt;br /&gt;
&lt;br /&gt;
[[Moodle a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Node-RED a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Snap! a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[VPN WireGuard]]&lt;br /&gt;
&lt;br /&gt;
== Snap! ==&lt;br /&gt;
[https://github.com/jmoenig/Snap Snap! al GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''amb''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''sense''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
=== JavaScript per defecte ===&lt;br /&gt;
Per raons de seguretat, s'ha desactivat el JavaScript per defecte. Si us munteu el vostre propi servei al núvol, per a poder cridar programes vostres amb funcions amb JavaScript, heu d'afegir aquesta línia, en negreta, a l'arxiu ''[https://github.com/jmoenig/Snap/blob/master/snap.html snap.html]'':&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            '''Process.prototype.enableJS = true;''' // &amp;lt;-- Per a tenir seleccionat el JS per defecte&lt;br /&gt;
            var world;&lt;br /&gt;
            window.onload = function () {&lt;br /&gt;
                if ('serviceWorker' in navigator) {&lt;br /&gt;
                    navigator.serviceWorker.register('sw.js');&lt;br /&gt;
                }&lt;br /&gt;
                world = new WorldMorph(document.getElementById('world'));&lt;br /&gt;
                new IDE_Morph().openIn(world);&lt;br /&gt;
                loop();&lt;br /&gt;
            };&lt;br /&gt;
            function loop() {&lt;br /&gt;
                requestAnimationFrame(loop);&lt;br /&gt;
                world.doOneCycle();&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MQTT for Snap! ===&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT4Snap !], desenvolupat per en Xavier Pi.&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld.xml Hello World emprant MQTT '''amb''' SSL]&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html#open:http://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld_NoSSL.xml Hello World emprant MQTT '''sense''' SSL]&lt;br /&gt;
&lt;br /&gt;
= Una aproximació a OPC-UA =&lt;br /&gt;
&lt;br /&gt;
[[OPC-UA]]&lt;br /&gt;
&lt;br /&gt;
= Placa IoT-02 =&lt;br /&gt;
[[Placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
== Programació remota (OTA) ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Esp32Ota.png|center|Programacio OTA de la placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
=== Dos programes de prova de programació remota ===&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_01.zip IoT-02_OTAWebUpdater_01] (Fa pampallugues el led blanc) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_02.zip IoT-02_OTAWebUpdater_02] (Fa pampallugues el led verd) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
=== Programació a la vora (''edge'') ===&lt;br /&gt;
L'ordinador a la vora (''edge'') pot ser un ordinador normal, habitualment de poca potència, del tipus Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Per a tenir visibilitat externa de la pàgina web servida per la placa IoT-02 (per exemple amb la IP 192.168.1.151:80), ho redireccionarem a un port ( 192.168.1.151:80 --&amp;gt; localhost:5001 )&lt;br /&gt;
&lt;br /&gt;
Per a fer funcionar [https://www.binefa.cat/training/iot02/ota/edge/simple-port-forwarding.js simple-port-forwarding.js] caldrà haver afegit el paquet '''http-proxy''':&lt;br /&gt;
&lt;br /&gt;
 npm install http-proxy&lt;br /&gt;
&lt;br /&gt;
El codi nodejs de redireccionament (suposant que la placa IoT-02 ha adquirit l'adreça IP 192.168.1.151):&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '192.168.1.151';&lt;br /&gt;
 var portOrigen = 80;&lt;br /&gt;
 var portDesti = 5001;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
Per a fer aquest redireccionador sigui un servei, es copia [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service] a la carpeta '''/etc/systemd/system''' o el fem de nou amb un editor:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/systemd/system&lt;br /&gt;
 sudo nano [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service]&lt;br /&gt;
 sudo chmod 755 myForwardingService.service&lt;br /&gt;
 sudo systemctl daemon-reload&lt;br /&gt;
 sudo systemctl '''start''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
Per a veure l'estat del servei:&lt;br /&gt;
 systemctl '''status''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
I per a fer que el servei es posi en marxa al reiniciar l'ordinador a la vora:&lt;br /&gt;
 sudo systemctl '''enable''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
=== Programació al núvol ===&lt;br /&gt;
Mitjançant una xarxa virtual privada (VPN) de l'estil [https://www.zerotier.com/ ZeroTier] podem fer que l'ordinador a la vora i l'ordinador al núvol comparteixin la mateixa xarxa.&lt;br /&gt;
&lt;br /&gt;
Suposant que l'ordinador a la vora té la IP 10.242.156.158, podem redireccionar-hi 10.242.156.158:5001 --&amp;gt; localhost:7007 :&lt;br /&gt;
&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '10.242.156.158';&lt;br /&gt;
 var portOrigen = 5001;&lt;br /&gt;
 var portDesti = 7007;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
I així tenim accés remot des del núvol, connectant mitjançant l'ordinador a la vora que es connecta a la placa IoT-02. &lt;br /&gt;
&lt;br /&gt;
Per accedir-hi des del navegador, escriviu a la URL: &lt;br /&gt;
 &amp;lt;nom_de_domini&amp;gt;:7007&lt;br /&gt;
Això visualitzarà el que presenta l'ordinador a la vora (la IP és la VPN a l'ordinador a la vora):&lt;br /&gt;
 10.242.156.158:5001&lt;br /&gt;
Que al seu temps presenta el servei pel port 80 de la placa IOT-02 connectada a la mateixa xarxa local que l'ordinador a la vora:&lt;br /&gt;
 192.168.1.151&lt;br /&gt;
&lt;br /&gt;
=== Els tres mètodes de programació OTA de l'ESP32 ===&lt;br /&gt;
[https://www.programmersought.com/article/90864120754/ How to implement OTA online update of ESP32 firmware]&lt;br /&gt;
&lt;br /&gt;
== MicroPython ==&lt;br /&gt;
[https://www.digikey.es/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce MicroPython Basics: Load Files &amp;amp; Run Code]&lt;br /&gt;
&lt;br /&gt;
[https://warped3.substack.com/p/compiling-micropython-with-espressif Compiling microPython with espressif SDK 4.4 for ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://docs.micropython.org/en/latest/esp32/tutorial/intro.html Getting started with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython The MicroPython project]&lt;br /&gt;
&lt;br /&gt;
[https://cdn-learn.adafruit.com/downloads/pdf/micropython-basics-loading-modules.pdf MicroPython Basics: Loading Modules]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/robert-hh/FTP-Server-for-ESP8266-ESP32-and-PYBD uftpd: small FTP server for ESP8266, ESP32 and Pyboard D]&lt;br /&gt;
&lt;br /&gt;
[https://electronicsinnovation.com/connect-esp32-to-ubidots-using-micropython-over-mqtt-with-visual-studio-code/ Connect ESP32 to Ubidots using Micropython over MQTT with Visual Studio Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peterhinch Peter Hinch's GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://wolles-elektronikkiste.de/en/programming-the-esp32-with-micropython Programming the ESP32 with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://awesome-micropython.com/ A curated list of awesome MicroPython libraries, frameworks, software and resources]&lt;br /&gt;
=== asyncio ===&lt;br /&gt;
[https://www.youtube.com/watch?v=5VLvmA__2v0 How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics]&lt;br /&gt;
=== Threads ===&lt;br /&gt;
[https://github.com/kevinmcaleer/threads Micropython thread tutorial]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=QeDnjcdGrpY Video: Micropython Threads - Use Both Cores, on Raspberry Pi Pico and ESP32]&lt;br /&gt;
=== MQTT ===&lt;br /&gt;
[https://bhave.sh/micropython-mqtt/ Secrets of MicroPython: MQTT on ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://wokwi.com/projects/341892004923310676 Exemple MQTT sobre micropython funcionant al wokwi] ([https://wokwi.com/projects/341895401936257620 Un exemple més compacte])&lt;br /&gt;
&lt;br /&gt;
=== Modbus ===&lt;br /&gt;
==== Modifying source code ====&lt;br /&gt;
[https://github.com/brainelectronics/micropython-modbus MicroPython Modbus library]&lt;br /&gt;
&lt;br /&gt;
Modbus control signal able to send or receive messages can be controlled directly by UART. To do that, file [https://github.com/mrvelic/micropython/blob/master/ports/esp32/machine_uart.c machine_uart.c] should be changed.&lt;br /&gt;
&lt;br /&gt;
Changes to be able to use Tx/Rx MAX3485 pin: [https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Information about Modbus an MicroPython has been got from this forum: https://github.com/micropython/micropython/pull/5567&lt;br /&gt;
==== Based on pycom-modbus from pycom ====&lt;br /&gt;
[https://github.com/danjperron/micropython-modbus Modbus Master library for MicroPython ESP32 devices]&lt;br /&gt;
=== LoRa ===&lt;br /&gt;
[https://github.com/martynwheeler/u-lora This is a port of raspi-lora for micropython]&lt;br /&gt;
&lt;br /&gt;
= IoT-Vertebrae =&lt;br /&gt;
== Raspberry ==&lt;br /&gt;
[[Configuració de la WiFi a la Raspberry Pi emprant nmtui]]&lt;br /&gt;
&lt;br /&gt;
[[Reconnexió automàtica a la WiFi]]&lt;br /&gt;
&lt;br /&gt;
[[WireGuard VPN]]&lt;br /&gt;
&lt;br /&gt;
= Exemples pràctics =&lt;br /&gt;
== Sensor ModBus de temperatura i humitat CWT-TH03S ==&lt;br /&gt;
[https://www.aliexpress.com/item/1005001404952412.html CWT-TH03S a AliExpress]&lt;br /&gt;
&lt;br /&gt;
[[Accés ModBus al sensor de temperatura i humitat CWT-TH03S]]&lt;br /&gt;
&lt;br /&gt;
= SBC =&lt;br /&gt;
== PocketBeagle ==&lt;br /&gt;
=== Grove Kit ===&lt;br /&gt;
==== Visió general ====&lt;br /&gt;
[https://beagleboard.org/Kits/Grove Informació comercial del Grove Kit]&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/pocket Informació comercial de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki Wiki de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual System Reference Manual] &amp;lt;----&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/latest-images Darreres imatges per a les SD]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/capes/tree/master/pocketbeagle/Grove Disseny del Grove Cape]&lt;br /&gt;
&lt;br /&gt;
==== Primera connexió a la xarxa sense fils ====&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$ '''sudo connmanctl'''⏎&lt;br /&gt;
 [sudo] password for debian: temppwd⏎&lt;br /&gt;
 connmanctl&amp;gt; '''scan wifi'''⏎&lt;br /&gt;
 Scan completed for wifi&lt;br /&gt;
 connmanctl&amp;gt; '''services'''⏎&lt;br /&gt;
       MyWifi                  wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''agent on'''⏎&lt;br /&gt;
 Agent registered&lt;br /&gt;
 connmanctl&amp;gt; '''connect wifi_1234567890_1234567890123456_managed_psk'''⏎&lt;br /&gt;
 Agent RequestInput wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
       Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]&lt;br /&gt;
       WPS = [ Type=wpspin, Requirement=alternate ]&lt;br /&gt;
 Passphrase? '''MySecretPassphrase'''⏎&lt;br /&gt;
 Connected wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''quit'''⏎&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$&lt;br /&gt;
&lt;br /&gt;
==== Tutorials ====&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/blob/master/PocketBeagle/Grove/workshop-handouts.md Blink PocketBeagle on-board USRx LED]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/tree/master/PocketBeagle/Grove Exemples]&lt;br /&gt;
&lt;br /&gt;
= Formació =&lt;br /&gt;
[https://www.binefa.com/index.php/IoT_amb_Arduino_i_Raspberry_Pi._Microcontroladors_d%27%C3%BAs_professional._Curs_Presencial._Edici%C3%B3_de_mar%C3%A7_de_2022 IoT amb Arduino i Raspberry Pi. Microcontroladors d'ús professional. Curs Presencial. Edició de març de 2022] - [https://formacio.eic.cat/cursos/1123577 Formació al Col·legi d'Enginyers Industrials de Catalunya] (30 / març / 2022)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Sistemes_encastats_d%27escala_petita_i_mitjana._Edici%C3%B3_d%27octubre_2021 Sistemes encastats d'escala petita i mitjana. Edició d'octubre 2021] (20 / octubre / 2021)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways)_IoT_(22_de_mar%C3%A7_de_2022) Nodes sensors (motes) i passarel·les (gateways) IoT (22 de març de 2022)] pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2022) Tecnologías IoT, Hands on y MVP (2022)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Diada_de_la_Llibertat_del_Maquinari_(Edici%C3%B3_2021) Diada de la Llibertat del Maquinari (Edició 2021)] (17 d'abril de 2021)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2021) Tecnologías IoT, Hands on y MVP (2021)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways) Nodes sensors (motes) i passarel·les (gateways)]  pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria] (23 de març de 2021)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Monitoritzaci%C3%B3_de_la_qualitat_de_l%27aire_mesurant_CO2_i_VOC_amb_LoRa Monitorització de la qualitat de l'aire mesurant CO2 i VOC amb LoRa] (9 de gener de 2021)&lt;br /&gt;
&lt;br /&gt;
[[Curset introductori d'Internet de les Coses per ADTelecom]] (Comença el 5 de novembre de 2020)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=%C3%9As_de_les_dades_generades_pels_sensors_LoRaWAN_i_arquitectura_del_sistema._Rub%C3%AD_2020 Ús de les dades generades pels sensors LoRaWAN i arquitectura del sistema. Rubí, 17 de juny de 2020]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Curset_a_TE_Connectivity_del_4_de_mar%C3%A7_de_2020 Curset a TE Connectivity del 4 de març de 2020] a [https://www.te.com/ TE Connectivity]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] (Ajuntament de Viladecans, 19 de febrer de 2020)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://www.binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2020) Tecnologías IoT, Hands on y MVP (2020)]&lt;br /&gt;
&lt;br /&gt;
UPC-School - 21802500 - Màster Industria 4.0 [https://wiki.binefa.cat/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP Tecnologías IoT, Hands on y MVP] (2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] a l'[http://www.icm.csic.es/ Institut de Ciències del Mar] (27 / setembre / 2018 i 25 / setembre / 2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_a_Internet_de_les_Coses_-_juny_2018 Introducció a Internet de les Coses - juny 2018] (Curset de formació per a professors de CF realitzat a l'[https://agora.xtec.cat/iesramblaprim/ Institut Rambla Prim])&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Sunna LoRa RMM v3.0]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Xifratge =&lt;br /&gt;
[[Eines de xifratge en línia]]&lt;br /&gt;
&lt;br /&gt;
= Opinió =&lt;br /&gt;
[http://www.xavierpi.com/mi40/HaciaUnIoT_democraticoYEfectivo.pdf Hacia un Internet de las Cosas democrático y efectivo] per Xavier Pi (octubre 2018)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Auxiliar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;MediaWiki s'ha instal·lat.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consulteu la [https://meta.wikimedia.org/wiki/Help:Contents Guia d'Usuari] per a més informació sobre com utilitzar aquest programari wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Primers passos ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Llista de paràmetres configurables]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ PMF del MediaWiki]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce Llista de correu per a anuncis del MediaWiki]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Traducció de MediaWiki en la vostra llengua]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Aprengueu com combatre la brossa que pot atacar el vostre wiki]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Migraci%C3%B3_d%27una_wiki_a_una_altra_dockeritzada&amp;diff=47492</id>
		<title>Migració d'una wiki a una altra dockeritzada</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Migraci%C3%B3_d%27una_wiki_a_una_altra_dockeritzada&amp;diff=47492"/>
		<updated>2024-09-28T20:18:44Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Connexió amb la base de dades */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Còpia de la wiki original =&lt;br /&gt;
La migració explicada a aquesta pàgina és per a poder integrar una wiki preexistent darrere un [[Servidor intermediari invers]].&lt;br /&gt;
&lt;br /&gt;
* Feu una còpia de la base de dades de la wiki (en aquesta explicació serà ''wiki_binefa_cat.sql''). Si no us recordeu dels paràmetres, feu-li un cop d'ull a l'arxiu '''LocalSettings.php''' present al directori arrel de la wiki.&lt;br /&gt;
&lt;br /&gt;
* Feu una còpia del directori arrel de la wiki&lt;br /&gt;
&lt;br /&gt;
= Prova del contenidor docker a migrar =&lt;br /&gt;
Es cerca la versió actual del wiki en funcionament a l'enllaç &amp;quot;[https://wiki.binefa.cat/index.php?title=Especial:P%C3%A0gines_especials Pàgines especials]&amp;quot; / &amp;quot;[https://wiki.binefa.cat/index.php?title=Especial:Versi%C3%B3 Versió]&amp;quot;. En el cas d'aquest exemple és la versió 1.29.0&lt;br /&gt;
&lt;br /&gt;
Es prova el funcionament, sense volums associats ni base de dades, a un domini secundari de prova (Aquest domini ha d'estar configurat a la configuració DNS del nostre proveïdor de nom de domini):&lt;br /&gt;
 docker run --name wiki_binefa_cat --network net -e VIRTUAL_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -d mediawiki:1.29.0&lt;br /&gt;
Un cop provat que funciona el servei web de la mediawiki, es desactiva el servei:&lt;br /&gt;
 docker stop wiki_binefa_cat&lt;br /&gt;
 docker rm wiki_binefa_cat&lt;br /&gt;
&lt;br /&gt;
= Connexió amb la base de dades =&lt;br /&gt;
Per tal de poder fer servir més d'una base de dades al nostre sistema dockeritzat, es canvia el port normal de funcionament a les bases de dades SQL, el 3306, per un altre exclusiu per al servei de cada wiki, en aquest cas és el 3309.&lt;br /&gt;
&lt;br /&gt;
També es comenten els volums relacionats amb el contingut html de la wiki a migrar i de l'arxiu LocalSettings.php&lt;br /&gt;
&lt;br /&gt;
Al mateix directori a on és [https://www.things.cat/index.php/Migraci%C3%B3_d%27una_wiki_a_una_altra_dockeritzada#Arxiu_docker-compose.yml_per_a_la_primera_connexi.C3.B3_amb_la_base_de_dades docker-compose.yml] executem el contenidor docker:&lt;br /&gt;
 docker-compose run --name wiki_binefa_cat -e VIRTUAL_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
Es verifica la correcta execució del contenidor docker:&lt;br /&gt;
 jordi@vps-wiki:~/bin/wikis/binefa_cat$ '''docker ps -a'''&lt;br /&gt;
 CONTAINER ID   IMAGE             COMMAND                  CREATED          STATUS         PORTS                                      NAMES&lt;br /&gt;
 03e0b6d10eda   mediawiki:1.29.0  &amp;quot;docker-php-entrypoi…&amp;quot;   11 minutes ago   Up 11 minutes  80/tcp                                     wiki_binefa_cat&lt;br /&gt;
 6944309dd20a   mysql:5.6.48      &amp;quot;docker-entrypoint.s…&amp;quot;   14 minutes ago   Up 14 minutes  0.0.0.0:3309-&amp;gt;3306/tcp, :::3309-&amp;gt;3306/tcp  binefa_cat_db_docker&lt;br /&gt;
&lt;br /&gt;
Es consulta l'adreça IP del contenidor de la base de dades dins de la xarxa local de contenidors (necessari per a la configuració de la mediawiki per la generació de l'arxiu LocalSettings.php):&lt;br /&gt;
 &amp;lt;pre&amp;gt;jordi@vps-wiki:~/bin/wikis/binefa_cat$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' binefa_cat_db_docker&lt;br /&gt;
172.18.0.11&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Aneu al navegador d'Internet i aneu a la pàgina de la wiki (en aquest exemple seria https://wiki2.binefa.cat). Si tot va bé, hi surt:&lt;br /&gt;
 MediaWiki 1.29.0&lt;br /&gt;
 LocalSettings.php not found.&lt;br /&gt;
 Please set up the wiki first.&lt;br /&gt;
&lt;br /&gt;
Premeu a sobre de ''Please set up the wiki first''. La primera pàgina és ''Instal·lació del MediaWiki 1.29.0''. Seleccioneu la vostra llengua i la llengua de la wiki. A les dues he seleccionat ''ca - català''.&lt;br /&gt;
&lt;br /&gt;
Després de prémer el botó per a continuar, i si tot ha anat bé, hi surt una pàgina amb aquest text de color verd: ''S'ha comprovat l'entorn. Podeu instal·lar el MediaWiki''.&lt;br /&gt;
&lt;br /&gt;
La següent pàgina és la de connexió a la base de dades. Per a saber quines dades posar, feu-li una ullada al vostre arxiu LocalSettings.php original. En aquest exemple fem servir aquests valors:&lt;br /&gt;
 $wgDBtype = &amp;quot;mysql&amp;quot;;&lt;br /&gt;
 $wgDBserver = &amp;quot;'''172.18.0.11'''&amp;quot;;&lt;br /&gt;
 $wgDBname = &amp;quot;nom_base_de_dades_sql&amp;quot;;&lt;br /&gt;
 $wgDBuser = &amp;quot;usuari_sql&amp;quot;;&lt;br /&gt;
 $wgDBpassword = &amp;quot;contrasenya_usuari_sql&amp;quot;;&lt;br /&gt;
 $wgDBprefix = &amp;quot;wiki_bc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Per defecte hi surt que el tipus és ''MySQL (o compatible)'', i així ha de ser. Al ''Servidor de la base de dades'' hi surt ''localhost'' per defecte i '''ho heu de canviar per la IP del contenidor de la base de dades dins de la xarxa local de contenidors''' (en aquest exemple és 172.18.0.11). Poseu-hi el nom de la base de dades (''nom_base_de_dades_sql''), el prefix de la base de dades (''wiki_bc''). Per a aquest configuració inicial fem servir com a nom de l'usuari de la base de dades ''usuari_sql'' i com a contrasenya ''contrasenya_usuari_sql''.&lt;br /&gt;
&lt;br /&gt;
La pàgina següent mostra aquestes seleccions per defecte (no les modifiqueu): Compte de la base de dades per a l'accés web ''Utilitza el mateix compte que a la instal·lació'', Motor d'emmagatzemament ''InnoDB'' i Joc de caràcters de la base de dades ''binari''.&lt;br /&gt;
&lt;br /&gt;
La pàgina següent us pregunta pel nom de la wiki, el vostre nom d'usuari, contrasenya i correu electrònic. Seleccioneu Fes-me més preguntes, que ja hi és per defecte.&lt;br /&gt;
&lt;br /&gt;
La pàgina següent es sobre permisos. He seleccionat a Perfil de permisos d'usuari: Només editors autoritzats, Copyright i llicència: Creative Commons Reconeixement-CompartirIgual. A Paràmetres del correu electrònic he desactivat els correus sortints. A Extensions he seleccionat ImageMap, Interwiki, Nuke i WikiEditor. A Imatges i càrregues de fitxers he habilitat Habilita la càrrega de fitxers. La resta d'opcions no les he canviat del seu estat per defecte.&lt;br /&gt;
&lt;br /&gt;
Es convenient que securitzeu el vostre '''LocalSettings.php''' per a evitar intrusions:&lt;br /&gt;
 # Disable anonymous editing&lt;br /&gt;
 $wgGroupPermissions['*']['edit'] = false;&lt;br /&gt;
 # Prevent new user registrations except by sysops&lt;br /&gt;
 $wgGroupPermissions['*']['createaccount'] = false;&lt;br /&gt;
Després de continuar les dues següents pàgines informatives ens demana desar l'arxiu '''LocalSettings.php''' (és molt important desar-lo per poder continuar el següent pas).&lt;br /&gt;
&lt;br /&gt;
== Arxiu docker-compose.yml per a la primera connexió amb la base de dades ==&lt;br /&gt;
 ### Based on https://kindalame.com/2020/11/25/self-hosting-mediawiki-with-docker/&lt;br /&gt;
 ### Docker Compose Example for Kinda Lame&lt;br /&gt;
 ### Created October 2020&lt;br /&gt;
 ### Modified August 2021 by Jordi Binefa&lt;br /&gt;
 ###&lt;br /&gt;
 version: '3.3'&lt;br /&gt;
 services:&lt;br /&gt;
  web:&lt;br /&gt;
 ###&lt;br /&gt;
 ### We suggest using the LTS, long term support images&lt;br /&gt;
 ###&lt;br /&gt;
    image: mediawiki:1.29.0&lt;br /&gt;
    ports:&lt;br /&gt;
      - 80:80&lt;br /&gt;
      - 443:443&lt;br /&gt;
      - '''3309''':3306&lt;br /&gt;
    links:&lt;br /&gt;
      - database&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    volumes:&lt;br /&gt;
     - /home/jordi/bin/wikis/binefa_cat/wikibinefacat/images:/var/www/html/images&lt;br /&gt;
 '''#     - /home/jordi/bin/wikis/binefa_cat/wikibinefacat/LocalSettings.php:/var/www/html/LocalSettings.php'''&lt;br /&gt;
 '''#     - /home/jordi/bin/wikis/binefa_cat/wikibinefacat:/var/www/html'''&lt;br /&gt;
 '''#     - /home/jordi/bin/wikis/binefa_cat/php:/usr/local/etc/php'''&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;net&amp;quot;      &lt;br /&gt;
  database:&lt;br /&gt;
    container_name: binefa_cat_db_docker&lt;br /&gt;
    image: mysql:5.6.48&lt;br /&gt;
    ports:&lt;br /&gt;
      - '''3309''':3306&lt;br /&gt;
    environment:&lt;br /&gt;
      MYSQL_DATABASE: 'nom_base_de_dades_sql'&lt;br /&gt;
      MYSQL_USER: 'usuari_sql'&lt;br /&gt;
 #&lt;br /&gt;
 # Generate a secure password and place it in the area below&lt;br /&gt;
 #&lt;br /&gt;
      MYSQL_PASSWORD: 'contrasenya_usuari_sql'&lt;br /&gt;
      MYSQL_ROOT_PASSWORD: 'contrasenya_mestra_sql'&lt;br /&gt;
      MYSQL_RANDOM_ROOT_PASSWORD: 'no'&lt;br /&gt;
    volumes:&lt;br /&gt;
      - /home/jordi/bin/wikis/binefa_cat/database:/var/lib/mysql&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;net&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 volumes:&lt;br /&gt;
  certs:&lt;br /&gt;
  html:&lt;br /&gt;
  vhost:&lt;br /&gt;
  dhparam:&lt;br /&gt;
      &lt;br /&gt;
 networks:&lt;br /&gt;
  net:&lt;br /&gt;
    external: true&lt;br /&gt;
&lt;br /&gt;
= Recàrrega de la base de dades =&lt;br /&gt;
Atureu el contenidor docker de la wiki, però no el de la base de dades:&lt;br /&gt;
 docker stop rm_binefa_cat&lt;br /&gt;
 docker rm wiki_binefa_cat&lt;br /&gt;
&lt;br /&gt;
 jordi@vps-wikie:~/bin/wikis/binefa_cat$ docker exec -i binefa_cat_db_docker mysql -u jordi -pfuroner2017 wiki_binefa_cat &amp;lt; wiki_binefa_cat.sql&lt;br /&gt;
 Warning: Using a password on the command line interface can be insecure.&lt;br /&gt;
 '''ERROR 1050 (42S01) at line 30: Table 'wiki_bcarchive' already exists'''&lt;br /&gt;
&lt;br /&gt;
Per a evitar aquest error:&lt;br /&gt;
 jordi@vps-wiki:~/bin/wikis/binefa_cat$ docker exec -it binefa_cat_db_docker bash -l&lt;br /&gt;
 root@6944309dd20a:/# mysql -u ''usuari_sql'' -p&lt;br /&gt;
 Enter password: ''contrasenya_usuari_sql''&lt;br /&gt;
 mysql&amp;gt; show databases;&lt;br /&gt;
 +--------------------+&lt;br /&gt;
 | Database           |&lt;br /&gt;
 +--------------------+&lt;br /&gt;
 | information_schema |&lt;br /&gt;
 | wiki_binefa_cat    |&lt;br /&gt;
 +--------------------+&lt;br /&gt;
 2 rows in set (0.00 sec)&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt; drop database wiki_binefa_cat;&lt;br /&gt;
 Query OK, 48 rows affected (0.09 sec)&lt;br /&gt;
 mysql&amp;gt; create database wiki_binefa_cat;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt; quit&lt;br /&gt;
 Bye&lt;br /&gt;
 root@6944309dd20a:/# exit&lt;br /&gt;
 logout&lt;br /&gt;
 jordi@vps-7d867fbd:~/bin/wikis/binefa_cat$ docker exec -i binefa_cat_db_docker mysql -u jordi -pfuroner2017 wiki_binefa_cat &amp;lt; wiki_binefa_cat.sql&lt;br /&gt;
 Warning: Using a password on the command line interface can be insecure.&lt;br /&gt;
&lt;br /&gt;
Copieu '''LocalSettings.php''' a la carpeta indicada als volums de l'arxiu docker-compose.yml (a l'exemple /home/jordi/bin/wikis/binefa_cat/wikibinefacat). Verifiqueu que hi consta l'adreça final real de la wiki:&lt;br /&gt;
 $wgServer = &amp;quot;https://wiki2.binefa.cat&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Torneu a executar el contenidor:&lt;br /&gt;
 docker-compose run --name wiki_binefa_cat -e VIRTUAL_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
== Arxiu docker-compose.yml per a la connexió amb la base de dades actualitzada ==&lt;br /&gt;
 ### Based on https://kindalame.com/2020/11/25/self-hosting-mediawiki-with-docker/&lt;br /&gt;
 ### Docker Compose Example for Kinda Lame&lt;br /&gt;
 ### Created October 2020&lt;br /&gt;
 ### Modified August 2021 by Jordi Binefa&lt;br /&gt;
 ###&lt;br /&gt;
 version: '3.3'&lt;br /&gt;
 services:&lt;br /&gt;
  web:&lt;br /&gt;
 ###&lt;br /&gt;
 ### We suggest using the LTS, long term support images&lt;br /&gt;
 ###&lt;br /&gt;
    image: mediawiki:1.29.0&lt;br /&gt;
    ports:&lt;br /&gt;
      - 80:80&lt;br /&gt;
      - 443:443&lt;br /&gt;
      - 3309:3306&lt;br /&gt;
    links:&lt;br /&gt;
      - database&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    volumes:&lt;br /&gt;
     - /home/jordi/bin/wikis/binefa_cat/wikibinefacat/images:/var/www/html/images&lt;br /&gt;
     '''- /home/jordi/bin/wikis/binefa_cat/wikibinefacat/LocalSettings.php:/var/www/html/LocalSettings.php'''&lt;br /&gt;
     '''- /home/jordi/bin/wikis/binefa_cat/wikibinefacat:/var/www/html'''&lt;br /&gt;
 #     - /home/jordi/bin/wikis/binefa_cat/php:/usr/local/etc/php&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;net&amp;quot;      &lt;br /&gt;
  database:&lt;br /&gt;
    container_name: binefa_cat_db_docker&lt;br /&gt;
    image: mysql:5.6.48&lt;br /&gt;
    ports:&lt;br /&gt;
      - '''3309''':3306&lt;br /&gt;
    environment:&lt;br /&gt;
      MYSQL_DATABASE: 'nom_base_de_dades_sql'&lt;br /&gt;
      MYSQL_USER: 'usuari_sql'&lt;br /&gt;
 #&lt;br /&gt;
 # Generate a secure password and place it in the area below&lt;br /&gt;
 #&lt;br /&gt;
      MYSQL_PASSWORD: 'contrasenya_usuari_sql'&lt;br /&gt;
      MYSQL_ROOT_PASSWORD: 'contrasenya_mestra_sql'&lt;br /&gt;
      MYSQL_RANDOM_ROOT_PASSWORD: 'no'&lt;br /&gt;
    volumes:&lt;br /&gt;
      - /home/jordi/bin/wikis/binefa_cat/database:/var/lib/mysql&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;net&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 volumes:&lt;br /&gt;
  certs:&lt;br /&gt;
  html:&lt;br /&gt;
  vhost:&lt;br /&gt;
  dhparam:&lt;br /&gt;
      &lt;br /&gt;
 networks:&lt;br /&gt;
  net:&lt;br /&gt;
    external: true&lt;br /&gt;
&lt;br /&gt;
= En marxa =&lt;br /&gt;
Assegureu-vos de no haver copiat l'arxiu '''.htaccess'''. Si el teniu, esborreu-lo o canvieu-li el nom.&lt;br /&gt;
&lt;br /&gt;
Des del directori a on hi ha l'arxiu docker-compose.yml (per exemple ~/bin/wikis/binefa_cat):&lt;br /&gt;
 docker-compose run --name wiki_binefa_cat -e VIRTUAL_HOST=&amp;quot;wiki2.things.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki2.things.cat&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
Un cop verificat el seu funcionament, per a migrar-lo a l'adreça definitiva:&lt;br /&gt;
 docker stop wiki_binefa_cat&lt;br /&gt;
 docker rm wiki_binefa_cat&lt;br /&gt;
&lt;br /&gt;
Editeu '''LocalSettings.php''' i modifiqueu la variable $wgServer per a que apunti al domini definitiu:&lt;br /&gt;
 $wgServer = &amp;quot;https://wiki.binefa.cat&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Torneu a executar el contenidor docker amb el nom de domini definitiu:&lt;br /&gt;
 docker-compose run --name wiki_binefa_cat -e VIRTUAL_HOST=&amp;quot;wiki.things.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki.things.cat&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Així mateix ho podeu fer amb la resta de dominis que tingueu compartits al VPS:&lt;br /&gt;
&lt;br /&gt;
Des del directori a on hi ha l'arxiu docker-compose.yml (per exemple ~/bin/wikis/things_cat):&lt;br /&gt;
 docker-compose run --name wiki_things_cat -e VIRTUAL_HOST=&amp;quot;wiki.things.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki.things.cat&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
Des del directori a on hi ha l'arxiu docker-compose.yml (per exemple ~/bin/wikis/binefa_com):&lt;br /&gt;
 docker-compose run --name wiki_binefa_com -e VIRTUAL_HOST=&amp;quot;wiki.binefa.com&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki.binefa.com&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
= docker-compose.yml de things.cat =&lt;br /&gt;
 ### Based on https://kindalame.com/2020/11/25/self-hosting-mediawiki-with-docker/&lt;br /&gt;
 ### Docker Compose Example for Kinda Lame&lt;br /&gt;
 ### Created October 2020&lt;br /&gt;
 ### Modified August 2021 by Jordi Binefa&lt;br /&gt;
 ###&lt;br /&gt;
 version: '3.3'&lt;br /&gt;
 services:&lt;br /&gt;
  web:&lt;br /&gt;
 #    image: mediawiki:lts # Es recomana la versió LTS per a wikis a partir de zero&lt;br /&gt;
    image: mediawiki:1.31.3 # Aquesta versió era l'original. Recomanen fer servir la mateixa per a la migració&lt;br /&gt;
    ports:&lt;br /&gt;
 ### We are running the server behind NGINX which we&lt;br /&gt;
 ### recommend all users doing. And due to the need to&lt;br /&gt;
 ### login to the site we recommend running Certbot&lt;br /&gt;
 ### on your domain and putting the proxy behind &lt;br /&gt;
 ### an SSL certificate to keep your passwords safe!&lt;br /&gt;
 ###&lt;br /&gt;
      - 80:80&lt;br /&gt;
      - 443:443&lt;br /&gt;
      - '''3307''':3306 # Es connecta amb la base de dades de sota mitjançant el port 3307. Això ens permet posar diferents bases de dades&lt;br /&gt;
    links:&lt;br /&gt;
      - database&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    volumes:&lt;br /&gt;
     - /home/jordi/bin/wikis/things_cat/www_things_cat_segur/images:/var/www/html/images&lt;br /&gt;
     - /home/jordi/bin/wikis/things_cat/www_things_cat_segur/LocalSettings.php:/var/www/html/LocalSettings.php&lt;br /&gt;
     - /home/jordi/bin/wikis/things_cat/www_things_cat_segur:/var/www/html&lt;br /&gt;
 #     - /home/jordi/bin/wikis/things_cat/php:/usr/local/etc/php&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;'''net'''&amp;quot;      &lt;br /&gt;
  database:&lt;br /&gt;
    container_name: things_cat_db_docker&lt;br /&gt;
    image: mysql:5.6.48&lt;br /&gt;
    ports:&lt;br /&gt;
      - '''3307''':3306  # Es connecta amb la wiki de dalt mitjançant el port 3307. Això ens permet posar diferents bases de dades&lt;br /&gt;
    environment:&lt;br /&gt;
      MYSQL_DATABASE: 'wiki_things_cat'&lt;br /&gt;
      MYSQL_USER: 'usuari_BD_things'&lt;br /&gt;
 #&lt;br /&gt;
 # Generate a secure password and place it in the area below&lt;br /&gt;
 #&lt;br /&gt;
      MYSQL_PASSWORD: 'contrasenya_BD_things'&lt;br /&gt;
      MYSQL_ROOT_PASSWORD: 'alguna'&lt;br /&gt;
      MYSQL_RANDOM_ROOT_PASSWORD: 'no'&lt;br /&gt;
    volumes:&lt;br /&gt;
      - /home/jordi/bin/wikis/things_cat/database:/var/lib/mysql&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;'''net'''&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 volumes:&lt;br /&gt;
  certs:&lt;br /&gt;
  html:&lt;br /&gt;
  vhost:&lt;br /&gt;
  dhparam:&lt;br /&gt;
      &lt;br /&gt;
 networks:&lt;br /&gt;
  '''net''':&lt;br /&gt;
    external: true&lt;br /&gt;
&lt;br /&gt;
= docker-compose.yml de binefa.com =&lt;br /&gt;
 ### Based on https://kindalame.com/2020/11/25/self-hosting-mediawiki-with-docker/&lt;br /&gt;
 ### Docker Compose Example for Kinda Lame&lt;br /&gt;
 ### Created October 2020&lt;br /&gt;
 ### Modified August 2021 by Jordi Binefa&lt;br /&gt;
 ###&lt;br /&gt;
 version: '3.3'&lt;br /&gt;
 services:&lt;br /&gt;
  web:&lt;br /&gt;
 ###&lt;br /&gt;
 ### We suggest using the LTS, long term support images&lt;br /&gt;
 ###&lt;br /&gt;
 #    image: mediawiki:lts # Es recomana la versió LTS per a wikis a partir de zero&lt;br /&gt;
    image: mediawiki:1.33.0 # Aquesta versió era l'original. Recomanen fer servir la mateixa per a la migració&lt;br /&gt;
    ports:&lt;br /&gt;
      - 80:80&lt;br /&gt;
      - 443:443&lt;br /&gt;
      - '''3308''':3306  # Es connecta amb la base de dades de sota mitjançant el port 3308. Això ens permet posar diferents bases de dades&lt;br /&gt;
    links:&lt;br /&gt;
      - database&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    volumes:&lt;br /&gt;
     - /home/jordi/bin/wikis/binefa_com/www_binefa_com/images:/var/www/html/images&lt;br /&gt;
     - /home/jordi/bin/wikis/binefa_com/www_binefa_com/LocalSettings.php:/var/www/html/LocalSettings.php&lt;br /&gt;
     - /home/jordi/bin/wikis/binefa_com/www_binefa_com:/var/www/html&lt;br /&gt;
 #     - /home/jordi/bin/wikis/binefa_com/php:/usr/local/etc/php&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;'''net'''&amp;quot;      &lt;br /&gt;
  database:&lt;br /&gt;
    container_name: binefa_com_db_docker&lt;br /&gt;
    image: mysql:5.6.48&lt;br /&gt;
    ports:&lt;br /&gt;
      - '''3308''':3306  # Es connecta amb la wiki de dalt mitjançant el port 3308. Això ens permet posar diferents bases de dades&lt;br /&gt;
    environment:&lt;br /&gt;
      MYSQL_DATABASE: 'wiki_binefa_com'&lt;br /&gt;
      MYSQL_USER: 'usuari_BD_binefa_com'&lt;br /&gt;
 #&lt;br /&gt;
 # Generate a secure password and place it in the area below&lt;br /&gt;
 #&lt;br /&gt;
      MYSQL_PASSWORD: 'contrasenya_BD_binefa_com'&lt;br /&gt;
      MYSQL_ROOT_PASSWORD: 'algunaAltra'&lt;br /&gt;
      MYSQL_RANDOM_ROOT_PASSWORD: 'no'&lt;br /&gt;
    volumes:&lt;br /&gt;
      - /home/jordi/bin/wikis/binefa_com/database:/var/lib/mysql&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;'''net'''&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 volumes:&lt;br /&gt;
  certs:&lt;br /&gt;
  html:&lt;br /&gt;
  vhost:&lt;br /&gt;
  dhparam:&lt;br /&gt;
      &lt;br /&gt;
 networks:&lt;br /&gt;
  '''net''':&lt;br /&gt;
    external: true&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=Migraci%C3%B3_d%27una_wiki_a_una_altra_dockeritzada&amp;diff=47491</id>
		<title>Migració d'una wiki a una altra dockeritzada</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=Migraci%C3%B3_d%27una_wiki_a_una_altra_dockeritzada&amp;diff=47491"/>
		<updated>2024-09-28T20:16:18Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Connexió amb la base de dades */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Còpia de la wiki original =&lt;br /&gt;
La migració explicada a aquesta pàgina és per a poder integrar una wiki preexistent darrere un [[Servidor intermediari invers]].&lt;br /&gt;
&lt;br /&gt;
* Feu una còpia de la base de dades de la wiki (en aquesta explicació serà ''wiki_binefa_cat.sql''). Si no us recordeu dels paràmetres, feu-li un cop d'ull a l'arxiu '''LocalSettings.php''' present al directori arrel de la wiki.&lt;br /&gt;
&lt;br /&gt;
* Feu una còpia del directori arrel de la wiki&lt;br /&gt;
&lt;br /&gt;
= Prova del contenidor docker a migrar =&lt;br /&gt;
Es cerca la versió actual del wiki en funcionament a l'enllaç &amp;quot;[https://wiki.binefa.cat/index.php?title=Especial:P%C3%A0gines_especials Pàgines especials]&amp;quot; / &amp;quot;[https://wiki.binefa.cat/index.php?title=Especial:Versi%C3%B3 Versió]&amp;quot;. En el cas d'aquest exemple és la versió 1.29.0&lt;br /&gt;
&lt;br /&gt;
Es prova el funcionament, sense volums associats ni base de dades, a un domini secundari de prova (Aquest domini ha d'estar configurat a la configuració DNS del nostre proveïdor de nom de domini):&lt;br /&gt;
 docker run --name wiki_binefa_cat --network net -e VIRTUAL_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -d mediawiki:1.29.0&lt;br /&gt;
Un cop provat que funciona el servei web de la mediawiki, es desactiva el servei:&lt;br /&gt;
 docker stop wiki_binefa_cat&lt;br /&gt;
 docker rm wiki_binefa_cat&lt;br /&gt;
&lt;br /&gt;
= Connexió amb la base de dades =&lt;br /&gt;
Per tal de poder fer servir més d'una base de dades al nostre sistema dockeritzat, es canvia el port normal de funcionament a les bases de dades SQL, el 3306, per un altre exclusiu per al servei de cada wiki, en aquest cas és el 3309.&lt;br /&gt;
&lt;br /&gt;
També es comenten els volums relacionats amb el contingut html de la wiki a migrar i de l'arxiu LocalSettings.php&lt;br /&gt;
&lt;br /&gt;
Al mateix directori a on és [https://www.things.cat/index.php/Migraci%C3%B3_d%27una_wiki_a_una_altra_dockeritzada#Arxiu_docker-compose.yml_per_a_la_primera_connexi.C3.B3_amb_la_base_de_dades docker-compose.yml] executem el contenidor docker:&lt;br /&gt;
 docker-compose run --name wiki_binefa_cat -e VIRTUAL_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
Es verifica la correcta execució del contenidor docker:&lt;br /&gt;
 jordi@vps-wiki:~/bin/wikis/binefa_cat$ '''docker ps -a'''&lt;br /&gt;
 CONTAINER ID   IMAGE             COMMAND                  CREATED          STATUS         PORTS                                      NAMES&lt;br /&gt;
 03e0b6d10eda   mediawiki:1.29.0  &amp;quot;docker-php-entrypoi…&amp;quot;   11 minutes ago   Up 11 minutes  80/tcp                                     wiki_binefa_cat&lt;br /&gt;
 6944309dd20a   mysql:5.6.48      &amp;quot;docker-entrypoint.s…&amp;quot;   14 minutes ago   Up 14 minutes  0.0.0.0:3309-&amp;gt;3306/tcp, :::3309-&amp;gt;3306/tcp  binefa_cat_db_docker&lt;br /&gt;
&lt;br /&gt;
Es consulta l'adreça IP del contenidor de la base de dades dins de la xarxa local de contenidors (necessari per a la configuració de la mediawiki per la generació de l'arxiu LocalSettings.php):&lt;br /&gt;
 &amp;lt;pre&amp;gt;jordi@vps-wiki:~/bin/wikis/binefa_cat$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' binefa_cat_db_docker&lt;br /&gt;
172.18.0.11&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Aneu al navegador d'Internet i aneu a la pàgina de la wiki (en aquest exemple seria https://wiki2.binefa.cat). Si tot va bé, hi surt:&lt;br /&gt;
 MediaWiki 1.29.0&lt;br /&gt;
 LocalSettings.php not found.&lt;br /&gt;
 Please set up the wiki first.&lt;br /&gt;
&lt;br /&gt;
Premeu a sobre de ''Please set up the wiki first''. La primera pàgina és ''Instal·lació del MediaWiki 1.29.0''. Seleccioneu la vostra llengua i la llengua de la wiki. A les dues he seleccionat ''ca - català''.&lt;br /&gt;
&lt;br /&gt;
Després de prémer el botó per a continuar, i si tot ha anat bé, hi surt una pàgina amb aquest text de color verd: ''S'ha comprovat l'entorn. Podeu instal·lar el MediaWiki''.&lt;br /&gt;
&lt;br /&gt;
La següent pàgina és la de connexió a la base de dades. Per a saber quines dades posar, feu-li una ullada al vostre arxiu LocalSettings.php original. En aquest exemple fem servir aquests valors:&lt;br /&gt;
 $wgDBtype = &amp;quot;mysql&amp;quot;;&lt;br /&gt;
 $wgDBserver = &amp;quot;'''172.18.0.11'''&amp;quot;;&lt;br /&gt;
 $wgDBname = &amp;quot;nom_base_de_dades_sql&amp;quot;;&lt;br /&gt;
 $wgDBuser = &amp;quot;usuari_sql&amp;quot;;&lt;br /&gt;
 $wgDBpassword = &amp;quot;contrasenya_usuari_sql&amp;quot;;&lt;br /&gt;
 $wgDBprefix = &amp;quot;wiki_bc&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Per defecte hi surt que el tipus és ''MySQL (o compatible)'', i així ha de ser. Al ''Servidor de la base de dades'' hi surt ''localhost'' per defecte i '''ho heu de canviar per la IP del contenidor de la base de dades dins de la xarxa local de contenidors''' (en aquest exemple és 172.18.0.11). Poseu-hi el nom de la base de dades (''nom_base_de_dades_sql''), el prefix de la base de dades (''wiki_bc''). Per a aquest configuració inicial fem servir com a nom de l'usuari de la base de dades ''usuari_sql'' i com a contrasenya ''contrasenya_usuari_sql''.&lt;br /&gt;
&lt;br /&gt;
La pàgina següent mostra aquestes seleccions per defecte (no les modifiqueu): Compte de la base de dades per a l'accés web ''Utilitza el mateix compte que a la instal·lació'', Motor d'emmagatzemament ''InnoDB'' i Joc de caràcters de la base de dades ''binari''.&lt;br /&gt;
&lt;br /&gt;
La pàgina següent us pregunta pel nom de la wiki, el vostre nom d'usuari, contrasenya i correu electrònic. Seleccioneu Fes-me més preguntes, que ja hi és per defecte.&lt;br /&gt;
&lt;br /&gt;
La pàgina següent es sobre permisos. He seleccionat a Perfil de permisos d'usuari: Només editors autoritzats, Copyright i llicència: Creative Commons Reconeixement-CompartirIgual. A Paràmetres del correu electrònic he desactivat els correus sortints. A Extensions he seleccionat ImageMap, Interwiki, Nuke i WikiEditor. A Imatges i càrregues de fitxers he habilitat Habilita la càrrega de fitxers. La resta d'opcions no les he canviat del seu estat per defecte.&lt;br /&gt;
&lt;br /&gt;
Després de continuar les dues següents pàgines informatives ens demana desar l'arxiu '''LocalSettings.php''' (és molt important desar-lo per poder continuar el següent pas).&lt;br /&gt;
&lt;br /&gt;
== Arxiu docker-compose.yml per a la primera connexió amb la base de dades ==&lt;br /&gt;
 ### Based on https://kindalame.com/2020/11/25/self-hosting-mediawiki-with-docker/&lt;br /&gt;
 ### Docker Compose Example for Kinda Lame&lt;br /&gt;
 ### Created October 2020&lt;br /&gt;
 ### Modified August 2021 by Jordi Binefa&lt;br /&gt;
 ###&lt;br /&gt;
 version: '3.3'&lt;br /&gt;
 services:&lt;br /&gt;
  web:&lt;br /&gt;
 ###&lt;br /&gt;
 ### We suggest using the LTS, long term support images&lt;br /&gt;
 ###&lt;br /&gt;
    image: mediawiki:1.29.0&lt;br /&gt;
    ports:&lt;br /&gt;
      - 80:80&lt;br /&gt;
      - 443:443&lt;br /&gt;
      - '''3309''':3306&lt;br /&gt;
    links:&lt;br /&gt;
      - database&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    volumes:&lt;br /&gt;
     - /home/jordi/bin/wikis/binefa_cat/wikibinefacat/images:/var/www/html/images&lt;br /&gt;
 '''#     - /home/jordi/bin/wikis/binefa_cat/wikibinefacat/LocalSettings.php:/var/www/html/LocalSettings.php'''&lt;br /&gt;
 '''#     - /home/jordi/bin/wikis/binefa_cat/wikibinefacat:/var/www/html'''&lt;br /&gt;
 '''#     - /home/jordi/bin/wikis/binefa_cat/php:/usr/local/etc/php'''&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;net&amp;quot;      &lt;br /&gt;
  database:&lt;br /&gt;
    container_name: binefa_cat_db_docker&lt;br /&gt;
    image: mysql:5.6.48&lt;br /&gt;
    ports:&lt;br /&gt;
      - '''3309''':3306&lt;br /&gt;
    environment:&lt;br /&gt;
      MYSQL_DATABASE: 'nom_base_de_dades_sql'&lt;br /&gt;
      MYSQL_USER: 'usuari_sql'&lt;br /&gt;
 #&lt;br /&gt;
 # Generate a secure password and place it in the area below&lt;br /&gt;
 #&lt;br /&gt;
      MYSQL_PASSWORD: 'contrasenya_usuari_sql'&lt;br /&gt;
      MYSQL_ROOT_PASSWORD: 'contrasenya_mestra_sql'&lt;br /&gt;
      MYSQL_RANDOM_ROOT_PASSWORD: 'no'&lt;br /&gt;
    volumes:&lt;br /&gt;
      - /home/jordi/bin/wikis/binefa_cat/database:/var/lib/mysql&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;net&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 volumes:&lt;br /&gt;
  certs:&lt;br /&gt;
  html:&lt;br /&gt;
  vhost:&lt;br /&gt;
  dhparam:&lt;br /&gt;
      &lt;br /&gt;
 networks:&lt;br /&gt;
  net:&lt;br /&gt;
    external: true&lt;br /&gt;
&lt;br /&gt;
= Recàrrega de la base de dades =&lt;br /&gt;
Atureu el contenidor docker de la wiki, però no el de la base de dades:&lt;br /&gt;
 docker stop rm_binefa_cat&lt;br /&gt;
 docker rm wiki_binefa_cat&lt;br /&gt;
&lt;br /&gt;
 jordi@vps-wikie:~/bin/wikis/binefa_cat$ docker exec -i binefa_cat_db_docker mysql -u jordi -pfuroner2017 wiki_binefa_cat &amp;lt; wiki_binefa_cat.sql&lt;br /&gt;
 Warning: Using a password on the command line interface can be insecure.&lt;br /&gt;
 '''ERROR 1050 (42S01) at line 30: Table 'wiki_bcarchive' already exists'''&lt;br /&gt;
&lt;br /&gt;
Per a evitar aquest error:&lt;br /&gt;
 jordi@vps-wiki:~/bin/wikis/binefa_cat$ docker exec -it binefa_cat_db_docker bash -l&lt;br /&gt;
 root@6944309dd20a:/# mysql -u ''usuari_sql'' -p&lt;br /&gt;
 Enter password: ''contrasenya_usuari_sql''&lt;br /&gt;
 mysql&amp;gt; show databases;&lt;br /&gt;
 +--------------------+&lt;br /&gt;
 | Database           |&lt;br /&gt;
 +--------------------+&lt;br /&gt;
 | information_schema |&lt;br /&gt;
 | wiki_binefa_cat    |&lt;br /&gt;
 +--------------------+&lt;br /&gt;
 2 rows in set (0.00 sec)&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt; drop database wiki_binefa_cat;&lt;br /&gt;
 Query OK, 48 rows affected (0.09 sec)&lt;br /&gt;
 mysql&amp;gt; create database wiki_binefa_cat;&lt;br /&gt;
 Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
 &lt;br /&gt;
 mysql&amp;gt; quit&lt;br /&gt;
 Bye&lt;br /&gt;
 root@6944309dd20a:/# exit&lt;br /&gt;
 logout&lt;br /&gt;
 jordi@vps-7d867fbd:~/bin/wikis/binefa_cat$ docker exec -i binefa_cat_db_docker mysql -u jordi -pfuroner2017 wiki_binefa_cat &amp;lt; wiki_binefa_cat.sql&lt;br /&gt;
 Warning: Using a password on the command line interface can be insecure.&lt;br /&gt;
&lt;br /&gt;
Copieu '''LocalSettings.php''' a la carpeta indicada als volums de l'arxiu docker-compose.yml (a l'exemple /home/jordi/bin/wikis/binefa_cat/wikibinefacat). Verifiqueu que hi consta l'adreça final real de la wiki:&lt;br /&gt;
 $wgServer = &amp;quot;https://wiki2.binefa.cat&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Torneu a executar el contenidor:&lt;br /&gt;
 docker-compose run --name wiki_binefa_cat -e VIRTUAL_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki2.binefa.cat&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
== Arxiu docker-compose.yml per a la connexió amb la base de dades actualitzada ==&lt;br /&gt;
 ### Based on https://kindalame.com/2020/11/25/self-hosting-mediawiki-with-docker/&lt;br /&gt;
 ### Docker Compose Example for Kinda Lame&lt;br /&gt;
 ### Created October 2020&lt;br /&gt;
 ### Modified August 2021 by Jordi Binefa&lt;br /&gt;
 ###&lt;br /&gt;
 version: '3.3'&lt;br /&gt;
 services:&lt;br /&gt;
  web:&lt;br /&gt;
 ###&lt;br /&gt;
 ### We suggest using the LTS, long term support images&lt;br /&gt;
 ###&lt;br /&gt;
    image: mediawiki:1.29.0&lt;br /&gt;
    ports:&lt;br /&gt;
      - 80:80&lt;br /&gt;
      - 443:443&lt;br /&gt;
      - 3309:3306&lt;br /&gt;
    links:&lt;br /&gt;
      - database&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    volumes:&lt;br /&gt;
     - /home/jordi/bin/wikis/binefa_cat/wikibinefacat/images:/var/www/html/images&lt;br /&gt;
     '''- /home/jordi/bin/wikis/binefa_cat/wikibinefacat/LocalSettings.php:/var/www/html/LocalSettings.php'''&lt;br /&gt;
     '''- /home/jordi/bin/wikis/binefa_cat/wikibinefacat:/var/www/html'''&lt;br /&gt;
 #     - /home/jordi/bin/wikis/binefa_cat/php:/usr/local/etc/php&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;net&amp;quot;      &lt;br /&gt;
  database:&lt;br /&gt;
    container_name: binefa_cat_db_docker&lt;br /&gt;
    image: mysql:5.6.48&lt;br /&gt;
    ports:&lt;br /&gt;
      - '''3309''':3306&lt;br /&gt;
    environment:&lt;br /&gt;
      MYSQL_DATABASE: 'nom_base_de_dades_sql'&lt;br /&gt;
      MYSQL_USER: 'usuari_sql'&lt;br /&gt;
 #&lt;br /&gt;
 # Generate a secure password and place it in the area below&lt;br /&gt;
 #&lt;br /&gt;
      MYSQL_PASSWORD: 'contrasenya_usuari_sql'&lt;br /&gt;
      MYSQL_ROOT_PASSWORD: 'contrasenya_mestra_sql'&lt;br /&gt;
      MYSQL_RANDOM_ROOT_PASSWORD: 'no'&lt;br /&gt;
    volumes:&lt;br /&gt;
      - /home/jordi/bin/wikis/binefa_cat/database:/var/lib/mysql&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;net&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 volumes:&lt;br /&gt;
  certs:&lt;br /&gt;
  html:&lt;br /&gt;
  vhost:&lt;br /&gt;
  dhparam:&lt;br /&gt;
      &lt;br /&gt;
 networks:&lt;br /&gt;
  net:&lt;br /&gt;
    external: true&lt;br /&gt;
&lt;br /&gt;
= En marxa =&lt;br /&gt;
Assegureu-vos de no haver copiat l'arxiu '''.htaccess'''. Si el teniu, esborreu-lo o canvieu-li el nom.&lt;br /&gt;
&lt;br /&gt;
Des del directori a on hi ha l'arxiu docker-compose.yml (per exemple ~/bin/wikis/binefa_cat):&lt;br /&gt;
 docker-compose run --name wiki_binefa_cat -e VIRTUAL_HOST=&amp;quot;wiki2.things.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki2.things.cat&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
Un cop verificat el seu funcionament, per a migrar-lo a l'adreça definitiva:&lt;br /&gt;
 docker stop wiki_binefa_cat&lt;br /&gt;
 docker rm wiki_binefa_cat&lt;br /&gt;
&lt;br /&gt;
Editeu '''LocalSettings.php''' i modifiqueu la variable $wgServer per a que apunti al domini definitiu:&lt;br /&gt;
 $wgServer = &amp;quot;https://wiki.binefa.cat&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Torneu a executar el contenidor docker amb el nom de domini definitiu:&lt;br /&gt;
 docker-compose run --name wiki_binefa_cat -e VIRTUAL_HOST=&amp;quot;wiki.things.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki.things.cat&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Així mateix ho podeu fer amb la resta de dominis que tingueu compartits al VPS:&lt;br /&gt;
&lt;br /&gt;
Des del directori a on hi ha l'arxiu docker-compose.yml (per exemple ~/bin/wikis/things_cat):&lt;br /&gt;
 docker-compose run --name wiki_things_cat -e VIRTUAL_HOST=&amp;quot;wiki.things.cat&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki.things.cat&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
Des del directori a on hi ha l'arxiu docker-compose.yml (per exemple ~/bin/wikis/binefa_com):&lt;br /&gt;
 docker-compose run --name wiki_binefa_com -e VIRTUAL_HOST=&amp;quot;wiki.binefa.com&amp;quot; -e LETSENCRYPT_HOST=&amp;quot;wiki.binefa.com&amp;quot; -d web&lt;br /&gt;
&lt;br /&gt;
= docker-compose.yml de things.cat =&lt;br /&gt;
 ### Based on https://kindalame.com/2020/11/25/self-hosting-mediawiki-with-docker/&lt;br /&gt;
 ### Docker Compose Example for Kinda Lame&lt;br /&gt;
 ### Created October 2020&lt;br /&gt;
 ### Modified August 2021 by Jordi Binefa&lt;br /&gt;
 ###&lt;br /&gt;
 version: '3.3'&lt;br /&gt;
 services:&lt;br /&gt;
  web:&lt;br /&gt;
 #    image: mediawiki:lts # Es recomana la versió LTS per a wikis a partir de zero&lt;br /&gt;
    image: mediawiki:1.31.3 # Aquesta versió era l'original. Recomanen fer servir la mateixa per a la migració&lt;br /&gt;
    ports:&lt;br /&gt;
 ### We are running the server behind NGINX which we&lt;br /&gt;
 ### recommend all users doing. And due to the need to&lt;br /&gt;
 ### login to the site we recommend running Certbot&lt;br /&gt;
 ### on your domain and putting the proxy behind &lt;br /&gt;
 ### an SSL certificate to keep your passwords safe!&lt;br /&gt;
 ###&lt;br /&gt;
      - 80:80&lt;br /&gt;
      - 443:443&lt;br /&gt;
      - '''3307''':3306 # Es connecta amb la base de dades de sota mitjançant el port 3307. Això ens permet posar diferents bases de dades&lt;br /&gt;
    links:&lt;br /&gt;
      - database&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    volumes:&lt;br /&gt;
     - /home/jordi/bin/wikis/things_cat/www_things_cat_segur/images:/var/www/html/images&lt;br /&gt;
     - /home/jordi/bin/wikis/things_cat/www_things_cat_segur/LocalSettings.php:/var/www/html/LocalSettings.php&lt;br /&gt;
     - /home/jordi/bin/wikis/things_cat/www_things_cat_segur:/var/www/html&lt;br /&gt;
 #     - /home/jordi/bin/wikis/things_cat/php:/usr/local/etc/php&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;'''net'''&amp;quot;      &lt;br /&gt;
  database:&lt;br /&gt;
    container_name: things_cat_db_docker&lt;br /&gt;
    image: mysql:5.6.48&lt;br /&gt;
    ports:&lt;br /&gt;
      - '''3307''':3306  # Es connecta amb la wiki de dalt mitjançant el port 3307. Això ens permet posar diferents bases de dades&lt;br /&gt;
    environment:&lt;br /&gt;
      MYSQL_DATABASE: 'wiki_things_cat'&lt;br /&gt;
      MYSQL_USER: 'usuari_BD_things'&lt;br /&gt;
 #&lt;br /&gt;
 # Generate a secure password and place it in the area below&lt;br /&gt;
 #&lt;br /&gt;
      MYSQL_PASSWORD: 'contrasenya_BD_things'&lt;br /&gt;
      MYSQL_ROOT_PASSWORD: 'alguna'&lt;br /&gt;
      MYSQL_RANDOM_ROOT_PASSWORD: 'no'&lt;br /&gt;
    volumes:&lt;br /&gt;
      - /home/jordi/bin/wikis/things_cat/database:/var/lib/mysql&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;'''net'''&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 volumes:&lt;br /&gt;
  certs:&lt;br /&gt;
  html:&lt;br /&gt;
  vhost:&lt;br /&gt;
  dhparam:&lt;br /&gt;
      &lt;br /&gt;
 networks:&lt;br /&gt;
  '''net''':&lt;br /&gt;
    external: true&lt;br /&gt;
&lt;br /&gt;
= docker-compose.yml de binefa.com =&lt;br /&gt;
 ### Based on https://kindalame.com/2020/11/25/self-hosting-mediawiki-with-docker/&lt;br /&gt;
 ### Docker Compose Example for Kinda Lame&lt;br /&gt;
 ### Created October 2020&lt;br /&gt;
 ### Modified August 2021 by Jordi Binefa&lt;br /&gt;
 ###&lt;br /&gt;
 version: '3.3'&lt;br /&gt;
 services:&lt;br /&gt;
  web:&lt;br /&gt;
 ###&lt;br /&gt;
 ### We suggest using the LTS, long term support images&lt;br /&gt;
 ###&lt;br /&gt;
 #    image: mediawiki:lts # Es recomana la versió LTS per a wikis a partir de zero&lt;br /&gt;
    image: mediawiki:1.33.0 # Aquesta versió era l'original. Recomanen fer servir la mateixa per a la migració&lt;br /&gt;
    ports:&lt;br /&gt;
      - 80:80&lt;br /&gt;
      - 443:443&lt;br /&gt;
      - '''3308''':3306  # Es connecta amb la base de dades de sota mitjançant el port 3308. Això ens permet posar diferents bases de dades&lt;br /&gt;
    links:&lt;br /&gt;
      - database&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    volumes:&lt;br /&gt;
     - /home/jordi/bin/wikis/binefa_com/www_binefa_com/images:/var/www/html/images&lt;br /&gt;
     - /home/jordi/bin/wikis/binefa_com/www_binefa_com/LocalSettings.php:/var/www/html/LocalSettings.php&lt;br /&gt;
     - /home/jordi/bin/wikis/binefa_com/www_binefa_com:/var/www/html&lt;br /&gt;
 #     - /home/jordi/bin/wikis/binefa_com/php:/usr/local/etc/php&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;'''net'''&amp;quot;      &lt;br /&gt;
  database:&lt;br /&gt;
    container_name: binefa_com_db_docker&lt;br /&gt;
    image: mysql:5.6.48&lt;br /&gt;
    ports:&lt;br /&gt;
      - '''3308''':3306  # Es connecta amb la wiki de dalt mitjançant el port 3308. Això ens permet posar diferents bases de dades&lt;br /&gt;
    environment:&lt;br /&gt;
      MYSQL_DATABASE: 'wiki_binefa_com'&lt;br /&gt;
      MYSQL_USER: 'usuari_BD_binefa_com'&lt;br /&gt;
 #&lt;br /&gt;
 # Generate a secure password and place it in the area below&lt;br /&gt;
 #&lt;br /&gt;
      MYSQL_PASSWORD: 'contrasenya_BD_binefa_com'&lt;br /&gt;
      MYSQL_ROOT_PASSWORD: 'algunaAltra'&lt;br /&gt;
      MYSQL_RANDOM_ROOT_PASSWORD: 'no'&lt;br /&gt;
    volumes:&lt;br /&gt;
      - /home/jordi/bin/wikis/binefa_com/database:/var/lib/mysql&lt;br /&gt;
    restart: unless-stopped&lt;br /&gt;
    networks: &lt;br /&gt;
      - &amp;quot;'''net'''&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 volumes:&lt;br /&gt;
  certs:&lt;br /&gt;
  html:&lt;br /&gt;
  vhost:&lt;br /&gt;
  dhparam:&lt;br /&gt;
      &lt;br /&gt;
 networks:&lt;br /&gt;
  '''net''':&lt;br /&gt;
    external: true&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47472</id>
		<title>Pàgina principal</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=P%C3%A0gina_principal&amp;diff=47472"/>
		<updated>2024-08-07T17:02:16Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Raspbian */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size:500%&amp;quot;&amp;gt;things.cat&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:300%&amp;quot;&amp;gt;Una pàgina pràctica sobre la Internet de les Coses&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Dispositius IoT. Maquinari i microprogramari =&lt;br /&gt;
Al '''maquinari''' li diem'' '''hardware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
Al '''microprogramari''' li diem'' '''firmware''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
'''IoT''' és l'acrònim d'''Internet of Things''. En català abreujat li podríem dir '''IdC''' per a referir-nos a '''la Internet de les Coses'''. En el moment d'escriure aquest text, la comunitat catalanoparlant sembla haver optat per referir-se als '''dispositius de la Internet de les Coses''' com a '''dispositius IoT'''. Si el [https://www.termcat.cat/ca/neoloteca/ termcat] es pronuncia de manera diferent, provaré d'adaptar la terminologia.&lt;br /&gt;
&lt;br /&gt;
== Placa IoT-02 ==&lt;br /&gt;
[https://www.binefa.com/index.php/Placa_IoT-02 Placa_IoT-02]&lt;br /&gt;
&lt;br /&gt;
== Controladors ==&lt;br /&gt;
Als '''controladors''' els hi diem'' '''drivers''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
El xip '''FT232''' ha estat durant molt de temps el xip més comú per convertir d''''USB a UART'''. Fins al punt que se'n van fer còpies pirates. Una actualització del sistema operatiu privatiu Windows va explotar una característica dels xips pirates: els xips pirates tenien el registre d'identificació USB de lectura i escriptura i l'original era tan sols de lectura. L'actualització que va fer Windows provocava l'escriptura d'aquest registre i hi escrivia un zero, que feia que el sistema operatiu ho identifiqués com a concentrador USB i no com a controlador d'UART, fent que el maquinari quedés inservible. A l'any 2014 em vaig veure atrapat amb uns quants Arduino Nano que duien aquest xip pirata i vaig escriure [https://binefa.cat/blog/?p=80 How to recover bricked fake FT232] per a poder-los reprogramar i poder-los fer servir amb sistemes operatius lliures GNU/Linux.&lt;br /&gt;
&lt;br /&gt;
A partir d'aquell moment, bona part de les plaques de fabricació xinesa van començar a dur, massivament, el xip '''CH340''' per a convertir d'USB a UART.&lt;br /&gt;
&lt;br /&gt;
[[Controlador CH340]]&lt;br /&gt;
&lt;br /&gt;
[[Controlador FT232]]&lt;br /&gt;
&lt;br /&gt;
== C / C++ ==&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-libraries Biblioteques per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes Codis per Arduino, ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
=== ESP8266 ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Afegint_la_targeta_ESP8266_a_l%27IDE_d%27Arduino Afegint la targeta ESP8266 a l'IDE d'Arduino] (NodeMCU1.0)&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp8266_udpServer_01b esp8266_udpServer_01.ino] Codi UDP per a ESP8266&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_a_l%27ESP8266 MQTT a l'ESP8266]&lt;br /&gt;
&lt;br /&gt;
=== ESP32 ===&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_udpServer_01b esp32_udpServer_01b] Codi UDP per a ESP32&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/arduino-IDE-codes/tree/master/esp32_i2cScanner_02 esp32_i2cScanner_02.ino Adreces de dispositius I2C connectats]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/modbus/rtu/esp32/ Exemple de ModBus RTU fent servir NodeRED i ESP32 (amb la placa IoT PLB)]&lt;br /&gt;
&lt;br /&gt;
[https://techtutorialsx.com/2017/05/06/esp32-arduino-creating-a-task/ ESP32 Arduino: Creating a FreeRTOS task]&lt;br /&gt;
&lt;br /&gt;
[https://savjee.be/2020/01/multitasking-esp32-arduino-freertos/ Multitasking on ESP32 with Arduino and FreeRTOS]&lt;br /&gt;
&lt;br /&gt;
==== Modbus ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#overview-of-rs485-specific-communication-options Overview of RS485 specific communication options]&lt;br /&gt;
&lt;br /&gt;
[https://pastebin.com/2PtWJvd6 Example setting RS485 at half duplex mode]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/jordibinefa/IoT-02/tree/master/codes/IoT-02_11_modbus_bme280_02 Code IoT-02_11_modbus_bme280_02] using RS485 at half duplex mode&lt;br /&gt;
&lt;br /&gt;
==== ESP-IDF ====&lt;br /&gt;
[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ Get Started]&lt;br /&gt;
&lt;br /&gt;
[https://docs.platformio.org/en/latest/tutorials/espressif32/espidf_debugging_unit_testing_analysis.html Get started with ESP-IDF and ESP32-DevKitC: debugging, unit testing, project analysis]&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
=== Accés al maquinari de la Raspberry Pi emprant Python ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Com_connectar-hi_pantalles_OLED_SSD1306_(128x64) Com connectar-hi pantalles OLED SSD1306 (128x64)]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=%C3%9As_d%27entrades_anal%C3%B2giques_amb_l%27ADS115_controlant_sortides_PWM Ús d'entrades analògiques amb l'ADS115 controlant sortides PWM]&lt;br /&gt;
&lt;br /&gt;
=== Micropython ===&lt;br /&gt;
[https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome Micropython and the Internet of Things]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp8266 MicroPython port to ESP8266]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython/tree/master/ports/esp32 MicroPython port to the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://icircuit.net/esp32-micropython-getting-started/1999 ESP32 – Getting started with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-on-the-esp32-decdd32c4720 Get on the Good Foot with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://hackernoon.com/get-on-the-good-foot-with-micropython-part-2-e1f2efaad50b Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor DS18B20 (One Wire Interface)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/gloveboxes/ESP32-MicroPython-BME280-MQTT-Sample Exemple en micropython de comunicació MQTT amb un ESP32 i el sensor BME280 (I2C)]&lt;br /&gt;
&lt;br /&gt;
=== CircuitPython ===&lt;br /&gt;
[https://learn.adafruit.com/circuitpython-with-esp32-quick-start CircuitPython on ESP32 Quick Start]&lt;br /&gt;
&lt;br /&gt;
== Sistemes operatius encastats ==&lt;br /&gt;
=== Raspbian ===&lt;br /&gt;
[https://www.raspberrypi.org/documentation/computers/remote-access.html Remote Access]&lt;br /&gt;
&lt;br /&gt;
[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ How to Install Mosquitto Broker on Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Adaptaci%C3%B3_per_a_que_la_Raspberry_Pi_funcioni_com_a_punt_d%27acc%C3%A9s_donant_adreces_IP_de_classe_B Adaptació per a que la Raspberry Pi funcioni com a punt d'accés donant adreces IP de classe B]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_dels_nodes_node-red-contrib-ttn_i_node-red-contrib-modbustcp-no-pooling_a_la_Raspberry_Pi Instal·lació dels nodes node-red-contrib-ttn i node-red-contrib-modbustcp-no-pooling a la Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Instal%C2%B7laci%C3%B3_de_l%27OPC-UA_a_la_Raspberry_Pi,_fent_servir_Python,_i_control_des_d%27Indusoft Instal·lació de l'OPC-UA a la Raspberry Pi, fent servir Python, i control des d'Indusoft]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Pr%C3%A0ctica_de_connexi%C3%B3_remota_a_una_Raspberry_Pi Pràctica de connexió remota a una Raspberry Pi]&lt;br /&gt;
&lt;br /&gt;
[https://core-electronics.com.au/guides/read-only-raspberry-pi/ Read-Only Raspberry Pi - Never Corrupt your Micro-SD Card]&lt;br /&gt;
&lt;br /&gt;
=== Mongoose OS ===&lt;br /&gt;
[https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md Guia ràpida d'introducció a Mongoose OS][en]&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
[[Sensors de so]]&lt;br /&gt;
&lt;br /&gt;
= Control remot dels dispositius IoT. Programari =&lt;br /&gt;
Al '''programari''' li diuen'' '''software''' ''en anglès.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
[https://binefa.cat/IoT/teoria/ethernetTcpUdp_00.pdf TCP/UDP Capa de transport d'Ethernet]&lt;br /&gt;
&lt;br /&gt;
[[Instal·lació d'un servidor de sòcols web a un Debian amb Apache]]&lt;br /&gt;
&lt;br /&gt;
=== MQTT(S) ===&lt;br /&gt;
[https://binefa.cat/IoT/teoria/mqtt_00.pdf Introducció a MQTT]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt/ Beginners Guide To The MQTT Protocol] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[https://www.rs-online.com/designspark/mqtt MQTT] explained by Andy Stanford-Clark (co-inventor of MQTT). Article written in 2017, and refering to v3.1.1&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/mqtt-5/ MQTT 5 Essentials] by HiveMQ&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/mqtt-hosting-brokers-and-servers/ MQTT Brokers/Servers and Cloud Hosting Guide] by Steve's Internet Guide&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer] An all-round MQTT client that provides a structured topic overview&lt;br /&gt;
&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT a Snap!]&lt;br /&gt;
&lt;br /&gt;
==== Public MQTT(S) brokers ====&lt;br /&gt;
[http://test.mosquitto.org/ mosquitto]&lt;br /&gt;
&lt;br /&gt;
[https://www.hivemq.com/public-mqtt-broker/ HiveMQ MQTT broker]&lt;br /&gt;
&lt;br /&gt;
[https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/ MQTT brokers online with a free offer to test and connect IoT to the internet]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) implementations ====&lt;br /&gt;
[http://binefa.com/index.php?title=MQTTS_y_NodeRED MQTTS y NodeRED]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations Comparison of MQTT implementations]&lt;br /&gt;
&lt;br /&gt;
[http://test.mosquitto.org/ test.mosquitto.org]&lt;br /&gt;
&lt;br /&gt;
[https://www.emqx.io/ emqx.io]&lt;br /&gt;
&lt;br /&gt;
[https://vernemq.com/ VerneMQ]&lt;br /&gt;
&lt;br /&gt;
=== Webhooks ===&lt;br /&gt;
[https://hookdeck.com/guides/webhooks/what-are-webhooks-how-they-work What Are Webhooks And How They Work]&lt;br /&gt;
&lt;br /&gt;
[[Exemple bàsic de funcionament de Webhooks. Servidor i client en node.js]]&lt;br /&gt;
&lt;br /&gt;
== Programació local (ordinadors d'escriptori i dispositius mòbils) ==&lt;br /&gt;
[https://binefa.cat/IoT/mqtt/MQTT_Dash/ Configuració de MQTT Dash (aplicació per Android)]&lt;br /&gt;
&lt;br /&gt;
=== Mosquitto local a l'ordinador ===&lt;br /&gt;
[https://www.vultr.com/docs/how-to-install-mosquitto-mqtt-broker-server-on-ubuntu-16-04 How to Install Mosquitto MQTT Broker/Server on Ubuntu 16.04]&lt;br /&gt;
&lt;br /&gt;
[http://www.steves-internet-guide.com/downloads/ Instal·lació de Mosquitto a Windows]&lt;br /&gt;
&lt;br /&gt;
Per a actualitzar les claus dels dipòsits de Debian:&lt;br /&gt;
 wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key&lt;br /&gt;
 sudo apt-key add mosquitto-repo.gpg.key&lt;br /&gt;
&lt;br /&gt;
=== SCADA ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=SCADA_fent_servir_Python_QML_i_Arduino SCADA fent servir Python QML i Arduino]&lt;br /&gt;
&lt;br /&gt;
== Núvol ==&lt;br /&gt;
=== Instal·lació de Node.js i npm ===&lt;br /&gt;
[https://github.com/nodesource/distributions/blob/master/README.md Instal·lació de node i npm]&lt;br /&gt;
 ecat@iot-ecat:~$ '''sudo bash'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''curl -sL https://deb.nodesource.com/setup_14.x | bash -'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''apt install -y nodejs'''&lt;br /&gt;
 root@iot-ecat:/home/ecat# '''exit'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''node --version'''&lt;br /&gt;
 v14.15.4&lt;br /&gt;
 ecat@iot-ecat:~$ '''npm -- version'''&lt;br /&gt;
 6.14.10&lt;br /&gt;
&lt;br /&gt;
=== Node-RED ===&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/nodeRed01.pdf Introducció al Node-RED]&lt;br /&gt;
&lt;br /&gt;
[[Gestió de Node-RED]]&lt;br /&gt;
&lt;br /&gt;
[https://www.aprendiendoarduino.com/cursos/node-red-developer-para-iot-nivel-i/ Node-RED Developer para IoT. Nivel I]&lt;br /&gt;
&lt;br /&gt;
==== Instal·lació i funcionament del NodeRed autònom ====&lt;br /&gt;
 ecat@iot-ecat:~$ '''mkdir bin'''&lt;br /&gt;
 ecat@iot-ecat:~$ '''cd bin'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''sudo apt install unzip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''mkdir nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin$ '''cd nodered-ui'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''wget https://www.binefa.cat/IoT/nodeRed/node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''unzip node_red_ui.zip'''&lt;br /&gt;
 ecat@iot-ecat:~/bin/nodered-ui$ '''node node_modules/node-red/red.js --userDir node_modules/node-red/data --settings node_modules/node-red/settings.js -v --port 2222 --title elmeuTitol --safe flows_meuTitol.json'''&lt;br /&gt;
&lt;br /&gt;
==== UDP ====&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/udpServer/udpServer_nodered_code.txt Codi NodeRED per a esp8266_udpServer_01.ino i esp32_udpServer_01b]&lt;br /&gt;
&lt;br /&gt;
==== MQTT(S) ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=MQTT_i_MQTTS MQTT i MQTTS]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex00/ Exemple amb MQTT i NodeRED emprant ESP8266 i ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/mqtt_esp8266_esp32/ex01/ Exercici amb MQTT i NodeRED emprant ESP8266]&lt;br /&gt;
&lt;br /&gt;
[[Elevador en Snap! controlat remotament amb MQTT mitjançant NodeRED fent crides HTTP]]&lt;br /&gt;
&lt;br /&gt;
[http://mqtt-explorer.com/ MQTT Explorer]&lt;br /&gt;
&lt;br /&gt;
==== Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Un_exemple_d%27us_de_Telegram_amb_el_NodeRed Un exemple d'us de Telegram amb el NodeRed]&lt;br /&gt;
&lt;br /&gt;
==== Modbus TCP ====&lt;br /&gt;
[https://binefa.cat/IoT/modbus/ Arxius per treballar amb Modbus TCP] [https://www.binefa.cat/php/doc/modbus/ El segon vídeo explica i compara Modbus RTU i Modbus TCP] &lt;br /&gt;
&lt;br /&gt;
[https://binefa.cat/IoT/nodeRed/prj/modbusCtrl/ ModBus TCP al NodeRED]&lt;br /&gt;
&lt;br /&gt;
==== Alguns nodes extra ====&lt;br /&gt;
[https://flows.nodered.org/node/node-red-contrib-google-sheets node-red-contrib-google-sheets]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/sammachin/node-red-contrib-google-sheets node-red-contrib-google-sheets al Github]&lt;br /&gt;
&lt;br /&gt;
=== Sistemes d'emmagatzematge i visualització ===&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=InfluxDB Base de dades de sèries temporals InfluxDB]&lt;br /&gt;
&lt;br /&gt;
[http://docs.grafana.org/installation/debian/ Instal·lació de Grafana a Debian][en]&lt;br /&gt;
&lt;br /&gt;
[[Sentilo]]&lt;br /&gt;
&lt;br /&gt;
=== Xarxes d'àrea estesa de baix consum (LPWAN) ===&lt;br /&gt;
==== Conceptes teòrics ====&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Xarxa_de_llarg_abast Xarxa de llarg abast (WAN)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Chirp_spread_spectrum Espectre eixamplat (Chirp Spread Spectrum)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_seq%C3%BC%C3%A8ncia_directa Espectre eixamplat per seqüència directa (DSSS)]&lt;br /&gt;
&lt;br /&gt;
[https://ca.wikipedia.org/wiki/Espectre_eixamplat_per_salt_de_freq%C3%BC%C3%A8ncia Espectre eixamplat per salt de freqüència (FHSS)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/LPWAN What is LPWAN?]&lt;br /&gt;
&lt;br /&gt;
[https://cms.edn.com/ContentEETimes/Documents/EDN/LP%20WAN%20Comparison%20Table%20final.pdf Comparison table of Low Power WAN alternatives]&lt;br /&gt;
&lt;br /&gt;
==== LoRa ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=LoRa LoRa]&lt;br /&gt;
&lt;br /&gt;
==== SigFox ====&lt;br /&gt;
[https://docs.pycom.io/chapter/tutorials/sipy/register.html Registering SiPy with Sigfox]&lt;br /&gt;
&lt;br /&gt;
[[Interacció amb SiPy1.0r de pycom]]&lt;br /&gt;
&lt;br /&gt;
==== Antenes ====&lt;br /&gt;
[https://youtu.be/CJNq2I_PDHQ Andreas Spiess video: &amp;quot;#182 ESP32 Lora Boards: What you need to know before you buy (incl. Antenna knowledge)&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Bots ===&lt;br /&gt;
==== Bot de Telegram ====&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Bot_de_Telegram Bot de Telegram]&lt;br /&gt;
&lt;br /&gt;
==== Bot de Mastodon ====&lt;br /&gt;
No totes les instàncies de [https://ca.wikipedia.org/wiki/Mastodon_(xarxa_social) Mastodon] faciliten la instal·lació de bots. Per a fer les primeres passes us recomano aquesta [https://botsin.space/ instància pensada per allotjar bots de Mastodon].&lt;br /&gt;
&lt;br /&gt;
[https://botsin.space/@siarq_sensors Exemple de bot de Mastodon] per a fer lectures de sensors cada hora.&lt;br /&gt;
&lt;br /&gt;
[https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26 Getting credentials for the Mastodon API with Mastodon.py, step by step]&lt;br /&gt;
&lt;br /&gt;
=== VPS ===&lt;br /&gt;
[[Introducció als contenidors docker]]&lt;br /&gt;
&lt;br /&gt;
[[Servidor intermediari invers]]&lt;br /&gt;
&lt;br /&gt;
[[Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[File Browser]]&lt;br /&gt;
&lt;br /&gt;
[[Apache i PHP]]&lt;br /&gt;
&lt;br /&gt;
[[Redireccions a subdomini]]&lt;br /&gt;
&lt;br /&gt;
[[Mastodon]]&lt;br /&gt;
&lt;br /&gt;
[https://medium.com/himinds/mqtt-broker-with-secure-websocket-using-traefik-docker-compose-and-lets-encrypt-2b8e32207555 MQTT broker with Secure WebSocket using Traefik, Docker Compose and Let’s Encrypt]&lt;br /&gt;
&lt;br /&gt;
[[Moodle a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Node-RED a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[Snap! a un servidor intermediari invers emprant Dockers]]&lt;br /&gt;
&lt;br /&gt;
[[VPN WireGuard]]&lt;br /&gt;
&lt;br /&gt;
== Snap! ==&lt;br /&gt;
[https://github.com/jmoenig/Snap Snap! al GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''amb''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html Versió pública d'Snap! '''sense''' SSL]. Amb el JavaScript desactivat per defecte.&lt;br /&gt;
&lt;br /&gt;
=== JavaScript per defecte ===&lt;br /&gt;
Per raons de seguretat, s'ha desactivat el JavaScript per defecte. Si us munteu el vostre propi servei al núvol, per a poder cridar programes vostres amb funcions amb JavaScript, heu d'afegir aquesta línia, en negreta, a l'arxiu ''[https://github.com/jmoenig/Snap/blob/master/snap.html snap.html]'':&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            '''Process.prototype.enableJS = true;''' // &amp;lt;-- Per a tenir seleccionat el JS per defecte&lt;br /&gt;
            var world;&lt;br /&gt;
            window.onload = function () {&lt;br /&gt;
                if ('serviceWorker' in navigator) {&lt;br /&gt;
                    navigator.serviceWorker.register('sw.js');&lt;br /&gt;
                }&lt;br /&gt;
                world = new WorldMorph(document.getElementById('world'));&lt;br /&gt;
                new IDE_Morph().openIn(world);&lt;br /&gt;
                loop();&lt;br /&gt;
            };&lt;br /&gt;
            function loop() {&lt;br /&gt;
                requestAnimationFrame(loop);&lt;br /&gt;
                world.doOneCycle();&lt;br /&gt;
            }&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MQTT for Snap! ===&lt;br /&gt;
[https://github.com/pixavier/mqtt4snap MQTT4Snap !], desenvolupat per en Xavier Pi.&lt;br /&gt;
&lt;br /&gt;
[https://snap.berkeley.edu/snap/snap.html#open:https://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld.xml Hello World emprant MQTT '''amb''' SSL]&lt;br /&gt;
&lt;br /&gt;
[http://extensions.snap.berkeley.edu/snap/snap.html#open:http://raw.githubusercontent.com/pixavier/mqtt4snap/master/HelloWorld_NoSSL.xml Hello World emprant MQTT '''sense''' SSL]&lt;br /&gt;
&lt;br /&gt;
= Una aproximació a OPC-UA =&lt;br /&gt;
&lt;br /&gt;
[[OPC-UA]]&lt;br /&gt;
&lt;br /&gt;
= Placa IoT-02 =&lt;br /&gt;
[[Placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
== Programació remota (OTA) ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Esp32Ota.png|center|Programacio OTA de la placa IoT-02]]&lt;br /&gt;
&lt;br /&gt;
=== Dos programes de prova de programació remota ===&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_01.zip IoT-02_OTAWebUpdater_01] (Fa pampallugues el led blanc) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.cat/training/iot02/ota/IoT-02_OTAWebUpdater_02.zip IoT-02_OTAWebUpdater_02] (Fa pampallugues el led verd) Per a que us funcioni, haureu d'actualitzar el codi amb el vostre nom de xarxa sense fils (SSID) i la vostra contrasenya d'accés.&lt;br /&gt;
&lt;br /&gt;
=== Programació a la vora (''edge'') ===&lt;br /&gt;
L'ordinador a la vora (''edge'') pot ser un ordinador normal, habitualment de poca potència, del tipus Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
Per a tenir visibilitat externa de la pàgina web servida per la placa IoT-02 (per exemple amb la IP 192.168.1.151:80), ho redireccionarem a un port ( 192.168.1.151:80 --&amp;gt; localhost:5001 )&lt;br /&gt;
&lt;br /&gt;
Per a fer funcionar [https://www.binefa.cat/training/iot02/ota/edge/simple-port-forwarding.js simple-port-forwarding.js] caldrà haver afegit el paquet '''http-proxy''':&lt;br /&gt;
&lt;br /&gt;
 npm install http-proxy&lt;br /&gt;
&lt;br /&gt;
El codi nodejs de redireccionament (suposant que la placa IoT-02 ha adquirit l'adreça IP 192.168.1.151):&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '192.168.1.151';&lt;br /&gt;
 var portOrigen = 80;&lt;br /&gt;
 var portDesti = 5001;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
Per a fer aquest redireccionador sigui un servei, es copia [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service] a la carpeta '''/etc/systemd/system''' o el fem de nou amb un editor:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/systemd/system&lt;br /&gt;
 sudo nano [https://www.binefa.cat/training/iot02/ota/edge/myForwardingService.service myForwardingService.service]&lt;br /&gt;
 sudo chmod 755 myForwardingService.service&lt;br /&gt;
 sudo systemctl daemon-reload&lt;br /&gt;
 sudo systemctl '''start''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
Per a veure l'estat del servei:&lt;br /&gt;
 systemctl '''status''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
I per a fer que el servei es posi en marxa al reiniciar l'ordinador a la vora:&lt;br /&gt;
 sudo systemctl '''enable''' myForwardingService&lt;br /&gt;
&lt;br /&gt;
=== Programació al núvol ===&lt;br /&gt;
Mitjançant una xarxa virtual privada (VPN) de l'estil [https://www.zerotier.com/ ZeroTier] podem fer que l'ordinador a la vora i l'ordinador al núvol comparteixin la mateixa xarxa.&lt;br /&gt;
&lt;br /&gt;
Suposant que l'ordinador a la vora té la IP 10.242.156.158, podem redireccionar-hi 10.242.156.158:5001 --&amp;gt; localhost:7007 :&lt;br /&gt;
&lt;br /&gt;
 var httpProxy = require('http-proxy');&lt;br /&gt;
 var targetHost = '10.242.156.158';&lt;br /&gt;
 var portOrigen = 5001;&lt;br /&gt;
 var portDesti = 7007;&lt;br /&gt;
 httpProxy.createProxyServer({target:'http://' + targetHost + ':' + portOrigen}).listen(portDesti);&lt;br /&gt;
&lt;br /&gt;
I així tenim accés remot des del núvol, connectant mitjançant l'ordinador a la vora que es connecta a la placa IoT-02. &lt;br /&gt;
&lt;br /&gt;
Per accedir-hi des del navegador, escriviu a la URL: &lt;br /&gt;
 &amp;lt;nom_de_domini&amp;gt;:7007&lt;br /&gt;
Això visualitzarà el que presenta l'ordinador a la vora (la IP és la VPN a l'ordinador a la vora):&lt;br /&gt;
 10.242.156.158:5001&lt;br /&gt;
Que al seu temps presenta el servei pel port 80 de la placa IOT-02 connectada a la mateixa xarxa local que l'ordinador a la vora:&lt;br /&gt;
 192.168.1.151&lt;br /&gt;
&lt;br /&gt;
=== Els tres mètodes de programació OTA de l'ESP32 ===&lt;br /&gt;
[https://www.programmersought.com/article/90864120754/ How to implement OTA online update of ESP32 firmware]&lt;br /&gt;
&lt;br /&gt;
== MicroPython ==&lt;br /&gt;
[https://www.digikey.es/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce MicroPython Basics: Load Files &amp;amp; Run Code]&lt;br /&gt;
&lt;br /&gt;
[https://warped3.substack.com/p/compiling-micropython-with-espressif Compiling microPython with espressif SDK 4.4 for ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://docs.micropython.org/en/latest/esp32/tutorial/intro.html Getting started with MicroPython on the ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/micropython/micropython The MicroPython project]&lt;br /&gt;
&lt;br /&gt;
[https://cdn-learn.adafruit.com/downloads/pdf/micropython-basics-loading-modules.pdf MicroPython Basics: Loading Modules]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/robert-hh/FTP-Server-for-ESP8266-ESP32-and-PYBD uftpd: small FTP server for ESP8266, ESP32 and Pyboard D]&lt;br /&gt;
&lt;br /&gt;
[https://electronicsinnovation.com/connect-esp32-to-ubidots-using-micropython-over-mqtt-with-visual-studio-code/ Connect ESP32 to Ubidots using Micropython over MQTT with Visual Studio Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/peterhinch Peter Hinch's GitHub]&lt;br /&gt;
&lt;br /&gt;
[https://wolles-elektronikkiste.de/en/programming-the-esp32-with-micropython Programming the ESP32 with MicroPython]&lt;br /&gt;
&lt;br /&gt;
[https://awesome-micropython.com/ A curated list of awesome MicroPython libraries, frameworks, software and resources]&lt;br /&gt;
=== asyncio ===&lt;br /&gt;
[https://www.youtube.com/watch?v=5VLvmA__2v0 How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics]&lt;br /&gt;
=== Threads ===&lt;br /&gt;
[https://github.com/kevinmcaleer/threads Micropython thread tutorial]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=QeDnjcdGrpY Video: Micropython Threads - Use Both Cores, on Raspberry Pi Pico and ESP32]&lt;br /&gt;
=== MQTT ===&lt;br /&gt;
[https://bhave.sh/micropython-mqtt/ Secrets of MicroPython: MQTT on ESP32]&lt;br /&gt;
&lt;br /&gt;
[https://wokwi.com/projects/341892004923310676 Exemple MQTT sobre micropython funcionant al wokwi] ([https://wokwi.com/projects/341895401936257620 Un exemple més compacte])&lt;br /&gt;
&lt;br /&gt;
=== Modbus ===&lt;br /&gt;
==== Modifying source code ====&lt;br /&gt;
[https://github.com/brainelectronics/micropython-modbus MicroPython Modbus library]&lt;br /&gt;
&lt;br /&gt;
Modbus control signal able to send or receive messages can be controlled directly by UART. To do that, file [https://github.com/mrvelic/micropython/blob/master/ports/esp32/machine_uart.c machine_uart.c] should be changed.&lt;br /&gt;
&lt;br /&gt;
Changes to be able to use Tx/Rx MAX3485 pin: [https://github.com/mrvelic/micropython/commit/e6a8481e31d64845b4774ecc2f5b973dacb90351 esp32/machine_uart: Add uart_mode/flow_ctrl args to UART construct/init]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Information about Modbus an MicroPython has been got from this forum: https://github.com/micropython/micropython/pull/5567&lt;br /&gt;
==== Based on pycom-modbus from pycom ====&lt;br /&gt;
[https://github.com/danjperron/micropython-modbus Modbus Master library for MicroPython ESP32 devices]&lt;br /&gt;
=== LoRa ===&lt;br /&gt;
[https://github.com/martynwheeler/u-lora This is a port of raspi-lora for micropython]&lt;br /&gt;
&lt;br /&gt;
= IoT-Vertebrae =&lt;br /&gt;
== Raspberry ==&lt;br /&gt;
[[Configuració de la WiFi a la Raspberry Pi emprant nmtui]]&lt;br /&gt;
&lt;br /&gt;
[[Reconnexió automàtica a la WiFi]]&lt;br /&gt;
&lt;br /&gt;
[[WireGuard VPN]]&lt;br /&gt;
&lt;br /&gt;
= Exemples pràctics =&lt;br /&gt;
== Sensor ModBus de temperatura i humitat CWT-TH03S ==&lt;br /&gt;
[https://www.aliexpress.com/item/1005001404952412.html CWT-TH03S a AliExpress]&lt;br /&gt;
&lt;br /&gt;
[[Accés ModBus al sensor de temperatura i humitat CWT-TH03S]]&lt;br /&gt;
&lt;br /&gt;
= SBC =&lt;br /&gt;
== PocketBeagle ==&lt;br /&gt;
=== Grove Kit ===&lt;br /&gt;
==== Visió general ====&lt;br /&gt;
[https://beagleboard.org/Kits/Grove Informació comercial del Grove Kit]&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/pocket Informació comercial de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki Wiki de la PocketBeagle]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual System Reference Manual] &amp;lt;----&lt;br /&gt;
&lt;br /&gt;
[https://beagleboard.org/latest-images Darreres imatges per a les SD]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/capes/tree/master/pocketbeagle/Grove Disseny del Grove Cape]&lt;br /&gt;
&lt;br /&gt;
==== Primera connexió a la xarxa sense fils ====&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$ '''sudo connmanctl'''⏎&lt;br /&gt;
 [sudo] password for debian: temppwd⏎&lt;br /&gt;
 connmanctl&amp;gt; '''scan wifi'''⏎&lt;br /&gt;
 Scan completed for wifi&lt;br /&gt;
 connmanctl&amp;gt; '''services'''⏎&lt;br /&gt;
       MyWifi                  wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''agent on'''⏎&lt;br /&gt;
 Agent registered&lt;br /&gt;
 connmanctl&amp;gt; '''connect wifi_1234567890_1234567890123456_managed_psk'''⏎&lt;br /&gt;
 Agent RequestInput wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
       Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]&lt;br /&gt;
       WPS = [ Type=wpspin, Requirement=alternate ]&lt;br /&gt;
 Passphrase? '''MySecretPassphrase'''⏎&lt;br /&gt;
 Connected wifi_1234567890_1234567890123456_managed_psk&lt;br /&gt;
 connmanctl&amp;gt; '''quit'''⏎&lt;br /&gt;
 debian@beaglebone:/var/lib/cloud9$&lt;br /&gt;
&lt;br /&gt;
==== Tutorials ====&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/blob/master/PocketBeagle/Grove/workshop-handouts.md Blink PocketBeagle on-board USRx LED]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/beagleboard/cloud9-examples/tree/master/PocketBeagle/Grove Exemples]&lt;br /&gt;
&lt;br /&gt;
= Formació =&lt;br /&gt;
[https://www.binefa.com/index.php/IoT_amb_Arduino_i_Raspberry_Pi._Microcontroladors_d%27%C3%BAs_professional._Curs_Presencial._Edici%C3%B3_de_mar%C3%A7_de_2022 IoT amb Arduino i Raspberry Pi. Microcontroladors d'ús professional. Curs Presencial. Edició de març de 2022] - [https://formacio.eic.cat/cursos/1123577 Formació al Col·legi d'Enginyers Industrials de Catalunya] (30 / març / 2022)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Sistemes_encastats_d%27escala_petita_i_mitjana._Edici%C3%B3_d%27octubre_2021 Sistemes encastats d'escala petita i mitjana. Edició d'octubre 2021] (20 / octubre / 2021)&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways)_IoT_(22_de_mar%C3%A7_de_2022) Nodes sensors (motes) i passarel·les (gateways) IoT (22 de març de 2022)] pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria]&lt;br /&gt;
&lt;br /&gt;
[https://www.binefa.com/index.php/Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2022) Tecnologías IoT, Hands on y MVP (2022)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Diada_de_la_Llibertat_del_Maquinari_(Edici%C3%B3_2021) Diada de la Llibertat del Maquinari (Edició 2021)] (17 d'abril de 2021)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2021) Tecnologías IoT, Hands on y MVP (2021)]&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Nodes_sensors_(motes)_i_passarel%C2%B7les_(gateways) Nodes sensors (motes) i passarel·les (gateways)]  pel [https://www.fundaciocim.org/ca/formacio/master-mtdi Màster en Transformació Digital en la Indústria] (23 de març de 2021)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=Monitoritzaci%C3%B3_de_la_qualitat_de_l%27aire_mesurant_CO2_i_VOC_amb_LoRa Monitorització de la qualitat de l'aire mesurant CO2 i VOC amb LoRa] (9 de gener de 2021)&lt;br /&gt;
&lt;br /&gt;
[[Curset introductori d'Internet de les Coses per ADTelecom]] (Comença el 5 de novembre de 2020)&lt;br /&gt;
&lt;br /&gt;
[http://www.binefa.com/index.php?title=%C3%9As_de_les_dades_generades_pels_sensors_LoRaWAN_i_arquitectura_del_sistema._Rub%C3%AD_2020 Ús de les dades generades pels sensors LoRaWAN i arquitectura del sistema. Rubí, 17 de juny de 2020]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Curset_a_TE_Connectivity_del_4_de_mar%C3%A7_de_2020 Curset a TE Connectivity del 4 de març de 2020] a [https://www.te.com/ TE Connectivity]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] (Ajuntament de Viladecans, 19 de febrer de 2020)&lt;br /&gt;
&lt;br /&gt;
UPC-School - Màster Industria 4.0 [http://www.binefa.com/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP_(2020) Tecnologías IoT, Hands on y MVP (2020)]&lt;br /&gt;
&lt;br /&gt;
UPC-School - 21802500 - Màster Industria 4.0 [https://wiki.binefa.cat/index.php?title=Tecnolog%C3%ADas_IoT,_Hands_on_y_MVP Tecnologías IoT, Hands on y MVP] (2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_r%C3%A0pida_a_LoRaWAN_i_The_Things_Network Introducció ràpida a LoRaWAN i The Things Network] a l'[http://www.icm.csic.es/ Institut de Ciències del Mar] (27 / setembre / 2018 i 25 / setembre / 2019)&lt;br /&gt;
&lt;br /&gt;
[https://wiki.binefa.cat/index.php?title=Introducci%C3%B3_a_Internet_de_les_Coses_-_juny_2018 Introducció a Internet de les Coses - juny 2018] (Curset de formació per a professors de CF realitzat a l'[https://agora.xtec.cat/iesramblaprim/ Institut Rambla Prim])&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Sunna LoRa RMM v3.0]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Xifratge =&lt;br /&gt;
[[Eines de xifratge en línia]]&lt;br /&gt;
&lt;br /&gt;
= Opinió =&lt;br /&gt;
[http://www.xavierpi.com/mi40/HaciaUnIoT_democraticoYEfectivo.pdf Hacia un Internet de las Cosas democrático y efectivo] per Xavier Pi (octubre 2018)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Auxiliar]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;MediaWiki s'ha instal·lat.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consulteu la [https://meta.wikimedia.org/wiki/Help:Contents Guia d'Usuari] per a més informació sobre com utilitzar aquest programari wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Primers passos ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Llista de paràmetres configurables]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ PMF del MediaWiki]&lt;br /&gt;
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce Llista de correu per a anuncis del MediaWiki]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Traducció de MediaWiki en la vostra llengua]&lt;br /&gt;
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Aprengueu com combatre la brossa que pot atacar el vostre wiki]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47187</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47187"/>
		<updated>2024-06-30T18:47:10Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive = 25'''&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
Feu un nou arxiu anomenat ''/etc/network/interfaces.d/wg0'':&lt;br /&gt;
 sudo nano /etc/network/interfaces.d/wg0&lt;br /&gt;
I poseu aquest contingut (amb la IP de la VPN Wireguard per a aquesta Raspberry Pi):&lt;br /&gt;
 # indicate that wg0 should be created when the system boots, and on ifup -a&lt;br /&gt;
 auto wg0&lt;br /&gt;
 &lt;br /&gt;
 # describe wg0 as an IPv4 interface with static address&lt;br /&gt;
 iface wg0 inet static&lt;br /&gt;
 &lt;br /&gt;
        # the IP address of this client on the WireGuard network&lt;br /&gt;
        address '''10.0.2.11'''/24&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, create the device with this ip link command&lt;br /&gt;
        pre-up ip link add $IFACE type wireguard&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, set the WireGuard config from earlier&lt;br /&gt;
        pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf&lt;br /&gt;
 &lt;br /&gt;
        # after ifdown, destroy the wg0 interface&lt;br /&gt;
        post-down ip link del $IFACE&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' ('''sudo nano /etc/wireguard/wg0.conf''') afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
&lt;br /&gt;
I actualitzeu el servidor de la VPN WireGuard:&lt;br /&gt;
 '''sudo wg syncconf wg0 /etc/wireguard/wg0.conf'''&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''sudo ifup wg0'''&lt;br /&gt;
Verifiqueu que podeu veure la interfície de xarxa ''wg0'':&lt;br /&gt;
 '''ip address show dev wg0'''&lt;br /&gt;
Verifiqueu que hi ha hagut tràfic entre el servidor de la VPN WireGuard i el client (a la Raspberry Pi):&lt;br /&gt;
 '''sudo wg show wg0'''&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47186</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47186"/>
		<updated>2024-06-30T18:42:45Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.1'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
Feu un nou arxiu anomenat ''/etc/network/interfaces.d/wg0'':&lt;br /&gt;
 sudo nano /etc/network/interfaces.d/wg0&lt;br /&gt;
I poseu aquest contingut (amb la IP de la VPN Wireguard per a aquesta Raspberry Pi):&lt;br /&gt;
 # indicate that wg0 should be created when the system boots, and on ifup -a&lt;br /&gt;
 auto wg0&lt;br /&gt;
 &lt;br /&gt;
 # describe wg0 as an IPv4 interface with static address&lt;br /&gt;
 iface wg0 inet static&lt;br /&gt;
 &lt;br /&gt;
        # the IP address of this client on the WireGuard network&lt;br /&gt;
        address '''10.0.2.11'''/24&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, create the device with this ip link command&lt;br /&gt;
        pre-up ip link add $IFACE type wireguard&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, set the WireGuard config from earlier&lt;br /&gt;
        pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf&lt;br /&gt;
 &lt;br /&gt;
        # after ifdown, destroy the wg0 interface&lt;br /&gt;
        post-down ip link del $IFACE&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' ('''sudo nano /etc/wireguard/wg0.conf''') afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
&lt;br /&gt;
I actualitzeu el servidor de la VPN WireGuard:&lt;br /&gt;
 '''sudo wg syncconf wg0 /etc/wireguard/wg0.conf'''&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''sudo ifup wg0'''&lt;br /&gt;
Verifiqueu que podeu veure la interfície de xarxa ''wg0'':&lt;br /&gt;
 '''ip address show dev wg0'''&lt;br /&gt;
Verifiqueu que hi ha hagut tràfic entre el servidor de la VPN WireGuard i el client (a la Raspberry Pi):&lt;br /&gt;
 '''sudo wg show wg0'''&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47185</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47185"/>
		<updated>2024-06-30T18:42:22Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.1'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
Feu un nou arxiu anomenat ''/etc/network/interfaces.d/wg0'':&lt;br /&gt;
 sudo nano /etc/network/interfaces.d/wg0&lt;br /&gt;
I poseu aquest contingut (amb la IP de la VPN Wireguard per a aquesta Raspberry Pi):&lt;br /&gt;
 # indicate that wg0 should be created when the system boots, and on ifup -a&lt;br /&gt;
 auto wg0&lt;br /&gt;
 &lt;br /&gt;
 # describe wg0 as an IPv4 interface with static address&lt;br /&gt;
 iface wg0 inet static&lt;br /&gt;
 &lt;br /&gt;
        # the IP address of this client on the WireGuard network&lt;br /&gt;
        address '''10.0.2.11'''/24&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, create the device with this ip link command&lt;br /&gt;
        pre-up ip link add $IFACE type wireguard&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, set the WireGuard config from earlier&lt;br /&gt;
        pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf&lt;br /&gt;
 &lt;br /&gt;
        # after ifdown, destroy the wg0 interface&lt;br /&gt;
        post-down ip link del $IFACE&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' ('''sudo nano /etc/wireguard/wg0.conf''') afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
&lt;br /&gt;
I actualitzeu el servidor de la VPN WireGuard:&lt;br /&gt;
 '''sudo wg syncconf wg0 /etc/wireguard/wg0.conf'''&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''sudo ifup wg0'''&lt;br /&gt;
Verifiqueu que podeu veure la interfície de xarxa wg0:&lt;br /&gt;
 '''ip address show dev wg0'''&lt;br /&gt;
Verifiqueu que hi ha hagut tràfic entre el servidor de la VPN WireGuard i el client (a la Raspberry Pi):&lt;br /&gt;
 '''sudo wg show wg0'''&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47184</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47184"/>
		<updated>2024-06-30T18:38:14Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.1'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
Feu un nou arxiu anomenat ''/etc/network/interfaces.d/wg0'':&lt;br /&gt;
 sudo nano /etc/network/interfaces.d/wg0&lt;br /&gt;
I poseu aquest contingut (amb la IP de la VPN Wireguard per a aquesta Raspberry Pi):&lt;br /&gt;
 # indicate that wg0 should be created when the system boots, and on ifup -a&lt;br /&gt;
 auto wg0&lt;br /&gt;
 &lt;br /&gt;
 # describe wg0 as an IPv4 interface with static address&lt;br /&gt;
 iface wg0 inet static&lt;br /&gt;
 &lt;br /&gt;
        # the IP address of this client on the WireGuard network&lt;br /&gt;
        address '''10.0.2.11'''/24&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, create the device with this ip link command&lt;br /&gt;
        pre-up ip link add $IFACE type wireguard&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, set the WireGuard config from earlier&lt;br /&gt;
        pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf&lt;br /&gt;
 &lt;br /&gt;
        # after ifdown, destroy the wg0 interface&lt;br /&gt;
        post-down ip link del $IFACE&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' ('''sudo nano /etc/wireguard/wg0.conf''') afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
&lt;br /&gt;
I actualitzeu el servidor de la VPN WireGuard:&lt;br /&gt;
 '''sudo wg syncconf wg0 /etc/wireguard/wg0.conf'''&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''sudo ifup wg0'''&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47183</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47183"/>
		<updated>2024-06-30T18:29:14Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
Feu un nou arxiu anomenat ''/etc/network/interfaces.d/wg0'':&lt;br /&gt;
 sudo nano /etc/network/interfaces.d/wg0&lt;br /&gt;
I poseu aquest contingut (amb la IP de la VPN Wireguard per a aquesta Raspberry Pi):&lt;br /&gt;
 # indicate that wg0 should be created when the system boots, and on ifup -a&lt;br /&gt;
 auto wg0&lt;br /&gt;
 &lt;br /&gt;
 # describe wg0 as an IPv4 interface with static address&lt;br /&gt;
 iface wg0 inet static&lt;br /&gt;
 &lt;br /&gt;
        # the IP address of this client on the WireGuard network&lt;br /&gt;
        address '''10.0.2.11'''/24&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, create the device with this ip link command&lt;br /&gt;
        pre-up ip link add $IFACE type wireguard&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, set the WireGuard config from earlier&lt;br /&gt;
        pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf&lt;br /&gt;
 &lt;br /&gt;
        # after ifdown, destroy the wg0 interface&lt;br /&gt;
        post-down ip link del $IFACE&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' ('''sudo nano /etc/wireguard/wg0.conf''') afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
&lt;br /&gt;
I actualitzeu el servidor de la VPN WireGuard:&lt;br /&gt;
 '''sudo wg syncconf wg0 /etc/wireguard/wg0.conf'''&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''sudo ifup wg0'''&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47182</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47182"/>
		<updated>2024-06-30T18:28:55Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
Feu un nou arxiu anomenat ''/etc/network/interfaces.d/wg0'':&lt;br /&gt;
 sudo nano /etc/network/interfaces.d/wg0&lt;br /&gt;
I poseu aquest contingut (amb la IP de la VPN Wireguard per a aquesta Raspberry Pi):&lt;br /&gt;
 # indicate that wg0 should be created when the system boots, and on ifup -a&lt;br /&gt;
 auto wg0&lt;br /&gt;
 &lt;br /&gt;
 # describe wg0 as an IPv4 interface with static address&lt;br /&gt;
 iface wg0 inet static&lt;br /&gt;
 &lt;br /&gt;
        # the IP address of this client on the WireGuard network&lt;br /&gt;
        address '''10.0.2.11'''/24&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, create the device with this ip link command&lt;br /&gt;
        pre-up ip link add $IFACE type wireguard&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, set the WireGuard config from earlier&lt;br /&gt;
        pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf&lt;br /&gt;
 &lt;br /&gt;
        # after ifdown, destroy the wg0 interface&lt;br /&gt;
        post-down ip link del $IFACE&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' ('''sudo nano /etc/wireguard/wg0.conf''') afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
&lt;br /&gt;
I actualitzeu el servidor de la VPN WireGuard:&lt;br /&gt;
 '''sudo wg syncconf wg0 /etc/wireguard/wg0.conf'''&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 sudo ifup wg0&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47181</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47181"/>
		<updated>2024-06-30T18:26:25Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
Feu un nou arxiu anomenat ''/etc/network/interfaces.d/wg0'':&lt;br /&gt;
 sudo nano /etc/network/interfaces.d/wg0&lt;br /&gt;
I poseu aquest contingut (amb la IP de la VPN Wireguard per a aquesta Raspberry Pi):&lt;br /&gt;
 # indicate that wg0 should be created when the system boots, and on ifup -a&lt;br /&gt;
 auto wg0&lt;br /&gt;
 &lt;br /&gt;
 # describe wg0 as an IPv4 interface with static address&lt;br /&gt;
 iface wg0 inet static&lt;br /&gt;
 &lt;br /&gt;
        # the IP address of this client on the WireGuard network&lt;br /&gt;
        address '''10.0.2.11'''/24&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, create the device with this ip link command&lt;br /&gt;
        pre-up ip link add $IFACE type wireguard&lt;br /&gt;
 &lt;br /&gt;
        # before ifup, set the WireGuard config from earlier&lt;br /&gt;
        pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf&lt;br /&gt;
 &lt;br /&gt;
        # after ifdown, destroy the wg0 interface&lt;br /&gt;
        post-down ip link del $IFACE&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' ('''sudo nano /etc/wireguard/wg0.conf''') afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
&lt;br /&gt;
I actualitzeu el servidor de la VPN WireGuard:&lt;br /&gt;
 '''sudo wg syncconf wg0 /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47180</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47180"/>
		<updated>2024-06-30T18:08:50Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' ('''sudo nano /etc/wireguard/wg0.conf''') afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
I actualitzeu el servidor de la VPN WireGuard:&lt;br /&gt;
 '''sudo wg syncconf wg0 /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47179</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47179"/>
		<updated>2024-06-30T18:08:22Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' ('''sudo nano /etc/wireguard/wg0.conf''') afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
I actualitzeu el servidor de la VPN WireGuard:&lt;br /&gt;
 $ sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47178</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47178"/>
		<updated>2024-06-30T18:06:03Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
I actualitzeu el servidor de la VPN WireGuard:&lt;br /&gt;
 $ sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47177</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47177"/>
		<updated>2024-06-30T18:05:02Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
* Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
* Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''cat wg-public.key''' &lt;br /&gt;
 Tu***************************************TE=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
* Aneu al servidor WireGuard (no a la Raspberry Pi) i editeu l'arxiu ''/etc/wireguard/wg0.conf'' afegint-hi al final:&lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = '''Tu***************************************TE='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47176</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47176"/>
		<updated>2024-06-30T17:56:35Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.**''':51820&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47175</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47175"/>
		<updated>2024-06-30T17:55:51Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''51.1*.**.*8''':51820&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
	<entry>
		<id>https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47174</id>
		<title>WireGuard VPN</title>
		<link rel="alternate" type="text/html" href="https://www.things.cat/index.php?title=WireGuard_VPN&amp;diff=47174"/>
		<updated>2024-06-30T17:55:16Z</updated>

		<summary type="html">&lt;p&gt;Jordi Binefa : /* Instal·lació de la VPN WireGuard a Raspberry Pi OS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= WireGuard Server =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Server: Debian]&lt;br /&gt;
= WireGuard Client =&lt;br /&gt;
[https://wireguard.how/server/debian/ WireGuard Client: Debian]&lt;br /&gt;
&lt;br /&gt;
[https://www.wireguard.com/install/ Instal·ladors del client de WireGuard per altres sistemes operatius]&lt;br /&gt;
== Instal·lació de la VPN WireGuard a Raspberry Pi OS ==&lt;br /&gt;
[https://wireguard.how/client/raspberry-pi-os/ WireGuard Client: Raspberry Pi OS]&lt;br /&gt;
&lt;br /&gt;
Des del terminal de la Raspberry Pi:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
 sudo apt install '''wireguard'''&lt;br /&gt;
&lt;br /&gt;
Aneu al servidor WireGuard (no a la Raspberry Pi) i copieu la clau pública:&lt;br /&gt;
 $ '''sudo wg show wg0'''&lt;br /&gt;
 interface: wg0&lt;br /&gt;
  public key: '''kj***************************************0Q='''&lt;br /&gt;
  private key: (hidden)&lt;br /&gt;
  listening port: 51820&lt;br /&gt;
&lt;br /&gt;
Torneu al terminal de la Raspberry Pi:&lt;br /&gt;
 '''(umask 077 &amp;amp;&amp;amp; wg genkey &amp;gt; wg-private.key)'''&lt;br /&gt;
 '''wg pubkey &amp;lt; wg-private.key &amp;gt; wg-public.key'''&lt;br /&gt;
 '''cat wg-private.key'''&lt;br /&gt;
 4H***************************************E0=&lt;br /&gt;
 '''sudo nano /etc/wireguard/wg0.conf'''&lt;br /&gt;
&lt;br /&gt;
Aquest ha de ser el contingut de l'arxiu ''/etc/wireguard/wg0.conf'':&lt;br /&gt;
 # define the local WireGuard interface (client)&lt;br /&gt;
 [Interface]&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = '''4H***************************************E0='''&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (server)&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 # contents of wg-public.key on the WireGuard server&lt;br /&gt;
 PublicKey = '''kj***************************************0Q='''&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the server on the WireGuard network &lt;br /&gt;
 AllowedIPs = '''10.0.2.11'''/32&lt;br /&gt;
 &lt;br /&gt;
 # public IP address and port of the WireGuard server&lt;br /&gt;
 Endpoint = '''3*.**.**.*8''':51820&lt;br /&gt;
&lt;br /&gt;
= WireGuard a Android =&lt;br /&gt;
[https://download.wireguard.com/android-client/ Client d'Android de l'aplicació WireGuard]&lt;br /&gt;
&lt;br /&gt;
* Per a crear les claus privada i pública per a Android des del servidor:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/generating-wireguard-qr-codes-for-fast-mobile-deployments/ Generating WireGuard QR codes for fast mobile deployments]&lt;br /&gt;
&lt;br /&gt;
* Configuració de l'aplicació d'Android:&lt;br /&gt;
&lt;br /&gt;
[https://serversideup.net/how-to-configure-a-wireguard-android-vpn-client/ How to configure a WireGuard Android VPN Client]&lt;br /&gt;
&lt;br /&gt;
L'apartat ''Add your client to your server'' no m'ha funcionat. Per a que em funcioni he fet:&lt;br /&gt;
&lt;br /&gt;
He afegit al final de l'arxiu '''/etc/wireguard/wg0.conf''' del servidor (l'adreça '''10.0.2.6''' és la IP que tindrà el mòbil a la VPN WireGuard):&lt;br /&gt;
 [Peer]&lt;br /&gt;
 &lt;br /&gt;
 PublicKey = Fn***************************************RU=&lt;br /&gt;
 &lt;br /&gt;
 AllowedIPs = '''10.0.2.6'''/32&lt;br /&gt;
I al final li he dit a WireGuard que recarregui la nova configuració:&lt;br /&gt;
 sudo wg syncconf wg0 /etc/wireguard/wg0.conf&lt;br /&gt;
&lt;br /&gt;
= Exemple de configuració =&lt;br /&gt;
== Al servidor ==&lt;br /&gt;
 sudo wg show wg0&lt;br /&gt;
[[Image:WgServer00.png|center|thumb|Server:~$ sudo wg show wg0]]&lt;br /&gt;
&lt;br /&gt;
Arxiu ''/etc/wireguard/wg0.conf'' :&lt;br /&gt;
 # define the WireGuard service&lt;br /&gt;
 '''[Interface]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-private.key that was recently created&lt;br /&gt;
 PrivateKey = SD***************************************1Q=&lt;br /&gt;
 &lt;br /&gt;
 # UDP service port; 51820 is a common choice for WireGuard&lt;br /&gt;
 ListenPort = 51820&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = EG***************************************yI=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.2/32&lt;br /&gt;
 &lt;br /&gt;
 # define the remote WireGuard interface (client)&lt;br /&gt;
 '''[Peer]'''&lt;br /&gt;
 &lt;br /&gt;
 # contents of file wg-public.key on the WireGuard client&lt;br /&gt;
 PublicKey = Pw***************************************gQ=&lt;br /&gt;
 &lt;br /&gt;
 # the IP address of the client on the WireGuard network&lt;br /&gt;
 AllowedIPs = 10.0.2.5/32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Al client ==&lt;br /&gt;
 sudo cat /etc/wireguard/wg0.conf&lt;br /&gt;
[[Image:WgClient00.png|center|thumb|Client:~$ sudo cat /etc/wireguard/wg0.conf]]&lt;br /&gt;
Per a que hi hagi visibilitat entre diferents clients de la VPN cal comentar l'exclusivitat de connexió al servidor (''10.0.2.1/32'') i permetre que altres hi puguin accedir (''0.0.0.0/0''). I per a mantenir la persistència del túnel s'ha afegit ''PersistentKeepalive'':&lt;br /&gt;
 # AllowedIPs = 10.0.2.1/32&lt;br /&gt;
 AllowedIPs = '''0.0.0.0/0, ::/0'''&lt;br /&gt;
 &lt;br /&gt;
 '''PersistentKeepalive''' = 25&lt;br /&gt;
== A un client Android ==&lt;br /&gt;
'''Interfície''' correspon al mòbil&lt;br /&gt;
&lt;br /&gt;
'''Parell''' (''Peer'') correspon al servidor a on és allotjada la VPN WireGuard&lt;br /&gt;
&lt;br /&gt;
Podeu editar els valors prement la icona del llapis&lt;br /&gt;
&lt;br /&gt;
[[Image:WgAndroid00.png|center|thumb|Client Android]]&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
</feed>