# Telemetry basics

- Our elab is monitored and controlled using a language called xml, or extensible markup language.
- You recall html stood for hypertext markup language, well this is another "markup" language that holds data not text.
- You have also see this in your word documents (.docx) spreadsheets (.xlsx) and slide shows (.pptx), where "x" stands for xml, or a container for data.
- 

<span style="font-weight: bold;">Part 1: Reading xml data</span>

- Scan the elab network, looking for devices in the format 10.14.x.1
- On each webpage you will see data presented
- In the browser window, enter the ip address then /state.xml to see the data inside each container
- Telemetry is the reading of remote data.

  
<span id="bkmrk-part-2%3A-controlling-" style="font-weight: bold;">Part 2: Controlling devices with xml</span>  

Control can also be done using xml in the following format:

<span style="font-weight: bold;">Output State Control: </span><span style="font-weight: bold;">Command Description</span>

- state.xml?relay1State=0 Turn Output 1 <span style="font-style: italic;">OFF</span>
- state.xml?relay1State=1 Turn Output 1 <span style="font-style: italic;">ON</span>
- state.xml?relay2State=0 Turn Output 2 <span style="font-style: italic;">OFF</span>
- state.xml?relay2State=1 Turn Output 2 <span style="font-style: italic;">ON</span>

<span style="font-weight: bold;">Pulse Relay: </span><span style="font-weight: bold;">Command Description</span>

- state.xml?relay1State=2 Pulse Output 1 for the preset time (1.5 seconds).
- state.xml?relay1State=2&amp;pulseTime1=5 Pulse Output 1 for 5 seconds.
- state.xml?relay1State=2&amp;pulseTime1=5 Pulse Output 1 for 5 seconds.
- state.xml?relay1State=2&amp;pulseTime1=5 Pulse Output 1 for 5 seconds.
- state.xml?relay1State=2 Pulse Output 1 for the preset time (1.5 seconds).

You will setup a device for you to control, please only control devices with my permission, as some are mission critical to the elab.

Turning on lights and opening windows are fine, but nothing else for now

