Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot:examples:setup:broker [2023/03/01 21:27] raivo.sellen:iot:examples:setup:broker [2023/03/02 10:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-=====Raspberry as a broker=====+=====MQTT broker=====
  
-On this page, we will explain how to turn your Raspberry Pi 3 (also works with 3+) into a broker with the Wifi access point. Having the Raspberry Pi working as an access point means that you will not need an additional router (NB. we have not tested this under heavy load). If you have a spare router and do not wish to install our image then you can follow the instructions [[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/|here]] on how to turn any Raspberry Pi into a broker.+This page will explain how to turn your Raspberry Pi 3 (also works with 3+) into a broker with Wifi access point. Having the Raspberry Pi working as an access point means you will not need an additional router (NB. we have not tested this under heavy load). If you have a spare router and do not wish to install our imageyou can follow the instructions [[https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/|here]] on how to turn any Raspberry Pi into a broker.
  
  
Line 12: Line 12:
  
  
-Once you have flashed the image to the SD card you should insert it into your Raspberry and boot it up. The Wifi-AP service should activate on its own. But to activate the MQTT broker enter <code>mosquitto -d</code> to the terminal window (you can use SSH or monitor and keyboard to do this). You can use the terminal on Raspbian to confirm if your broker is working. For this, open a terminal window and enter <code>mosquitto_sub -t "mytopic"</code> Then open another terminal window and enter <code>mosquitto_pub -t "mytopic" -m "This is my message"</code>+Once you have flashed the image to the SD cardinsert it into your Raspberry and boot it up. The Wifi-AP service should activate on its own. But to start the MQTT brokerenter <code>mosquitto -d</code> to the terminal window (you can use SSH or monitor and keyboard to do this). You can use the terminal on Raspbian to confirm if your broker is working. For this, open a terminal window and enter <code>mosquitto_sub -t "mytopic"</code> Then open another terminal window and enter <code>mosquitto_pub -t "mytopic" -m "This is my message"</code>
  
-If this works then the next thing you should try is connecting your laptop (or other) device to the Raspberry and test publishing and subscribing to messages with it. A good program for debugging is [[en:iot:examples:setup:debugging|MQTTBox]]. You can find the default Wifi name and password below.+If this worksthen you should next try connecting your laptop (or other) device to Raspberry and test publishing and subscribing to messages with it. A good program for debugging is [[en:iot:examples:setup:debugging|MQTTBox]]. You can find the default Wifi name and password below.
  
 NB!! Avoid turning off Raspberry by removing the power cord since it can cause the SD card to become corrupted. You should always turn the Raspberry off via GUI or typing //sudo shutdown now// to the terminal (using screen and keyboard, or SSH). NB!! Avoid turning off Raspberry by removing the power cord since it can cause the SD card to become corrupted. You should always turn the Raspberry off via GUI or typing //sudo shutdown now// to the terminal (using screen and keyboard, or SSH).
-Upgrading Rasbian may stop the initial system from working. Always consider it when upgrading and keep a copy of important configuration files or the original system.+Upgrading Rasbian may stop the initial system from working. Consider it when upgrading and keep a copy of important configuration files or the original system.
  
 =====Passwords and other data for the raspberry broker===== =====Passwords and other data for the raspberry broker=====
Line 43: Line 43:
 To test that everything works, use the IoT Basic kit. To test that everything works, use the IoT Basic kit.
  
-Connect one Controller with the Button module and upload the following test code to this module:+Connect one Controller module with the Button module and upload the following test code to this module:
  
 Libraries in platformio.ini Libraries in platformio.ini
 <code> <code>
-lib_deps = ITTIoT, Adafruit NeoPixel+lib_deps = ITTIoT, blackketter/Switch
 </code> </code>
  
Line 93: Line 93:
 </code> </code>
  
-then connect the second controller module with RGB module and upload the following code:+then connect the second Controller module with RGB module and upload the following code:
  
 Libraries in platformio.ini Libraries in platformio.ini
Line 166: Line 166:
 </code> </code>
  
-Power up Raspberry broker and both modules. Wait until RGB lights up, and then try to press the button module. RGB module colour should change to green. If this happens, everything is set up correctly, and Raspberry Pi is serving wifi and MQTT broker service in the given parameters.+Power up Raspberry Pi and both modules. Wait until RGB lights up, and then try to press the button on the Button module. RGB module colour should turn green. If this happens, everything is set up correctlyRaspberry Pi serves wifi and MQTT broker service in the given parameters.
  
 +{{:en:iot:examples:setup:broker.jpg?400|}}
  
en/iot/examples/setup/broker.1677706028.txt.gz · Last modified: 2023/03/01 10:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0