Try reading devices around the elab with the [http://ipaddress/state.xml](http://ipaddress/state.xml) web link

Try controlling these devices using the commands above:

- 10.14.17.1
- 10.14.18.1
- 10.14.19.1

<div id="bkmrk-part-3%3A-sensors"><span style="font-weight: bold;">Part 3: sensors</span></div><div id="bkmrk-we-will-begin-with-m">We will begin with measuring temperature.</div><div id="bkmrk-two-types-of-tempera">Two types of temperature sensors are most common:</div><div id="bkmrk-2-wire-sensor%3A-also-"><span style="font-weight: bold;">2 wire sensor:</span> also called a thermistor is a resistor that changes value (resistance) when temp changes. You will see these in some solar thermal controllers, or older pre-digital devices. </div><div id="bkmrk-3-wire-digital-senso"><span style="font-weight: bold;">3 wire digital sensor:</span> these have three wires:  power (+), ground (-) and data. Each sensor has a digital address. These are much more accurate than 2 wire sensors, but require more advanced circuits to use</div><div id="bkmrk--12">  
</div><div id="bkmrk-temp-sensor-setup%3A%C2%A0"><span style="font-weight: bold;">Temp sensor setup: </span></div><div id="bkmrk-get-a-control-by-web">

1. get a control by web temperature module, power supply (12V) and a digital temp sensor (metal case)
2. wire the power and sensor to the device, check to see if the power light is on (see below)
3. on a desktop computer, create a network connection for the 192.168.1.0/24 network
4. open a web page for 192.168.1.2, the address of CBW devices out of the box
5. go to 192.168.1.2/setup.html with the login admin/webrelay and change the IP address to the one given by me
6. restart the unit
7. go to the new address, and go to the temperature page
8. add the digital address for the three wire sensor
9. check the web page to see if it records the correct value (warm with your hands to see the change)
10. use xml to check the values: [http://ipaddress/state.xml](http://ipaddress/state.xml)
11. use xml to control the relays in the unit (see above for commands)
12. verify that you can control the unit by watching the web page change
13. expand your system by adding more digital sensors (note they all connect to the same terminals)

<div>Temperature module manual:</div></div><div id="bkmrk-download-temperature">[Download temperature\_um\_v1.6.pdf (application/pdf, 4.6 MB)](https://bookstack.kamuela.org/attachments/275)

</div><div id="bkmrk-advanced-next-steps%3A"><span style="font-weight: bold;">Advanced next steps:</span></div><div id="bkmrk-analog-module%3A-measu">

- Analog module: measure current and power
- X-320 module
- X-420 module
- 400 series modules (bus controlled)
- arduino temp sensors
- raspberry pi sensors
- Lorawan sensors (fire detection project)

<div><span style="font-weight: bold;">Lorawan sensors: Drone project and others...</span></div></div><div id="bkmrk-lorawan-stands-for-l">Lorawan stands for long range, wide area network.</div><div id="bkmrk-these-units-are-very">These units are very low power, very small data systems used for remote telemetry (data sensors and control).</div><div id="bkmrk-advantages%3A">Advantages:</div><div id="bkmrk-very-low-power%2C-some">

1. very low power, some run on batteries for several years, so no need to wire power supplies
2. radio linked using 900 mHz radio, so no need for network wiring
3. long range: can be used up to several miles away, depending on terrain
4. flexibility: move them around as you like, no need to reconfigure
5. location tracking: some have built in GPS

<div>We will be testing two types of sensors: SenseCap sensors and Dragino sensors.</div></div><div id="bkmrk-sensecap-sensors-con"><span style="font-weight: bold;">SenseCap </span>sensors connect to a dashboard provided by the company:</div><div id="bkmrk-https%3A%2F%2Fsensecap.see">[https://sensecap.seeed.cc/portal/#/dashboard](https://sensecap.seeed.cc/portal/#/dashboard)  
</div><div id="bkmrk-they-can-also-be-con">They can also be connected to non-sponsored systems like The Things Network (TTN) or Thingsboard</div><div id="bkmrk-dragino-sensors-are-">Dragino sensors are a bit cheaper, and can only be integrated into either TTN, Thingsboard or your own MQTT database server.</div><div id="bkmrk-mqtt-is-a-database-p">MQTT is a database protocol used by small devices, holding and transferring either messages (like in Meshtastic) or data.</div><div id="bkmrk-we-use-tools-like-mq">We use tools like MQTT explorer to check the data going in and out:</div><div id="bkmrk-https%3A%2F%2Fmqtt-explore">[https://mqtt-explorer.com/](https://mqtt-explorer.com/)  
</div><div id="bkmrk-temperature-data-is-">Temperature data is not usually encrypted (who cares?), but Meshtastic has an encryption option, so messages can be encrypted. </div><div id="bkmrk-fun-fact%3A-if-you-are">Fun fact: if you are a licensed radio operator, you can use higher power on Meshtastic, but you cannot use encryption, per the laws for radio operators.</div><div id="bkmrk-part-1%3A-sensecap"><span style="font-weight: bold;">Part 1: SenseCap</span></div><div id="bkmrk-login-to-the-senseca">

1. Login to the sensecap dashboard above and look at the data. You should see a weather station (3.27.25) and several sensors labeled alpha, beta and so on.
2. Check out the graphs available
3. Note the sensors, and possible data on location
4. Look at caltopo.com, this is were we need to add the location of the sensors

<div><span style="font-weight: bold;">Part 2: The Things Network (TTN)</span></div></div><div id="bkmrk-login-to-ttn-here%3A%C2%A0h">

1. Login to TTN here: [https://nam1.cloud.thethings.network/console/](https://nam1.cloud.thethings.network/console/)
2. Look for sensors and gateways
3. Look at traffic on the gateway, and the data stream
4. Adding a sensor is not easy, we will do this next

<div><span style="font-weight: bold;">Part 3: MQTT</span></div></div><div id="bkmrk-check-out-the-public">

1. Check out the public mqtt server here: [https://www.mqtt-dashboard.com/](https://www.mqtt-dashboard.com/)
2. Note the traffic
3. Using the mqtt explorer, see if you can watch data
4. Try watching Meshtastic messages using the server [mqtt.meshtastic.org](http://mqtt.meshtastic.org) login meshdev/large4cats

</div><div id="bkmrk-part-4%3A-mapping"><span style="font-weight: bold;">Part 4: Mapping</span></div><div id="bkmrk-login-to-caltopo-her">

1. Login to caltopo here: <span style="text-decoration: underline;">[https://caltopo.com/p/0NE7J](https://caltopo.com/p/0NE7J)</span>
2. Notice that the map can be shared.
3. Our goal is to create a single page dashboard for all of our sensors  
    <div>  
    </div>

</div>  
---

<small>Migrated from Apple Server Wiki. Original page ID: T8D7o8</small>