<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>environmental monitoring &#8211; Voltaic Systems Blog</title>
	<atom:link href="https://blog.voltaicsystems.com/tag/environmental-monitoring/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.voltaicsystems.com</link>
	<description>Solar Tutorial and DIY Solar Guides</description>
	<lastBuildDate>Mon, 09 Feb 2026 18:09:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://blog.voltaicsystems.com/wp-content/uploads/2024/07/cropped-Favicon_48x48-32x32.png</url>
	<title>environmental monitoring &#8211; Voltaic Systems Blog</title>
	<link>https://blog.voltaicsystems.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Obscape Uses Voltaic In Rugged Environmental Devices</title>
		<link>https://blog.voltaicsystems.com/obscape-environmental-monitoing/</link>
					<comments>https://blog.voltaicsystems.com/obscape-environmental-monitoing/#respond</comments>
		
		<dc:creator><![CDATA[Voltaic Systems]]></dc:creator>
		<pubDate>Mon, 09 Feb 2026 17:56:29 +0000</pubDate>
				<category><![CDATA[Profiles]]></category>
		<category><![CDATA[environmental monitoring]]></category>
		<category><![CDATA[IoT]]></category>
		<category><![CDATA[time-lapse camera]]></category>
		<category><![CDATA[wave monitoring]]></category>
		<guid isPermaLink="false">https://blog.voltaicsystems.com/?p=115072</guid>

					<description><![CDATA[Obscape is a designer and manufacturer of easy-to-use environmental monitoring products. Their devices are placed in extremely challenging locations around the world including coastlines, ports, offshore drilling platforms. Once deployed, they take photographs and measure wave height, water quality, water levels and water flow. For Obscape&#8217;s customers, product reliability is a critical feature. Obscape outlines [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="https://site.obscape.com/">Obscape</a> is a designer and manufacturer of easy-to-use environmental monitoring products. Their devices are placed in extremely challenging locations around the world including coastlines, ports, offshore drilling platforms. Once deployed, they take photographs and measure wave height, water quality, water levels and water flow.</p>
<div id="attachment_115074" style="width: 760px" class="wp-caption alignleft"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-115074" class="wp-image-115074 size-large" src="https://blog.voltaicsystems.com/wp-content/uploads/2026/02/DSCF2630-1497x1000.jpg" alt="Solar panel time lapse camera" width="750" height="501" /><p id="caption-attachment-115074" class="wp-caption-text">Solar powered Time-Lapse Camera deployed on a beach.</p></div>
<p>For Obscape&#8217;s customers, product reliability is a critical feature. Obscape outlines the reasons they choose to use Voltaic <a href="http://voltaicsystems.com/small-solar-panels">solar panels</a> in this video.</p>
<p><iframe title="Obscape x Voltaic Solar Panels" width="750" height="422" src="https://www.youtube.com/embed/1LVflDu56Xg?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<p><img decoding="async" src="https://blog.voltaicsystems.com/wp-content/uploads/2026/02/time-lapse-camera-solar.jpg" alt="" width="750" height="491" class="alignleft size-large wp-image-115078" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2026/02/time-lapse-camera-solar.jpg 1000w, https://blog.voltaicsystems.com/wp-content/uploads/2026/02/time-lapse-camera-solar-750x491.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2026/02/time-lapse-camera-solar-768x503.jpg 768w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<p>Voltaic has spent extensive time and resources validating the material stack used in all of our ETFE panels. They have been tested against a wide variety of environmental forces:</p>
<ul>
<li>combined UV, temperature and humidity</li>
<li>thermal cycling</li>
<li>thermal shock</li>
<li>vibration</li>
<li>mechanical shock</li>
<li>saltwater</li>
<li>chemical exposure</li>
<p>
The solar panels have also been field tested with well over a million panels deployed across a wide variety of use cases and environmental conditions.</p>
<div id="attachment_115073" style="width: 760px" class="wp-caption alignleft"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-115073" class="wp-image-115073 size-large" src="https://blog.voltaicsystems.com/wp-content/uploads/2026/02/7W-Umhlanga-1333x1000.jpg" alt="Solar panels on ocean buoy" width="750" height="563" /><p id="caption-attachment-115073" class="wp-caption-text">Solar panels on OBS-BUOY</p></div>
<p>Voltaic collaborates with our customers to ensure mechanical and electrical designs follow best practices. Obscape embeds each of the panels precisely and securely in the enclosure which shields them from impact. This design step extends the length of the panel by several years.</p>
<div id="attachment_115075" style="width: 760px" class="wp-caption alignleft"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-115075" class="size-large wp-image-115075" src="https://blog.voltaicsystems.com/wp-content/uploads/2026/02/Still_1.17.1-1500x844.jpg" alt="solar panel embedded electronics" width="750" height="422" /><p id="caption-attachment-115075" class="wp-caption-text">Solar panels in Time-Lapse camera during production.</p></div>
<p>We are excited to work with companies like Obscape who help their customers better understand the world around them.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.voltaicsystems.com/obscape-environmental-monitoing/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Solar for BirdWeather BioAcoustic Platform</title>
		<link>https://blog.voltaicsystems.com/solar-for-birdweather-bioacoustic-platform/</link>
					<comments>https://blog.voltaicsystems.com/solar-for-birdweather-bioacoustic-platform/#comments</comments>
		
		<dc:creator><![CDATA[Voltaic Systems]]></dc:creator>
		<pubDate>Tue, 02 Apr 2024 20:19:32 +0000</pubDate>
				<category><![CDATA[All]]></category>
		<category><![CDATA[IoT Product]]></category>
		<category><![CDATA[Birds]]></category>
		<category><![CDATA[environmental monitoring]]></category>
		<guid isPermaLink="false">http://80ca4ebf1c.nxcli.io/?p=113201</guid>

					<description><![CDATA[This is a quick demonstration on how to power the BirdWeather PUC from solar power. The PUC listens to the sounds around it and is able to identify over 6,000 birds and many other non-avian species. It uses the BirdNET neural network from Cornell Lab of Ornithology and the Chemnitz University of Technology. Here is [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is a quick demonstration on how to power the BirdWeather PUC from solar power. The PUC listens to the sounds around it and is able to identify over 6,000 birds and many other non-avian species. It uses the <a href="https://birdnet.cornell.edu/" target="_blank" rel="noopener">BirdNET</a> neural network from Cornell Lab of Ornithology and the Chemnitz University of Technology.</p>
<p>Here is some of the birds our device identified in the first days of deployment.</p>
<h2><img loading="lazy" decoding="async" class="size-medium wp-image-113228 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/featured_bird_detector-750x500.jpg" alt="" width="750" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/featured_bird_detector-750x500.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/featured_bird_detector-768x512.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/featured_bird_detector-300x200.jpg 300w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/featured_bird_detector-360x240.jpg 360w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/featured_bird_detector-600x400.jpg 600w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/featured_bird_detector.jpg 1125w" sizes="auto, (max-width: 750px) 100vw, 750px" /></h2>
<p>The PUC is simple to use and get started (especially compared to the raspberry Pi version) and is pretty power efficient. It consumes about 60mA at 5 Volts and improvements are underway to bring this down further.</p>
<p>We recommend most customers pair the PUC with our <a href="https://voltaicsystems.com/5-watt-5-volt-35wh-solar-system/">5 Watt 5 Volt 35Wh solar power system</a>. For customers in environments with less sun because of shading or northern latitudes or if you want to decrease the risk of your system going out of power, you can increase the panel size to 10 Watts in the drop down menu.</p>
<h2></h2>
<p><strong>Quick math:</strong> 60mA * 5V * 24h = 7.2 Watt hours per day. In New York City, the 5 Watt system will perform well up until December. At that point, a south facing panel in will receive the equivalent of two hours of sun. After losses in and out of the circuit, it will provide only about 6 Watt hours to the PUC and it will likely have some down time. Doubling the panel size to 10 Watts gets us to 12 Watt hours into the battery and a more stable system.</p>
<h2></h2>
<p>The 5 Watt system includes a mounting bracket (<a href="https://voltaicsystems.com/BK102/">BK102</a>) which includes slots for u-bolts and screws. We simply used a few bolts to attach the panel to a steel post.</p>
<h2><img loading="lazy" decoding="async" class="size-medium wp-image-113222 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/detail-750x500.jpg" alt="" width="750" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/detail-750x500.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/detail-768x512.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/detail-300x200.jpg 300w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/detail-360x240.jpg 360w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/detail-600x400.jpg 600w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/detail.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></h2>
<p>We placed the PUC underneath the solar panel. The back mount has a 1/4&#8243; 40 screw thread.  We attached a short piece of <a href="https://www.amazon.com/Beduan-Stainless-Thread-Threaded-Length/dp/B083R6BNKP">1/4&#8243; 40 threaded rod</a> and a wing not to secure it to the post.</p>
<h2><img loading="lazy" decoding="async" class="size-medium wp-image-113225 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector_detail_2-750x500.jpg" alt="" width="750" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector_detail_2-750x500.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector_detail_2-768x512.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector_detail_2-300x200.jpg 300w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector_detail_2-360x240.jpg 360w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector_detail_2-600x400.jpg 600w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector_detail_2.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></h2>
<p>The V35 battery from the Voltaic system connects to the PUC via a USBC adapter (<a href="https://voltaicsystems.com/a123">A123</a>).  That&#8217;s it!</p>
<h2><img loading="lazy" decoding="async" class="size-medium wp-image-113226 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector-750x500.jpg" alt="" width="750" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector-750x500.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector-768x512.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector-300x200.jpg 300w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector-360x240.jpg 360w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector-600x400.jpg 600w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/deployed_back_bird_detector.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></h2>
<p>Another option is our systems with enclosure. This is the 5 Watt, 5 Volt system using the V50 battery. This system was deployed by Derek Rogers of the <a href="https://adirondacklandtrust.org/">Adirondack Land Trust</a>. <img loading="lazy" decoding="async" class="alignleft size-large wp-image-113466" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/04/5-Watt-Kit-PUC-1466x1000.jpg" alt="solar powered PUC acoustic monitoring" width="750" height="512" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/04/5-Watt-Kit-PUC-1466x1000.jpg 1466w, https://blog.voltaicsystems.com/wp-content/uploads/2024/04/5-Watt-Kit-PUC-733x500.jpg 733w, https://blog.voltaicsystems.com/wp-content/uploads/2024/04/5-Watt-Kit-PUC-768x524.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/04/5-Watt-Kit-PUC-1536x1047.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/04/5-Watt-Kit-PUC-2048x1397.jpg 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Happy acoustic birding.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a class="maxbutton-48 maxbutton maxbutton-5-watt-5-volt-35wh-solar-system" target="_blank" title="5 Watt 5 Volt 35Wh Solar System" rel="noopener" href="https://voltaicsystems.com/5-watt-5-volt-35wh-solar-system/"><span class='mb-text'>Shop Now</span></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.voltaicsystems.com/solar-for-birdweather-bioacoustic-platform/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Solar Powered Nano 33 IoT Soil Moisture Tutorial</title>
		<link>https://blog.voltaicsystems.com/solar-powered-nano-33-iot-soil-moisture-tutorial/</link>
					<comments>https://blog.voltaicsystems.com/solar-powered-nano-33-iot-soil-moisture-tutorial/#respond</comments>
		
		<dc:creator><![CDATA[Lizabeth Arum]]></dc:creator>
		<pubDate>Wed, 13 Mar 2024 21:24:15 +0000</pubDate>
				<category><![CDATA[IoT Tutorial]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Nano 33 IoT]]></category>
		<category><![CDATA[environmental monitoring]]></category>
		<guid isPermaLink="false">http://80ca4ebf1c.nxcli.io/?p=113093</guid>

					<description><![CDATA[Overview This blog post is a step-by-step walkthrough to run a Nano 33 IoT application from solar power. You will learn about: Managing power consumption on an Arduino Nano 33 IoT Converting RS485 data to serial Publishing data on the Qubitro IoT platform Monitoring system health of a solar powered application Whether you&#8217;re a hobbyist, [&#8230;]]]></description>
										<content:encoded><![CDATA[<h2>Overview</h2>
<p>This blog post is a step-by-step walkthrough to run a Nano 33 IoT application from solar power. You will learn about:</p>
<ul>
<li>Managing power consumption on an Arduino Nano 33 IoT</li>
<li>Converting RS485 data to serial</li>
<li>Publishing data on the <a href="https://qubitro.com">Qubitro</a> IoT platform</li>
<li>Monitoring system health of a solar powered application</li>
</ul>
<p><a href="https://portal.qubitro.com/57bb0fc2-e1b4-46ed-9e94-117601d68260"><img loading="lazy" decoding="async" class="aligncenter wp-image-113196 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-14-at-11.18.27 AM-308x500.png" alt="Qubitro Dashboard" width="308" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-14-at-11.18.27 AM-308x500.png 308w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-14-at-11.18.27 AM-615x1000.png 615w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-14-at-11.18.27 AM-768x1248.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-14-at-11.18.27 AM.png 822w" sizes="auto, (max-width: 308px) 100vw, 308px" /></a><br />
Whether you&#8217;re a hobbyist, educator, or professional, this POC demonstrates the potential of solar-powered IoT solutions and the ease with which they can be implemented to address real-world challenges.</p>
<p><img loading="lazy" decoding="async" class="wp-image-113179 size-medium aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/circuit_photo2-750x478.jpg" alt="Photo of circuit in enclosure" width="750" height="478" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/circuit_photo2-750x478.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/circuit_photo2-768x490.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/circuit_photo2.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<h2>Parts Needed</h2>
<ul>
<li><a href="https://store-usa.arduino.cc/products/arduino-nano-33-iot-with-headers">Arduino® Nano 33 IoT with headers</a></li>
<li><a href="https://voltaicsystems.com/5-watt-5-volt-35wh-solar-system/">5 Watt 5 Volt 35Wh Solar System</a></li>
<li><a href="https://www.renkeer.com/product/soil-moisture-sensor/">Renkeer RS-SD-N01-TR- Soil moisture sensor</a></li>
<li><a href="https://www.amazon.com/dp/B07X3JX7SY">RS-485 Converter Module TTL to RS-485 Adapte</a>r</li>
<li><a href="https://www.amazon.com/dp/B0CKPRHQRT">USB 2.0 Pigtail 4 Wire </a></li>
<li>Wires</li>
<li>For lowering power consumption with a RTC
<ul>
<li><a href="https://www.adafruit.com/product/3013">Adafruit DS3231 Precision RTC Breakout</a></li>
<li>1x resistor 10kOhms</li>
<li>1x resistor 100Ohms</li>
<li>IRF9520  P-channel MOSFET</li>
<li><a href="https://www.amazon.com/Pololu-Step-Up-Step-Down-Voltage-Regulator/dp/B01M4KIS7K/ref=sr_1_1">Pololu S7V7F5 voltage regulator</a></li>
</ul>
</li>
</ul>
<hr />
<h2> <img loading="lazy" decoding="async" class="size-medium wp-image-113183 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/battery_closeup-667x500.jpg" alt="" width="667" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/battery_closeup-667x500.jpg 667w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/battery_closeup-1334x1000.jpg 1334w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/battery_closeup-768x576.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/battery_closeup-1536x1152.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/battery_closeup-80x60.jpg 80w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/battery_closeup.jpg 1679w" sizes="auto, (max-width: 667px) 100vw, 667px" /></h2>
<h2>The Renke  Soil Moisture Sensor</h2>
<p>The sensor measures the dielectric constant of soil  and the volume percentage of soil moisture, which is a soil moisture measurement method in line with current international standards. You can bury it in the soil for a long time, as the electrode is made of alloy material, it is durable, waterproof, and resistant to long-term electrolysis, acid and alkali corrosion.</p>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-113109 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image13-711x500.png" alt="RS485 Soil Sensor" width="711" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image13-711x500.png 711w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image13-768x540.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image13.png 1322w" sizes="auto, (max-width: 711px) 100vw, 711px" /></p>
<p>The sensor is suitable for soil moisture monitoring, scientific experiments, water-saving irrigation, greenhouses, flowers and vegetables, grassland pastures, soil rapid testing, plant cultivation, sewage treatment, precision agriculture and other occasions temperature and humidity, conductivity, PH value testing .</p>
<p>It can be powered by 4.5-30V and operates between -20°C to ~60°C.</p>
<p>Here are some <b>best practices</b> for using the sensor:</p>
<ul>
<li>The steel needles must be fully inserted into the soil when measuring.</li>
<li>Avoid direct sunlight on the transmitter that will cause the temperature to be too high. Pay attention to lightning protection when using in the field.</li>
<li>Do not bend the steel needles violently, do not pull the lead wire of the transmitter forcibly, and do not violently hit the transmitter.</li>
<li>The protection level of the transmitter is IP68, and the entire transmitter can be soaked in water.</li>
<li>Due to the existence of radio frequency electromagnetic radiation in the air, it is not suitable to be energized in the air for a long time.</li>
<li>It should be calibrated before each measurement. It is recommended to calibrate every 1 month for long-term use. The calibration frequency should be adjusted according to different application conditions (soil quality, moisture content, salt content, pH, etc. of the application)</li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113148" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-04-at-2.04.46 PM-750x398.png" alt="soil sensor installed" width="750" height="398" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-04-at-2.04.46 PM-750x398.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-04-at-2.04.46 PM-768x408.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-04-at-2.04.46 PM.png 942w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<h4>Wiring Instructions</h4>
<table>
<tbody>
<tr>
<th><strong>Color</strong></th>
<th><strong>Function</strong></th>
</tr>
<tr>
<td>Brown</td>
<td>V+</td>
</tr>
<tr>
<td>Black</td>
<td>GND</td>
</tr>
<tr>
<td>Yellow</td>
<td>RS485-A</td>
</tr>
<tr>
<td>Blue</td>
<td>RS485-B</td>
</tr>
</tbody>
</table>
<h2>Modbus Communication of the Soil Sensor</h2>
<p>Here are the specific configurations for the soil sensor that define how data is formatted, transmitted, and checked for errors in Modbus communication:</p>
<ul>
<li>8 bit binary</li>
<li>Parity bit= none</li>
<li>Stop bit= 1</li>
<li>Error checking &#8211; CRC</li>
<li>Baud rate = default 4800</li>
</ul>
<p>The following refers to specific Modbus register addresses in hexadecimal format and their associated data points for the soil sensor:</p>
<p>Address code=0x01 — the address of the peripheral device</p>
<p>Register address= 0x00 0x9C41 -moisture content<br />
Register address= 0x01 0x9C42 -temperature<br />
Register address= 0x02 0x9C43 -Conductivity<br />
Register address= 0x03 0x9C44 -pH value<br />
Register address= 07D0 0xA411 -Device Address<br />
Register address= 07D1 0xA412 -Device Baud Rate</p>
<table>
<tbody>
<tr>
<th><strong>Command</strong></th>
<th><strong>Baud Rate</strong></th>
</tr>
<tr>
<td>0</td>
<td>2400</td>
</tr>
<tr>
<td>1</td>
<td>4800</td>
</tr>
<tr>
<td>2</td>
<td>9600</td>
</tr>
</tbody>
</table>
<p>You can test this out in a program like <a href="https://apps.apple.com/us/app/modbus-rtu-master/id1551561587?mt=12">ModbusRTUmaster</a> to read moisture, temperature, conductivity, and PH value of the four-in-one device (address 0x01).</p>
<pre>0x01 0x03 0x00 0x00 0x00 0x04 0x44 0x09</pre>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-113112 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image16-255x500.png" alt="" width="255" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image16-255x500.png 255w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image16-509x1000.png 509w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image16.png 652w" sizes="auto, (max-width: 255px) 100vw, 255px" /></p>
<p>Here are some helpful details about the results:</p>
<p><b>Temperature calculation:</b><br />
When the temperature is lower than 0 °C, the temperature data is uploaded in the form of complement code.</p>
<p><b>Temperature:</b><br />
FF9B H(hex) = -101 =&gt; temperature = -10.1°C</p>
<p><b>Moisture calculation:</b><br />
292 H (Hex) = 658 =&gt; Humidity = 65.8%, that is, the soil volume moisture content is 65.8%.</p>
<p><b>Conductivity calculation:</b><br />
3E8 H (hex) = 1000 Conductivity = 1000 us/cm</p>
<p><b>PH value calculation:</b><br />
38H (hexadecimal) = 56 =&gt; PH value = 5.6</p>
<hr />
<h2>The Arduino Nano 33 IoT</h2>
<div>
<div style="float: left;"><img loading="lazy" decoding="async" src="https://store-usa.arduino.cc/cdn/shop/files/ABX00032_03.front_1000x750.jpg" alt="" width="333" height="250" /></div>
<div style="float: left;"><img loading="lazy" decoding="async" src="https://store-usa.arduino.cc/cdn/shop/files/ABX00032_01.iso_1000x750.jpg" alt="" width="333" height="250" /><br />
</a></div>
</div>
<div style="clear: both;"></div>
<p style="text-align: center;">
<a href="https://cdn.shopify.com/s/files/1/0438/4735/2471/files/ABX00032_03.front.jpg">Images from the Arduino Store</a>
</p>
<p>The Arduino Nano 33 IoT can be powered by the USB connector (5V) or through the Vin pin (4.5V &#8211; 21V). Its operating voltage is 3.3V.</p>
<hr />
<h2>Saving Power</h2>
<p>Here are two recommended approaches to save power with the Arduino Nano 33 IoT (We’ll be taking the second approach):</p>
<ol>
<li><a href="https://github.com/ostaquet/Arduino-Nano-33-IoT-Ultimate-Guide/blob/master/SavePowerSleeping.md">See how to put the Arduino Nano 33 IoT on sleep</a>.</li>
<li><a href="https://github.com/ostaquet/Arduino-Nano-33-IoT-Ultimate-Guide/blob/master/SavePowerRTC.md">See how to shut down the power of the Arduino Nano 33 IoT and wake up on a specific time with the RTC</a>.</li>
</ol>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-113118 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image22-500x500.png" alt="" width="500" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image22-500x500.png 500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image22-1000x1000.png 1000w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image22-150x150.png 150w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image22-768x768.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image22-1536x1536.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image22-125x125.png 125w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image22.png 1999w" sizes="auto, (max-width: 500px) 100vw, 500px" /></p>
<hr />
<h2>Setting up the Arduino Nano 33 IoT</h2>
<ol>
<li>Open the Arduino IDE</li>
<li>Create a new Sketch</li>
<li>Under Boards, add the <b>Arduino SAMD Boards<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113100" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image4-750x491.jpg" alt="" width="750" height="491" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image4-750x491.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image4-768x502.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image4.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></b></li>
<li>Select the board and port by clicking on the triangle in the box next to the debug icon:<br />
<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113101" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image5-750x488.png" alt="" width="750" height="488" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image5-750x488.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image5-1500x976.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image5-768x500.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image5-1536x1000.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image5.png 1999w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
</ol>
<h2>Setting up the MAX 485 TTL to RS485 Converter Module</h2>
<p>Here is some guidance for connecting  the Max 485 to the Arduino to the Soil Sensor</p>
<table>
<tbody>
<tr>
<th>Max 485</th>
<th>Description</th>
<th>Arduino</th>
<th>Soil Sensor</th>
</tr>
<tr>
<td>VCC</td>
<td>3.3 to 5V</td>
<td>USB</td>
<td>5V (Brown)</td>
</tr>
<tr>
<td>GND</td>
<td>Ground</td>
<td>GND</td>
<td>GND (Black)</td>
</tr>
<tr>
<td>A</td>
<td>RS485 A (Driver Output)</td>
<td></td>
<td>Yellow Wire</td>
</tr>
<tr>
<td>B</td>
<td>RS485 B (Driver Output)</td>
<td></td>
<td>Blue Wire</td>
</tr>
<tr>
<td>RO</td>
<td>Receiver Output</td>
<td>RX (0)</td>
<td></td>
</tr>
<tr>
<td>DE</td>
<td>Driver Enable Input</td>
<td>10</td>
<td></td>
</tr>
<tr>
<td>RE</td>
<td>Receiver Enable Input</td>
<td>10</td>
<td></td>
</tr>
<tr>
<td>DI</td>
<td>Driver Input</td>
<td>TX (1)</td>
<td></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<ol>
<li>Wire up the circuit:
<ul>
<li>Tie RE to DE with a small wire</li>
<li>Connect RO to RX</li>
<li>Connect DI to  TX</li>
<li>Connect Ground to common GND</li>
<li>Connect VCC to the V35 5V</li>
<li>Connect RS485 DATA B to Soil Sensor Blue</li>
<li>Connect RS485 DATA A to Soil Sensor Yellow</li>
<li>Soil Sensor Brown to V35 5V</li>
<li>Soil Sensor Black to GND<img loading="lazy" decoding="async" class="alignnone wp-image-113492 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/nano_soil-1-750x296.jpg" alt="" width="750" height="296" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/nano_soil-1-750x296.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/nano_soil-1-768x303.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/nano_soil-1.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
</ul>
</li>
<li>In the Arduino IDE add the following library:<b>ModbusMaster</b> by Doc Walker</li>
<li>Make sure that the Nano 33 IoT board and USB port are selected.</li>
<li>The function we are interested in is
<p>[code] 0x03 – Read Holding Registers:readHoldingRegisters(uint16_t u16ReadAddress, uint16_t u16ReadQty);[/code]</p>
<p>Copy and paste this code into the Sketch:</p>
<p>[code lang=&#8221;arduino&#8221;]// github link: https://github.com/4-20ma/ModbusMaster</p>
<p>#include &amp;lt;ModbusMaster.h&amp;gt;</p>
<p>/* Modbus stuff */<br />
#define MODBUS_DIR_PIN 10        // connect DR, RE pin of MAX485 to gpio 10<br />
#define MODBUS_RX_PIN 0          // Rx pin<br />
#define MODBUS_TX_PIN 1          // Tx pin<br />
#define MODBUS_SERIAL_BAUD 4800  // Baud rate for max485 communication</p>
<p>//Initialize the ModbusMaster object as node</p>
<p>ModbusMaster node;<br />
float moisture, pH, conductivity, temperature;</p>
<p>// Pin 10 made high for Modbus transmision mode</p>
<p>void modbusPreTransmission() {<br />
 delay(500);<br />
 digitalWrite(MODBUS_DIR_PIN, HIGH);<br />
}</p>
<p>// Pin 10 made low for Modbus receive mode<br />
void modbusPostTransmission() {<br />
 digitalWrite(MODBUS_DIR_PIN, LOW);<br />
 delay(500);<br />
}</p>
<p>void setup() {<br />
 // serial communication<br />
 Serial.begin(9600);<br />
 pinMode(MODBUS_DIR_PIN, OUTPUT);<br />
 digitalWrite(MODBUS_DIR_PIN, LOW);</p>
<p> //Serial1.begin(baud-rate, protocol, RX pin, TX pin);.<br />
 Serial1.begin(MODBUS_SERIAL_BAUD);<br />
 <br />
//modbus slave ID 1<br />
 node.begin(1, Serial1);</p>
<p> //  callbacks allow us to configure the RS485 transceiver correctly<br />
 node.preTransmission(modbusPreTransmission);<br />
 node.postTransmission(modbusPostTransmission);</p>
<p>}</p>
<p>void loop() {<br />
 uint8_t result;</p>
<p> //Modbus function 0x03 Read Holding Registers<br />
 result = node.readHoldingRegisters(0, 4);</p>
<p> if (result == node.ku8MBSuccess) {<br />
   Serial.println(&quot;Success, Received data: &quot;);<br />
   Serial.print(&quot;Moisture: &quot;);</p>
<p>   // we just convert the uint16_t type data array to float type using type casting<br />
   moisture = float(node.getResponseBuffer(0)) * 0.1f;<br />
   temperature = float(node.getResponseBuffer(1)) * 0.1f;<br />
   conductivity = float(node.getResponseBuffer(2));<br />
   pH = float(node.getResponseBuffer(3)) * 0.1f;<br />
   <br />
   Serial.print(&quot;Moisture: &quot;);<br />
   Serial.print(moisture);<br />
   Serial.println(&quot;%&quot;);<br />
   Serial.print(&quot;Temperature: &quot;);<br />
   temperature = (temperature * 9) / 5 + 32;<br />
   Serial.print(temperature);<br />
   Serial.println(&quot;°F&quot;);<br />
   Serial.print(&quot;Conductivity: &quot;);<br />
   Serial.print(conductivity);<br />
   Serial.println(&quot;us/cm&quot;);<br />
   Serial.print(&quot;pH value: &quot;);<br />
   Serial.println(pH);<br />
 }else {</p>
<p> Serial.print(&quot;Failed, Response Code: &quot;);<br />
 Serial.print(result, HEX);<br />
 Serial.println(&quot;&quot;);<br />
 delay(5000);<br />
}<br />
delay(1000);</p>
<p>}[/code]</p>
</li>
<li>Here are the <a href="https://4-20ma.io/ModbusMaster/group__constant.html">error codes.</a>.<br />
If you get an error, make sure:</p>
<ul>
<li>Your wires are connected properly</li>
<li>Your sensor is receiving enough power</li>
<li>Your sensor is in the dirt</li>
</ul>
</li>
</ol>
<h2>Power Consumption</h2>
<p>We still need to put the board to sleep to conserve power. In order to keep our project alive for months/years on the battery/panel strategy, we need to minimize our power consumption. Below you will find two approaches (I’ll be using the second approach).</p>
<h3><b>Approach One: ArduinoLowPower with N-Channel MOSFET</b></h3>
<p>The Arduino Nano 33 IoT can be put into various sleep modes to reduce power consumption. The <b>ArduinoLowPower</b> library is one way to put the board into idle or deep sleep modes. We’ll also need to turn off the sensor. One strategy for turning off the sensor is to use an N-channel mosfet.</p>
<p>Here’s the pseudocode:</p>
<ul>
<li>Turn off the sensor</li>
<li>Shutdown power during sleep cycle</li>
<li>Wake up the board at a predefined interval</li>
<li>Turn on the sensor</li>
</ul>
<p>Parts Needed:</p>
<ul>
<li>1x resistor 10kOhms</li>
<li>IRFZ44N N-channel MOSFET<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113129" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image33-471x500.jpg" alt="" width="471" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image33-471x500.jpg 471w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image33-768x816.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image33.jpg 772w" sizes="auto, (max-width: 471px) 100vw, 471px" /></li>
</ul>
<ol>
<li>Wire up the circuit with an N-Channel MOSFET. I’m using an IRFZ44N Mosfet. An N-Channel Mosfet allows us to connect the GNDs of the sensors and board together.</li>
<li>Place a 10KΩ resistor between the Gate (pin 1) and the Source (pin 3).</li>
<li>Pull the Source (pin 3) down by connecting it to GND.</li>
<li>Connect the Drain (pin 2) to the ground of the MAX 485 module.</li>
<li>Connect the Gate (pin 1)  to Nano D2.<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113117" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image21-750x298.jpg" alt="" width="750" height="298" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image21-750x298.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image21-768x306.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image21.jpg 1191w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
</ol>
<p>When adding sleep functions, add a long delay in the setup() function so that you have an opportunity to reprogram the board. Just reset the board to initiate the setup() function.</p>
<ol>
<li>Adjust your code:
<ul>
<li>Include the Arduino Low Power library</li>
<li>Add an instance variable for the transistor pin:
<p>[code]int transistorPin=2;[/code]</p>
</li>
<li>Add another variable called counter. This will keep track of how many times we poll the sensor before calling a sleep function
<p>[code]int counter=0;[/code]</p>
</li>
<li>Add another variable named <code>seconds</code> of type int and set it to 30:
<p>[code]int seconds=30;[/code]</p>
</li>
<li>Add a long delay in setup():
<p>[code]delay(5000);[/code]</p>
</li>
<li>Set the pin to an OUTPUT in setup() and set it to LOW:
<p>[code lang=&#8221;arduino&#8221;]pinMode(transistorPin, OUTPUT);</p>
<p>digitalWrite(transistorPin, LOW);<br />
[/code]</p>
</li>
<li>Set counter to 0:
<p>[code]counter=0;[/code]</p>
</li>
<li>Set the transistorPin HIGH after you connect to the Arduino Cloud. You can do that by adding the line <code>digitalWrite(transistorPin, HIGH);</code> after <code>ArduinoCloud.begin(ArduinoIoTPreferredConnection);</code> in <code>setup()</code></li>
<li>In loop, nest the sensor code in a conditional that runs if <code>counter&lt;5</code>.</li>
<li>At the end of the conditional, increment <code>counter</code> by 1.</li>
<li>If the condition is not met, call this function: <code>callForSleep()</code></li>
<li>Create a  <code>callForSleep()</code> function</li>
<li>Inside the <code>callForSleep()</code> set the transistor pin to low before you call the sleep function:
<pre>digitalWrite(transistorPin,LOW);
</pre>
</li>
<li>Call sleep after setting the transistorPin <code>LOW</code>
<pre>LowPower.deepSleep(seconds * 1000);</pre>
</li>
<li>Call <code>setup()</code></li>
</ul>
</li>
</ol>
<h3><b>Approach Two: RTC and P-Channel MOSFET</b></h3>
<p>This second strategy involves a RTC module and P-channel mosfet. This strategy basically does the following (you can find more information in <a href="https://github.com/ostaquet">Olivier Staquet</a>’s <a href="https://github.com/ostaquet/Arduino-Nano-33-IoT-Ultimate-Guide/blob/master/SavePowerRTC.md">Arduino-Nano-33-IoT-Ultimate-Guide</a>):</p>
<ul>
<li>Shutdowns all the power of the circuit during the sleep cycle</li>
<li>Wakes up the microcontroller at a predefined interval (every minute, every hour, every day or at a specific moment).</li>
<li>Consumes only the power required for the RTC clock</li>
</ul>
<p><strong>Parts Needed:</strong></p>
<ul>
<li><a href="https://www.adafruit.com/product/3013">Adafruit DS3231 Precision RTC Breakout</a></li>
<li>1x resistor 10k Ohms</li>
<li>1x resistor 100 Ohms</li>
<li>IRF9520  P-channel MOSFET</li>
<li><a href="https://www.amazon.com/Pololu-Step-Up-Step-Down-Voltage-Regulator/dp/B01M4KIS7K/ref=sr_1_1">Pololu S7V7F5 voltage regulator</a></li>
</ul>
<ol>
<li>Wire up this circuit
<ul>
<li>Add the DS3231, Voltage Regulator, and MOSFET to your breadboard</li>
<li aria-level="1"><b>DS3231 connections</b>
<ul>
<li>Connect VIN to VOUT of your Voltage Regulator</li>
<li>Connect GND to common ground</li>
<li>Connect SCL to Nano A5</li>
<li>Connect SDA to Nano A4</li>
<li>Connect SQW to MOSFET Gate (pin 1)</li>
<li>Connect SQW to VOUT of your Voltage Regulator through a 10KΩ Resistor</li>
</ul>
</li>
<li aria-level="1"><b>Voltage Regulator connections</b>
<ul>
<li>Connect GND to common ground</li>
<li>Connect VIN to 5V</li>
</ul>
</li>
<li aria-level="1"><b>MOSFET connections</b>
<ul>
<li>Connect Drain (pin 2) to common ground through a 100Ω Resistor</li>
<li>Connect Drain (pin 2) to Nano VIN</li>
<li>Connect Source (pin 3) to 5V<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113132" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image36-750x428.jpg" alt="" width="750" height="428" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image36-750x428.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image36-768x438.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image36.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
</ul>
</li>
</ul>
<p><a href="https://github.com/ostaquet/Arduino-Nano-33-IoT-Ultimate-Guide/blob/master/SavePowerRTC.md">https://github.com/ostaquet/Arduino-Nano-33-IoT-Ultimate-Guide/blob/master/SavePowerRTC.md</a></p>
<ol>
<li>Download and install  <a href="https://github.com/NorthernWidget/DS3231">library DS3231 by NothernWidget</a></li>
<li>Include the DS3231 library in your sketch.</li>
<li>Add the following to the top of your sketch:
<p>[code lang=&#8221;arduino&#8221;]<br />
#include &amp;lt;Wire.h&amp;gt;<br />
#include &amp;lt;DS3231.h&amp;gt;<br />
#include &amp;lt;SPI.h&amp;gt;<br />
[/code]</p>
</li>
<li>Add this global variable:
<p>[code lang=&#8221;arduino&#8221;]<br />
DS3231 Clock;<br />
[/code]</p>
</li>
<li>In <code>setup()</code> before <code>Serial.begin()</code>, set up the RTC:
<p>[code lang=&#8221;arduino&#8221;]<br />
// Start the I2C interface</p>
<p>Wire.begin();</p>
<p>// Initialize the RTC clock</p>
<p>// Disable alarm</p>
<p>Clock.turnOffAlarm(2);</p>
<p>// Disable oscialltor</p>
<p>Clock.enableOscillator(false, false, 0);</p>
<p>// Disable 32kHz output</p>
<p>Clock.enable32kHz(false);</p>
<p>// Set in 24-hour mode</p>
<p>Clock.setClockMode(false);<br />
[/code]</p>
</li>
<li>Before the end of setup(), add the following:
<p>[code lang=&#8221;arduino&#8221;]<br />
// Prepare the next execution (defined by the day, hour, minute, second) + interval<br />
// Interval:<br />
//   0b1111 // each second<br />
//   0b1110 // Once per minute (when second matches)<br />
//   0b1100 // Once per hour (when minute and second matches)<br />
//   0b1000 // Once per day (when hour, minute and second matches)<br />
//   0b0000 // Once per month when date, hour, minute and second matches. Once per week if day of the week and A1Dy=true<br />
// Set alarm to happen every minute (change to your wanted interval)</p>
<p>// Every time the seconds match 4 (every minute at the 4th second, the system wakes up)<br />
Clock.setA1Time(1, 2, 3, 4, 0b1110, false, false, false);</p>
<p>Clock.turnOnAlarm(1);</p>
<p>// Empty the I2C buffer<br />
while (Wire.available()) {<br />
Wire.read();</p>
<p>}<br />
[/code]</p>
</li>
<li>In your loop() function find these lines:
<p>[code lang=&#8221;arduino&#8221;]<br />
} else {<br />
Serial.print(&quot;Failed, Response Code: &quot;);<br />
Serial.print(result, HEX);<br />
Serial.println(&quot;&quot;);<br />
delay(5000);<br />
}<br />
[/code]</p>
</li>
<li>Paste in the following after the else closes:
<p>[code lang=&#8221;arduino&#8221;]<br />
// End doing something<br />
// Reset alarm is the last instruction of the program<br />
// When we reset the alarm, the power is shutdown for the system<br />
Clock.checkIfAlarm(1);</p>
<p>// We never arrive here because the alarm is cleared<br />
// on the RTC which cause the shutdown of the circuit<br />
while (1)<br />
;[/code]</p>
</li>
<li>Verify and Upload</li>
<li>Disconnect from the computer to test.</li>
<li>When satisfied with the code, reconnect and change to wake up every hour.</li>
</ol>
<p>Here is the complete circuit diagram:<br />
<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113137" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image41-750x428.jpg" alt="" width="750" height="428" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image41-750x428.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image41-768x438.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image41.jpg 921w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
<h2>Connecting to Wi-Fi</h2>
<p>If we want to connect to a publish dashboard, we’ll have to modify our code a bit.</p>
<p>The Nano 33 IoT’s embedded Wifi module is the <a href="https://content.u-blox.com/sites/default/files/NINA-W10_DataSheet_UBX-17065507.pdf">NINA W102</a> ESP32 based module. It provides support of Wifi 802.11 b/g/n in the 2.4 GHz band and Bluetooth v4.2 (Bluetooth BR/EDR and Bluetooth Low Energy BLE). The module is fully compatible with the <a href="https://www.arduino.cc/en/Reference/WiFiNINA">official WiFiNINA library</a>.</p>
<ol>
<li>Open a new Sketch.</li>
<li>To install the <b>WiFiNINA by Arduino </b>library in the Arduino IDE. Click on the library icon on the left side, search for WifiNINA and click the INSTALL button to install the library:<br />
<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113141" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image45-750x490.jpg" alt="" width="750" height="490" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image45-750x490.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image45-768x502.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image45.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Replace the current sketch with:
<p>[code lang=&#8221;arduino&#8221;]/*<br />
 WiFi Web Server LED Blink<br />
A simple web server that lets you blink an LED via the web.<br />
This sketch will print the IP address of your WiFi module (once connected)<br />
to the Serial Monitor. From there, you can open that address in a web browser<br />
to turn on and off the LED on pin 9.<br />
If the IP address of your board is yourAddress:<br />
http://yourAddress/H turns the LED on<br />
http://yourAddress/L turns it off<br />
This example is written for a network using WPA encryption. For<br />
WEP or WPA, change the WiFi.begin() call accordingly.<br />
Circuit:<br />
* Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and Uno WiFi Rev.2)<br />
* LED attached to pin 9<br />
created 25 Nov 2012<br />
by Tom Igoe<br />
*/<br />
#include &amp;lt;SPI.h&amp;gt;<br />
#include &amp;lt;WiFiNINA.h&amp;gt;<br />
#include &quot;arduino_secrets.h&quot;<br />
///////please enter your sensitive data in the Secret tab/arduino_secrets.h<br />
char ssid[] = SECRET_SSID;        // your network SSID (name)<br />
char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)<br />
int keyIndex = 0;                 // your network key index number (needed only for WEP)<br />
int status = WL_IDLE_STATUS;<br />
WiFiServer server(80);<br />
void setup() {<br />
 Serial.begin(9600);      // initialize serial communication<br />
 pinMode(LED_BUILTIN, OUTPUT);      // set the LED pin mode<br />
 // check for the WiFi module:<br />
 if (WiFi.status() == WL_NO_MODULE) {<br />
   Serial.println(&quot;Communication with WiFi module failed!&quot;);<br />
   // don&#039;t continue<br />
   while (true);<br />
 }<br />
 String fv = WiFi.firmwareVersion();<br />
 if (fv &amp;lt; WIFI_FIRMWARE_LATEST_VERSION) {<br />
   Serial.println(&quot;Please upgrade the firmware&quot;);<br />
 }<br />
 // attempt to connect to WiFi network:<br />
 while (status != WL_CONNECTED) {<br />
   Serial.print(&quot;Attempting to connect to Network named: &quot;);<br />
   Serial.println(ssid);                   // print the network name (SSID);<br />
   // Connect to WPA/WPA2 network. Change this line if using open or WEP network:<br />
   status = WiFi.begin(ssid, pass);<br />
   // wait 10 seconds for connection:<br />
   delay(10000);<br />
 }<br />
 server.begin();                           // start the web server on port 80<br />
 printWifiStatus();                        // you&#039;re connected now, so print out the status<br />
}<br />
void loop() {<br />
 WiFiClient client = server.available();   // listen for incoming clients<br />
 if (client) {                             // if you get a client,<br />
   Serial.println(&quot;new client&quot;);           // print a message out the serial port<br />
   String currentLine = &quot;&quot;;                // make a String to hold incoming data from the client<br />
   while (client.connected()) {            // loop while the client&#039;s connected<br />
     if (client.available()) {             // if there&#039;s bytes to read from the client,<br />
       char c = client.read();             // read a byte, then<br />
       Serial.write(c);                    // print it out to the serial monitor<br />
       if (c == &#039;\n&#039;) {                    // if the byte is a newline character<br />
         // if the current line is blank, you got two newline characters in a row.<br />
         // that&#039;s the end of the client HTTP request, so send a response:<br />
         if (currentLine.length() == 0) {<br />
           // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)<br />
           // and a content-type so the client knows what&#039;s coming, then a blank line:<br />
           client.println(&quot;HTTP/1.1 200 OK&quot;);<br />
           client.println(&quot;Content-type:text/html&quot;);<br />
           client.println();<br />
           // the content of the HTTP response follows the header:<br />
           client.print(&quot;Click &amp;lt;a href=\&quot;/H\&quot;&amp;gt;here&amp;lt;/a&amp;gt; turn the BUILTIN LED  on&amp;lt;br&amp;gt;&quot;);<br />
           client.print(&quot;Click &amp;lt;a href=\&quot;/L\&quot;&amp;gt;here&amp;lt;/a&amp;gt; turn the BUILTIN LED off&amp;lt;br&amp;gt;&quot;);<br />
           // The HTTP response ends with another blank line:<br />
           client.println();<br />
           // break out of the while loop:<br />
           break;<br />
         } else {    // if you got a newline, then clear currentLine:<br />
           currentLine = &quot;&quot;;<br />
         }<br />
       } else if (c != &#039;\r&#039;) {  // if you got anything else but a carriage return character,<br />
         currentLine += c;      // add it to the end of the currentLine<br />
       }<br />
       // Check to see if the client request was &quot;GET /H&quot; or &quot;GET /L&quot;:<br />
       if (currentLine.endsWith(&quot;GET /H&quot;)) {<br />
         digitalWrite(LED_BUILTIN, HIGH);               // GET /H turns the LED on<br />
       }<br />
       if (currentLine.endsWith(&quot;GET /L&quot;)) {<br />
         digitalWrite(LED_BUILTIN, LOW);                // GET /L turns the LED off<br />
       }<br />
     }<br />
   }<br />
   // close the connection:<br />
   client.stop();<br />
   Serial.println(&quot;client disconnected&quot;);<br />
 }<br />
}<br />
void printWifiStatus() {<br />
 // print the SSID of the network you&#039;re attached to:<br />
 Serial.print(&quot;SSID: &quot;);<br />
 Serial.println(WiFi.SSID());<br />
 // print your board&#039;s IP address:<br />
 IPAddress ip = WiFi.localIP();<br />
 Serial.print(&quot;IP Address: &quot;);<br />
 Serial.println(ip);<br />
 // print the received signal strength:<br />
 long rssi = WiFi.RSSI();<br />
 Serial.print(&quot;signal strength (RSSI):&quot;);<br />
 Serial.print(rssi);<br />
 Serial.println(&quot; dBm&quot;);<br />
 // print where to go in a browser:<br />
 Serial.print(&quot;To see this page in action, open a browser to http://&quot;);<br />
 Serial.println(ip);<br />
}[/code]</p>
</li>
<li>Create a new tab and name it <b>arduino_secrets.h</b>. Then add the following and include your network (yourssid) and password (yourpasswd):
<p>[code lang=&#8221;arduino&#8221;]#define SECRET_SSID &quot;yourssid&quot;<br />
#define SECRET_PASS &quot;yourpasswd&quot;<br />
[/code]</p>
</li>
<li>Upload, open the Serial monitor, and then follow the instructions to test.</li>
</ol>
<h2>Connecting to a Public Dashboard &#8211; Qubitro</h2>
<p>For our public dashboard, we’ll use  <a href="https://www.qubitro.com/">Qubitro</a> and the MQTT protocol.</p>
<p>MQTT is a lightweight application layer messaging protocol designed for resource-constrained devices used for IoT applications.  It utilizes  a topic-based, <b>publish-subscribe,</b> or <b>Pub/Sub</b> model where the protocol defines how IoT devices can publish and subscribe to data over the Internet. There is a sender (Publisher) and a receiver (Subscriber) and they communicate by topics.</p>
<p>MQTT is the most commonly used messaging protocol for IoT because:</p>
<ul>
<li>It is lightweight and efficient- Its small code footprint and minimal network bandwidth usage enable efficient communication even in constrained environments</li>
<li>Low power consumption &#8211; This makes it suitable for battery-operated IoT devices, such as sensors and actuators, that need to conserve power to extend battery life&lt;</li>
<li>Easy to implement and has numerous libraries and associated tools</li>
<li>Supports bi-directional messaging between device and cloud</li>
<li>Can scale easily to handle a large number of devices</li>
<li>Can support levels of reliable message delivery &#8211; the three levels of <b>Quality of Service</b> allow developers to balance between overhead and the importance of message delivery guarantees</li>
<li>Works well over unreliable networks- the Pub/Sub model makes it suitable for IoT devices that might be operating on limited data plans or in areas with poor network connectivity.</li>
<li>Works with TLS/SSL and common authentication protocols</li>
</ul>
<p>Before we can send data, we need to create a new MQTT source at Qubitro.</p>
<ol>
<li>Create an account or log into your <a href="https://www.qubitro.com/">Qubitro</a> account.</li>
<li>Create a New Project: <img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113110" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image14-750x234.jpg" alt="" width="750" height="234" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image14-750x234.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image14-768x240.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image14.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Add the details to your project and click on the Create button:<br />
<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113139" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image43-750x383.png" alt="" width="750" height="383" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image43-750x383.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image43-1500x766.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image43-768x392.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image43-1536x785.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image43.png 1999w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Select the project:<br />
<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113115" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image19-750x287.jpg" alt="" width="750" height="287" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image19-750x287.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image19-768x294.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image19.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>On the project detail page, click on the <b>New Source</b> button:<br />
<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113127" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image31-750x232.jpg" alt="" width="750" height="232" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image31-750x232.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image31-768x237.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image31.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Select MQTT:<br />
<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113103" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image7-750x233.jpg" alt="" width="750" height="233" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image7-750x233.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image7-768x238.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image7.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Complete the details:<br />
<img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113099" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image3-750x448.jpg" alt="" width="750" height="448" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image3-750x448.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image3-768x458.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image3.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Click on the project again and select <b>Connection details</b>: <img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-113113" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image17-750x426.jpg" alt="" width="750" height="426" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image17-750x426.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image17-768x436.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/image17.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>You’ll need the USERNAME and PASSWORD for your Arduino Code.</li>
<li>Create a New Sketch.</li>
<li>Select your board and USB port.</li>
<li>Create a new tab named “arduino_secrets.h”</li>
<li>Complete the following:
<p>[code lang=&#8221;arduino&#8221;]#define WiFi_ID &quot;[YOUR Network]&quot;<br />
#define WiFi_PASSWORD &quot;[YOUR password]&quot;<br />
#define DEVICE_ID &quot;[Qubitro USERNAME]&quot;<br />
#define DEVICE_TOKEN &quot;[Qubitro TOKEN]&quot;<br />
[/code]</p>
</li>
<li>Back in main Sketch, replace the current contents with the following:
<p>[code lang=&#8221;arduino&#8221;]#include &amp;lt;QubitroMqttClient.h&amp;gt;<br />
#include &amp;lt;WiFiNINA.h&amp;gt;<br />
#include &amp;lt;Wire.h&amp;gt;<br />
#include &amp;lt;DS3231.h&amp;gt;<br />
#include &amp;lt;SPI.h&amp;gt;<br />
#include &amp;lt;ModbusMaster.h&amp;gt;<br />
#include &quot;ArduinoLowPower.h&quot;<br />
#include &quot;arduino_secrets.h&quot;</p>
<p>#define PERIOD 5000</p>
<p>// Global variables<br />
DS3231 Clock;</p>
<p>WiFiClient wifiClient;<br />
QubitroMqttClient mqttClient(wifiClient);</p>
<p>// WiFi Credentials<br />
char ssid[] = WiFi_ID;<br />
char pass[] = WiFi_PASSWORD;</p>
<p>char deviceID[] = DEVICE_ID;<br />
char deviceToken[] = DEVICE_TOKEN;<br />
char host[] = &quot;broker.qubitro.com&quot;;<br />
int port = 1883;</p>
<p>/* Modbus stuff */<br />
#define MODBUS_DIR_PIN 10        // connect DR, RE pin of MAX485 to gpio 10<br />
#define MODBUS_RX_PIN RX         // Rx pin<br />
#define MODBUS_TX_PIN TX         // Tx pin<br />
#define MODBUS_SERIAL_BAUD 4800  // Baud rate for max485 communication</p>
<p>unsigned long next = 0;<br />
int publishCounter = 0;<br />
int counter = 0;<br />
int wifiCounter = 0;</p>
<p>ModbusMaster node;<br />
float moisture, pH, conductivity, temperature, voltage, battery;<br />
// Pin 10 made high for Modbus transmision mode<br />
void modbusPreTransmission() {<br />
  delay(500);<br />
  digitalWrite(MODBUS_DIR_PIN, HIGH);<br />
}<br />
// Pin 10 made low for Modbus receive mode<br />
void modbusPostTransmission() {<br />
  digitalWrite(MODBUS_DIR_PIN, LOW);<br />
  delay(500);<br />
}</p>
<p>void setup() {<br />
  // Warm-up<br />
  delay(5000);<br />
  analogReadResolution(12);<br />
  // Start the I2C interface<br />
  Wire.begin();</p>
<p>  int wifiCounter = 0;<br />
  // Initialize serial port<br />
  Serial.begin(9600);</p>
<p>  // connect to Wifi network:<br />
  Serial.print(&quot;Connecting to WiFi&#8230;&quot;);<br />
  WiFi.begin(ssid, pass);<br />
  while (WiFi.status() != WL_CONNECTED) {<br />
    if (wifiCounter &amp;lt; 5) {<br />
    	Serial.print(&quot;.&quot;);<br />
    	delay(1000);<br />
    	wifiCounter++;<br />
 		status = WiFi.begin(ssid, pass);<br />
 	} else {<br />
 		LowPower.sleep(2000);<br />
 		NVIC_SystemReset();<br />
 		setup();<br />
 	}<br />
	} </p>
<p>	Serial.println(&quot;\tConnected to the WiFi !&quot;);<br />
	// You need to provide device id and device token mqttClient.setId(deviceID);<br />
 	mqttClient.setDeviceIdToken(deviceID, deviceToken);<br />
 	Serial.println(&quot;Connecting to Qubitro&#8230;&quot;);<br />
 	if (!mqttClient.connect(host, port)) {<br />
 		Serial.println(&quot;Connection failed! Error code = &quot;);<br />
 	Serial.println(mqttClient.connectError());<br />
 	Serial.println(&quot;Visit docs.qubitro.com or create a new issue on github.com/qubitro&quot;);<br />
 	while (1) ;<br />
 	} </p>
<p> 	Serial.println(&quot;Connected to the Qubitro !&quot;);<br />
 	mqttClient.onMessage(receivedMessage);<br />
 	mqttClient.subscribe(deviceID);<br />
 	// Initialize the RTC clock // Disable alarm Clock.turnOffAlarm(2);<br />
 	// Disable oscialltor Clock.enableOscillator(false, false, 0);<br />
 	// Disable 32kHz output Clock.enable32kHz(false);<br />
 	// Set in 24-hour mode Clock.setClockMode(false);<br />
 	// Serial communication Serial.begin(9600);<br />
 	pinMode(MODBUS_DIR_PIN, OUTPUT);<br />
 	digitalWrite(MODBUS_DIR_PIN, LOW);<br />
 	counter = 0;<br />
 	publishCounter = 0;</p>
<p> 	//Serial1.begin(baud-rate, protocol, RX pin, TX pin);<br />
	Serial1.begin(MODBUS_SERIAL_BAUD);</p>
<p> 	//modbus slave ID 1 node.begin(1, Serial1);<br />
 	// callbacks allow us to configure the RS485 transceiver correctly 		</p>
<p> 	node.preTransmission(modbusPreTransmission);<br />
 	node.postTransmission(modbusPostTransmission);</p>
<p> 	// Prepare the next execution (defined by the day, hour, minute, second) + interval<br />
  	// Interval:<br />
  	//   0b1111 // each second<br />
  	//   0b1110 // Once per minute (when second matches)<br />
  	//   0b1100 // Once per hour (when minute and second matches)<br />
  	//   0b1000 // Once per day (when hour, minute and second matches)<br />
  	//   0b0000 // Once per month when date, hour, minute and second matches. Once per week if day of the week and A1Dy=true<br />
	// Every time the seconds match 4 (every minute at the 4th second, the system wakes up)<br />
	Clock.setA1Time(1, 2, 3, 4, 0b1110, false, false, false);<br />
 	Clock.turnOnAlarm(1);</p>
<p> 	// Empty the I2C buffer while (Wire.available()) { Wire.read();<br />
 	}<br />
 	Serial.println(&quot;here&quot;);<br />
 } </p>
<p>void loop() {<br />
 	mqttClient.poll();<br />
 	if (millis() &amp;gt; next) {<br />
    	next = millis() + PERIOD;</p>
<p>    	// Change if possible to have a message over 256 characters<br />
    	readModVals();<br />
    	publishSensorVal();<br />
    	publishCounter++;<br />
  	}<br />
}</p>
<p>void receivedMessage(int messageSize) {<br />
  Serial.print(&quot;New message received:&quot;);<br />
  Serial.print(mqttClient.messageTopic());<br />
  Serial.print(&quot;&#039;, length &quot;);<br />
  Serial.print(messageSize);<br />
  Serial.println(&quot; bytes:&quot;);<br />
  // We want to read each character into a useable String<br />
  String content = &quot;&quot;;<br />
  char character;<br />
  while (mqttClient.available()) {<br />
    character = Serial.print((char)mqttClient.read());<br />
    content.concat(character);<br />
  }<br />
  Serial.println(content);<br />
  Serial.println();<br />
  Serial.println();<br />
  timeToTurnOff();<br />
}</p>
<p>void timeToTurnOff() {<br />
  Serial.println(&quot;sleep&quot;);<br />
  Clock.checkIfAlarm(1);</p>
<p>  // We never arrive here because the alarm is cleared<br />
  // on the RTC which cause the shutdown of the circuit<br />
  while (1)<br />
    ;<br />
}</p>
<p>//Modbus function 0x03 Read Holding Registers<br />
    result = node.readHoldingRegisters(0, 5);</p>
<p>    if (result == node.ku8MBSuccess) {<br />
      Serial.println(&quot;Success, Received data: &quot;);</p>
<p>      Serial.print(&quot;Moisture: &quot;);<br />
      // we just convert the uint16_t type data array to float type using type casting<br />
      moisture = float(node.getResponseBuffer(0)) * 0.1f;<br />
      temperature = float(node.getResponseBuffer(1)) * 0.1f;<br />
      conductivity = float(node.getResponseBuffer(2));<br />
      pH = float(node.getResponseBuffer(3)) * 0.1f;<br />
      float salinity = float(node.getResponseBuffer(4)) * 0.1f;</p>
<p>      Serial.print(&quot;Moisture: &quot;);<br />
      Serial.print(moisture);<br />
      Serial.println(&quot;%&quot;);</p>
<p>      Serial.print(&quot;Temperature: &quot;);<br />
      temperature = (temperature * 9) / 5 + 32;<br />
      Serial.print(temperature);<br />
      Serial.println(&quot;°F&quot;);</p>
<p>      Serial.print(&quot;Conductivity: &quot;);<br />
      Serial.print(conductivity);<br />
      Serial.println(&quot;us/cm&quot;);</p>
<p>      Serial.print(&quot;pH value: &quot;);<br />
      Serial.println(pH);</p>
<p>      &lt;!&#8211;/*First, let’s divide the reading we’re getting from the ADC by 4095 to get a reading in what we could call ADC ‘units’. Now we have 4095ths of 3.3V incoming. Multiply by 3.3 to give us a voltage reading (dplus) We’re at the mid-point of the voltage divider, half the actual battery voltage, so to get the latter we need to multiply by 2.(voltage)*/ float dPlus = float(analogRead(A0)) / 4095 * 3.3; voltage = dPlus * 2 * 0.78; battery = voltage / 4.2 * 100; Serial.print(&quot;D+ &quot;); Serial.println(voltage); Serial.print(&quot;Battery &quot;); Serial.println(battery);&#8211;&gt;</p>
<p>      delay(1000);<br />
    }<br />
  }<br />
}</p>
<p>void publishSensorVal() {</p>
<p>  // Change if possible to have a message over 256 characters<br />
  static char payload[256];</p>
<p>  snprintf(payload, sizeof(payload) &#8211; 1, &quot;{\&quot;m\&quot;:%.2f,\&quot;t\&quot;:%.2f,\&quot;c\&quot;:%.2f,\&quot;pH\&quot;:%.2f}&quot;,<br />
           moisture, temperature, conductivity, pH);</p>
<p>  if (publishCounter &amp;gt;= 2) {<br />
    mqttClient.beginMessage(deviceID);<br />
    // Send value<br />
    mqttClient.print(payload);<br />
    mqttClient.endMessage();<br />
    delay(1000);<br />
  }<br />
}<br />
[/code]</p>
</li>
<li>Set up your <a href="https://portal.qubitro.com/57bb0fc2-e1b4-46ed-9e94-117601d68260">Qubitro dashboard</a>:<a href="https://portal.qubitro.com/57bb0fc2-e1b4-46ed-9e94-117601d68260"><img loading="lazy" decoding="async" class="aligncenter wp-image-113196 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-14-at-11.18.27 AM-308x500.png" alt="Qubitro Dashboard" width="308" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-14-at-11.18.27 AM-308x500.png 308w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-14-at-11.18.27 AM-615x1000.png 615w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-14-at-11.18.27 AM-768x1248.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/Screenshot-2024-03-14-at-11.18.27 AM.png 822w" sizes="auto, (max-width: 308px) 100vw, 308px" /></a></li>
</ol>
<h2>Characterizing Power Consumption</h2>
<p>Now that we have taken steps to reduce the power consumption, we need to determine how much power our current system draws.</p>
<p>We need to measure the power consumption when sensing, transmitting, and sleeping. Once we have those values, we can use this <a href="https://voltaicsystems.com/tool-for-small-panels/">calculator</a> to determine what size panel we’ll need.</p>
<p><b>Power consumption of Microcontroller</b></p>
<p><b>Power consumption of Battery</b></p>
<p><b>Power consumption of RTC</b></p>
<table>
<tbody>
<tr>
<th></th>
<th><b>Sensing/Awake</b></th>
<th><b>Transmitting</b></th>
<th><b>Sleeping</b></th>
</tr>
<tr>
<td>Microcontroller</td>
<td>60mA</td>
<td>140mA</td>
<td>9mA</td>
</tr>
<tr>
<td>RTC</td>
<td>0.1 mA</td>
<td>0.1 mA</td>
<td>0.1 mA</td>
</tr>
<tr>
<td></td>
<td>60.1</td>
<td>140.1</td>
<td>9.1</td>
</tr>
<tr>
<td>Time in seconds</td>
<td>20</td>
<td>1</td>
<td>60</td>
</tr>
<tr>
<td>Battery</td>
<td>0.6wh per day</td>
<td>0.6wh per day</td>
<td>0.6wh per day</td>
</tr>
</tbody>
</table>
<p>The device is consuming a whopping 3.39 Watt hours per day. If we change the sleep to every hour, we can bring down the consumption to 1.73 Watt hours per day which is more efficient and sustainable in terms of battery life.</p>
<p>Return to the code and update the length of sleep.</p>
<hr />
<h2>Connecting to Solar</h2>
<p>If we use the 5 Watt, 6 Volt panel and V35 battery, our system should theoretically last about 20 days without sun.</p>
<p>Here’s how we connect the <a href="https://voltaicsystems.com/5-watt-5-volt-35wh-solar-system/">5 Watt 5 Volt 35Wh Solar System</a></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-113176 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/solar2-750x328.jpg" alt="" width="750" height="328" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/03/solar2-750x328.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/solar2-768x336.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/03/solar2.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
<h2>Wrapping up</h2>
<p>This blog post has provided a comprehensive walkthrough for setting up and configuring, deploying and publishing data for a simple IoT device with the Nano 33. Let us know what you come up with in your next IoT project.</li>
</ol>
<p style="text-align: center;"><a class="maxbutton-46 maxbutton maxbutton-solar-consultation" title="Set Up a Consultation" href="https://voltaicsystems.com/contact-us/"><span class='mb-text'>Sign Up for a Consultation</span></a></p>
<div style="border: 2px black solid; padding: 1em; background-color: #eee;">
<p>Enclosures can get very hot in sunny locations and very cold in many locations. This tutorial does not address all the safety issues associated with charging a lithium ion battery outdoors and you should understand these prior to deploying a battery powered system. Batteries charged outside of specifications can overheat and catch fire. Here are some key considerations for safely housing lithium-ion batteries in enclosures:</p>
<ul>
<li>Follow battery cell instructions for safe charging and storage</li>
<li>Always use cables and adapters that are made specifically for the device</li>
<li>Store and charge batteries away from anything flammable</li>
<li>Ensure your charge controller includes over and under temperature protection and that these settings match the specifications on your battery cells</li>
<li>Ensure your charge controller has over charge, over discharge and short circuit protection</li>
</ul>
<p>If a battery changes shape or is leaking, you should discontinue use immediately.</p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.voltaicsystems.com/solar-powered-nano-33-iot-soil-moisture-tutorial/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Tide Monitoring Tutorial with Particle Monitor One</title>
		<link>https://blog.voltaicsystems.com/tide-monitoring-tutorial-with-particle-monitor-one/</link>
					<comments>https://blog.voltaicsystems.com/tide-monitoring-tutorial-with-particle-monitor-one/#comments</comments>
		
		<dc:creator><![CDATA[Lizabeth Arum]]></dc:creator>
		<pubDate>Wed, 17 Jan 2024 18:27:46 +0000</pubDate>
				<category><![CDATA[All]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[IoT Tutorial]]></category>
		<category><![CDATA[environmental monitoring]]></category>
		<category><![CDATA[tide gauge]]></category>
		<guid isPermaLink="false">http://80ca4ebf1c.nxcli.io/?p=112898</guid>

					<description><![CDATA[Project Overview We deployed a solar powered water level monitor in New York Harbor on Governors Island using Particle’s Monitor One Developer Edition. Similar to the Tracker One, the Monitor One is a code free cellular device but it has a larger waterproof enclosure with room inside for an expansion card and additional connectors allowing [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Project Overview</h1>
<p>We deployed a solar powered water level monitor in New York Harbor on Governors Island using <a href="https://www.particle.io/">Particle’s</a> <a href="https://www.particle.io/devices/monitor-one/">Monitor One Developer Edition</a>. Similar to the <a href="https://www.particle.io/tracker-one/">Tracker One</a>, the Monitor One is a code free cellular device but it has a larger waterproof enclosure with room inside for an expansion card and additional connectors allowing for more customization.</p>
<p><a href="https://app.datacake.de/pd/ef89288a-ad52-4f19-be40-a3d45f18b284"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112999" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/datacake-750x440.png" alt="datacake dashboard" width="750" height="440" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/datacake-750x440.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/datacake-1500x880.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/datacake-768x450.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/datacake-1536x901.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/datacake-2048x1201.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /></a></p>
<p>The beauty of the Monitor One system is that you can control everything from the Console. Even after the system has been deployed, you can remotely change the sleep interval, monitor the sensor data, or track the device’s vitals.</p>
<div id="attachment_112934" style="width: 760px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112934" class="wp-image-112934 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image36-750x442.png" alt="Particle Console" width="750" height="442" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image36-750x442.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image36-1500x885.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image36-768x453.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image36-1536x906.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image36.png 1999w" sizes="auto, (max-width: 750px) 100vw, 750px" /><p id="caption-attachment-112934" class="wp-caption-text">Particle Console Events</p></div>
<p>Thanks to the Harbor School on Governors Island for agreeing to host the system on their pier.</p>
<p>In this post, we’ll cover:</p>
<ul>
<li>Getting started with Particle’s Monitor One<br />
<hr />
</li>
<li>An introduction to RS485<br />
<hr />
</li>
<li>Measuring and monitoring the external battery voltage<br />
<hr />
</li>
<li>Enabling sleep to make the device more efficient<br />
<hr />
</li>
<li>Deploying the system with appropriately sized solar panel and battery<br />
<hr />
</li>
<li>Publishing the data to the dashboard<br />
<hr />
</li>
</ul>
<h2><b>Background on Tide Monitoring</b></h2>
<p>From April-October, I can be found sailing in New York Harbor with the <a href="https://one15brooklynmarina.com/sail-club/">One°15 sail club</a>. To help navigate the waters and strategize for Wednesday night racing, I use several apps to monitor the wind and tides, so why not create one more? This exercise also gives me a chance to see how my device might align with  commercial applications.</p>
<p>If you’re looking for complete products, there are a number of established companies that have water level monitoring solutions including: <a href="https://www.hohonu.io/">Hohonu</a>, <a href="https://www.divirod.com/">Divirod</a> and <a href="https://www.greenstream.com/">Greenstream</a>.</p>
<p>This was how we imagined the deployment before visiting the site:</p>
<div id="112916" style="width: 760px" class="wp-caption aligncenter"><img decoding="async" aria-describedby="caption-112916" class="alignnone size-medium wp-image-112916" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image18-750x358.jpg" alt="Deployment of IoT device concept" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image18-750x358.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image18-1500x717.jpg 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image18-768x367.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image18-1536x734.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image18.jpg 1796w" sizes="(max-width: 750px) 100vw, 750px" /><p id="caption-112916" class="wp-caption-text">Original POC</p></div>
<p>And, this was how we actually deployed the device:</p>
<div id="112904" style="width: 760px" class="wp-caption aligncenter"><img decoding="async" aria-describedby="caption-112904" class="alignnone size-medium wp-image-112904" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image6-667x500.jpg" alt="Deployment" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image6-667x500.jpg 667w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image6-768x576.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image6-80x60.jpg 80w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image6.jpg 1200w" sizes="(max-width: 667px) 100vw, 667px" /><p id="caption-112904" class="wp-caption-text">Actual Deployment</p></div>
<h2><b>Parts Needed for Tide Monitoring</b></h2>
<ul>
<li><a href="https://www.particle.io/devices/monitor-one/">Particle Monitor One</a><br />
<hr />
</li>
<li><a href="https://www.dfrobot.com/product-1913.html">URM08 &#8211; Waterproof Industrial Ultrasonic Distance Sensor (35~550cm, ModBus-RTU)</a><br />
<hr />
</li>
<li>Two 5.6KΩ resistors<br />
<hr />
</li>
<li><a href="https://voltaicsystems.com/V70-iot">V70</a><br />
<hr />
</li>
<li><a href="https://voltaicsystems.com/9-watt-18v-panel/">9W-18V ETFE Panel</a><br />
<hr />
</li>
<li><a href="https://voltaicsystems.com/W175">Extension with Leads &#8211; Molex Extension</a><br />
<hr />
</li>
<li><a href="https://voltaicsystems.com/W036/">3.5&#215;1.1mm Extension Cable &#8211; 4 Foot</a><br />
<hr />
</li>
<li><a href="https://voltaicsystems.com/PG135">PG 13.5 Cable Glands</a><br />
<hr />
</li>
<li>Medium Solar Ready Enclosure<br />
<hr />
</li>
<li><a href="https://voltaicsystems.com/BK102">Solar Panel Bracket &#8211; Medium</a><br />
<hr />
</li>
<li>Drill<br />
<hr />
</li>
<li>Wires<br />
<hr />
</li>
<li>Optional:
<ul>
<li><a href="https://www.dfrobot.com/product-2340.html">RS485 Wind Vane Direction Sensor</a><br />
<hr />
</li>
<li><a href="https://www.amazon.com/dp/B07L64GJ42">XL6009 DC-DC Booster Converter Module</a><br />
<hr />
</li>
<li>A second panel<br />
<hr />
</li>
</ul>
</li>
<li>Optional:
<ul>
<li><a href="https://www.amazon.com/dp/B0BRXQXXW6?ref=ppx_yo2ov_dt_b_product_details&amp;th=1">Lever Wire Nuts Connectors Kit</a><br />
<hr />
</li>
<li><a href="https://www.sparkfun.com/products/9822">SparkFun USB to RS-485 Converter</a><br />
<hr />
</li>
<li>Arduino Uno<br />
<hr />
</li>
<li><a href="https://www.dfrobot.com/product-1024.html">RS485 Shield</a><br />
<hr />
</li>
<li>Software
<ul>
<li>CoolTerm<br />
<hr />
</li>
<li>Modbus RTU Master<br />
<hr />
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2><b>Software Requirements</b></h2>
<ul>
<li><a href="https://code.visualstudio.com/">Visual studio code</a><br />
<hr />
</li>
<li><a href="https://docs.particle.io/getting-started/developer-tools/workbench/">Particle workbench</a> installed<br />
<hr />
</li>
<li><a href="https://docs.particle.io/getting-started/developer-tools/cli/">Particle CLI</a> installed (used for the serial logging)<br />
<hr />
</li>
<li><a href="https://github.com/">GitHub</a>client<br />
<hr />
</li>
<li>A claimed Monitor One device.<br />
<hr />
</li>
</ul>
<h2><b>Helpful Documents</b></h2>
<ul>
<li><a href="https://docs.particle.io/firmware/best-practices/firmware-introduction/">Firmware Introduction</a><br />
<hr />
</li>
<li><a href="https://docs.particle.io/reference/datasheets/tracker/monitor-one-datasheet/">Monitor One Datasheet</a><br />
<hr />
</li>
<li><a href="https://docs.particle.io/getting-started/console/console/">Getting Started with Console</a><br />
<hr />
</li>
</ul>
<p><img loading="lazy" decoding="async" class="wp-image-112961 size-medium aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/circuit-663x500.jpg" alt="Monitor One Circuit" width="663" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/circuit-663x500.jpg 663w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/circuit-80x60.jpg 80w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/circuit.jpg 768w" sizes="auto, (max-width: 663px) 100vw, 663px" /></p>
<h1><b>The Monitor One</b></h1>
<p>Advantages of the Monitor One</p>
<ul>
<li>The console provides a programming-free way to set up your system.<br />
<hr />
</li>
<li>You can control the system remotely through the console. This means that you can easily change how often the system polls the sensors during development and even after the system is deployed.<br />
<hr />
</li>
<li>The system uses cellular connectivity so it works anywhere where there is cellular service.<br />
<hr />
</li>
</ul>
<h2><b>Step 1: Follow the <a href="https://docs.particle.io/quickstart/monitor-one/"> Monitor One Quickstart Guide</a></b></h2>
<p>In the <a href="https://console.particle.io/devices">Console</a>, on the device page, make sure you mark the device as a<b> development</b> device. Once it is marked, you should see this displayed:</p>
<p><img decoding="async" class="size-medium wp-image-112935 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image37-750x314.jpg" alt="Mark for Development" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image37-750x314.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image37-768x322.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image37-600x250.jpg 600w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image37.jpg 836w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<hr />
<h2><b>Step 2: Set Up the <a href="https://docs.particle.io/getting-started/developer-tools/workbench/">Particle Workbench</a> in Visual Studio Code</b></h2>
<hr />
<h2><b>Step 3: Gather Your Parts</b></h2>
<hr />
<h2><b>Step 4: Connect the Sensor</b></h2>
<p>All of our connections to the M1 will use <b>the I/O Card M12 8-pin to flying leads</b></p>
<p><a href="https://docs.particle.io/assets/images/monitor-one/m12-cable.png"><img loading="lazy" decoding="async" class="size-full wp-image-112940 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image41.png" alt="M8" width="310" height="309" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image41.png 310w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image41-150x150.png 150w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image41-125x125.png 125w" sizes="auto, (max-width: 310px) 100vw, 310px" /></a></p>
<table>
<tbody>
<tr>
<th>Conn P1 (M12)</th>
<th>Color</th>
<th>Function/GPIO</th>
<th>Using in our application</th>
</tr>
<tr>
<td>1</td>
<td>white</td>
<td>CAN_P</td>
<td>No</td>
</tr>
<tr>
<td>2</td>
<td>red</td>
<td>VIN (6-30 VDC)</td>
<td>Yes</td>
</tr>
<tr>
<td>3</td>
<td>green</td>
<td>4-20mA input</p>
<p>A7</td>
<td>No</td>
</tr>
<tr>
<td>4</td>
<td>yellow</td>
<td>0-10V input</p>
<p>A6</td>
<td>Yes</td>
</tr>
<tr>
<td>5</td>
<td>gray</td>
<td>RS485_B (N)</td>
<td>Yes</td>
</tr>
<tr>
<td>6</td>
<td>pink</td>
<td>RS485_A (P)</td>
<td>Yes</td>
</tr>
<tr>
<td>7</td>
<td>blue</td>
<td>CAN_N</td>
<td>No</td>
</tr>
<tr>
<td>8</td>
<td>black</td>
<td>GND</td>
<td>Yes</td>
</tr>
</tbody>
</table>
<div id="attachment_112910" style="width: 760px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112910" class="wp-image-112910 size-full" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image12.jpg" alt="Ultrasonic Sensor" width="750" height="400" /><p id="caption-attachment-112910" class="wp-caption-text">Ultrasonic sensor</p></div>
<p>This is the detection area of the sensor. While the max distance is 550 cm, you also need to be about a meter away from obstructions.</p>
<div id="attachment_112946" style="width: 449px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112946" class="wp-image-112946 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-10.13.29-PM-439x500.png" alt="Detection Area" width="439" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-10.13.29-PM-439x500.png 439w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-10.13.29-PM.png 672w" sizes="auto, (max-width: 439px) 100vw, 439px" /><p id="caption-attachment-112946" class="wp-caption-text">Sensor’s Detection Area</p></div>
<p>&nbsp;</p>
<p>The <a href="https://www.dfrobot.com/product-1913.html">URM08 &#8211; Waterproof Industrial Ultrasonic Distance Sensor</a> employs an RS485 communication interface and supports the Modbus protocol.</p>
<p>RS-485 is a robust standard for serial communication. It defines the electrical characteristics of the data and how it is physically transmitted through a network.</p>
<p>Modbus, on the other hand, is a communication protocol that defines a message structure independent of network type. It is one of the most widely used protocols in the industrial sector, particularly for connecting electronic equipment.</p>
<p>Modbus and RS-485 are often used in industrial communication systems where the Modbus protocol can be implemented over an RS-485 network. In a typical setup, Modbus commands are sent over RS-485 to a device where the command is processed and returns a response. Modbus defines how the data is structured and processed, while RS-485 defines how the data is physically transmitted between devices.</p>
<p>The <a href="https://www.dfrobot.com/product-1913.html">URM08 &#8211; Waterproof Industrial Ultrasonic Distance Sensor (35~550cm, ModBus-RTU)</a> uses Modbus RTU.</p>
<p>Modbus RTU is an implementation of Modbus that transmits data in binary format and uses a simple 16-bit structure with a Cyclic Redundancy Checksum (CRC), 8-bit bytes, one bit at a time, at a baud rate ranging from 1200 bps to 115200 bps. RTU values are encoded as standard big-endian binary where the Most Significant Byte (MSB) is encoded before the Least Significant byte (LSB).</p>
<p>Each exchange of data consists of a request from the controller, in our case, the M1, followed by a response from the worker (the sensor). Each data packet, whether request or response, begins with the device address or worker’s address, followed by function code, and then by parameters defining what is being asked for or provided.</p>
<p>Each request is broken down like this:</p>
<ul>
<li>Device Address<br />
<hr />
</li>
<li>Function Code<br />
<hr />
</li>
<li>Register Number<br />
<hr />
</li>
<li>Register Count<br />
<hr />
</li>
<li>Data<br />
<hr />
</li>
<li>Checksum<br />
<hr />
</li>
</ul>
<p>For more information about the Modbus RTU Protocol , see this<a href="https://unserver.xyz/modbus-guide/"> Unserver guide</a> or this <a href="https://ipc2u.com/articles/knowledge-base/modbus-rtu-made-simple-with-detailed-descriptions-and-examples/">IPC2U guide</a>.</p>
<p>When connecting the M1 to the sensor you want to connect the sensor’s red wire black wires to a battery, the green wire to the M1’s RS485-N, and the yellow wire to the M1’s RS485-P.</p>
<table>
<tbody>
<tr>
<th>M1</th>
<th>URM08 (SEN0246)</th>
</tr>
<tr>
<td>RS485_N (Gray)</td>
<td>M1 RS485-B (Yellow)</td>
</tr>
<tr>
<td>RS485_P (Pink)</td>
<td>RS485-A (Green)</td>
</tr>
<tr>
<td></td>
<td><span style="color: red;">VIN (Red) Do not power from M1 supply!</span></td>
</tr>
<tr>
<td>GND (Black)</td>
<td>GND (Black)</td>
</tr>
</tbody>
</table>
<p>Because the URM08 requires 6V-12V, you must initially power it separately from the M1. While setting up your system and connected to the M1’s AC charger, the VIN will receive 24V and will damage your sensor.</p>
<hr />
<h2><b>Step 5: Connecting the M1 to your computer</b></h2>
<p>Open the M1 and connect a micro USB cable between it and your computer.</p>
<hr />
<h2><b>Step 6:</b> <b>Clone the Firmware</b></h2>
<p>Cloning the firmware will create a local copy of the official version so that you can modify it with the custom functions.</p>
<p>Download the M1’s <a href="https://github.com/particle-iot/monitor-edge">official firmware</a> to a folder on your desktop.</p>
<hr />
<h2><b>Step 7: Open the folder from the Particle Workbench</b></h2>
<p>In VSCode go to File → Open folder and select/open the downloaded folder:</p>
<p><img decoding="async" class="size-medium wp-image-112914 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image16-750x421.png" alt="VS Code" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image16-750x421.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image16-1500x843.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image16-768x431.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image16-1536x863.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image16.png 1602w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<p>Click on <b>Yes, I trust the authors</b>:</p>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-112900 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image2-750x480.png" alt="Trust" width="750" height="480" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image2-750x480.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image2-768x491.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image2.png 1132w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
<h2><b>Step 8: Modify the code</b></h2>
<ol>
<li style="list-style-type: none;">
<ol>
<li>In the <b>Explore panel</b>, open <b>main.cpp</b>:<br />
<img decoding="async" class="size-medium wp-image-112915 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image17-750x424.png" alt="Explore panel" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image17-750x424.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image17-1500x848.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image17-768x434.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image17-1536x868.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image17.png 1999w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>In the top search bar run the command:
<div>
<pre> &gt;particle: configure project for device</pre>
</div>
<p><img decoding="async" class="size-medium wp-image-112947 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image8-1-750x158.png" alt="Configure" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image8-1-750x158.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image8-1-1500x315.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image8-1-768x161.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image8-1-1536x323.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image8-1.png 1999w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>Choose device OS@5.5.0 (or the latest version):<br />
<img decoding="async" class="size-medium wp-image-112929 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image31-750x311.png" alt="Device" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image31-750x311.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image31-1500x621.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image31-768x318.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image31-1536x636.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image31-600x250.png 600w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image31.png 1999w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>Choose Asset Tracker / Monitor One:<br />
<img decoding="async" class="size-medium wp-image-112917 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image19-750x350.jpg" alt="Asset Tracker" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image19-750x350.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image19-1500x699.jpg 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image19-768x358.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image19-1536x716.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image19.jpg 1999w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>Click esc when asked for a device name:<br />
<img decoding="async" class="size-medium wp-image-112942 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image43-750x334.png" alt="Device Name" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image43-750x334.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image43-1500x667.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image43-768x342.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image43-1536x683.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image43.png 1999w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>We’re ready to add a line of code. This example is configured in <b>SEMI_AUTOMATIC </b>mode, so we need to add a <code>Particle.connect()</code> at the end of the <code>setup() </code>function:<br />
<img decoding="async" class="size-medium wp-image-112905 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image7-750x429.png" alt="Add Code" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image7-750x429.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image7-1500x858.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image7-768x439.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image7-1536x879.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image7.png 1730w" sizes="(max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
</ol>
<h2><b>Step 9: Compile the code</b></h2>
<p>Click on the the check mark in the upper right to compile your code:<br />
<img loading="lazy" decoding="async" class="size-medium wp-image-112933 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image35-750x424.png" alt="Compile" width="750" height="424" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image35-750x424.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image35-1500x847.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image35-768x434.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image35-1536x868.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image35.png 1999w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
<h2><b>Step 10: Flash the M1:</b></h2>
<p>When the compiler finishes, click on the lightning bolt in the upper right hand corner to flash the M1:<br />
<img loading="lazy" decoding="async" class="size-medium wp-image-112921 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image23-750x425.png" alt="Add Code" width="750" height="425" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image23-750x425.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image23-1500x850.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image23-768x435.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image23-1536x871.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image23.png 1999w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
<h2><b>Step 11: Using the Console to Enable Modbus Settings</b></h2>
<p>Return to the Particle Console.</p>
<p>Make sure that you set the baud rate to 19200 under the Modbus RS-485 setting in <b>Gateway Settings</b> and click <b>Save</b>:</p>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-112909 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image11-750x395.png" alt="Baud Rate" width="750" height="395" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image11-750x395.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image11-1500x790.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image11-768x405.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image11-1536x809.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image11.png 1999w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
<h2><b>Step 12: Set up Modbus Polling 1</b></h2>
<p>To get the distance value you would think you would consult the sensor’s <a href="https://wiki.dfrobot.com/URM08-RS485_Waterproof_Sonar_Range_Finder_SKU_SEN0246">Product Wiki</a>, but in this case you’d be mistaken. We’ll look for the command to read the distance, but what we’ll find is not what we expect:<br />
<img loading="lazy" decoding="async" class="size-medium wp-image-112937 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image39-690x500.png" alt="Product Wiki" width="690" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image39-690x500.png 690w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image39-1380x1000.png 1380w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image39-768x556.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image39-1536x1113.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image39.png 1706w" sizes="auto, (max-width: 690px) 100vw, 690px" /></p>
<p>This particular sensor is described as using Modbus RTU, but the information provided in its wiki contradicts this. The SEN0246 sensor datasheet provides a set of specific commands for operations like reading distance and temperature, setting the address, and setting the baud rate. These commands are designed to communicate with the sensor&#8217;s firmware and are unique to this particular model. They follow a format that includes a frame header, device address, data length, command, data (if any), and checksum.</p>
<p>This format is different from standard Modbus RTU commands, which typically consist of a <b>device address</b>, <b>function code</b>, <b>data</b> (such as register addresses and values), and a <b>checksum</b>. In Modbus RTU, common function codes include reading and writing to discrete inputs/outputs and holding/input registers.</p>
<p>A Modbus RTU command to read the analog input from a holding register would follow this format:</p>
<table>
<tbody>
<tr>
<th>BYTE</th>
<th>REQUEST</th>
<th>BYTE</th>
<th>ANSWER</th>
</tr>
<tr>
<td>(Hex)</td>
<td>Field name</td>
<td>(Hex)</td>
<td>Field name</td>
</tr>
<tr>
<td>11</td>
<td>Device address</td>
<td>11</td>
<td>Device address</td>
</tr>
<tr>
<td>03</td>
<td>Functional code</td>
<td>03</td>
<td>Functional code</td>
</tr>
<tr>
<td>00</td>
<td>Address of the first register Hi bytes</td>
<td>06</td>
<td>Number of bytes more</td>
</tr>
<tr>
<td>01</td>
<td>Address of the first register Lo bytes</td>
<td>AE</td>
<td>Register value Hi #40108</td>
</tr>
<tr>
<td>00</td>
<td>Number of registers Hi bytes</td>
<td>41</td>
<td>Register value Lo #40108</td>
</tr>
<tr>
<td>00</td>
<td>Number of registers Lo bytes</td>
<td>56</td>
<td>Register value Hi #40109</td>
</tr>
<tr>
<td>5A</td>
<td>Checksum CRC</td>
<td>52</td>
<td>Register value Lo #40109</td>
</tr>
<tr>
<td>D7</td>
<td>Checksum CRC</td>
<td>43</td>
<td>Register value Hi #40110</td>
</tr>
</tbody>
</table>
<p>The command looks like this:<code> 11 03 00 01 00 D7 5A</code>, but our documentation provides different commands, ones that do not begin with the device’s ID.</p>
<p>The truth is, I actually didn’t figure out how to use this sensor on my own. The very helpful Alberto Sanchez from the Particle team, with a bit of research on his part, came to my aid:</p>
<p><i>While using the non-standard protocol (the one in the datasheet), the address is 0x02. But for using Modbus standard protocol, the address for the distance is 0x01. That is something not listed on the specs. I found it on a forum, tested it and it worked on my device. <a href="https://www.dfrobot.com/forum/topic/312312">https://www.dfrobot.com/forum/topic/312312</a></i></p>
<p>What we do need from the datasheet is the device ID.</p>
<ol>
<li>Enable Modbus Polling 1. It is disabled as the default:<br />
<img loading="lazy" decoding="async" class="size-medium wp-image-112931 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image33-750x422.jpg" alt="Enable Modbus" width="750" height="422" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image33-750x422.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image33-1500x844.jpg 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image33-768x432.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image33-1536x864.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image33.jpg 1990w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>Set the Modbus Server ID to 17. The ID for the sensor is Hex 11, which is Decimal 17:<br />
<img loading="lazy" decoding="async" class="size-medium wp-image-112911 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image13-750x352.jpg" alt="Baud Rate" width="750" height="352" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image13-750x352.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image13-768x360.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image13.jpg 1280w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>Set the following and then press <b>Save</b>:
<ul>
<li>Polling Interval to<b>15</b>. This will be good for testing. When all has been tested, you’ll set this to a different interval.<br />
<hr />
</li>
<li>Publish polled value to <b>always</b><br />
<hr />
</li>
<li>Modbus Function to <b>holding_register </b>(This is associated with the functional  code hex value 0x03)<br />
<hr />
</li>
<li>Register Address to 1 (0x01)<br />
<hr />
</li>
<li>Modbus data type to <b>unit16</b><br />
<hr />
</li>
<li>Mask value to <b>65535</b><br />
<hr />
</li>
<li>Shift Value to <b>0</b><br />
<hr />
</li>
<li>Offset Value to <b>0</b><br />
<hr />
</li>
<li>Scaling Value to <b>0</b><br />
<hr />
</li>
</ul>
</li>
<li>Click Save.<br />
<hr />
</li>
<li>Click on <b>Events</b> and wait until you start to see your modbus values.<br />
<hr />
</li>
<li>Enable <b>Modbus Polling 2</b>.<br />
<hr />
</li>
<li>Set the Modbus Server ID to 17.<br />
<hr />
</li>
<li>Set the following and then press <b>Save</b>:
<ul>
<li>Polling Interval to <b>15</b>. This will be good for testing. When all has been tested, you’ll set this to a greater interval.<br />
<hr />
</li>
<li>Publish polled value to <b>always</b><br />
<hr />
</li>
<li>Modbus Function to holding_register (This is associated with the functional  code hex value 0x03)<br />
<hr />
</li>
<li>Register Address to 2 (0x02)<br />
<hr />
</li>
<li>Modbus data type to <b>unit16</b><br />
<hr />
</li>
<li>Mask value to <b>65535</b><br />
<hr />
</li>
<li>Shift Value to <b>0</b><br />
<hr />
</li>
<li>Offset Value to <b>0</b><br />
<hr />
</li>
<li>Scaling Value to <b>0.1</b><br />
<hr />
</li>
</ul>
</li>
</ol>
<h2><b>Step 13: Troubleshooting</b></h2>
<p>If your Modbus result is 226, you have a communication error with your sensor. Check the wiring, especially between power and GND. If you still get 226 you could have:</p>
<ul>
<li>The wrong baud rate<br />
<hr />
</li>
<li>The wrong Modbus Server ID<br />
<hr />
</li>
<li>The wrong Register Address (remember to convert your Hex value to decimal)<br />
<hr />
</li>
</ul>
<p>If your result is 224. You have power, but your A and B lines are not connected properly. Check your wiring.</p>
<p>You can connect a USB to RS485 converter to the circuit and then use a serial program to monitor the Modbus commands from the M1. I used <a href="https://www.macupdate.com/app/mac/31352/coolterm">CoolTerm</a> for the Mac and ModbusRTUMaster (not simultaneously) to monitor the transmissions.</p>
<hr />
<h2><b>Step 14: Characterize Power Consumption</b></h2>
<ol>
<li>To turn off/disconnect the internal battery enter the shipping mode command in the console. <b>Shipping mode</b> allows the device to be shipped in a way that the battery does not discharge. Note that you can only get out of shipping mode by connecting the device to USB power or power by the M8 connector.
<div><code>{"cmd":"enter_shipping"}</code></div>
<div><code></code></div>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-112928 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image30-750x232.png" alt="Command" width="750" height="232" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image30-750x232.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image30-768x238.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image30.png 820w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>I connected my power and GND lines to a programmable power supply and collected the following data:
<ul>
<li>When not sending data I measured 20mA.<br />
<hr />
</li>
<li>When actively sensing and sending data, I measured 110mA.<br />
<hr />
</li>
</ul>
<p>The system takes less than 10 seconds to transmit data, so if I sent data every thirty minutes</p>
<p>Sleeping: 0.02 A * 12 V* 24*(86376/86400)(Proportion per Day )= <b>5.75840 Wh<b></b></b></p>
<p>Awake: 0.11 A * 12 V * 24* (24/86400)(Proportion per Day )=<b>0.01760 Wh</b></p>
<p><b>Total=5.77 Wh per day</b></p>
<p>To determine which panel and battery I need, I considered the following information:</p>
<ul>
<li><b>Daily Energy Consumption</b>=5.77 Wh per day<br />
<hr />
</li>
<li><b>Average Sunlight Hours</b>=The average sunlight hours in New York City (NYC) in December are typically about <b>4 to 5 hours</b> of effective sunlight per day.<br />
<hr />
</li>
<li><b>Solar Panel:</b> If we select the 9 Watt 18 Volt Solar Panel we know that in December we will be able to charge the battery for 4 hours a day.<br />
<hr />
</li>
<li><b>Battery</b>: We need a battery that can store enough energy to run the device for days when sunlight might be insufficient. The V70 outputs 12V and has a capacity of 71 Watt Hours.<br />
<b>71/5.77=12.305</b></li>
</ul>
</li>
</ol>
<p>The V70 Battery with a 9W-18V ETFE Panel can theoretically run indefinitely under normal conditions with sufficient daily sunlight. The battery alone provides around 12 days of backup power without solar charging, and this duration extends with partial solar charging on less sunny days.</p>
<hr />
<h2><b>Step 15: Adding a Voltage Divider Circuit</b></h2>
<p>And, of course we want to measure our battery voltage to understand how our system is performing, but how do we connect a voltage divider to the Monitor One? Once again, Alberto from Particle provided the answer:</p>
<ol>
<li>We need to use two 5.6KOhm resistors to scale down our 12 Volts:<br />
<img loading="lazy" decoding="async" class="size-medium wp-image-112925 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image27-750x433.png" alt="Voltage Divider" width="750" height="433" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image27-750x433.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image27-768x444.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image27.png 1094w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>Back in the Console, select the <b>IO</b> setting:<br />
<img loading="lazy" decoding="async" class="size-medium wp-image-112899 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image1-750x455.png" alt="IO" width="750" height="455" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image1-750x455.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image1-1500x909.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image1-768x466.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image1-1536x931.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image1.png 1999w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>By default, the scaling is 0-10V, but we can scale down 12V to half, and then multiply the maximum value by 2. To do this, change the sensor high setting from 10 to 24:<br />
<img loading="lazy" decoding="async" class="size-medium wp-image-112939 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image40-750x455.jpg" alt="IO" width="750" height="455" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image40-750x455.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image40-768x466.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image40.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>Save your settings and you&#8217;ll see the measurement included in the location (loc) event as <b>io_v</b><br />
<hr />
</li>
<li>You don&#8217;t need to wait for the location event to check your scaling or calibrations, you can get the value instantly, as long as the device is not in sleep mode. Just look at the <b>Voltage In</b> variable on the right pane and click GET:<br />
<img loading="lazy" decoding="async" class="size-medium wp-image-112912 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image14-750x433.jpg" alt="Get loc" width="750" height="433" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image14-750x433.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image14-768x444.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image14.jpg 786w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
</ol>
<h2><b>Step 16: Putting the Board to Sleep</b></h2>
<p><b>Sleep Mode</b> can be set to enable or disable in the Console.</p>
<p><b>Post Publish Execution Time</b> is the minimum duration in seconds to stay awake after publishing before going to sleep. The default is 10 seconds. This provides enough time to make sure a software update can be started when waking up from sleep. If a software update starts, the device will automatically stay awake until the update completes.</p>
<p><b>Maximum Connecting Time </b>is the maximum duration, in seconds, to wait for being cellular-connected and to obtain a GNSS lock before publishing. If connecting takes too long, then the device will go back to sleep instead of continuously attempting to connect. The default is 90 seconds.</p>
<p>Here are best practices from Particle regarding sleep:</p>
<ul>
<li>If you are sleeping for less than 10 seconds, you shouldn&#8217;t use sleep at all, and instead just stay awake.<br />
<hr />
</li>
<li>If you are sleeping less than 10 minutes, you should never use a cellular off mode because frequently reconnecting to cellular may use more power than it saves, and also your SIM may be banned from the cellular network for aggressive reconnection.<br />
<hr />
</li>
<li>If you are sleeping more than 15 minutes, using cellular off mode uses the least power.<br />
<hr />
</li>
<li>From 10 to 15 minutes, using cellular standby or cellular off is a toss-up, and will depend on other factors.<br />
<hr />
</li>
</ul>
<p>To enable sleep I consulted again with Alberto:</p>
<ul>
<li>Make sure that Modbus polling settings use a <b>Polling interval</b> less than the value used in the <b>Post Publish Execution Time</b> on the sleep settings.<br />
<hr />
</li>
<li>I set each of my Modbus <b>Polling Intervals</b> to 10 seconds.<br />
<hr />
</li>
<li>I set the <b>Post Publish Execution Time</b> in <b>Sleep</b> to 40 and the <b>Maximum Connection Time</b> to 90 seconds.<br />
<hr />
</li>
</ul>
<p>And here is where the magic happens: I set my <b>Minimum location update frequency</b> to be my desired interval. In this case, every 20 minutes, or specifically 2100 seconds. And then I set my <b>Maximum location update frequency</b> to a number less than the minimum. In my case, I set it to 600.</p>
<p>With these settings, the device will wake up to post the location data every 2100 seconds. When it wakes, the Monitor One will stay on for at least 40 seconds, allowing the Modbus to be polled and published a couple of times.</p>
<hr />
<h2><b>Step 18: Connecting to a Dashboard</b></h2>
<p>For this project I connected the Monitor One to a <a href="https://app.datacake.de/pd/ef89288a-ad52-4f19-be40-a3d45f18b284">Datacake dashboard</a>. Datacake is a cloud-based platform offering tools for building custom IoT applications and dashboards.</p>
<p><img decoding="async" class="wp-image-112907 size-medium aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image9-723x500.png" alt="Dashboard" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image9-723x500.png 723w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image9-1446x1000.png 1446w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image9-768x531.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image9-1536x1062.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image9.png 1999w" sizes="(max-width: 723px) 100vw, 723px" /></p>
<p>To set up the dashboard, I followed this Datacake <a href="https://docs.datacake.de/integrations/particle/templates/asset-tracker-one">tutorial</a></p>
<p>And here is the payload decoder:</p>
<div>
<pre><code>/*

Datacake Template for Particle.io Asset Tracker One
Author: derived from Simon Kemper
Version: 0.2
(c) Datacake GmbH
*/
function calculateDistance(lat1, lon1, lat2, lon2) {
    Number.prototype.toRad = function() {
        return this * Math.PI / 180;
    }            
    var R = 6371; // km
    var dLat = (lat2-lat1).toRad();
    var dLon = (lon2-lon1).toRad();
    var a = Math.sin(dLat/2) * Math.sin(dLat/2) + 
    Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * 
    Math.sin(dLon/2) * Math.sin(dLon/2);
    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
    var d = R * c;
    return d;
}
function calculateF(celsius){
 return (9*celsius)/5+32;   
}
function map_range(value, low1, high1, low2, high2){
return low2 + (high2 - low2) * (value - low1) / (high1 - low1);
 
}
function calculateSlope(x1, y1, x2, y2) {
    return (y2 - y1) / (x2 - x1);
}
function calculateIntercept(x, y, slope) {
    return y - slope * x;
}
// Data points
const x1 = 164, y1 = -0.9;
const x2 = 86, y2 = 5.2;
// Calculate slope and intercept
const slope = calculateSlope(x1, y1, x2, y2);
const intercept = calculateIntercept(x1, y1, slope);
function convertCmToTideLevel(cm) {
    return slope * cm + intercept;
}
function Decoder(payload, event) { 
    var decoded = {};
    if (event == "loc") {     
        payload = JSON.parse(payload);
        if (payload.cmd == "loc") {    
            if ("batt" in payload.loc) decoded.battery = payload.loc.batt;
            if ("cell" in payload.loc) decoded.cellular = payload.loc.cell;
            if ("speed" in payload.loc) decoded.speed = payload.loc.speed;
            if ("alt" in payload.loc) decoded.altitude = payload.loc.alt;
            if ("lck" in payload.loc) decoded.has_fix = payload.loc.lck ? true : false;
            if ("temp" in payload.loc) decoded.temperature = payload.loc.temp;
            if ("io_v" in payload.loc) decoded.io_v = payload.loc.io_v;
            
            // Decode Location and check for valid data
            
            if (("lat" in payload.loc) &amp;&amp; (decoded.has_fix) &amp;&amp; (payload.loc.lon != 0) &amp;&amp; (payload.loc.lat != 0)) {
                   
                // Store new Location in Dictionary for Datacake Fields
                
                decoded.location = "(" + payload.loc.lat + "," + payload.loc.lon + ")";
                
                /* --- Experimental - Geofencing and Distance Covered Detection --- */
                
                // Calculate Relative + Total Distance covered
                
                // Check if we already have a location stored (skip otherwise)
                
                try {
                    if (measurements.LOCATION.value != 0) {
                        
                        // get old position from Datacake Database
                        
                        var oldLocation = measurements.LOCATION.value.replace("(","").replace(")","").split(",");
                        var oldLat = parseFloat(oldLocation[0]);
                        var oldLong = parseFloat(oldLocation[1]);
                        var newLat = payload.loc.lat;
                        var newLong = payload.loc.lon;
                        
                        // get old distance from Datacake
                        
                        var oldDistance = measurements.DISTANCE.value;
                        
                        // Calculate new distance
                        
                        var newDistance = calculateDistance(oldLat, oldLong, newLat, newLong);
                        
                        // Distance is stored in a Counter-Field. These need absolute values.
                        // Counter fields can be used to show relative changes and relative values over time period
                        
                        decoded.distance = oldDistance + newDistance;    
                        
                        // Geofencing - Distance from Homezone
                        
                        try {
                            if (measurements.GEOFENCE_HOMEZONE_LOCATION.value != 0) {
                                
                                var homezoneLocation = measurements.GEOFENCE_HOMEZONE_LOCATION.value.replace("(","").replace(")","").split(",");
                                var homezoneLat = parseFloat(homezoneLocation[0]);
                                var homezoneLong = parseFloat(homezoneLocation[1]);
                                
                                decoded.geofence_distance_from_homezone = calculateDistance(homezoneLat, homezoneLong, newLat, newLong);                                                                                
                                
                            }                            
                        } catch (e) {
                            console.log("no homezone set");
                        }
                        
                        
                    }                    
                } catch (e) {
                    console.log("catched no value on history");
                }
            
            }
            
        }   
        
    } else if (event == "spark/device/diagnostics/update") {
        
        payload = JSON.parse(payload);
        
        decoded.cellular_radio_access_technology = payload.device.network.cellular.radio_access_technology;
        decoded.cellular_operator = payload.device.network.cellular.operator;
        
    } else if (event == "spark/status") {
        
        if (payload == "online") {
            
            decoded.online_status = true;
            
        } else {
            
            decoded.online_status = false;
        }
    } else if (event == "modbus") {
        
        payload = JSON.parse(payload);
if (payload.modbus[0].name == "modbus2"){
            decoded.Temp = calculateF(payload.modbus[0].value);
            
        } 
        else if (payload.modbus[0].name == "modbus1"){
            decoded.TideLevel=convertCmToTideLevel(payload.modbus[0].value);
        }
    
    }
    // Array where we store the fields that are being sent to Datacake
    var datacakeFields = []
    
    // take each field from decoded and convert them to Datacake format
    for (var key in decoded) {
        if (decoded.hasOwnProperty(key)) {
            datacakeFields.push({field: key.toUpperCase(), value: decoded[key]})
        }
    }      
    
    // forward data to Datacake
    return datacakeFields;
}</code></pre>
</div>
<hr />
<h2><b>Step 17: Deploying</b></h2>
<p style="text-align: left;">On a very windy recent January afternoon, Jeff Crystal and I ferried over to Governors Island. Once there, we met with Dorick Lee’s Harbor School HS class to talk about the project and how we could in turn help them add solar to their own water-related spring physical computing projects.</p>
<div id="attachment_112936" style="width: 676px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112936" class="wp-image-112936 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image38-666x500.jpg" alt="Visiting the Harbor School" width="666" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image38-666x500.jpg 666w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image38-1333x1000.jpg 1333w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image38-768x576.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image38-1536x1153.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image38-80x60.jpg 80w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image38.jpg 1999w" sizes="auto, (max-width: 666px) 100vw, 666px" /><p id="caption-attachment-112936" class="wp-caption-text">The parts of our system laid out on the table before installation</p></div>
<p style="text-align: left;">After speaking with the students, we made our first attempt at installation. In the first iteration we found that our Ultrasonic device was over a pair of cables instead of water:</p>
<div id="attachment_112959" style="width: 760px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112959" class="wp-image-112959 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/installing1-750x382.jpg" alt="First try" width="750" height="382" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/installing1-750x382.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/installing1-768x391.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/installing1.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /><p id="caption-attachment-112959" class="wp-caption-text">First attempt at installing</p></div>
<p>&nbsp;</p>
<div id="attachment_112958" style="width: 760px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112958" class="wp-image-112958 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/installing2-750x361.jpg" alt="Second try" width="750" height="361" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/installing2-750x361.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/installing2-768x369.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/installing2.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /><p id="caption-attachment-112958" class="wp-caption-text">Final installation</p></div>
<p style="text-align: left;">Fortunately, we were able to quickly scout out a better location and in short order uninstalled and reinstalled the system:</p>
<p style="text-align: left;">The lesson learned here was if at all possible, visit the location before deploying your system. We were lucky that we brought multiple zip ties, hose clamps, u bolts, nuts, and a cordless drill. Being prepared allowed us to quickly pivot from one location to another.</p>
<div id="attachment_112950" style="width: 760px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112950" class="wp-image-112950 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-11.36.04-PM-750x358.png" alt="The system installed" width="750" height="358" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-11.36.04-PM-750x358.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-11.36.04-PM-768x367.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-11.36.04-PM.png 1056w" sizes="auto, (max-width: 750px) 100vw, 750px" /><p id="caption-attachment-112950" class="wp-caption-text">Installed</p></div>
<p>&nbsp;</p>
<div id="attachment_112949" style="width: 760px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112949" class="wp-image-112949 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-11.36.11-PM-750x354.png" alt="Using unistruts and u bolts" width="750" height="354" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-11.36.11-PM-750x354.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-11.36.11-PM-768x362.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/Screenshot-2024-01-15-at-11.36.11-PM.png 1056w" sizes="auto, (max-width: 750px) 100vw, 750px" /><p id="caption-attachment-112949" class="wp-caption-text">Using unistruts and u bolts</p></div>
<h1 style="text-align: left;"><b>Next steps </b></h1>
<p style="text-align: left;">Next steps could be adding another sensor or designing an entirely different configuration.</p>
<h2 style="text-align: left;"><b>Adding Another Sensor</b></h2>
<div id="attachment_112922" style="width: 760px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112922" class="wp-image-112922 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image24-750x500.jpg" alt="Wind Vane" width="750" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image24-750x500.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image24-768x512.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image24-300x200.jpg 300w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image24-360x240.jpg 360w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image24-600x400.jpg 600w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image24.jpg 900w" sizes="auto, (max-width: 750px) 100vw, 750px" /><p id="caption-attachment-112922" class="wp-caption-text">Wind Vane</p></div>
<p style="text-align: left;">I really wanted to add a wind vane to the project, but this would require a different solar system set up.</p>
<p style="text-align: left;">The default baud rates for the wind vane and the ultrasonic sensors are different. While the default rate for the ultrasonic sensor is 19200, the wind vane is 9600. Fortunately, the ultrasonic sensor can also work at 9600, but we do need to set it.</p>
<div id="attachment_112901" style="width: 760px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112901" class="wp-image-112901 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image3-750x500.jpg" alt="Arduino Shield" width="750" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image3-750x500.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image3-768x512.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image3-300x200.jpg 300w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image3-360x240.jpg 360w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image3-600x400.jpg 600w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image3.jpg 900w" sizes="auto, (max-width: 750px) 100vw, 750px" /><p id="caption-attachment-112901" class="wp-caption-text">Arduino RS485 Shield</p></div>
<p style="text-align: left;">Changing the baud rate of the ultrasonic sensor was a bit challenging. After failing to change the speed using CoolTerm, Serial, or modbusRTUMaster, I ended up attaching the sensor to an Arduino Uno with a<a href="https://www.dfrobot.com/product-1024.html">RS485 Shield</a>.</p>
<p style="text-align: center;"><img decoding="async" class="alignnone wp-image-112908 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image10-688x500.png" alt="Shield Information" width="750" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image10-688x500.png 688w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image10-768x558.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image10.png 976w" sizes="(max-width: 688px) 100vw, 688px" /></p>
<p style="text-align: left;">To change the baud rate from the default, I ran this simple program that used the command from the product wiki and a checksum that I got from this <a href="https://www.scadacore.com/tools/programming-calculators/online-checksum-calculator/">online checksum calculator</a> that Particle’s Alberto recommended:<img loading="lazy" decoding="async" class="size-medium wp-image-112902 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image4-541x500.jpg" alt="Checksum" width="541" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image4-541x500.jpg 541w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image4-1081x1000.jpg 1081w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image4-768x710.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image4.jpg 1200w" sizes="auto, (max-width: 541px) 100vw, 541px" /></p>
<div style="text-align: left;">
<pre><code>unsigned char i=0;

//command to change baud rate to 9600
unsigned char CMD[9]={0x55,0xAA,0x11,0x01,0x08,0x03,0x1C,0x7B, 0x0B}; //

void setup() {
	// Serial1.begin(19200);  //Communicate with module via Serial1, set baud rate to 19200
	 Serial.begin(19200);   //Set Serial to serial port of data output

}

void loop() {
	for(i=0;i&lt;9;i++){
	   Serial.write(CMD[i]);
	   }
	delay(50);  //Wait data to return
	i=0;
}</code></pre>
</div>
<p>Once the baud rate was changed, you’ll need to reset the baud rate to 9600 in the Console:<img loading="lazy" decoding="async" class="size-medium wp-image-112927 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image29-750x417.jpg" alt="9600 Baud Rate" width="750" height="417" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image29-750x417.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image29-768x427.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image29.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<p>Like the ultrasonic sensor, the <a href="https://www.dfrobot.com/product-2340.html">RS485 Wind Vane Direction Sensor</a> also employs RS485 communication interface and supports the Modbus protocol.</p>
<p>When connecting the M1 to the sensor, connect the sensor’s green wire to  RS485-A, and the yellow wire to RS485-B.</p>
<table>
<tbody>
<tr>
<th>M1</th>
<th>URM08 (SEN0246)</th>
<th>Wind Vane (SEN0482)</th>
</tr>
<tr>
<td>RS485_N (Gray)</td>
<td>M1 RS485-B (Yellow)</td>
<td>RS485-/B/T (Green)</td>
</tr>
<tr>
<td>RS485_P (Pink)</td>
<td>RS485-A (Green)</td>
<td>RS485+/A/T+ (Yellow)</td>
</tr>
<tr>
<td></td>
<td>VIN (Red) Do not power from M1 supply!</td>
<td>(Red) Connect to Buck Converter</td>
</tr>
<tr>
<td>GND (Black)</td>
<td>GND (Black)</td>
<td>GND (Black) Connect to Buck Converter</td>
</tr>
</tbody>
</table>
<p>In order to power the wind vane which requires a minimum of 12V, we’ll need to add a buck converter:<br />
<img loading="lazy" decoding="async" class="size-medium wp-image-112903 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image5-500x500.jpg" alt="Buck Converter" width="500" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image5-500x500.jpg 500w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image5-1000x1000.jpg 1000w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image5-150x150.jpg 150w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image5-768x768.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image5-125x125.jpg 125w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image5.jpg 1200w" sizes="auto, (max-width: 500px) 100vw, 500px" /></p>
<p>Adjust the <a href="https://www.amazon.com/dp/B07L64GJ42">XL6009 DC-DC Booster Converter Module</a> to deliver between 12 and 15 V to the wind vane.</p>
<p>In the console we’ll need to enable <b>Modbus Polling 3</b>.</p>
<p>The wind vane follows standard Modbus RTU commands, and the documentation describes how we can monitor wind directions: principle, half-winds, and quarter-winds.</p>
<p>To find the direction, the host (M1) sends a query frame (hexadecimal):</p>
<div><code> 02 03 00 01 00 01 D5 F9（8 bytes）</code></div>
<table>
<tbody>
<tr>
<th>Peripheral Add.</th>
<th>Function Code</th>
<th>Register Start Add.</th>
<th>Length of Register</th>
<th>High Bits of Check Code</th>
<th>Low Bits of Check Code</th>
</tr>
<tr>
<td>1 byte</td>
<td>1 byte</td>
<td>2byt</td>
<td>2byt</td>
<td>1 byte</td>
<td>1 byte</td>
</tr>
<tr>
<td><b>0x02</b></td>
<td>0x03</td>
<td><b>0x00 0x01</b></td>
<td>0x00 0x01</td>
<td>0xD5</td>
<td>0xF9</td>
</tr>
</tbody>
</table>
<p>The peripheral device (the wind vane) responds with this frame (hexadecimal):</p>
<div><code>02 03 02 <b>00 03</b> BC 45 (7 bytes)</code></div>
<table>
<tbody>
<tr>
<th>Peripheral Add.</th>
<th>Function Code</th>
<th>Number of Valid Bytes</th>
<th>Data Area</th>
<th>High Bits of Check Code</th>
<th>Low Bits of Check Code</th>
</tr>
<tr>
<td>1 byte</td>
<td>1 byte</td>
<td>1 byte</td>
<td>2 byte</td>
<td>1 byte</td>
<td>1 byte</td>
</tr>
<tr>
<td>0×02</td>
<td>0x03</td>
<td>0x02</td>
<td>0x00 0x03</td>
<td>0xBC</td>
<td>0x45</td>
</tr>
</tbody>
</table>
<p>There are 16 directions in total, and a value = 00 03 = 3 corresponds to East-northeast as seen in the table below.</p>
<table>
<tbody>
<tr>
<th>Direction</th>
<th>16 Directions Value</th>
<th>360°</th>
</tr>
<tr>
<td>North</td>
<td>0</td>
<td>0° &#8211; 11.2°</td>
</tr>
<tr>
<td>North-northeast</td>
<td>1</td>
<td>11.3° &#8211; 33.7°</td>
</tr>
<tr>
<td>Northeast</td>
<td>2</td>
<td>33.8° &#8211; 56.2°</td>
</tr>
<tr>
<td>East-northeast</td>
<td>3</td>
<td>56.3° &#8211; 78.7°</td>
</tr>
<tr>
<td>East</td>
<td>4</td>
<td>78.8° &#8211; 101.2°</td>
</tr>
<tr>
<td>East-southeast</td>
<td>5</td>
<td>101.3° &#8211; 123.7°</td>
</tr>
<tr>
<td>Southeast</td>
<td>6</td>
<td>123.8° &#8211; 146.2°</td>
</tr>
<tr>
<td>South-southeast</td>
<td>7</td>
<td>146.3° &#8211; 168.7°</td>
</tr>
<tr>
<td>South</td>
<td>8</td>
<td>168.8° &#8211; 191.2°</td>
</tr>
<tr>
<td>South-southwest</td>
<td>9</td>
<td>191.3° &#8211; 213.7°</td>
</tr>
<tr>
<td>Southwest</td>
<td>10</td>
<td>213.8° &#8211; 236.2°</td>
</tr>
<tr>
<td>West-southwest</td>
<td>11</td>
<td>236.3° &#8211; 258.7°</td>
</tr>
<tr>
<td>West</td>
<td>12</td>
<td>258.8° &#8211; 281.2°</td>
</tr>
<tr>
<td>West-northwest</td>
<td>13</td>
<td>281.3° &#8211; 303.7°</td>
</tr>
<tr>
<td>Northwest</td>
<td>14</td>
<td>303.8° &#8211; 326.2°</td>
</tr>
<tr>
<td>North-northwest</td>
<td>15</td>
<td>326.3° &#8211; 348.7°</td>
</tr>
</tbody>
</table>
<p>Setting up the Wind vane in the Console</p>
<ol>
<li>Disable Sleep.<br />
<hr />
</li>
<li>Navigate to <b>Modbus Polling 3.</b><br />
<hr />
</li>
<li>Enable <b>Modbus Server Enable.</b><br />
<hr />
</li>
<li>Set the following and then press <b>Save</b>:</li>
<li>Set the Modbus Server ID to 2.<br />
<hr />
</li>
<li>Polling Interval to <b>10</b>. This will be good for testing. When all has been tested, you’ll set this to a greater interval.<br />
<hr />
</li>
<li>Publish polled value to <b>always</b><br />
<hr />
</li>
<li>Modbus Function to <b>holding_register </b>(This is associated with the functional  code hex value 0x03)<br />
<hr />
</li>
<li>Register Address to 1 (0x01)<br />
<hr />
</li>
<li>Modbus data type to <b>unit16</b><br />
<hr />
</li>
<li>Mask value to <b>65535</b><br />
<hr />
</li>
<li>Shift Value to <b>0</b><br />
<hr />
</li>
<li>Offset Value to <b>0</b><br />
<hr />
</li>
<li>Scaling Value to <b>1</b><br />
<hr />
</li>
<li>After testing, re-enable sleep.<br />
<hr />
</li>
<li>Add to the Datacake payload decoder:
<div>
<pre><code>function getDirections(num){

    var directions=["North Northeast","Northeast", "East Northeast","East","East Southeast","Southeast","South Southeast","South","South Southwest","Southwest","West Southwest", "West","West Northwest","Northwest","North Northwest","North"];

    return directions[num];

}</code></pre>
</div>
<hr />
</li>
<li>Add this if statement with the other modbus conditionals:
<div>
<pre><code>if (payload.modbus[0].name == "modbus3"){
	decoded.Wind = getDirections(payload.modbus[0].value);
 }</code></pre>
</div>
<hr />
</li>
</ol>
<p>Adding a second sensor means we’ll need to recharacterize the power consumption.</p>
<ol>
<li>Turn off/disconnect the internal battery by entering the shipping mode command in the console.
<div><code>{"cmd":"enter_shipping"}</code></div>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-112928 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image30-750x232.png" alt="Command" width="750" height="232" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image30-750x232.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image30-768x238.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image30.png 820w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li>Connect power and GND lines to a programmable power supply and collect the following data. These are the numbers I received:
<ul>
<li>When sleeping=0.03A<br />
<hr />
</li>
<li>When actively sensing and sending data, I measured 0.1A.<br />
<hr />
</li>
</ul>
<p>The system is awake for 40 seconds while it polls and transmits data, so if I sent data every fifteen minutes</p>
<p>Sleeping: 0.03 A * 12 V* 24*(86304/86400)(Proportion per Day )= <strong>8.63040 Wh</strong></p>
<p>Awake: .11 A * 12 V * 24* (96/86400)(Proportion per Day )=<strong>0.03200 Wh</strong></p>
<p><strong>Total=8.66 Wh per day</strong></p>
<p>[CP_CALCULATED_FIELDS id=&#8221;11&#8243;]</p>
<p>This new system requires a different battery/solar panel configuration. A single 9W panel will no longer be sufficient. One solution could be to use two 9W panels with the V70 battery.</p>
<hr />
</li>
</ol>
<p>Where am I going to take this project next? The plan is to create a device for a local marina that measures</p>
<ul>
<li>Air Temp<br />
<hr />
</li>
<li>Wind velocity<br />
<hr />
</li>
<li>Wind direction<br />
<hr />
</li>
<li>Atmospheric pressure<br />
<hr />
</li>
<li>Tide height<br />
<hr />
</li>
</ul>
<p>This system will be useful for boats entering the marina and monitoring the conditions inside the marina.</p>
<div id="attachment_112930" style="width: 760px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112930" class="wp-image-112930 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image32-750x396.png" alt="One &amp;deg;15 Marina" width="750" height="396" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image32-750x396.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image32-768x405.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2024/01/image32.png 1105w" sizes="auto, (max-width: 750px) 100vw, 750px" /><p id="caption-attachment-112930" class="wp-caption-text">One °15 Marina</p></div>
<p>Stay tuned…</li>
<li style="list-style-type: none;">
<p style="text-align: center;"><a class="maxbutton-46 maxbutton maxbutton-solar-consultation" title="Set Up a Consultation" href="https://voltaicsystems.com/contact-us/"><span class='mb-text'>Sign Up for a Consultation</span></a></p>
</li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.voltaicsystems.com/tide-monitoring-tutorial-with-particle-monitor-one/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Solar Powered LoRa Radio Barometric Pressure and Altimeter Tutorial</title>
		<link>https://blog.voltaicsystems.com/solar-powered-lora-radio-barometric-pressure-and-altimeter-tutorial/</link>
					<comments>https://blog.voltaicsystems.com/solar-powered-lora-radio-barometric-pressure-and-altimeter-tutorial/#comments</comments>
		
		<dc:creator><![CDATA[Lizabeth Arum]]></dc:creator>
		<pubDate>Fri, 22 Dec 2023 17:01:09 +0000</pubDate>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[IoT Tutorial]]></category>
		<category><![CDATA[adafruit]]></category>
		<category><![CDATA[environmental monitoring]]></category>
		<category><![CDATA[feather MO]]></category>
		<category><![CDATA[LoRa]]></category>
		<guid isPermaLink="false">http://80ca4ebf1c.nxcli.io/?p=112800</guid>

					<description><![CDATA[Overview: Learn how to create a LoRa wireless networked device with an Adafruit Feather M0 RFM95 LoRa Radio 900MHz connected to a sensor and powered by a e-Peas energy harvester and a Lithium Ion Capacitor (LIC). In this tutorial, you will: Program your board using the Arduino IDE Measure and monitor the battery voltage Enable [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112805" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/inside_enclosure2-734x500.jpg" alt="LoRaWAN Circuit inside enclosure" width="734" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/inside_enclosure2-734x500.jpg 734w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/inside_enclosure2-768x523.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/inside_enclosure2.jpg 1200w" sizes="auto, (max-width: 734px) 100vw, 734px" /></p>
<h1>Overview:</h1>
<p>Learn how to create a LoRa wireless networked device with an Adafruit Feather M0 RFM95 LoRa Radio 900MHz connected to a sensor and powered by a e-Peas energy harvester and a Lithium Ion Capacitor (LIC). In this tutorial, you will:</p>
<ul>
<li>Program your board using the Arduino IDE<br />
<hr />
</li>
<li>Measure and monitor the battery voltage<br />
<hr />
</li>
<li>Enable sleep to make the device more efficient<br />
<hr />
</li>
<li>Deploy system with appropriately sized <a href="https://voltaicsystems.com/small-solar-panels/">solar panel</a> and <a href="https://voltaicsystems.com/iot-battery-packs/">battery</a><br />
<hr />
</li>
<li>Publish data to a Qubitro dashboard<br />
<hr />
</li>
</ul>
<h1>An IoT Feather M0 with Barometric Sensor</h1>
<p>This tutorial will cover powering an Adafruit Feather M0 radio with two 0.3 Watt, 2 Volt solar panels, and an e-Peas energy harvester. It will also cover connecting the Feather to The Things Network (TTN). This simple project will introduce you to the Feather M0 module, working with a barometric sensor, coding, and LoRaWAN, all of which you can  apply to other long range, low power, secure, standardized, low cost, and flexible LoRaWAN applications.</p>
<div id="attachment_112840" style="width: 760px" class="wp-caption alignnone"><a href="https://portal.qubitro.com/1da06267-e2d8-4dcf-9da3-c1438b8d42d5"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112840" class="wp-image-112840 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-1-750x353.png" alt="Solar LoRaWAN Dashboard" width="750" height="353" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-1-750x353.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-1-1500x705.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-1-768x361.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-1-1536x722.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-1-2048x963.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /></a><p id="caption-attachment-112840" class="wp-caption-text">Qubitro Dashboard. Click <a href="https://portal.qubitro.com/1da06267-e2d8-4dcf-9da3-c1438b8d42d5">here</a> for live data</p></div>
<h2>Parts Needed</h2>
<ul>
<li style="font-weight: 400;" aria-level="1">The Things Network Gateway if the network is not available in <a href="https://ttnmapper.org/heatmap/" target="_blank" rel="noopener">your area</a>. I’m using <a href="https://www.adafruit.com/product/4345">The Things Indoor LoRaWAN WiFi Gateway &#8211; 8 Channel LoRa 900 MHz</a><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><a href="https://www.adafruit.com/product/3178">Adafruit Feather M0 with RFM95 LoRa Radio &#8211; 900MHz &#8211; RadioFruit</a><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><a href="https://www.adafruit.com/product/2830">Stacking Headers for Feather &#8211; 12-pin and 16-pin female headers</a><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><a href="https://www.adafruit.com/product/1893">MPL3115A2 &#8211; I2C Barometric Pressure/Altitude/Temperature Sensor</a><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><a href="https://www.amazon.com/2-54mm-Arduino-Stackable-Shield-Assortment/dp/B077Z4KWM3/ref=sr_1_1_sspa?crid=341BJY06I0JWI&amp;keywords=stacking+headers&amp;qid=1702915942&amp;s=industrial&amp;sprefix=stacking+headers%2Cindustrial%2C105&amp;sr=1-1-spons&amp;sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&amp;psc=1">Stacking Headers</a><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Breadboard<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Wires<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Wire clippers<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Wire Strippers<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><a href="https://www.amazon.com/dp/B07V56N33J?ref=ppx_yo2ov_dt_b_product_details&amp;th=1">JST 2.0 PH 2-Pin Connector Plug with Wires Cables</a><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><a href="https://voltaicsystems.com/LIC-solar-charger/">Lithium Ion Capacitor Solar Charger</a> e-Peas Energy Harvester (C117)<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">1-2 <a href="https://voltaicsystems.com/0-3-watt-2-volt-solar-panel-etfe/">0.3 Watt 2 Volt Mini Solar Panel &#8211; ETFE</a><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><a href="https://voltaicsystems.com/mini-solar-ready-enclosure/">Mini Solar Ready Enclosure</a><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><a href="https://voltaicsystems.com/copy-of-etfe-panel-corner-mount-set/">ETFE Panel Magnet Mount Set</a><br />
<hr />
</li>
</ul>
<p>&nbsp;</p>
<div style="width: 1034px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-medium" src="https://cdn-learn.adafruit.com/assets/assets/000/032/896/large1024/feather_3178_quarter_ORIG.jpg?1465414051" alt="Feather M0 LoRa Radio" width="1024" height="788" /><p class="wp-caption-text"><a href="https://cdn-learn.adafruit.com/assets/assets/000/032/896/large1024/feather_3178_quarter_ORIG.jpg?1465414051">Feather M0 LoRa Radio</a></p></div>
<p><a href="https://github.com/adafruit/Adafruit-Feather-M0-RFM-LoRa-PCB/blob/master/Adafruit%20Feather%20M0%20RFM9x%20Pinout.pdf"><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112841" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/pins-750x268.png" alt="Adafruit-Feather-M0-RFM-LoRa Pins" width="750" height="268" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/pins-750x268.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/pins-1500x536.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/pins-768x275.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/pins-1536x549.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/pins.png 2000w" sizes="auto, (max-width: 750px) 100vw, 750px" /></a></p>
<p>The Adafruit Feather M0 with an RFM9x LoRa 868/915 MHz radio module that transmits and receives small packets of data is designed to make flexible wireless networks without the high power requirements of WiFi.</p>
<p>Each Adafruit LoRa device comes with a small label that contains a MAC address in the form <b>98:76:B6:xx:yy:zz</b>. This might be a sticker attached to the device itself or included separately. The MAC address is needed when connecting the Feather to <a href="https://lora-alliance.org/about-lorawan/">LoRaWAN</a>. Speaking from experience, I suggest taking a photo of this sticker as a backup plan for when the sticker goes missing.</p>
<p>To make it easy to use the Feather for portable projects, Adafruit added a connector for a  3.7V Lithium polymer battery. The Feather can run off a battery or a micro USB, and you can use the USB input to recharge the battery. The Feather will automatically switch from the battery to USB power when available. The battery is also tied through a divider to an analog pin, so you can measure and monitor the battery voltage to detect when you need a recharge.</p>
<p>The module can be programmed in the Arduino IDE. To get the battery’s voltage, connect the battery to D9 (A7), read the pin’s voltage, and then double it to get the battery voltage. Here is the code you’ll need:<br />
[code lang=&#8221;arduino&#8221;]#define VBATPIN A7<br />
double measuredvbat = analogRead(VBATPIN);<br />
measuredvbat *= 2;    // we divided by 2, so multiply back<br />
measuredvbat *= 3.3;  // Multiply by 3.3V, our reference voltage<br />
measuredvbat /= 1024; // convert to voltage<br />
Serial.print(&quot;VBat: &quot; ); Serial.println(measuredvbat);[/code]<br />
While one can set up two Feather M0 with RFM9x LoRa 868/915 MHz radio modules to transmit and receive data from one another, we will use the module to communicate with a Things Gateway.</p>
<p>It’s important to note that LoRaWAN (Long Range Wide Area Network) projects are unsuitable for applications where you must send a lot of data. LoRaWAN is a wireless communication protocol that connects devices over long distances with minimal power consumption.</p>
<p>It is also essential to understand that LoRa and LoRaWAN are not interchangeable terms. LoRa refers to the type of hardware that is responsible for wireless modulation communication that operates with very low power consumption, while LoRaWAN refers to a network protocol. LoRa is the <i>physical layer</i>, and LoRaWAN is the <i>MAC (media access protocol) layer</i>.</p>
<h2>Parts of the System</h2>
<ul>
<li style="font-weight: 400;" aria-level="1">The feather is an end node, a part of the system equipped with one or more sensors that collects and transmits data.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">The  <a href="https://www.adafruit.com/product/4345">The Things Indoor LoRaWAN WiFi Gateway</a> is our Gateway.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><a href="https://www.thethingsnetwork.org/">The Things Network</a> (TTN) is the Network Server, and<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><a href="https://www.qubitro.com/">Qubitro</a>, a platform that provides tools and services for connecting, managing, and analyzing IoT devices and data, is the application server.<br />
<hr />
</li>
</ul>
<p>LoRa operates in various frequency bands. Which band you work in depends on your region. In North America, the range is between 902 MHz and 928 MHz. In Europe, there are two bands; one range is between 863-870 MHz, and the other is at 433MHz. Asia has two bands: one between 865 to 867 MHz and the other between 920 to 923 MHz. If you’re curious, here’s a list of <a href="https://www.thethingsnetwork.org/docs/lorawan/frequencies-by-country/">frequencies by country</a>.</p>
<h2><b>Step 1: Gather Your Parts</b></h2>
<h2><b>Step 2: Solder Your Headers and Antenna</b></h2>
<p>Your radio module needs an antenna. For a DIY antenna, cut a stranded or solid core wire to the proper length for your module/frequency:</p>
<ul>
<li style="font-weight: 400;" aria-level="1"><b>433 MHz</b> &#8211; 6.5 inches, or 16.5 cm</li>
<li style="font-weight: 400;" aria-level="1"><b>868 MHz</b> &#8211; 3.25 inches or 8.2 cm</li>
<li style="font-weight: 400;" aria-level="1"><b>915 MHz </b>&#8211; 3 inches or 7.8 cm</li>
</ul>
<p>Strip a mm or two off the end of the wire, tin and solder into the <b>ANT</b> pad on the very right hand edge of the Feather.</p>
<p>&nbsp;</p>
<div style="width: 1214px" class="wp-caption alignnone"><img loading="lazy" decoding="async" src="https://cdn-learn.adafruit.com/assets/assets/000/031/585/original/feather_antennadone.jpg?1459963446" alt="Adafruit example of DIY antenna" width="1204" height="903" /><p class="wp-caption-text"><a href="https://learn.adafruit.com/assets/31585">Adafruit example of DIY antenna</a></p></div>
<h2><b>Step 3: Wire the Circuit</b></h2>
<ol>
<li style="font-weight: 400;" aria-level="1">By default Adafruit Feather M0&#8217;s pin GPIO6 and DIO1 are not connected. Please ensure they are connected.<img loading="lazy" decoding="async" class="alignnone size-medium" src="https://github.com/werktag/m0-lorawan-ttn/raw/master/feather-lora-wiring.png" width="702" height="249" /><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Wire up the basic circuit for now. After everything is working, we’ll add solar.<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112815" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_bb-750x283.jpg" alt="Adafruit-Feather-M0-RFM-LoRa breadboard" width="750" height="283" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_bb-750x283.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_bb-1500x567.jpg 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_bb-768x290.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_bb-1536x580.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_bb.jpg 1787w" sizes="auto, (max-width: 750px) 100vw, 750px" /><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112842" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_schem-653x500.jpg" alt="Adafruit-Feather-M0-RFM-LoRa Schematic" width="653" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_schem-653x500.jpg 653w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_schem-768x588.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_schem-80x60.jpg 80w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/feather_schem.jpg 1157w" sizes="auto, (max-width: 653px) 100vw, 653px" /><b></b><br />
<hr />
</li>
</ol>
<h2><b>Step 4:</b> <b>Set Up the Gateway</b></h2>
<ol>
<li style="font-weight: 400;" aria-level="1">Navigate  to the <a href="https://www.thethingsnetwork.org/">TTN website</a> to log in or to create an account.<br />
<hr />
</li>
<li aria-level="1">Navigate to <a href="https://console.cloud.thethings.network/">Console</a>. Choose your cluster:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112839" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/01_cluster-750x412.png" alt="Cluster" width="750" height="412" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/01_cluster-750x412.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/01_cluster-1500x823.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/01_cluster-768x422.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/01_cluster-1536x843.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/01_cluster-2048x1124.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Select <strong>Register Gateway</strong> or <strong>Go to Gateway</strong>:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112838" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-750x409.png" alt="TTN Application" width="750" height="409" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-750x409.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-1500x818.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-768x419.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-1536x837.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-2048x1116.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li aria-level="1">Add your Gateway EUI. The Gateway EUI is obtained by writing down the first six digits of the 12-digit alphanumeric number found on the top left corner of the sticker below the QR code on the bag where the gateway was packaged. This 12-digit number is the gateway ID. After the first six digits, insert FFFE, and then finish by writing down the last six digits.
<pre>Example: 2FA02C60AA3C —&gt; 2FA02CFFFE60AA3C</pre>
<p>The gateway EUI is 2FA02CFFFE60AA3C <img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112845" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway-750x353.png" alt="Register TTN Gateway" width="750" height="353" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway-750x353.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway-1500x706.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway-768x362.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway-1536x723.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway.png 1788w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li aria-level="1">Use your WiFiPW on the back of the device as your claim authentication code. The gateway Wifi password is located after the phrase “WiFi PW:” on the sticker on the back of the device. This alphanumeric Wifi password will look similar to “LwtHsNYK”:<br />
<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112846" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway2-750x468.png" alt="Registering TTN Gateway" width="750" height="468" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway2-750x468.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway2-1500x936.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway2-768x479.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway2-1536x958.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway2-400x250.png 400w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/reg_gateway2.png 1706w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<hr />
</li>
<li aria-level="1">Select your region. In the US, we’ll select <strong>FSB 2</strong>: <img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112847" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/18_region-1-750x407.jpg" alt="TTN Regions" width="750" height="407" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/18_region-1-750x407.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/18_region-1-768x417.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/18_region-1.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Click on <b>Claim Gateway</b>.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Configure the Gateway:
<ol>
<li style="font-weight: 400;" aria-level="2">Plug in the gateway.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="2">Press the reset button for 5 seconds (on the bottom of the gateway next to the USB port) or until the light blinks GREEN-RED rapidly a couple of times.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="2">After resetting, press the SETUP button for 10 seconds (at the top of the gateway) until the light blinks RED rapidly. The gateway’s Wifi network <b>MiniHub-XXXXXX</b> will now be visible (at least for the next 10 minutes).<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="2">On your computer, select the MiniHub network.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="2">Open a browser window and type <strong>192.168.4.1</strong> in the address bar type. Then press Enter to access the Wifi config page.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="2">Select your home/office Wifi network from the Scanned Networks list and enter your Wifi network password.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="2">Select the “Save and Reboot” option at the bottom of the screen.</li>
</ol>
<p>If everything is working correctly and the gateway can connect to The Things Network (TTN) via your home/office Wifi, the light on top of the gateway will be solid green after about a minute.</p>
<hr />
</li>
</ol>
<h2><b>Step 5: </b><b>Register your Feather</b></h2>
<p>You need to register your Feather with The Things Network to get the three unique identifiers you’ll need for your code: APPEUI, DEVEUI, and APPKEY.</p>
<ol>
<li>Navigate to <b>Applications</b>, or if you are logging in again, click on <b>Go to Applications:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112838" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-750x409.png" alt="TTN Application" width="750" height="409" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-750x409.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-1500x818.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-768x419.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-1536x837.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/02_application-2048x1116.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /></b><br />
<hr />
</li>
<li>Click on the <b>+</b> <b>Create Application:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112818" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/03_create_application-750x408.jpg" alt="Create TTN Application" width="750" height="408" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/03_create_application-750x408.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/03_create_application-768x417.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/03_create_application.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></b><br />
<hr />
</li>
<li>Provide an Application ID and an Application name for your application and then click on <b>Create application</b>:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112836" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/04_create_the_details-750x477.png" alt="Solar LoRaWAN Application" width="750" height="477" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/04_create_the_details-750x477.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/04_create_the_details-1500x953.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/04_create_the_details-768x488.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/04_create_the_details-1536x976.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/04_create_the_details-2048x1301.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li>Click on <b>+Register end device</b>:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112835" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/05_register_end_device-750x379.png" alt="End Node for Solar LoRaWAN system" width="750" height="379" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/05_register_end_device-750x379.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/05_register_end_device-1500x758.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/05_register_end_device-768x388.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/05_register_end_device-1536x776.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/05_register_end_device-2048x1035.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li>Select <b>Enter end device specifics manually</b>:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112834" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/06_enter_end_device_specifics_manually-750x406.png" alt="End node for Solar LoRaWAN system" width="750" height="406" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/06_enter_end_device_specifics_manually-750x406.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/06_enter_end_device_specifics_manually-1500x813.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/06_enter_end_device_specifics_manually-768x416.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/06_enter_end_device_specifics_manually-1536x832.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/06_enter_end_device_specifics_manually-2048x1109.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Select your region and a LoRaWAN version. The LoRaWAN protocol is developed and maintained by the <a href="https://lora-alliance.org/">LoRa Alliance</a><br />
<table>
<tbody>
<tr>
<td>Version</td>
<td>Release date</td>
</tr>
<tr>
<td>1.0</td>
<td>January 2015</td>
</tr>
<tr>
<td>1.0.1</td>
<td>February 2016</td>
</tr>
<tr>
<td>1.0.2</td>
<td>July 2016</td>
</tr>
<tr>
<td>1.1</td>
<td>October 2017</td>
</tr>
<tr>
<td>1.0.3</td>
<td>July 2018</td>
</tr>
<tr>
<td>1.0.4</td>
<td>October 2020</td>
</tr>
</tbody>
</table>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112833" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/07_us-543x500.png" alt="Solar LoRaWAN" width="543" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/07_us-543x500.png 543w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/07_us-1087x1000.png 1087w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/07_us-768x707.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/07_us.png 1276w" sizes="auto, (max-width: 543px) 100vw, 543px" /></p>
<hr />
</li>
<li>For the provisioning, locate the sticker that came with your Feather. Enter the first six hex values, then add 00 00 followed by the last six hex digits: XX XX XX 00 00 XX XX XX<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112832" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/08_provisioning-750x220.png" alt="TTN and Solar LoRaWAN" width="750" height="220" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/08_provisioning-750x220.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/08_provisioning-768x225.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/08_provisioning.png 1274w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li>Click <b>Generate</b> for the DevEUI:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112831" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/09_generate-606x500.jpg" alt="TTN and Solar LoRaWAN" width="606" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/09_generate-606x500.jpg 606w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/09_generate-1211x1000.jpg 1211w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/09_generate-768x634.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/09_generate-282x232.jpg 282w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/09_generate.jpg 1434w" sizes="auto, (max-width: 606px) 100vw, 606px" /><br />
<hr />
</li>
<li>Click <b>Generate</b> for the AppKey:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112830" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/10_generate-582x500.jpg" alt="TTN and Solar LoRaWAN" width="582" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/10_generate-582x500.jpg 582w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/10_generate-1163x1000.jpg 1163w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/10_generate-768x660.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/10_generate.jpg 1384w" sizes="auto, (max-width: 582px) 100vw, 582px" /><br />
<hr />
</li>
<li>Click <b>Register end device</b>:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112829" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/11_register-597x500.jpg" alt="TTN and Solar LoRaWAN" width="597" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/11_register-597x500.jpg 597w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/11_register-1194x1000.jpg 1194w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/11_register-768x643.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/11_register-300x250.jpg 300w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/11_register.jpg 1404w" sizes="auto, (max-width: 597px) 100vw, 597px" /><br />
<hr />
</li>
<li>You will need the information found under Activation Information. Click on the &lt;&gt; to change the format to little-endian. For the AppEUI you need to get the lsb (least significant byte first) version. To toggle between msb ( most significant byte first) and lsb, click on the two way arrows:<img loading="lazy" decoding="async" class="alignnone size-full wp-image-112827" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/12_arrows.png" alt="TTN and Solar LoRaWAN" width="482" height="144" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/12_arrows.png 482w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/12_arrows-480x144.png 480w" sizes="auto, (max-width: 482px) 100vw, 482px" /><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Click on the Copy icon and paste the AppEUI in a document that you can refer to later.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Do the same (lsb) for the DevEUI and paste the lsb version into your document:<img loading="lazy" decoding="async" class="alignnone size-full wp-image-112826" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/13_lsbs.png" alt="DevEUI for Solar LoRaWAN system" width="464" height="196" /><br />
<hr />
</li>
<li>The AppKey will need to be the msb format so just copy it into your document:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112825" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/14_activation-750x185.png" alt="AppKey for Solar LoRaWAN" width="750" height="185" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/14_activation-750x185.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/14_activation-768x190.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/14_activation.png 1118w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li>Save your separate document somewhere where you can find it later:
<div id="attachment_112824" style="width: 760px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112824" class="wp-image-112824 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/15_copied-750x128.jpg" alt="Save credentials" width="750" height="128" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/15_copied-750x128.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/15_copied-768x131.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/15_copied.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /><p id="caption-attachment-112824" class="wp-caption-text">Example text file</p></div>
<hr />
</li>
</ol>
<h2>Step 6: Arduino</h2>
<h3>Open the Arduino IDE</h3>
<ol>
<li style="font-weight: 400;" aria-level="1">Open or install the Arduino IDE. If you do not have the latest version of the Arduino IDE installed:
<ol>
<li style="font-weight: 400;" aria-level="2">Navigate to the <a href="https://www.arduino.cc/en/software">Arduino website</a>.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="2">Select your operating system and download the software.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">To program the Feather M0 board using Arduino IDE, you need to install the package_adafruit_index.json file. Open the <b>Preferences </b>window in the Arduino IDE.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Go to <b>File </b>&gt; <b>Preferences</b>.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Enter the following into the &#8220;Additional Board Manager URLs&#8221; field:  &#8220;https://adafruit.github.io/arduino-board-index/package_adafruit_index.json&#8221;<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112848" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/arduino-750x496.png" alt="Add Library for Feather" width="750" height="496" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/arduino-750x496.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/arduino-768x508.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/arduino.png 1476w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li aria-level="1">Here&#8217;s a short description of each of the Adafruit supplied packages that will be available in the Board Manager when you add the URL:
<ol>
<li style="font-weight: 400;" aria-level="1">Adafruit AVR Boards &#8211; Includes support for Flora, Gemma, Feather 32u4, Trinket, &amp; Trinket Pro.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Adafruit SAMD Boards &#8211; Includes support for Feather M0 and M4, Metro M0 and M4, ItsyBitsy M0 and M4,<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Circuit Playground Express, Gemma M0 and Trinket M0<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Arduino Leonardo &amp; Micro MIDI-USB &#8211; This adds MIDI over USB support for the Flora, Feather 32u4, Micro and Leonardo using the arcore project (<a href="https://adafru.it/eSI">https://adafru.it/eSI</a>).</li>
</ol>
<p>&nbsp;</p>
<hr />
</li>
<li aria-level="1">Click OK.<br />
<hr />
</li>
<li aria-level="1">Open the <b>Boards Manager</b>. Go to <b>Tools </b>&gt; <b>Board </b>&gt;<b>Boards Manager&#8230;</b><br />
<hr />
</li>
<li aria-level="1">Search for <b>Adafruit SAMD Boards </b>by Adafruit and <b>Arduino SAMD Boards<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112849" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/samd-750x487.png" alt="Arduino SAMD" width="750" height="487" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/samd-750x487.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/samd-1500x973.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/samd-768x498.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/samd-1536x997.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/samd.png 2022w" sizes="auto, (max-width: 750px) 100vw, 750px" /></b><br />
<hr />
</li>
</ol>
<h2>Step 7: Setting up Your Feather M0</h2>
<p>Connect your Feather M0 into your computer through USB. Then, follow these steps:</p>
<ol>
<li style="font-weight: 400;" aria-level="1">Open the Arduino IDE.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Select your Board in the <b>Tools Board</b> menu (in our case, it’s the Adafruit Feather M0 -SAMD21)<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112850" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/select_board-750x408.jpg" alt="Select Board" width="750" height="408" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/select_board-750x408.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/select_board-768x418.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/select_board.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Select the <b>Port</b> (if you don’t see the COM Port in your Arduino IDE and you are running Windows 7 or 8,  you may need to install the <a href="https://learn.adafruit.com/adafruit-arduino-ide-setup/windows-driver-installation>adafruit drivers</a>)<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">To test that  it all works, open the Blink Example:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112852" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/arduino_example_code-750x272.jpg" alt="Blink code" width="750" height="272" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/arduino_example_code-750x272.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/arduino_example_code-768x279.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/arduino_example_code.jpg 1340w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Click on the <b>Upload</b> button:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112853" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/upload-750x484.jpg" alt="Upload" width="750" height="484" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/upload-750x484.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/upload-768x496.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/upload.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
</ol>
<p>If everything went as expected, you should see a “Done uploading.” message. If you don’t, you’ll need to troubleshoot. If your upload was successful, you&#8217;ll get a bunch of red text that tells you that the device was found and it was programmed, verified &amp; reset.</p>
<p>After uploading, you may see a message saying &#8220;Disk Not Ejected Properly&#8221; about the &#8230;BOOT drive. You can ignore that message: it&#8217;s an artifact of how the bootloader and uploading work.</p>
<h2><b>Step 8: </b><b>Set Up Your Program</b></h2>
<p>Create a new Sketch and save it as<b> feather_temperature</b></p>
<h2><b>Step 9: </b><b>Importing Libraries</b></h2>
<p>You’ll need a few libraries, so go to tools and select <b>Manage Libraries…<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112854" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/manage_library-449x500.png" alt="Manage Library" width="449" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/manage_library-449x500.png 449w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/manage_library-898x1000.png 898w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/manage_library-768x855.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/manage_library.png 1036w" sizes="auto, (max-width: 449px) 100vw, 449px" /></b></p>
<p>You’ll need to Install:</p>
<ul>
<li style="font-weight: 400;" aria-level="1"><b>MCCI Arduino LoRaWAN</b> library<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><b>MCCI LoRaWAN LMIC</b> library<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><b>Adafruit MPL3115A2</b> library<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1"><b>Adafruit Sensor Lab</b> library<br />
<hr />
</li>
</ul>
<p>When prompted, install the library and any dependencies.</p>
<h2><strong>Step 10: Copy and paste the code</strong></h2>
<p>Copy and paste the code into your sketch:<br />
[code lang=&#8221;arduino&#8221;]<br />
/*******************************************************************************<br />
* derived from The Things Network &#8211; Sensor Data Example<br />
* Example of sending a valid LoRaWAN packet to The Things Networ using a Feather M0 LoRa.<br />
* Learn Guide: https://learn.adafruit.com/the-things-network-for-feather<br />
* Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman<br />
* Copyright (c) 2018 Terry Moore, MCCI<br />
* Copyright (c) 2018 Brent Rubell, Adafruit Industries<br />
*<br />
* Permission is hereby granted, free of charge, to anyone<br />
* obtaining a copy of this document and accompanying files,<br />
* to do whatever they want with them without any restriction,<br />
* including, but not limited to, copying, modification and redistribution.<br />
* NO WARRANTY OF ANY KIND IS PROVIDED.</p>
<p>*******************************************************************************/</p>
<p>#include &lt;lmic.h&gt;<br />
#include &lt;hal/hal.h&gt;<br />
#include &lt;Adafruit_MPL3115A2.h&gt;<br />
Adafruit_MPL3115A2 baro;<br />
#define VBATPIN A7</p>
<p>// This EUI must be in little-endian format, so least-significant-byte<br />
// first. When copying an EUI from ttnctl output, this means to reverse<br />
// the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,<br />
// 0x70.<br />
static const u1_t PROGMEM APPEUI[8] = {[XXX]};<br />
void os_getArtEui(u1_t* buf) {<br />
 memcpy_P(buf, APPEUI, 8);<br />
}</p>
<p>// This should also be in little endian format, see above.<br />
static const u1_t PROGMEM DEVEUI[8] = {[XXX]};<br />
void os_getDevEui(u1_t* buf) {<br />
 memcpy_P(buf, DEVEUI, 8);<br />
}</p>
<p>// This key should be in big endian format (or, since it is not really a<br />
// number but a block of memory, endianness does not really apply). In<br />
// practice, a key taken from the TTN console can be copied as-is.<br />
static const u1_t PROGMEM APPKEY[16] = { [XXX] };<br />
void os_getDevKey(u1_t* buf) {<br />
 memcpy_P(buf, APPKEY, 16);<br />
}</p>
<p>// payload to send to TTN gateway<br />
static uint8_t payload[7];</p>
<p>static osjob_t sendjob;</p>
<p>// Schedule TX every this many seconds (might become longer due to duty<br />
// cycle limitations).<br />
const unsigned TX_INTERVAL = 30;</p>
<p>// Pin mapping for Adafruit Feather M0 LoRa<br />
// /!\ By default Adafruit Feather M0&#039;s pin 6 and DIO1 are not connected.<br />
// Please ensure they are connected.</p>
<p>const lmic_pinmap lmic_pins = {<br />
 .nss = 8,<br />
 .rxtx = LMIC_UNUSED_PIN,<br />
 .rst = 4,<br />
 .dio = { 3, 6, LMIC_UNUSED_PIN },<br />
 .rxtx_rx_active = 0,<br />
 .rssi_cal = 8,  // LBT cal for the Adafruit Feather M0 LoRa, in dB<br />
 .spi_freq = 8000000,<br />
};</p>
<p>void printHex2(unsigned v) {<br />
 v &amp;= 0xff;<br />
 if (v &amp;lt; 16)<br />
   Serial.print(&#039;0&#039;);<br />
   Serial.print(v, HEX);<br />
}</p>
<p>void onEvent(ev_t ev) {<br />
 Serial.print(os_getTime());<br />
 Serial.print(&quot;: &quot;);<br />
 switch (ev) {<br />
   case EV_SCAN_TIMEOUT:<br />
     Serial.println(F(&quot;EV_SCAN_TIMEOUT&quot;));<br />
     break;<br />
   case EV_BEACON_FOUND:<br />
     Serial.println(F(&quot;EV_BEACON_FOUND&quot;));<br />
     break;<br />
   case EV_BEACON_MISSED:<br />
     Serial.println(F(&quot;EV_BEACON_MISSED&quot;));<br />
     break;</p>
<p>   case EV_BEACON_TRACKED:<br />
     Serial.println(F(&quot;EV_BEACON_TRACKED&quot;));<br />
     break;<br />
   case EV_JOINING:<br />
     Serial.println(F(&quot;EV_JOINING&quot;));<br />
     break;<br />
   case EV_JOINED:<br />
     Serial.println(F(&quot;EV_JOINED&quot;));<br />
     {<br />
       u4_t netid = 0;<br />
       devaddr_t devaddr = 0;<br />
       u1_t nwkKey[16];<br />
       u1_t artKey[16];<br />
       LMIC_getSessionKeys(&amp;netid, &amp;devaddr, nwkKey, artKey);<br />
       Serial.print(&quot;netid: &quot;);<br />
       Serial.println(netid, DEC);<br />
       Serial.print(&quot;devaddr: &quot;);<br />
       Serial.println(devaddr, HEX);<br />
       Serial.print(&quot;AppSKey: &quot;);<br />
       for (size_t i = 0; i &amp;lt; sizeof(artKey); ++i) {<br />
         if (i != 0)<br />
           Serial.print(&quot;-&quot;);<br />
         printHex2(artKey[i]);<br />
       }</p>
<p>       Serial.println(&quot;&quot;);<br />
       Serial.print(&quot;NwkSKey: &quot;);<br />
       for (size_t i = 0; i &amp;lt; sizeof(nwkKey); ++i) {<br />
         if (i != 0)<br />
           Serial.print(&quot;-&quot;);<br />
         printHex2(nwkKey[i]);<br />
       }<br />
    <br />
     }</p>
<p>     // Disable link check validation (automatically enabled<br />
     // during join, but because slow data rates change max TX<br />
     // size, we don&#039;t use it in this example.<br />
     //LMIC_setLinkCheckMode(0);<br />
     break;</p>
<p>   /*<br />
       || This event is defined but not used in the code. No<br />
       || point in wasting codespace on it.<br />
       ||<br />
       || case EV_RFU1:<br />
       ||     Serial.println(F(&quot;EV_RFU1&quot;));<br />
       ||     break;<br />
       */</p>
<p>   case EV_JOIN_FAILED:<br />
     Serial.println(F(&quot;EV_JOIN_FAILED&quot;));<br />
     break;<br />
   case EV_REJOIN_FAILED:<br />
     Serial.println(F(&quot;EV_REJOIN_FAILED&quot;));<br />
     break;<br />
   case EV_TXCOMPLETE:<br />
     Serial.println(F(&quot;EV_TXCOMPLETE (includes waiting for RX windows)&quot;));<br />
     if (LMIC.txrxFlags &amp; TXRX_ACK)<br />
       Serial.println(F(&quot;Received ack&quot;));<br />
     if (LMIC.dataLen) {<br />
       Serial.println(F(&quot;Received &quot;));<br />
       Serial.println(LMIC.dataLen);<br />
       Serial.println(F(&quot; bytes of payload&quot;));<br />
     }<br />
     // Schedule next transmission<br />
     os_setTimedCallback(&amp;sendjob, os_getTime() + sec2osticks(TX_INTERVAL), do_send);<br />
     break;<br />
   case EV_LOST_TSYNC:<br />
     Serial.println(F(&quot;EV_LOST_TSYNC&quot;));<br />
     break;<br />
   case EV_RESET:<br />
     Serial.println(F(&quot;EV_RESET&quot;));<br />
     break;<br />
   case EV_RXCOMPLETE:<br />
     // data received in ping slot<br />
     Serial.println(F(&quot;EV_RXCOMPLETE&quot;));<br />
     break;<br />
   case EV_LINK_DEAD:<br />
     Serial.println(F(&quot;EV_LINK_DEAD&quot;));<br />
     break;<br />
   case EV_LINK_ALIVE:<br />
     Serial.println(F(&quot;EV_LINK_ALIVE&quot;));<br />
     break;<br />
   /*<br />
       || This event is defined but not used in the code. No<br />
       || point in wasting codespace on it.<br />
       ||<br />
       || case EV_SCAN_FOUND:<br />
       ||    Serial.println(F(&quot;EV_SCAN_FOUND&quot;));<br />
       ||    break;<br />
       */</p>
<p>   case EV_TXSTART:<br />
     Serial.println(F(&quot;EV_TXSTART&quot;));<br />
     break;<br />
   case EV_TXCANCELED:<br />
     Serial.println(F(&quot;EV_TXCANCELED&quot;));<br />
     break;<br />
   case EV_RXSTART:<br />
     /* do not print anything &#8212; it wrecks timing */<br />
     break;<br />
   case EV_JOIN_TXCOMPLETE:<br />
     Serial.println(F(&quot;EV_JOIN_TXCOMPLETE: no JoinAccept&quot;));<br />
     break;<br />
   default:<br />
     Serial.print(F(&quot;Unknown event: &quot;));<br />
     Serial.println((unsigned)ev);<br />
     break;<br />
 }<br />
}</p>
<p>void do_send(osjob_t* j) {<br />
 // Check if there is not a current TX/RX job running<br />
 if (LMIC.opmode &amp; OP_TXRXPEND) {<br />
   Serial.println(F(&quot;OP_TXRXPEND, not sending&quot;));<br />
 } else {<br />
   // read the sensor<br />
   if (!baro.begin()) {<br />
     Serial.println(&quot;Could not find sensor. Check wiring.&quot;);<br />
     while (1);<br />
   }<br />
   // use to set sea level pressure for current location<br />
   // this is needed for accurate altitude measurement<br />
   // STD SLP = 1013.26 hPa<br />
   baro.setSeaPressure(1013.26);<br />
   float pressure = baro.getPressure();<br />
   //adjusted for fahrenheit<br />
   float temperature = (9 * baro.getTemperature()) / 5 + 32;<br />
   Serial.println(&quot;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&quot;);<br />
   Serial.print(&quot;pressure = &quot;);<br />
   Serial.print(pressure);<br />
   Serial.println(&quot; hPa&quot;);<br />
   Serial.print(&quot;temperature = &quot;);<br />
   Serial.print(temperature);<br />
   Serial.println(&quot; F&quot;);</p>
<p>   // float -&gt; int<br />
   temperature = temperature / 100;<br />
   pressure = pressure / 1000;<br />
   // note: this uses the sflt16 datum (https://github.com/mcci-catena/arduino-lmic#sflt16)<br />
   uint16_t payloadTemp = LMIC_f2sflt16(temperature);<br />
   // int -&gt; bytes<br />
   byte tempLow = lowByte(payloadTemp);<br />
   byte tempHigh = highByte(payloadTemp);<br />
   // place the bytes into the payload<br />
   payload[0] = tempLow;<br />
   payload[1] = tempHigh;<br />
  <br />
   // float -&gt; int<br />
   uint16_t payloadPressure = LMIC_f2sflt16(pressure / 10);<br />
   // int -&gt; bytes<br />
   byte pressureLow = lowByte(payloadPressure);<br />
   byte pressureHigh = highByte(payloadPressure);<br />
   // place the bytes into the payload<br />
   payload[2] = pressureLow;<br />
   payload[3] = pressureHigh;<br />
   <br />
// Payload format Bytes: [(Bat-Voltage &#8211; 2) * 100]</p>
<p>   double measuredvbat = analogRead(VBATPIN);<br />
   measuredvbat *= 2;    // we divided by 2, so multiply back<br />
   measuredvbat *= 3.3;  // Multiply by 3.3V, our reference voltage<br />
   measuredvbat /= 1024; // convert to voltage<br />
   Serial.print(&quot;VBat: &quot; ); Serial.println(measuredvbat);<br />
   measuredvbat = measuredvbat / 100;<br />
   uint16_t payloadBattery=LMIC_f2sflt16(measuredvbat);</p>
<p>   // int -&gt; bytes<br />
   byte batteryLow = lowByte(payloadBattery);<br />
   byte batteryHigh = highByte(payloadBattery);<br />
   // place the bytes into the payload<br />
   payload[4] = batteryLow;<br />
   payload[5] = batteryHigh;</p>
<p>   // prepare upstream data transmission at the next possible time.<br />
   // transmit on port 1 (the first parameter); you can use any value from 1 to 223 (others are reserved).<br />
   // don&#039;t request an ack (the last parameter, if not zero, requests an ack from the network).<br />
   // Remember, acks consume a lot of network resources; don&#039;t ask for an ack unless you really need it<br />
   LMIC_setTxData2(1, payload, sizeof(payload) &#8211; 1, 0);<br />
 }</p>
<p> // Next TX is scheduled after TX_COMPLETE event.<br />
}</p>
<p>void setup() {<br />
 delay(5000);<br />
  Serial.begin(9600);<br />
 Serial.println(F(&quot;Starting&quot;));<br />
 // LMIC init<br />
 os_init();<br />
  // Reset the MAC state. Session and pending data transfers will be discarded.<br />
 LMIC_reset();<br />
  // Disable link-check mode and ADR, because ADR tends to complicate testing.<br />
 LMIC_setLinkCheckMode(0);<br />
 // Set the data rate to Spreading Factor 7.  This is the fastest supported rate for 125 kHz channels, and it<br />
 // minimizes air time and battery power. Set the transmission power to 14 dBi (25 mW).<br />
 LMIC_setDrTxpow(DR_SF7, 14);<br />
  // in the US, with TTN, it saves join time if we start on subband 1 (channels 8-15). This will<br />
 // get overridden after the join by parameters from the network. If working with other<br />
 // networks or in other regions, this will need to be changed.<br />
 LMIC_selectSubBand(1);<br />
 // Start job (sending automatically starts OTAA too)<br />
 do_send(&amp;sendjob);<br />
}</p>
<p>void loop() {<br />
 // we call the LMIC&#039;s runloop processor. This will cause things to happen based on events and time. One<br />
 // of the things that will happen is callbacks for transmission complete or received messages. We also<br />
 // use this loop to queue periodic data transmissions.  You can put other things here in the `loop()` routine,<br />
 // but beware that LoRaWAN timing is pretty tight, so if you do more than a few milliseconds of work, you<br />
 // will want to call `os_runloop_once()` every so often, to keep the radio running.<br />
 os_runloop_once();</p>
<p> }<br />
[/code]</p>
<h2><strong>Step 11: Adding your Activation Information</strong></h2>
<p>Update the [XXX]s  with your saved AppEUI, DevEUI, and AppKey:<br />
[code lang=&#8221;arduino&#8221;]static const u1_t PROGMEM APPEUI[8] = {&lt;b&gt;[XXX]&lt;/b&gt;;</p>
<p>// This should also be in little endian format, see above.<br />
static const u1_t PROGMEM DEVEUI[8] = {&lt;b&gt;[XXX]&lt;/b&gt;};</p>
<p>// This key should be in big endian format (or, since it is not really a<br />
// number but a block of memory, endianness does not really apply). In<br />
// practice, a key taken from the TTN console can be copied as-is.<br />
static const u1_t PROGMEM APPKEY[16] = { &lt;b&gt;[XXX]&lt;/b&gt; };[/code]<br />
Compile and upload the code.</p>
<h2><strong>Step 12: </strong><b>Payload formatters</b></h2>
<p>After uploading the code we’re going to send the data from the Feather to TTN and decode it.</p>
<p>Back in the TTN console, we need to add an uplink payload formatter.</p>
<ol>
<li>Click on <b>Application</b>, select your application and then select <b>Payload formatters</b> from the left menu:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112817" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/19_payload_formatter-750x472.png" alt="TTN Payload formatter for Solar LoRaWAN" width="750" height="472" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/19_payload_formatter-750x472.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/19_payload_formatter-1500x945.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/19_payload_formatter-768x484.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/19_payload_formatter-1536x967.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/19_payload_formatter-430x270.png 430w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/19_payload_formatter.png 1842w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li>Click on <b>Uplink</b>.<br />
<hr />
</li>
<li>Select <b>Custom Javascript formatter</b>:<img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112816" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/20_custom_javascript-750x492.png" alt="Payload formatter for Solar LoRaWAN" width="750" height="492" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/20_custom_javascript-750x492.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/20_custom_javascript-1500x984.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/20_custom_javascript-768x504.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/20_custom_javascript-1536x1007.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/20_custom_javascript-2048x1343.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Copy the following code and replace the existing javascript:<br />
[code lang=&#8221;arduino&#8221;]// TTN Decoder for TTN OTAA Feather US915<br />
function Decoder(bytes, port) {</p>
<p>  // Decode an uplink message from a buffer<br />
  // (array) of bytes to an object of fields.</p>
<p>  var decoded = {};</p>
<p>  <br />
  // temperature <br />
  rawTemp = bytes[0] + bytes[1] * 256;<br />
  decoded.degrees_F = parseFloat((sflt162f(rawTemp) * 100).toFixed(2));  </p>
<p>  // pressure <br />
  rawPressure = bytes[2] + bytes[3] * 256;<br />
  decoded.pressure_hPa = parseFloat((sflt162f(rawPressure) * 10000).toFixed(2)); </p>
<p>   // battery <br />
  rawBattery = bytes[4] + bytes[5] * 256;<br />
  decoded.battery_V = parseFloat((sflt162f(rawBattery) * 100).toFixed(2)); <br />
  <br />
  return decoded;<br />
}</p>
<p>function sflt162f(rawSflt16)<br />
    {<br />
    // rawSflt16 is the 2-byte number decoded from wherever;<br />
    // it&#039;s in range 0..0xFFFF<br />
    // bit 15 is the sign bit<br />
    // bits 14..11 are the exponent<br />
    // bits 10..0 are the the mantissa. Unlike IEEE format,<br />
    // the msb is explicit; this means that numbers<br />
    // might not be normalized, but makes coding for<br />
    // underflow easier.<br />
    // As with IEEE format, negative zero is possible, so<br />
    // we special-case that in hopes that JavaScript will<br />
    // also cooperate.<br />
    //<br />
    // The result is a number in the open interval (-1.0, 1.0);<br />
    //<br />
    // throw away high bits for repeatability.</p>
<p>    rawSflt16 &amp;= 0xFFFF;</p>
<p>    // special case minus zero:<br />
    if (rawSflt16 == 0x8000)</p>
<p>        return -0.0;</p>
<p>    // extract the sign.<br />
    var sSign = ((rawSflt16 &amp; 0x8000) != 0) ? -1 : 1;</p>
<p>    // extract the exponent<br />
    var exp1 = (rawSflt16 &gt;&gt; 11) &amp; 0xF;</p>
<p>    // extract the &quot;mantissa&quot; (the fractional part)<br />
    var mant1 = (rawSflt16 &amp; 0x7FF) / 2048.0;</p>
<p>    // convert back to a floating point number. We hope<br />
    // that Math.pow(2, k) is handled efficiently by<br />
    // the JS interpreter! If this is time critical code,<br />
    // you can replace by a suitable shift and divide.<br />
    var f_unscaled = sSign * mant1 * Math.pow(2, exp1 &#8211; 15);</p>
<p>    return f_unscaled;</p>
<p>    }[/code]
</li>
</ol>
<h2><b>Step 13: Characterize Power Consumption</b></h2>
<p>The battery life of an end device is highly dependent on the spreading factor used. Higher spreading factors result in longer active times for the radio transceivers and shorter battery life. We’ll be using a spreading factor of 7, which provides the highest bit rate and longest battery life. You can see in the code where this is set:<br />
[code lang=&#8221;arduino&#8221;]// Set the data rate to Spreading Factor 7.  This is the fastest supported rate for 125 kHz channels, and it<br />
//minimizes air time and battery power. Set the transmission power to 14 dBi (25 mW).<br />
LMIC_setDrTxpow(DR_SF7, 14);[/code]<br />
According to the specs, The power consumption of the radio is ~0.0003 A during full sleep, ~.12A during +20dBm transmit, and ~.04A during active radio listening.</p>
<p>I tested my setup with a programmable power supply and collected the following data.</p>
<p>When the module was not sending data, I measured 0.015 amps. And when actively sending data, I measured .136 amps.</p>
<p>I found that for reading and sending data my device measured 0.0331 A. which makes sense if you look at the power consumption above.</p>
<p><strong>0.04 A</strong> per active listening</p>
<p><strong>0.136 A</strong> for transmitting</p>
<p>0.04 A *17/60 seconds =   0.0113 A</p>
<p>0.136 A * 3/60 seconds = 0.0068 A</p>
<p>0.018 A * 3.3V= 0.05 W</p>
<p>Or <strong>0.05 W</strong></p>
<p>If I ran the system continuously, meaning multiplying 0.05 Watts by 24 hours. I would be at 0.6 Watt hours per day and would need a much larger panel and battery.</p>
<p>Fortunately, I can put the board to sleep between readings and I only need about a about 20 seconds to read and send data.</p>
<p>[CP_CALCULATED_FIELDS id=&#8221;8&#8243;]</p>
<h2><b>Step 14: Putting the Board to Sleep</b></h2>
<p>We can reduce the power consumption by manipulating the duty cycle, controlling when the module is active and when it sleeps. To put the board to sleep, we’re going to use the <strong>Arduino Low Power Library</strong>.</p>
<ol>
<li style="font-weight: 400;" aria-level="1">In Arduino install the <b>Arduino Low Power Library</b>.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Return to your Arduino code. Save and rename your sketch as <i>feather-ttn-with-sleep. </i>In case something goes wrong you can always revert back to your original version.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Add these lines near your other include statements:<br />
[code lang=&#8221;arduino&#8221;]#define uS_TO_S_FACTOR 1000 /* Conversion factor for microseconds to seconds */<br />
#define TIME_TO_SLEEP 1200 /* Time feather will go to sleep (in seconds) */<br />
#include &quot;ArduinoLowPower.h&quot;[/code]<br />
&nbsp;</p>
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Navigate to <code>setup()</code> and add the following lines after the line that prints “Starting” to the serial monitor. These lines will turn on the internal LED so that you know when your device is awake:<br />
[code lang=&#8221;arduino&#8221;]pinMode(LED_BUILTIN, OUTPUT);<br />
digitalWrite(LED_BUILTIN, HIGH);[/code]<br />
&nbsp;</p>
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Navigate to this line <code>os_setTimedCallback(&amp;sendjob,os_getTime() + sec2osticks(TX_INTERVAL), do_send);</code><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Add the following after the line above:<br />
[code lang=&#8221;arduino&#8221;]Serial.println(&quot;Going to sleep&quot;);<br />
digitalWrite(LED_BUILTIN, LOW);<br />
LowPower.sleep(TIME_TO_SLEEP*uS_TO_S_FACTOR);<br />
digitalWrite(LED_BUILTIN, HIGH);[/code]
</li>
</ol>
<p>The code will put the board to sleep for however long you specify at the top of your code. You can change this value after you test the code, however, you should note that you will lose access to the serial monitor when the module is sleeping and you will have to reset the board by double clicking on the reset button after compiling, but before uploading.</p>
<p>When adjusting your sleep, think about how often you really need to take a reading and what kind of power your panel can provide. Then make your adjustment to your code.</p>
<p>I’m sleeping every 20 minutes between readings.</p>
<p>Readings which include sending data</p>
<p><b>Sleeping </b>= 0.000597 or ~0.0006 A</p>
<p><b>Active</b>= 0.018 A</p>
<p>The device is sleeping 0.9836 percent of the time and active for 0.01639 percent of the time</p>
<p>0.0006 A * 3.3 V * 24 hours * 0.9836 proportion of time= 0.04651 Wh</p>
<p>0.018 A * 3.3 V * 24 hours * 0.01639 proportion of time= 0.0233 Wh</p>
<p>Add them up for a total of <b>~0.07 Watt hours per day.</b></p>
<p>Now we have to think about what happens when the device tries to connect to TTN and can’t? Right now, the feather will keep trying and will consume more and more power.</p>
<p>To deal with this scenario, we’re going to use another type of sleep. This one won’t put the radio to sleep, but will reduce our power consumption. We’re going to make use of a <b>Watchdog timer</b> (WDT). A WDT is a simple countdown timer used to reset a microprocessor after a specific interval of time. During normal operation, a WDT timeout will generate a device RESET, but if the device is in SLEEP mode, a WDT timeout will cause the device to wake up and continue with normal operation. This is known as a WDT wake up.</p>
<ol>
<li style="font-weight: 400;" aria-level="1">In Arduino install the <b>Adafruit SleepyDog Library</b>.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Open the <b>Adafruit SleepyDog Library&gt;Utility&gt;WatchdogSAMD.cpp </b>in a text editor.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Add this line (line ~198):<code>SysTick-&gt;CTRL &amp;= ~SysTick_CTRL_TICKINT_Msk;</code><br />
after:<code>int actualPeriodMS = enable(maxPeriodMS, true); // true = for sleep.</code>Replace this line (217)<code>SysTick-&gt;CTRL &amp;= ~SysTick_CTRL_TICKINT_Msk;</code>With this:<code>SysTick-&gt;CTRL |= SysTick_CTRL_TICKINT_Msk;</code></p>
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Save the file.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Return to your Arduino code. Save and rename your sketch as <i>feather-ttn-with-sleep and watchdog. </i>In case something goes wrong you can revert back to your previous program.<br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">At the top of your program with your other instance variable add:<br />
[code lang=&#8221;arduino&#8221;]static unsigned long  previousMillis = 0;<br />
unsigned long currentMillis;<br />
unsigned long interval=10000;[/code]<br />
&nbsp;</p>
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Navigate to <code>void onEvent(ev_t ev)&lt;{</code><br />
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Add the following line:<br />
[code lang=&#8221;arduino&#8221;]currentMillis = millis();[/code]</p>
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Now navigate to:<br />
[code lang=&#8221;arduino&#8221;]case EV_JOIN_TXCOMPLETE:<br />
Serial.println(F(&quot;EV_JOIN_TXCOMPLETE: no JoinAccept&quot;));[/code]<br />
&nbsp;</p>
<hr />
</li>
<li style="font-weight: 400;" aria-level="1">Before the <code>break</code>, add:<br />
[code lang=&#8221;arduino&#8221;]if(currentMillis &#8211; previousMillis &gt; interval){<br />
previousMillis = currentMillis;<br />
Serial.println(&quot;Going to sleep in one second&#8230;&quot;);<br />
delay(1000);<br />
// To enter low power sleep mode call Watchdog.sleep() like below<br />
// and the watchdog will allow low power sleep for as long as possible.<br />
// The actual amount of time spent in sleep will be returned (in milliseconds).<br />
digitalWrite(LED_BUILTIN, LOW); // Show we&#039;re asleep<br />
int sleepMS = Watchdog.sleep();<br />
// Alternatively you can provide a millisecond value to specify<br />
// how long you&#039;d like the chip to sleep, but the hardware only<br />
// supports a limited range of values so the actual sleep time might<br />
// be smaller.  The time spent in sleep will be returned (in // milliseconds).<br />
// int sleepMS = Watchdog.sleep(1000); <br />
// Sleep for up to 1 second.<br />
// Code resumes here on wake. </p>
<p>digitalWrite(LED_BUILTIN, HIGH);// Show we&#039;re awake again </p>
<p>// The LED indicator lets you know you&#039;re back.[/code]<br />
&nbsp;</p>
<hr />
</li>
</ol>
<p>Now, using Qoitech’s<a href="https://www.qoitech.com/otii-ace/"> Otii Ace Pro</a> to accurately measure the power consumption, I confirm the following.</p>
<p>MAX: 136mA</p>
<p>AVG: 803µA</p>
<p>MIN: 550µA</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-112810" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/qoitech-375x500.jpg" alt="" width="375" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/qoitech-375x500.jpg 375w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/qoitech-750x1000.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/qoitech-768x1024.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/qoitech-1152x1536.jpg 1152w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/qoitech.jpg 1200w" sizes="auto, (max-width: 375px) 100vw, 375px" /></p>
<p>So my new values are:</p>
<p><b>0.0005A </b>during <b>sleep</b></p>
<p>Averaging the active and transmit states:</p>
<p>0.04A *17/60 seconds= 0.011 A</p>
<p>0.136A * 3/60 seconds=0.0068 A</p>
<p>0.011A+0.0068 A=<b>0.0178A for 20 seconds</b></p>
<p>Putting it all together:</p>
<p><b>Active: </b>0.0178A *20/1220 * 3.3V * 24 hours=<b>0.023Wh</b></p>
<p><b>Sleep: </b>0.0005A *1200/1220 * 3.3V * 24 hours=<b>0.038Wh</b></p>
<p>0.023Wh +0.38 Wh=~<b>0.06 Wh per day</b></p>
<hr />
<h2><strong>Sizing the System</strong></h2>
<p>Longevity is a crucial element of solar system design. When batteries fail, replacing them requires money, time, and human intervention: the more remote the deployment, the more challenging and costlier it is to replace the battery.</p>
<p>Remote sensor applications across agriculture, data collection, environmental monitoring, and asset tracking are generally expected to run for extended periods and, in some cases, need to run in extreme temperatures. As a solar system designer, you want your devices to continue running through various conditions (i.e., clouds, precipitation, or low and high temperatures)</p>
<p>One solution available to you is Voltaic Systems’ Lithium-Ion Capacitor (LiC) based solar charger that incorporates the e-Peas AEM10941 Energy Harvester (<a href="https://voltaicsystems.com/LIC-solar-charger/">https://voltaicsystems.com/LIC-solar-charger/</a>) and the <a href="https://www.vinatech.com/en/">Vinatech</a> hybrid capacitor. E-Peas is a leader in <a href="https://e-peas.com/energy-harvesting/">PMICs for energy harvesting</a>, and the AEM10941 is an integrated energy management circuit that extracts DC power from up to 7-cell solar panels to simultaneously store energy in a rechargeable element and supply the system with an unregulated voltage output between 2.5 &#8211; 3.6V.<img loading="lazy" decoding="async" class="alignnone size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2022/09/supercap-circuit-board.jpg" width="602" height="190" /><br />
Lithium Ion Capacitors (LICs) are a great alternative to traditional lithium-ion batteries in many Low-power WAN (LPWAN) applications. The combination of high energy production solar panels (up to 300mW @1SUN) + High current PMIC (110mA) + High-capacity Storage (250F) makes this LiC exceptionally well suited to power connected nodes using LoRa and LTE CAT-M, and NB-IoT, or those using the Generic Node running on The Things Industries LoRaWAN network.<br />
<img loading="lazy" decoding="async" class="alignnone size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2022/09/supercap-Solar-Charger-1167x1000.jpg" width="1167" height="1000" /></p>
<p>The LIC charges quickly. Even if completely discharged, the capacitor can be fully recharged in about 2 hours at full sun. The module can even work over periods of extended darkness. If your end device is low consumption, the module could theoretically run for a few months without access to the sun.</p>
<p>The Voltaic Systems’ LIC is an ultra-compact, lightweight, long-lifetime energy supply solution for heavy-duty applications that eliminates battery replacements and ensures performance across a range of temperatures (-40°C to 85°C).</p>
<p>For our device, we are going to add two 0.3 Watt 2 Volt ETFE laminate solar panels in parallel to charge the capacitor, which will provide an unregulated voltage between 2.5 – 3.8V—placing the panels in parallel increases the current but not the voltage. The Feather will run as long as the voltage is greater than 2.7V.</p>
<p>Connect positive leads from the panels to each other and negative leads to each other. Then, connect them to a JST to connect them to the capacitor.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-112811" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/20_e-peas.png" alt="Circuit for Solar LoRaWAN" width="500" height="319" /></p>
<p>Connect the positive lead from the capacitor to the BAT input on the feather and the negative lead to GND.<img loading="lazy" decoding="async" class="alignnone size-full wp-image-112814" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/19_bat.png" alt="Circuit for Solar LoRaWAN" width="640" height="379" /></p>
<h2><strong>Connecting to a Dashboard</strong></h2>
<p>Now that the device is working and powered by solar, we need to connect it to a dashboard. A dashboard in an IoT context is not just a nice to have, but a crucial element of any IoT system. It enhances your IoT devices&#8217; usability, management, and efficiency by providing a real-time view of your collected data.</p>
<p>For this example, we will use the <a href="https://qubitro.com/">Qubitro</a> platform to visualize the temperature, pressure, and battery voltage. Qubitro provides tools and infrastructure to connect, manage, and scale IoT devices and has <a href="https://docs.qubitro.com/platform">good documentation for getting started</a>. Built to be device-agnostic, it can work with a wide variety of IoT devices regardless of manufacturer or protocols used.</p>
<p><a href="https://portal.qubitro.com/1da06267-e2d8-4dcf-9da3-c1438b8d42d5"><img loading="lazy" decoding="async" class="alignnone wp-image-112856 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/full_dashboard-566x500.png" alt="Qubitro for Solar LoRaWAN" width="566" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/full_dashboard-566x500.png 566w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/full_dashboard-1131x1000.png 1131w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/full_dashboard-768x679.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/full_dashboard.png 1276w" sizes="auto, (max-width: 566px) 100vw, 566px" /></a></p>
<p>Here is the complete code:<br />
[code lang=&#8221;arduino&#8221;]</p>
<p>/*******************************************************************************<br />
* derived from The Things Network &#8211; Sensor Data Example<br />
*<br />
* Example of sending a valid LoRaWAN packet to The Things Networ using a Feather M0 LoRa.<br />
*<br />
* Learn Guide: https://learn.adafruit.com/the-things-network-for-feather<br />
*<br />
* Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman<br />
* Copyright (c) 2018 Terry Moore, MCCI<br />
* Copyright (c) 2018 Brent Rubell, Adafruit Industries<br />
*<br />
* Permission is hereby granted, free of charge, to anyone<br />
* obtaining a copy of this document and accompanying files,<br />
* to do whatever they want with them without any restriction,<br />
* including, but not limited to, copying, modification and redistribution.<br />
* NO WARRANTY OF ANY KIND IS PROVIDED.<br />
*******************************************************************************/<br />
#include &lt;lmic.h&gt;<br />
#include &lt;hal/hal.h&gt;<br />
/*#include */<br />
#include &lt;SPI.h&gt;<br />
#define uS_TO_S_FACTOR 1000 /* Conversion factor for microseconds to seconds */<br />
#define TIME_TO_SLEEP 1200  /* Time feather will go to sleep (in seconds) */<br />
#include &quot;ArduinoLowPower.h&quot;<br />
#include &lt;Adafruit_SleepyDog.h&gt;<br />
#include &lt;Arduino.h&gt;<br />
#include &lt;Wire.h&gt;<br />
#include &lt;ArtronShop_SHT3x.h&gt;</p>
<p>ArtronShop_SHT3x sht3x(0x44, &amp;Wire);  // ADDR: 0 =&gt; 0x44, ADDR: 1 =&gt; 0x45</p>
<p>#define VBATPIN A7<br />
static unsigned long previousMillis = 0;<br />
unsigned long currentMillis;<br />
unsigned long interval = 10000;<br />
// This EUI must be in little-endian format, so least-significant-byte<br />
// first. When copying an EUI from ttnctl output, this means to reverse<br />
// the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,<br />
// 0x70.<br />
static const u1_t PROGMEM APPEUI[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };<br />
void os_getArtEui(u1_t* buf) {<br />
  memcpy_P(buf, APPEUI, 8);<br />
}<br />
// This should also be in little endian format, see above.<br />
static const u1_t PROGMEM DEVEUI[8] = { 0x79, 0x9D, 0x06, 0xD0, 0x7E, 0xD5, 0xB3, 0x70 };<br />
void os_getDevEui(u1_t* buf) {<br />
  memcpy_P(buf, DEVEUI, 8);<br />
}<br />
// This key should be in big endian format (or, since it is not really a<br />
// number but a block of memory, endianness does not really apply). In<br />
// practice, a key taken from the TTN console can be copied as-is.<br />
static const u1_t PROGMEM APPKEY[16] = { 0x31, 0x4E, 0xA4, 0x36, 0x2F, 0x49, 0x1E, 0x30, 0x43, 0x4D, 0x6E, 0xA5, 0x14, 0x3B, 0x02, 0xAE };<br />
void os_getDevKey(u1_t* buf) {<br />
  memcpy_P(buf, APPKEY, 16);<br />
}<br />
// payload to send to TTN gateway<br />
static uint8_t payload[7];<br />
static osjob_t sendjob;<br />
// Schedule TX every this many seconds (might become longer due to duty<br />
// cycle limitations).<br />
const unsigned TX_INTERVAL = 30;<br />
// Pin mapping for Adafruit Feather M0 LoRa<br />
// /!\ By default Adafruit Feather M0&#039;s pin 6 and DIO1 are not connected.<br />
// Please ensure they are connected.<br />
const lmic_pinmap lmic_pins = {<br />
  .nss = 8,<br />
  .rxtx = LMIC_UNUSED_PIN,<br />
  .rst = 4,<br />
  .dio = { 3, 6, LMIC_UNUSED_PIN },<br />
  .rxtx_rx_active = 0,<br />
  .rssi_cal = 8,  // LBT cal for the Adafruit Feather M0 LoRa, in dB<br />
  .spi_freq = 8000000,<br />
};<br />
void printHex2(unsigned v) {<br />
  v &amp;= 0xff;<br />
  if (v &lt; 16)<br />
    Serial.print(&#039;0&#039;);<br />
  Serial.print(v, HEX);<br />
}<br />
void onEvent(ev_t ev) {<br />
  currentMillis = millis();<br />
  Serial.print(os_getTime());<br />
  Serial.print(&quot;: &quot;);<br />
  switch (ev) {<br />
    case EV_SCAN_TIMEOUT:<br />
      Serial.println(F(&quot;EV_SCAN_TIMEOUT&quot;));<br />
      break;<br />
    case EV_BEACON_FOUND:<br />
      Serial.println(F(&quot;EV_BEACON_FOUND&quot;));<br />
      break;<br />
    case EV_BEACON_MISSED:<br />
      Serial.println(F(&quot;EV_BEACON_MISSED&quot;));<br />
      break;<br />
    case EV_BEACON_TRACKED:<br />
      Serial.println(F(&quot;EV_BEACON_TRACKED&quot;));<br />
      break;<br />
    case EV_JOINING:<br />
      Serial.println(F(&quot;EV_JOINING&quot;));<br />
      break;<br />
    case EV_JOINED:<br />
      Serial.println(F(&quot;EV_JOINED&quot;));<br />
      {<br />
        u4_t netid = 0;<br />
        devaddr_t devaddr = 0;<br />
        u1_t nwkKey[16];<br />
        u1_t artKey[16];<br />
        LMIC_getSessionKeys(&amp;netid, &amp;devaddr, nwkKey, artKey);<br />
        Serial.print(&quot;netid: &quot;);<br />
        Serial.println(netid, DEC);<br />
        Serial.print(&quot;devaddr: &quot;);<br />
        Serial.println(devaddr, HEX);<br />
        Serial.print(&quot;AppSKey: &quot;);<br />
        for (size_t i = 0; i &lt; sizeof(artKey); ++i) {<br />
          if (i != 0)<br />
            Serial.print(&quot;-&quot;);<br />
          printHex2(artKey[i]);<br />
        }<br />
        Serial.println(&quot;&quot;);<br />
        Serial.print(&quot;NwkSKey: &quot;);<br />
        for (size_t i = 0; i &lt; sizeof(nwkKey); ++i) {<br />
          if (i != 0) Serial.print(&quot;-&quot;);<br />
          printHex2(nwkKey[i]);<br />
        }<br />
        Serial.println();<br />
      }  // Disable link check validation (automatically enabled // during join, but because slow data rates change max TX // size, we don&#039;t use it in this example. //LMIC_setLinkCheckMode(0); break; /* || This event is defined but not used in the code. No || point in wasting codespace on it. || || case EV_RFU1: || Serial.println(F(&quot;EV_RFU1&quot;)); || break; */ case EV_JOIN_FAILED: Serial.println(F(&quot;EV_JOIN_FAILED&quot;)); break; case EV_REJOIN_FAILED: Serial.println(F(&quot;EV_REJOIN_FAILED&quot;)); break; case EV_TXCOMPLETE: Serial.println(F(&quot;EV_TXCOMPLETE (includes waiting for RX windows)&quot;)); if (LMIC.txrxFlags &amp; TXRX_ACK) Serial.println(F(&quot;Received ack&quot;)); if (LMIC.dataLen) { Serial.println(F(&quot;Received &quot;)); Serial.println(LMIC.dataLen); Serial.println(F(&quot; bytes of payload&quot;)); } // Schedule next transmission os_setTimedCallback(&amp;sendjob, os_getTime() + sec2osticks(TX_INTERVAL), do_send); Serial.println(&quot;Going to sleep&quot;); digitalWrite(LED_BUILTIN, LOW); LowPower.sleep(TIME_TO_SLEEP * uS_TO_S_FACTOR); digitalWrite(LED_BUILTIN, HIGH); break; case EV_LOST_TSYNC: Serial.println(F(&quot;EV_LOST_TSYNC&quot;)); break; case EV_RESET: Serial.println(F(&quot;EV_RESET&quot;)); break; case EV_RXCOMPLETE: // data received in ping slot Serial.println(F(&quot;EV_RXCOMPLETE&quot;)); break; case EV_LINK_DEAD: Serial.println(F(&quot;EV_LINK_DEAD&quot;)); break; case EV_LINK_ALIVE: Serial.println(F(&quot;EV_LINK_ALIVE&quot;)); break; /* || This event is defined but not used in the code. No || point in wasting codespace on it. || || case EV_SCAN_FOUND: || Serial.println(F(&quot;EV_SCAN_FOUND&quot;)); || break; */ case EV_TXSTART: Serial.println(F(&quot;EV_TXSTART&quot;)); break; case EV_TXCANCELED: Serial.println(F(&quot;EV_TXCANCELED&quot;)); break; case EV_RXSTART: /* do not print anything &#8212; it wrecks timing */ break; case EV_JOIN_TXCOMPLETE: Serial.println(F(&quot;EV_JOIN_TXCOMPLETE: no JoinAccept&quot;)); if (currentMillis &#8211; previousMillis &gt; interval) {<br />
      previousMillis = currentMillis;<br />
      Serial.println(&quot;Going to sleep in one second&#8230;&quot;);<br />
      delay(1000);<br />
      // To enter low power sleep mode call Watchdog.sleep() like below<br />
      // and the watchdog will allow low power sleep for as long as possible.<br />
      // The actual amount of time spent in sleep will be returned (in<br />
      // milliseconds).<br />
      digitalWrite(LED_BUILTIN, LOW);  // Show we&#039;re asleep<br />
      int sleepMS = Watchdog.sleep();<br />
      // Alternatively you can provide a millisecond value to specify<br />
      // how long you&#039;d like the chip to sleep, but the hardware only<br />
      // supports a limited range of values so the actual sleep time might<br />
      // be smaller.  The time spent in sleep will be returned (in<br />
      // milliseconds).<br />
      // int sleepMS = Watchdog.sleep(1000);  // Sleep for up to 1 second.<br />
      // Code resumes here on wake.<br />
      digitalWrite(LED_BUILTIN, HIGH);  // Show we&#039;re awake again<br />
// Try to reattach USB connection on &quot;native USB&quot; boards (connection is<br />
// lost on sleep). Host will also need to reattach to the Serial monitor.<br />
// Seems not entirely reliable, hence the LED indicator fallback.<br />
#if defined(USBCON) &amp;&amp; !defined(USE_TINYUSB)<br />
      USBDevice.attach();<br />
#endif<br />
      break;<br />
  }<br />
  break;<br />
  default:<br />
    Serial.print(F(&quot;Unknown event: &quot;));<br />
    Serial.println((unsigned)ev);<br />
    break;<br />
}<br />
}<br />
void do_send(osjob_t* j) {<br />
  // Check if there is not a current TX/RX job running<br />
  if (LMIC.opmode &amp; OP_TXRXPEND) {<br />
    Serial.println(F(&quot;OP_TXRXPEND, not sending&quot;));<br />
  } else {<br />
    // read the sensor<br />
    if (sht3x.measure()) {</p>
<p>      temperature = (9 * sht3x.temperature()) / 5 + 32;<br />
      Serial.print(&quot;Temperature: &quot;);<br />
      Serial.print(temperature);<br />
      Serial.println(&quot; *F&quot;);<br />
      // adjust for the f2sflt16 range (-1 to 1)<br />
      temperature = temperature / 100;</p>
<p>      // read the humidity from the DHT22<br />
      rHumidity = (sht3x.humidity());<br />
      Serial.print(&quot;%RH &quot;);<br />
      Serial.println(rHumidity);<br />
      // adjust for the f2sflt16 range (-1 to 1)<br />
      rHumidity = rHumidity / 100;</p>
<p>      // note: this uses the sflt16 datum (https://github.com/mcci-catena/arduino-lmic#sflt16)<br />
      uint16_t payloadTemp = LMIC_f2sflt16(temperature);<br />
      // int -&gt; bytes<br />
      byte tempLow = lowByte(payloadTemp);<br />
      byte tempHigh = highByte(payloadTemp);<br />
      // place the bytes into the payload<br />
      payload[0] = tempLow;<br />
      payload[1] = tempHigh;</p>
<p>      // float -&gt; int<br />
      uint16_t payloadHumid = LMIC_f2sflt16(rHumidity);<br />
      // int -&gt; bytes<br />
      byte humidLow = lowByte(payloadHumid);<br />
      byte humidHigh = highByte(payloadHumid);<br />
      payload[2] = humidLow;<br />
      payload[3] = humidHigh;</p>
<p>    } else {<br />
      Serial.println(&quot;SHT3x read error&quot;);<br />
    }<br />
    delay(1000);</p>
<p>    int readings = 1000;<br />
    float myReadings[readings];</p>
<p>    float v;<br />
    float sumV;</p>
<p>    for (int i = 0; i &lt; readings; i++) {<br />
      myReadings[i] = analogRead(VOLT_PIN);<br />
    }<br />
    for (int j = 0; j &lt; readings; j++) {<br />
      sumV += myReadings[j];<br />
    }<br />
    float averagedV = sumV / readings;<br />
    //float v = analogRead(VOLT_PIN);<br />
    float voltage = (averagedV * 3.3 / 4095) * 2.178;<br />
    /*b = val * 5 / 1024;        //the math<br />
     b = val * (R1 + R2) / R2;  //more math*/<br />
    float level;</p>
<p>    if (voltage &gt;= 3.2 &amp;&amp; voltage &lt;= 4.2) {<br />
      level = map(voltage * 100, 3.2 * 100, 4.2 * 100, 0, 100);<br />
    } else if (voltage &gt; 4.2) {<br />
      voltage = 4.2;<br />
      level = 100;<br />
    } else {<br />
      level = 0;<br />
    }</p>
<p>    Serial.print(&quot;voltage=&quot;);<br />
    Serial.println(voltage);<br />
    Serial.print(&quot;Level=&quot;);<br />
    Serial.println(level);</p>
<p>    voltage = voltage / 100;<br />
    level = level / 100;<br />
    // float -&gt; int<br />
    uint16_t payloadV = LMIC_f2sflt16(voltage);<br />
    // int -&gt; bytes<br />
    byte vLow = lowByte(payloadV);<br />
    byte vHigh = highByte(payloadV);<br />
    payload[4] = vLow;<br />
    payload[5] = vHigh;</p>
<p>    // float -&gt; int<br />
    uint16_t payloadL = LMIC_f2sflt16(level);<br />
    // int -&gt; bytes<br />
    byte lLow = lowByte(payloadL);<br />
    byte lHigh = highByte(payloadL);<br />
    payload[6] = lLow;<br />
    payload[7] = lHigh;</p>
<p>    // prepare upstream data transmission at the next possible time.<br />
    // transmit on port 1 (the first parameter); you can use any value from 1 to 223 (others are reserved).<br />
    // don&#039;t request an ack (the last parameter, if not zero, requests an ack from the network).<br />
    // Remember, acks consume a lot of network resources; don&#039;t ask for an ack unless you really need it.<br />
    LMIC_setTxData2(1, payload, sizeof(payload) &#8211; 1, 0);<br />
  }</p>
<p>  // Next TX is scheduled after TX_COMPLETE event.<br />
}</p>
<p>void setup() {<br />
  delay(5000);<br />
  Serial.begin(9600);<br />
  Serial.println(F(&quot;Starting&quot;));<br />
  pinMode(LED_BUILTIN, OUTPUT);<br />
  digitalWrite(LED_BUILTIN, HIGH);  // LMIC<br />
  init os_init();                   // Reset the MAC state. Session and pending data transfers will be discarded.<br />
  LMIC_reset();                     // Disable link-check mode and ADR, because ADR tends to complicate testing.<br />
  LMIC_setLinkCheckMode(0);         // Set the data rate to Spreading Factor 7. This is the fastest supported rate for 125 kHz channels, and it // minimizes air time and battery power. Set the transmission power to 14 dBi (25 mW).<br />
  LMIC_setDrTxpow(DR_SF7, 14);      // in the US, with TTN, it saves join time if we start on subband 1 (channels 8-15). This will // get overridden after the join by parameters from the network. If working with other // networks or in other regions, this will need to be changed. //comment this out?<br />
  LMIC_selectSubBand(1);            // Start job (sending automatically starts OTAA too)<br />
  do_send(&amp;sendjob);<br />
}<br />
void loop() {<br />
  // we call the LMIC&#039;s runloop processor. This will cause things to happen based on events and time. One<br />
  // of the things that will happen is callbacks for transmission complete or received messages. We also<br />
  // use this loop to queue periodic data transmissions. You can put other things here in the `loop()` routine,<br />
  // but beware that LoRaWAN timing is pretty tight, so if you do more than a few milliseconds of work, you<br />
  // will want to call `os_runloop_once()` every so often, to keep the radio running.<br />
  os_runloop_once();<br />
}<br />
[/code]<br />
In conclusion, this tutorial offers a entry point into the world of IoT powered by This tutorial is an entry point into the world of solar-powered IoT. Programming and sizing your system are some of the practical aspects of designing energy-efficient remote data monitoring devices. Introducing the LIC demonstrates that a capacitor can provide a viable alternative to a battery for truly low-power devices. Using The Things Network and Qubitro dashboard brings an added dimension of network connectivity and data visualization to the project, making it a perfect blend of the practical IoT challenges you will face when designing your applications. Whether you’re a hobbyist, a student, or a professional, this tutorial provides valuable skills and knowledge applicable to a wide range of IoT applications, emphasizing the importance of efficient design.</p>
<p style="text-align: left;">So what will you build?</p>
</li>
</ol>
<p style="text-align: center;"><a class="maxbutton-46 maxbutton maxbutton-solar-consultation" title="Set Up a Consultation" href="https://voltaicsystems.com/contact-us/"><span class='mb-text'>Sign Up for a Consultation</span></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.voltaicsystems.com/solar-powered-lora-radio-barometric-pressure-and-altimeter-tutorial/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Solar Powered ESP32 over WiFi Application Tutorial</title>
		<link>https://blog.voltaicsystems.com/solar-powered-esp32-over-wifi-application-tutorial/</link>
					<comments>https://blog.voltaicsystems.com/solar-powered-esp32-over-wifi-application-tutorial/#respond</comments>
		
		<dc:creator><![CDATA[Lizabeth Arum]]></dc:creator>
		<pubDate>Fri, 15 Dec 2023 17:11:10 +0000</pubDate>
				<category><![CDATA[All]]></category>
		<category><![CDATA[IoT Tutorial]]></category>
		<category><![CDATA[environmental monitoring]]></category>
		<category><![CDATA[esp32]]></category>
		<guid isPermaLink="false">http://80ca4ebf1c.nxcli.io/?p=112671</guid>

					<description><![CDATA[Overview: Learn how to create a cloud-connected IoT device using an ESP32 connected to a DS18B20 temperature sensor temperature probe. In this tutorial, you will: Program your board using the Arduino IDE to send via WiFi temperature and battery voltage levels at certain times Reduce power consumption and consider ways to make the device more [&#8230;]]]></description>
										<content:encoded><![CDATA[<h2>Overview:</h2>
<p>Learn how to create a cloud-connected IoT device using an ESP32 connected to a DS18B20 temperature sensor temperature probe. In this tutorial, you will:</p>
<ul>
<li>Program your board using the Arduino IDE to send via WiFi temperature and battery voltage levels at certain times</li>
<li>Reduce power consumption and consider ways to make the device more efficient</li>
<li>Deploy system with appropriately sized solar panel and battery</li>
<li>Publish data on the tago.io dashboard</li>
</ul>
<p><img loading="lazy" decoding="async" width="750" height="500" class="alignnone size-medium wp-image-112753" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/circuit-750x500.jpg" alt="circuit" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/circuit-750x500.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/circuit-768x512.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/circuit-300x200.jpg 300w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/circuit-360x240.jpg 360w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/circuit-600x400.jpg 600w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/circuit.jpg 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<h2>An IoT ESP 32 Temperature Sensor</h2>
<p>This tutorial will cover powering an ESP32 with a 6V solar panel and a 3.7V LiPo battery. It will also cover connecting the ESP32 to a network using WiFi and sending data to a cloud platform at regular intervals. Sending your data to a dashboard allows you to log and monitor sensor data over time and can be used for trends analysis and data-based decision-making. This type of remote monitoring system can be implemented in various fields, such as agriculture, environmental monitoring, and outdoor asset tracking.</p>
<p>This tutorial setup, from the parts to the dashboard, is relatively low-cost, making it accessible to anyone interested in getting started with setting up their own IoT devices. Ideally, this simple project will introduce you to sensors, coding, network communication, and cloud integration.</p>
<p>The dashboard we will be using in this tutorial is from <a class="editor-rtfLink" href="https://tago.io/" target="_blank" rel="noopener">TagoIO</a>. TagoIO is a cloud IoT platform that is easy to connect to, use, and customize. In addition to being simple to set up, TagoIO provides free access to create five devices and five dashboards. This free level lets you immediately explore TagoIO’s dashboard capabilities. US-based TagoIO is used in over 120 countries and currently supports over 1000 different IoT applications across Agriculture, Buildings, Industrial, Energy, and Logistics verticals. Here’s a <a class="editor-rtfLink" href="https://653da135690a5e0009cb2965.tago.run/dashboards/info/653ea5d1590eca0009a497ed?anonymousToken=00000000-653d-a135-690a-5e0009cb2965" target="_blank" rel="noopener">link</a> to the dashboard in this tutorial.</p>
<div><a class="editor-rtfLink" href="https://653da135690a5e0009cb2965.tago.run/dashboards/info/653ea5d1590eca0009a497ed?anonymousToken=00000000-653d-a135-690a-5e0009cb2965" target="_blank" rel="noopener"><br />
<img loading="lazy" decoding="async" class="alignnone wp-image-112794 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-750x392.png" alt="Dashboard" width="750" height="392" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-750x392.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-1500x784.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-768x401.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-1536x802.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/12/dashboard-2048x1070.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /></a></div>
<h2>Parts Needed</h2>
<ul>
<li><a class="editor-rtfLink" href="https://www.amazon.com/dp/B0B11N1X8R?psc=1&amp;ref=ppx_yo2ov_dt_b_product_details" target="_blank" rel="noopener">ESP32 WROOM board</a></li>
<li>Breadboard</li>
<li>Wires</li>
<li><a class="editor-rtfLink" href="https://www.amazon.com/dp/B0CDG746G8?psc=1&amp;ref=ppx_yo2ov_dt_b_product_details" target="_blank" rel="noopener">ESP32 Breakout board </a></li>
<li><a class="editor-rtfLink" href="https://www.amazon.com/dp/B00M1PM55K?psc=1&amp;ref=ppx_yo2ov_dt_b_product_details" target="_blank" rel="noopener">Waterproof DS18B20 Temperature Sensor Temperature Probe </a></li>
<li><a class="editor-rtfLink" href="https://voltaicsystems.com/search.php?search_query=6%20Volt&amp;section=product" target="_blank" rel="noopener">6 Volt Solar Panel</a></li>
<li><a class="editor-rtfLink" href="https://voltaicsystems.com/BK102" target="_blank" rel="noopener">Solar Panel Bracket &#8211; Medium</a></li>
<li>Small Solar Ready Enclosure</li>
<li><a class="editor-rtfLink" href="https://www.adafruit.com/product/4755?gclid=Cj0KCQjwqP2pBhDMARIsAJQ0CzrtactEuBysJ1VUBmrUQ4H7r_tmdrcqpkgXI-ylRMMu8WLgcd3gvooaAqpbEALw_wcB" target="_blank" rel="noopener">Adafruit Universal USB / DC / Solar Lithium Ion/Polymer charger &#8211; bq24074</a></li>
<li><a class="editor-rtfLink" href="https://www.adafruit.com/search?q=Lithium+Ion+Battery+Pack+-+3.7V+6600mAh+" target="_blank" rel="noopener">Lithium Ion Battery Pack &#8211; 3.7V 6600mAh</a></li>
<li><a href="https://www.amazon.com/Power-Connector-Female-Adapter-Camera/dp/B07C61434H/ref=sr_1_1_sspa" target="_blank" rel="noopener">12V DC Power Connector 5.5mm x 2.1mm male</a></li>
<li>Voltage divider for battery monitor:
<ul>
<li class="ql-indent-1"><a class="editor-rtfLink" href="https://makeradvisor.com/tools/resistors-kits/" target="_blank" rel="noopener">27k Ohm resistor</a></li>
<li class="ql-indent-1"><a class="editor-rtfLink" href="https://makeradvisor.com/tools/resistors-kits/" target="_blank" rel="noopener">100k Ohm resistor</a></li>
</ul>
</li>
</ul>
<p>Note that while there are a few versions of the ESP32 board, the board in this tutorial has 30 pins:</p>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-112682 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/ESP32-Pinout-716x500.jpg" alt="ESP32-Pinout" width="716" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/ESP32-Pinout-716x500.jpg 716w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/ESP32-Pinout.jpg 727w" sizes="auto, (max-width: 716px) 100vw, 716px" /></p>
<div style="text-align: center;"><a class="editor-rtfLink" href="https://lastminuteengineers.com/esp32-pinout-reference/" target="_blank" rel="noopener">https://lastminuteengineers.com/esp32-pinout-reference/</a></div>
<p>Several example circuits on the internet make use of the <a class="editor-rtfLink" href="https://www.amazon.com/dp/B071RG4YWM?psc=1&amp;ref=ppx_yo2ov_dt_b_product_details" target="_blank" rel="noopener">TP4056 Lithium Battery Charger Module</a>, but these circuits require a voltage regulator — a <a class="editor-rtfLink" href="https://makeradvisor.com/tools/low-dropout-ldo-regulator-mcp1700-3320e/" target="_blank" rel="noopener">Low-dropout or LDO regulator (MCP1700-3302E</a>, a 100uF electrolytic capacitor, and a <a class="editor-rtfLink" href="https://www.amazon.com/dp/B07P8N8BW9?psc=1&amp;ref=ppx_yo2ov_dt_b_product_details" target="_blank" rel="noopener">100nF ceramic capacitor</a> or a diode.</p>
<p>Besides needing additional components, there are better solutions than the TP4056 for a solar-powered circuit: Solar panels are not batteries. As a power source, they are unstable. Depending on the sunlight, the voltage and current a panel generates will vary according to the amount of light available. It is the fluctuations of voltage generated that can confuse battery chargers. When chargers are confused, they either rapidly turn on and off as they try to draw more current from the panel than possible, and/or they draw much less current than they can to keep the voltage from collapsing.</p>
<p>For this tutorial, I opted to go with the <a class="editor-rtfLink" href="https://www.adafruit.com/product/4755" target="_blank" rel="noopener">Adafruit Universal USB / DC / Solar Lithium Ion/Polymer charger &#8211; bq24074</a>, which is designed to handle the variability of power from a solar panel. When the input drops below 4.5V, the charger backs off and automatically reduces the charge rate to keep the voltage above 4.5V.</p>
<h2>Step 1: Gather Your Parts</h2>
<p>&nbsp;</p>
<h2>Step 2: Pick a Breadboard Strategy</h2>
<p>The ESP32 is not particularly breadboard-friendly. One solution is to use two breadboards and straddle the gap with the ESP32 or use a breakout board as I do.</p>
<p><img loading="lazy" decoding="async" width="750" height="426" class="size-medium wp-image-112683 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/two_breadboards-750x426.png" alt="" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/two_breadboards-750x426.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/two_breadboards-1500x852.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/two_breadboards-768x436.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/two_breadboards-1536x872.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/two_breadboards.png 1606w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<div style="text-align: center;"><a href="https://randomnerdtutorials.com/">randomnerdtutorials.com</a></div>
<div><img decoding="async" class="size-medium wp-image-112684 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/81xrbaOyk3L._SL1500_-500x500.jpg" alt="breakout board for ESP32" width="500px" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/81xrbaOyk3L._SL1500_-500x500.jpg 500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/81xrbaOyk3L._SL1500_-1000x1000.jpg 1000w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/81xrbaOyk3L._SL1500_-150x150.jpg 150w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/81xrbaOyk3L._SL1500_-768x768.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/81xrbaOyk3L._SL1500_-125x125.jpg 125w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/81xrbaOyk3L._SL1500_.jpg 1500w" sizes="(max-width: 500px) 100vw, 500px" /></div>
<p>&nbsp;</p>
<h2>Step 3: Wire the Circuit</h2>
<p><img loading="lazy" decoding="async" width="500" height="500" class="wp-image-112743 size-medium aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic-500x500.jpg" alt="schematic" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic-500x500.jpg 500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic-1000x1000.jpg 1000w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic-150x150.jpg 150w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic-768x768.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic-125x125.jpg 125w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic.jpg 1440w" sizes="auto, (max-width: 500px) 100vw, 500px" /></p>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-112778 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic_bb-2-614x500.jpg" alt="Breadboard" width="614" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic_bb-2-614x500.jpg 614w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic_bb-2-1229x1000.jpg 1229w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic_bb-2-768x625.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic_bb-2-1536x1250.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/schematic_bb-2.jpg 1633w" sizes="auto, (max-width: 614px) 100vw, 614px" /></p>
<p>The voltage divider for battery monitor logic comes from Random Nerd&#8217;s <a href="https://randomnerdtutorials.com/power-esp32-esp8266-solar-panels-battery-level-monitoring/">Power ESP32/ESP8266 with Solar Panels</a> tutorial. The ESP32 has an input voltage of 3.3V, but the battery, when fully charged, outputs a higher voltage. By adding a voltage divider we are able to read the voltage level of the battery:</p>
<div style="width: 847px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="size-medium" src="https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/04/voltage-divider-battery-level.png?w=837&amp;quality=100&amp;strip=all&amp;ssl=1" alt="Voltage divider" width="837" height="420" /><p class="wp-caption-text">Voltage divider from Random Nerd&#8217;s tutorial</p></div>
<p><strong>Code for reading battery level  where b returns percentage and b2 returns voltage</strong><br />
[code lang=&#8221;arduino&#8221;]  float val = analogRead(VOLT_PIN);<br />
//reads the analog input<br />
Serial.println(val);<br />
Vout = (val * 3.3) / 4095.0;  // formula for calculating voltage out<br />
float b = Vout * (R2 + R1) / R2;    // formula for calculating voltage in<br />
b = map(val, 0.0f, 4095.0f, 0, 100);<br />
float b2=(((b*40.95)*(3.3/4095))*4.2)/3.3;<br />
[/code]</p>
<p>&nbsp;</p>
<h2>Step 4: Set Up the Arduino IDE</h2>
<ol>
<li>Open or install the Arduino IDE. If you do not have the latest version of the Arduino IDE installed:
<ol>
<li class="ql-indent-1">Navigate to the <a class="editor-rtfLink" href="https://www.arduino.cc/en/software" target="_blank" rel="noopener">Arduino website</a>.</li>
<li class="ql-indent-1">Select your operating system and download the software.</li>
</ol>
</li>
<li>To program the ESP32 board using Arduino IDE, you need to install the ESP32 and add-on. Open the <strong>Preferences </strong>window in the Arduino IDE.</li>
<li>Go to <strong>File </strong>&gt; <strong>Preferences</strong>.</li>
<li>Enter the following into the “<strong>Additional Board Manager URLs</strong>” field.<br />
<blockquote><p><a class="editor-rtfLink" href="https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" target="_blank" rel="noopener">https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json</a></p></blockquote>
<p><img loading="lazy" decoding="async" width="611" height="500" class="size-medium wp-image-112687 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_preferences-611x500.png" alt="Arduino Preferences" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_preferences-611x500.png 611w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_preferences-1223x1000.png 1223w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_preferences-768x628.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_preferences-282x232.png 282w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_preferences.png 1306w" sizes="auto, (max-width: 611px) 100vw, 611px" /></li>
<li>Click OK.</li>
<li>Open the <strong>Boards Manager</strong>. Go to <strong>Tools </strong>&gt; <strong>Board </strong>&gt;<strong>Boards Manager&#8230;</strong></li>
<li>Search for ESP32 by Espressif Systems   <img loading="lazy" decoding="async" width="750" height="486" class="size-medium wp-image-112719 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/board_manager-750x486.png" alt="" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/board_manager-750x486.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/board_manager-1500x972.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/board_manager-768x498.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/board_manager-1536x996.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/board_manager.png 2018w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
</ol>
<h2>Step 5: Set Up Your ESP32</h2>
<p>Connect your ESP32-WROOM to your computer through USB. Then, follow these steps:</p>
<ol>
<li>Open the Arduino IDE.</li>
<li>Select your board in the  <strong>Tools Board</strong> menu (in our case, it’s the ESP32-WROOM-DA Module).<img loading="lazy" decoding="async" width="492" height="500" class="size-medium wp-image-112718 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/board_esp-1-492x500.png" alt="ESP32 Wroom" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/board_esp-1-492x500.png 492w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/board_esp-1-768x780.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/board_esp-1.png 910w" sizes="auto, (max-width: 492px) 100vw, 492px" /></li>
<li>Select the <strong>Port</strong>. If you don’t see the COM Port in your Arduino IDE, you will need to install the <a class="editor-rtfLink" href="https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers" target="_blank" rel="noopener">ESP32 CP210x USB to UART Bridge VCP Drivers</a> or other drivers, depending on the board model you’re using).</li>
<li>To test that it all works, open the WiFi example:                                                         <img loading="lazy" decoding="async" width="767" height="1000" class="alignnone wp-image-112735 size-full" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/wifi_test-767x1000-1.jpg" alt="Wifi Test" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/wifi_test-767x1000-1.jpg 767w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/wifi_test-767x1000-1-384x500.jpg 384w" sizes="auto, (max-width: 767px) 100vw, 767px" /></li>
<li>Click on the <strong>Upload</strong> button:<strong><img loading="lazy" decoding="async" width="750" height="487" class="size-medium wp-image-112716 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/upload-750x487.jpg" alt="" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/upload-750x487.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/upload-1500x974.jpg 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/upload-768x499.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/upload-1536x998.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/upload.jpg 2020w" sizes="auto, (max-width: 750px) 100vw, 750px" /></strong></li>
</ol>
<p>If everything went as expected, you should see a “Done uploading.” message. If you don’t, you’ll need to troubleshoot.</p>
<h2>Step 6: Set Up Your Program</h2>
<p>Create a new Sketch and save it as<strong> ESP32_temperature</strong>.</p>
<h2>Step 7: Import Libraries</h2>
<p>You’ll need a few libraries, so go to Tools and select <strong>Manage Libraries…<img loading="lazy" decoding="async" width="449" height="500" class="size-medium wp-image-112712 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/manage_libraries-449x500.png" alt="Manage Libraries" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/manage_libraries-449x500.png 449w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/manage_libraries-898x1000.png 898w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/manage_libraries-768x855.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/manage_libraries.png 1036w" sizes="auto, (max-width: 449px) 100vw, 449px" /></strong></p>
<p>You’ll need to install:</p>
<ul>
<li><strong>DallasTemperature</strong> by Miles Burton</li>
<li><strong>OneWire</strong> by Jim Studt, Tom Pollard, Robin James, and Paul Stoffregen</li>
<li><strong>ArduinoHttpClient</strong> by Arduino</li>
<li><strong>WifiMulti_Generic</strong> by Khoi Hoang</li>
<li><strong>ESPEssentials</strong> by Stephen Rumswinkel</li>
</ul>
<p>When prompted, install all libraries and their dependencies.</p>
<h2>Step 8: Copy and Paste the Code into Your Sketch</h2>
<p>[code lang=&#8221;arduino&#8221;]// TagoIO and ESP integration with Temperature<br />
// inspired by Carlo Stramaglia April 2nd 2023</p>
<p>#include &lt;DallasTemperature.h&gt;<br />
#include &lt;OneWire.h&gt;<br />
#include &lt;HTTPClient.h&gt;<br />
#include &lt;WiFi.h&gt;<br />
#include &lt;sp_wifi.h&gt;;</p>
<p>#define uS_TO_S_FACTOR 1000000ULL /* Conversion factor for micro seconds to seconds */<br />
#define TIME_TO_SLEEP 10       /* Time ESP32 will go to sleep (in seconds) */</p>
<p>char serverAddress[] = &quot;https://api.tago.io/data&quot;;  // TagoIO address<br />
char contentHeader[] = &quot;application/json&quot;;<br />
char tokenHeader[] = &quot;[XXX]&quot;;  // TagoIO Token<br />
const char *ssid = &quot;[XXX]&quot;;<br />
const char *password = &quot;[XXX]&quot;;</p>
<p>WiFiClient wifia;<br />
// HttpClient client = HttpClient(wifia, serverAddress, port);<br />
HTTPClient client;<br />
int status = WL_IDLE_STATUS;</p>
<p>// Variables used in calculating the battery voltage<br />
float b;<br />
float Vout = 0.00;<br />
float Vin = 0.00;<br />
float R1 = 27000.00;   // resistance of R1 (27K) // You can also use 33K<br />
float R2 = 100000.00;  // resistance of R2x (100K)<br />
//int val = 0;<br />
// GPIO where the DS18B20 is connected to<br />
const int oneWireBus = 4;</p>
<p>const int VOLT_PIN = 33;</p>
<p>unsigned long startTime;<br />
unsigned long timeAwake;<br />
bool started=false;<br />
// Setup a oneWire instance to communicate with any OneWire devices<br />
OneWire oneWire(oneWireBus);</p>
<p>// Pass our oneWire reference to Dallas Temperature sensor<br />
DallasTemperature sensors(&amp;oneWire);</p>
<p>//Time in seconds<br />
#define CONNECTION_TIMEOUT 5<br />
#define DEEP_SLEEP_DURATION 10</p>
<p>void wifi_connect() {</p>
<p>  WiFi.mode(WIFI_STA);<br />
  if (ssid != &quot;&quot;)<br />
    WiFi.begin(ssid, password);<br />
  WiFi.begin();<br />
  Serial.println(&quot;&quot;);</p>
<p>  // Wait for connection<br />
  int timeout_counter = 0;</p>
<p>  while (WiFi.status() != WL_CONNECTED) {<br />
    Serial.print(&quot;.&quot;);<br />
    delay(100);<br />
    timeout_counter++;<br />
    if (timeout_counter &gt;= CONNECTION_TIMEOUT * 10) {<br />
      Serial.println(&quot;\nCan&#039;t establish WiFi connexion&quot;);<br />
      //Setup timer<br />
      esp_sleep_enable_timer_wakeup(DEEP_SLEEP_DURATION * 1000000);<br />
      //Start deep sleep<br />
      esp_deep_sleep_start();<br />
    }<br />
  }</p>
<p>  Serial.println(&quot;&quot;);<br />
  Serial.print(&quot;Connected to &quot;);<br />
  Serial.println(ssid);<br />
  Serial.print(&quot;IP address: &quot;);<br />
  Serial.println(WiFi.localIP());<br />
}<br />
void Read_And_Send_Sensors_Data() {<br />
  char anyData[30];<br />
  char postData[300];<br />
  char anyData1[30];<br />
  char bAny[30];<br />
  int statusCode = 0;<br />
  sensors.requestTemperatures();<br />
  Serial.print(&quot;Temperature in F: &quot;);<br />
  Serial.println((sensors.getTempCByIndex(0) * 9.0) / 5.0 + 32.0);  //print the temperature in Fahrenheit<br />
  float t = (sensors.getTempCByIndex(0) * 9.0) / 5.0 + 32.0;</p>
<p>  //Temperature<br />
  Serial.print(F(&quot;Temperature: &quot;));<br />
  Serial.println(t);<br />
  strcpy(postData, &quot;{\n\t\&quot;variable\&quot;: \&quot;Temperature\&quot;,\n\t\&quot;value\&quot;: &quot;);<br />
  dtostrf(t, 6, 2, anyData);<br />
  strncat(postData, anyData, 100);<br />
  strcpy(anyData1, &quot;,\n\t\&quot;unit\&quot;: \&quot;F\&quot;\n\t}\n&quot;);<br />
  strncat(postData, anyData1, 100);<br />
  Serial.println(postData);<br />
  client.begin(serverAddress);<br />
  client.addHeader(&quot;Content-Type&quot;, contentHeader);<br />
  client.addHeader(&quot;Device-Token&quot;, tokenHeader);<br />
  statusCode = client.POST(postData);<br />
  // read the status code and body of the response<br />
  Serial.print(&quot;Status code: &quot;);<br />
  Serial.println(statusCode);<br />
  Serial.println(&quot;End of POST to TagoIO&quot;);<br />
  Serial.println();</p>
<p>  // Reading Battery Level<br />
  float val = analogRead(VOLT_PIN);  //reads the analog input<br />
  Serial.println(val);<br />
  Vout = (val * 3.3) / 4095.0;  // formula for calculating voltage out<br />
  b = Vout * (R2 + R1) / R2;    // formula for calculating voltage in<br />
  float b = map(val, 0.0f, 4095.0f, 0, 100);<br />
  float b2=(((b*40.95)*(3.3/4095))*4.2)/3.3;</p>
<p>  Serial.print(F(&quot;Battery Voltage: &quot;));<br />
  Serial.println(b2);<br />
  strcpy(postData, &quot;{\n\t\&quot;variable\&quot;: \&quot;Voltage\&quot;,\n\t\&quot;value\&quot;: &quot;);<br />
  dtostrf(b2, 6, 2, anyData);<br />
  strncat(postData, anyData, 100);<br />
  strcpy(anyData1, &quot;,\n\t\&quot;unit\&quot;: \&quot;V\&quot;\n\t}\n&quot;);</p>
<p>  Serial.print(F(&quot;Battery Voltage: &quot;));<br />
  Serial.println(b);<br />
  strcpy(postData, &quot;{\n\t\&quot;variable\&quot;: \&quot;Voltage\&quot;,\n\t\&quot;value\&quot;: &quot;);<br />
  dtostrf(b, 6, 2, anyData);<br />
  strncat(postData, anyData, 100);<br />
  strcpy(anyData1, &quot;,\n\t\&quot;unit\&quot;: \&quot;%\&quot;\n\t}\n&quot;);<br />
  strncat(postData, anyData1, 100);<br />
  client.begin(serverAddress);<br />
  client.addHeader(&quot;Content-Type&quot;, contentHeader);<br />
  client.addHeader(&quot;Device-Token&quot;, tokenHeader);<br />
  statusCode = client.POST(postData);<br />
  // read the status code and body of the response<br />
  Serial.print(&quot;Status code: &quot;);<br />
  Serial.println(statusCode);<br />
  Serial.println(&quot;End of POST to TagoIO&quot;);<br />
  Serial.println();<br />
  startTime=false;<br />
}<br />
void go_to_sleep() {<br />
  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);  // ESP32 wakes up every x seconds<br />
  Serial.println(&quot;Going to deep-sleep now&quot;);<br />
  startTime=false;<br />
  timeAwake=millis()-startTime;<br />
  Serial.print(&quot;Time Awake=&quot;);<br />
  Serial. println(timeAwake/1000.0);<br />
  Serial.flush();<br />
  esp_deep_sleep_start();<br />
}</p>
<p>void setup() {<br />
  startTime=millis();<br />
  Serial.begin(115200);<br />
  delay(10);<br />
  wifi_connect();<br />
}</p>
<p>void loop() {<br />
  wifi_connect();<br />
  Read_And_Send_Sensors_Data();<br />
  go_to_sleep();<br />
}[/code]</p>
<h2>Step 9: Create the Dashboard</h2>
<ol>
<li>Navigate to <a class="editor-rtfLink" href="https://tago.io/" target="_blank" rel="noopener">TagoIO</a> and create an account or sign in.</li>
<li>Create a new <strong>device</strong> by clicking on the <strong>Device</strong> icon and then selecting the <strong>Arduino HTTP </strong>profile:<img loading="lazy" decoding="async" width="495" height="500" class="size-medium wp-image-112711 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/device-495x500.png" alt="Select Device" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/device-495x500.png 495w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/device-125x125.png 125w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/device.png 546w" sizes="auto, (max-width: 495px) 100vw, 495px" /><img loading="lazy" decoding="async" width="750" height="396" class="size-medium wp-image-112688 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_device-750x396.jpg" alt="Arduino Device" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_device-750x396.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_device-1500x792.jpg 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_device-768x405.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_device-1536x811.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/arduino_device-2048x1081.jpg 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Assign a name to your device and press the <strong>Create my Device</strong> button:<img loading="lazy" decoding="async" width="682" height="500" class="size-medium wp-image-112709 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/create_my_device_button-682x500.png" alt="Create My Device" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/create_my_device_button-682x500.png 682w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/create_my_device_button-1363x1000.png 1363w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/create_my_device_button-768x563.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/create_my_device_button-1536x1127.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/create_my_device_button-80x60.png 80w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/create_my_device_button.png 1906w" sizes="auto, (max-width: 682px) 100vw, 682px" /></li>
<li>Once the device is created, TagoIO will generate a token. Copy the token as you will need it in your Arduino code:<img loading="lazy" decoding="async" width="574" height="500" class="size-medium wp-image-112708 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/token-574x500.png" alt="TagoIO Token" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/token-574x500.png 574w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/token-1149x1000.png 1149w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/token-768x668.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/token.png 1234w" sizes="auto, (max-width: 574px) 100vw, 574px" /></li>
</ol>
<h2>Step 10: Return to Arduino</h2>
<ol>
<li style="text-align: left;">Back in the Arduino IDE, paste your token in this line and replace [XXX]
<div>
<pre><code>char tokenHeader[] = "[XXX]"; // TagoIO Token</code></pre>
</div>
</li>
<li style="text-align: left;">Add your SSID name and password, replacing [XXX]:
<div>
[code lang=&#8221;arduino&#8221;]const char *ssid = &quot;[XXX]&quot;;<br />
const char *password = &quot;[XXX]&quot;;[/code]
</div>
</li>
<li style="text-align: left;">Compile and upload the code.</li>
</ol>
<h2>Step 11: Return to TagoIO</h2>
<ol>
<li style="list-style-type: none;">
<ol>
<li>Navigate back to TagoIO.</li>
<li>Open the <strong>Live Inspector</strong> to check the data. You should see the <strong>temperature</strong> and battery level values posted in the TagoIO Interface.</li>
<li>Add a dashboard and name it:                                         <img loading="lazy" decoding="async" width="541" height="500" class="size-medium wp-image-112707 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_dashboard-541x500.png" alt="Add Dashboard " srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_dashboard-541x500.png 541w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_dashboard.png 656w" sizes="auto, (max-width: 541px) 100vw, 541px" /></li>
<li>Name your dashboard and add a background:<img loading="lazy" decoding="async" width="750" height="380" class="size-medium wp-image-112726 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Screenshot-2023-11-21-at-4.55.14-PM-750x380.png" alt="Name Dashboard" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Screenshot-2023-11-21-at-4.55.14-PM-750x380.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Screenshot-2023-11-21-at-4.55.14-PM-768x389.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Screenshot-2023-11-21-at-4.55.14-PM.png 1406w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Click on the three dots and select Configure:<img loading="lazy" decoding="async" width="722" height="500" class="size-medium wp-image-112727 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/configure-722x500.png" alt="Configure Dashboard" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/configure-722x500.png 722w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/configure-768x532.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/configure.png 774w" sizes="auto, (max-width: 722px) 100vw, 722px" /></li>
<li>You can add a background image to your dashboard here:<img loading="lazy" decoding="async" width="750" height="474" class="size-medium wp-image-112728 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_bg_image-750x474.png" alt="Add a background image" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_bg_image-750x474.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_bg_image-768x486.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_bg_image.png 1200w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Save and click on <strong>Add widget</strong>:<img loading="lazy" decoding="async" width="750" height="465" class="size-medium wp-image-112706 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_widget-750x465.png" alt="Add Widget" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_widget-750x465.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_widget-768x477.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/add_widget.png 1170w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Select a widget and format it. Give it a name and select the variable, change the colors, enable <strong>Show last update</strong>:<img loading="lazy" decoding="async" class="wp-image-112781 size-medium aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/widget-750x443.jpg" alt="widget" width="750" height="443" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/widget-750x443.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/widget-768x454.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/widget.jpg 1000w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Create a second widget for the <strong>Battery Voltage Level</strong>.</li>
<li>If the values make sense, set your access by clicking on the <strong>Access</strong> button. Here, I have set access to be public:<img loading="lazy" decoding="async" width="750" height="399" class="size-medium wp-image-112690 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/access-750x399.png" alt="Access" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/access-750x400.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/access-1500x798.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/access-768x408.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/access-1536x817.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/access-2048x1089.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li>Set up your preferences in the <strong>Run</strong> tab:<img loading="lazy" decoding="async" width="750" height="399" class="size-medium wp-image-112723 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/run-750x399.png" alt="Run Tab" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/run-750x400.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/run-1500x797.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/run-768x408.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/run-1536x816.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/run-2048x1088.png 2048w" sizes="auto, (max-width: 750px) 100vw, 750px" /></li>
<li style="text-align: left;">Ctrl+click on the Dashboard name in the dashboards list and select <strong>Share Public</strong> if you want your dashboard to be public:<img loading="lazy" decoding="async" width="393" height="500" class="size-medium wp-image-112722 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/public-393x500.png" alt="Share Public" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/public-393x500.png 393w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/public-787x1000.png 787w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/public-768x976.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/public.png 856w" sizes="auto, (max-width: 393px) 100vw, 393px" /></li>
</ol>
<h2>Step 12: Enable Deep_Sleep Mode</h2>
<p>Now that everything is working, you’ll want to update the code to take advantage of deep sleep mode.</p>
<p>The use of <em>deep_sleep</em> mode in conjunction with solar power demonstrates efficient energy management. By sleeping most of the time and only waking up to read sensors and send data, you can minimize the energy consumption of your ESP32 device, which is crucial for battery longevity, especially when it relies on solar charging.</p>
<p>The ESP32 has the following operating modes:</p>
<ul>
<li>Active mode</li>
<li>Modem Sleep mode</li>
<li>Light Sleep mode</li>
<li>Deep Sleep mode</li>
<li>Hibernation mode</li>
</ul>
<p>&nbsp;</p>
<p>The following table lists which peripherals and units are either active or inactive during different modes.</p>
<p><img /><img loading="lazy" decoding="async" width="750" height="201" class="size-medium wp-image-112703 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/operating_modes-750x201.png" alt="Operating Modes" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/operating_modes-750x201.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/operating_modes-768x206.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/operating_modes.png 1348w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<div style="text-align: center;"><a class="editor-rtfLink" href="https://microcontrollerslab.com/micropython-esp32-deep-sleep-mode-wake-up-sources/" target="_blank" rel="noopener">https://microcontrollerslab.com/micropython-esp32-deep-sleep-mode-wake-up-sources/</a></div>
<p>&nbsp;</p>
<p>Generally, the ESP32 is very power-hungry and may pull up to 75mA in normal consumption or inactive mode. If WiFi is also being used, then your current consumption could go up to somewhere around 240mA. If that’s the case, and you’re trying to power your device using batteries and solar, you won’t be able to use the ESP32 in active mode without draining your batteries.</p>
<p>There is a solution, and that is to put the module into a deep sleep mode to reduce the power consumption. When in deep sleep, the current consumption should be in the range of micro Amperes (μA) and your batteries will last longer.</p>
<p>I tested my setup before implementing deep sleep mode using a <a class="editor-rtfLink" href="https://www.amazon.com/dp/B07Z91FWT9?ref=ppx_yo2ov_dt_b_product_details&amp;th=1" target="_blank" rel="noopener">Proshopping 150A RC Watt Meter, High Precision Power Analyzer</a> attached to an external battery:</p>
<div id="attachment_112774" style="width: 704px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-112774" class="wp-image-112774 size-medium" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/inline_setup_02-694x500.jpg" alt="Inline setup with external battery" width="694" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/inline_setup_02-694x500.jpg 694w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/inline_setup_02-1389x1000.jpg 1389w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/inline_setup_02-768x553.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/inline_setup_02-1536x1106.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/inline_setup_02.jpg 2000w" sizes="auto, (max-width: 694px) 100vw, 694px" /><p id="caption-attachment-112774" class="wp-caption-text">Inline setup with external battery connected</p></div>
<p>&nbsp;</p>
<p>Here were my results when the ESP32 was sending data: <strong><img loading="lazy" decoding="async" width="750" height="345" class="size-medium wp-image-112699 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/amps-750x345.jpg" alt="" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/amps-750x345.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/amps-1500x689.jpg 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/amps-768x353.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/amps-1536x706.jpg 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/amps.jpg 1800w" sizes="auto, (max-width: 750px) 100vw, 750px" /></strong></p>
<p><code>4.8V * 0.21A=.987 Watt</code> or about 1 Watt. If I ran the program continually, it would consume 24 Watt hours per day (24hours * 1 Watt). In this semi-shady location, I expect the panel to produce closer to 5 Watt hours a day and if I don&#8217;t change anything, the system will fail. The solution is to send less data and put the device to sleep between transmission.</p>
<p>The <strong>duty cycle </strong>is the ratio of time a load or circuit is ON compared to when the load or circuit is OFF. By manipulating this cycle, we can reduce the device’s power consumption.</p>
<p>The ESP32’s WiFi module, Processing Cores, and Bluetooth module all require current to operate. To conserve power, we can disable what we’re not using. Putting the ESP32 in deep_sleep mode disables everything except the RTC (Real Time Clock) module.</p>
<p>The power analyzer I’m using does not capture the current below .01A. So I can assume .01A in the worst case, but from the documentation, I know I’m in the micro Amperes range. If I use the timer in the code to measure how many seconds the device needs to take a measurement and send the data and then enable deep_sleep for a certain amount of time in between waking, reading, and sensing, I can conserve quite a bit of power.</p>
<p>If the device needs around 5-10 seconds to connect to WiFi, read and send the data, and is in deep_sleep mode for 10 minutes in between readings, then the device is on for about 2 minutes every hour and in deep_sleep for the rest of the hour.</p>
<div>
<p><strong>Deep_sleep Power Consumption</strong><br />
[code lang=&#8221;arduino&#8221;]4.7V * 0.01A = ~0.047 Watts  <br />
proportion of time device is sleeping = 59/60<br />
59/60 * 0.047 Watts = 0.0462 Watts<br />
0.0462 Watts *  24h/day = 1.108 Watt hours per day in sleep mode[/code]
</div>
<p><strong>Reading and Sending Power Consumption</strong><br />
[code lang=&#8221;arduino&#8221;]4.7V * 0.21A = ~1 Watt <br />
proportion of time device is awake = 1/60<br />
1/60 * 1 Watt = 0.0166 Watts<br />
0.0166 Watts * 24h/day =0.3983 Watt hours per day reading and sending[/code]<br />
So guesstimating my consumption this way brings it down to about 0.066Wh.</p>
<p>If I multiply that number by 24, I end up with 1.58Wh a day.</p>
<div>
<p><strong>Total Power Consumption</strong><br />
[code lang=&#8221;arduino&#8221;](1/60)*0.21A + (59/60)*0.01A = 0.0133A<br />
0.0035 + 0.0098 = 0.0133A<br />
4.7V * 0.0133A = 0.0625Wh<br />
24 * .0625Wh = ~1.5Wh[/code]
</div>
<p>Implementing deep_sleep brings the power consumption down from 24Wh to about 1.5Wh. That’s a big difference!</p>
<p>The method above was a rough estimation. If I use Qoitech’s<a class="editor-rtfLink" href="https://www.qoitech.com/otii-ace/" target="_blank" rel="noopener"> Otii Ace Pro</a>, I can more accurately measure the power consumption.</p>
<p>Here is the circuit attached inline to the Qoitech:<img loading="lazy" decoding="async" width="713" height="500" class="alignnone size-medium wp-image-112730 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Qoitech-713x500.jpg" alt="Inline setup" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Qoitech-713x500.jpg 713w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Qoitech-768x539.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Qoitech.jpg 1200w" sizes="auto, (max-width: 713px) 100vw, 713px" /></p>
<p>And here are the results:</p>
<p><img loading="lazy" decoding="async" width="750" height="487" class="size-medium wp-image-112729 aligncenter" src="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Screenshot-2023-11-20-174158-1-750x487.png" alt="Qoitech Results" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Screenshot-2023-11-20-174158-1-750x487.png 750w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Screenshot-2023-11-20-174158-1-1500x974.png 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Screenshot-2023-11-20-174158-1-768x499.png 768w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Screenshot-2023-11-20-174158-1-1536x998.png 1536w, https://blog.voltaicsystems.com/wp-content/uploads/2023/11/Screenshot-2023-11-20-174158-1.png 1589w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<p>From the readings, I can see that when the device is awake, sensing, and sending, the amps measured equal a max of 180mA or .18A. When the device is in deep_sleep mode, the amps measured are 4.54mA or 0.00454A.</p>
<p>[CP_CALCULATED_FIELDS id=&#8221;7&#8243;]</p>
<p>Return to your code and update this line:</p>
<div>
<pre><code>#define TIME_TO_SLEEP 30 /* Time ESP32 will go to sleep (in seconds) */</code></pre>
</div>
<p>Think about how often you really need to check the temperature. Every 15 minutes, 30 minutes, hour? Play with the form above and then make your adjustments to your code.</li>
</ol>
<p>While I started with a panel and battery, if you were building your own device from scratch, you would want to create your circuit without the panel or battery. You would then measure your power consumption with a watt meter, Qoitech, or similar. You would then select your <a href="https://voltaicsystems.com/small-solar-panels/" target="_blank" rel="noopener">panel</a> and device based on:</p>
<ul>
<li>your estimated daily power consumption</li>
<li>where your device is deployed</li>
<li>how much sun your device will be exposed</li>
<li>how many days you would expect your device to run without sun.</li>
</ul>
<p style="text-align: center;"><a class="maxbutton-46 maxbutton maxbutton-solar-consultation" title="Set Up a Consultation" href="https://voltaicsystems.com/contact-us/"><span class='mb-text'>Sign Up for a Consultation</span></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.voltaicsystems.com/solar-powered-esp32-over-wifi-application-tutorial/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Solar Powered River Gauge with Particle</title>
		<link>https://blog.voltaicsystems.com/solar-powered-river-gauge-with-particle/</link>
					<comments>https://blog.voltaicsystems.com/solar-powered-river-gauge-with-particle/#respond</comments>
		
		<dc:creator><![CDATA[Voltaic Systems]]></dc:creator>
		<pubDate>Mon, 09 Dec 2019 15:43:14 +0000</pubDate>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Sustainability]]></category>
		<category><![CDATA[environmental monitoring]]></category>
		<category><![CDATA[IoT]]></category>
		<category><![CDATA[particle boron]]></category>
		<guid isPermaLink="false">http://80ca4ebf1c.nxcli.io/?p=10907</guid>

					<description><![CDATA[StreamBeam a community funded, volunteer run organization has built some beautiful stream monitoring gauges using ultrasonic sensors, Particle Boron and Voltaic solar panels. The monitors are placed on bridges in Alabama and provide updated data every 15 minutes. These systems were developed to support the local kayaking community, but we imagine the design could be [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>StreamBeam a community funded, volunteer run organization has built some beautiful stream monitoring gauges using ultrasonic sensors, Particle Boron and Voltaic solar panels. The monitors are placed on <a href="https://www.streambeam.net/Gauge/GaugeList">bridges in Alabama</a> and provide updated data every 15 minutes.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-10908" src="https://blog.voltaicsystems.com/wp-content/uploads/2019/12/20190330_101150-750x422.jpg" alt="ultrasonic stream gauge" width="750" height="422" /></p>
<p>These systems were developed to support the local kayaking community, but we imagine the design could be useful to a wide range of people including researchers, local DOTs, and water boards.</p>
<p>The detailed BOM is as follows:</p>
<ul>
<li>Custom PCB Mount</li>
<li><a href="https://www.maxbotix.com/Ultrasonic_Sensors/MB7386.htm">Maxbotix MB 7386</a> Ultrasonic Sensor</li>
<li><a href="https://store.particle.io/products/boron-lte-cat-m1-noram-with-ethersim-4th-gen">Particle Boron</a></li>
<li>2500mAh LiPo Battery</li>
<li><a href="https://voltaicsystems.com/6-watt-panel/">6 Watt Solar Panel</a></li>
</ul>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-10910" src="https://blog.voltaicsystems.com/wp-content/uploads/2019/12/20191201_124046-375x500.jpg" alt="stream level gauge" width="375" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2019/12/20191201_124046-375x500.jpg 375w, https://blog.voltaicsystems.com/wp-content/uploads/2019/12/20191201_124046-750x1000.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2019/12/20191201_124046-768x1024.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2019/12/20191201_124046-1152x1536.jpg 1152w, https://blog.voltaicsystems.com/wp-content/uploads/2019/12/20191201_124046-scaled.jpg 1536w" sizes="auto, (max-width: 375px) 100vw, 375px" /></p>
<p>With this version, StreamBeam has made a number of improvements. They recently switched from the Electron to the Boron and said they are achieving &#8220;better connectivity in more locations and reduced power consumption.&#8221;  To make the solar generation more efficient, they modified the PMIC settings to set the charge voltage to 5.08 (closer to that of Vp on the panel) to increase power to the battery.  Finally, they added solar radiation housings so that they can more accurately measure ambient air temperature and make generate more accurate river height measurements.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-10909" src="https://blog.voltaicsystems.com/wp-content/uploads/2019/12/IMG_7829-333x500.jpg" alt="ultrasonic stream gauge" width="333" height="500" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2019/12/IMG_7829-333x500.jpg 333w, https://blog.voltaicsystems.com/wp-content/uploads/2019/12/IMG_7829-667x1000.jpg 667w, https://blog.voltaicsystems.com/wp-content/uploads/2019/12/IMG_7829-768x1152.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2019/12/IMG_7829-1024x1536.jpg 1024w, https://blog.voltaicsystems.com/wp-content/uploads/2019/12/IMG_7829-scaled.jpg 1365w" sizes="auto, (max-width: 333px) 100vw, 333px" /></p>
<p>&nbsp;</p>
<p>We&#8217;re excited to see how off the shelf components can be put together to make such a useful tool. We look forward to seeing more in action. View the live stream heights <a href="https://www.streambeam.net/Gauge/GaugeList">here</a>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.voltaicsystems.com/solar-powered-river-gauge-with-particle/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Solar Kit for Makers Giveaway (20 Winners!)</title>
		<link>https://blog.voltaicsystems.com/solar-kit-for-makers-giveaway-20-winners/</link>
					<comments>https://blog.voltaicsystems.com/solar-kit-for-makers-giveaway-20-winners/#respond</comments>
		
		<dc:creator><![CDATA[Voltaic Systems]]></dc:creator>
		<pubDate>Sat, 16 Nov 2019 19:53:26 +0000</pubDate>
				<category><![CDATA[All]]></category>
		<category><![CDATA[2.0W]]></category>
		<category><![CDATA[adafruit]]></category>
		<category><![CDATA[environmental monitoring]]></category>
		<category><![CDATA[IoT]]></category>
		<category><![CDATA[particle]]></category>
		<category><![CDATA[sensors]]></category>
		<guid isPermaLink="false">http://80ca4ebf1c.nxcli.io/?p=10859</guid>

					<description><![CDATA[This contest is closed. Congrats to all the winners! Great to see all the exciting projects in the works including weather, water, garden monitoring, sound art and water fountains. We&#8217;re getting in the holiday spirit and giving away free 2 Watt Solar Charger Kits to 20 lucky makers. This system includes our waterproof 2 Watt [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>This contest is closed. </strong>Congrats to all the winners! Great to see all the exciting projects in the works including weather, water, garden monitoring, sound art and water fountains.</p>
<p>We&#8217;re getting in the holiday spirit and giving away free 2 Watt Solar Charger Kits to 20 lucky makers. This system includes our waterproof <a href="http://www.voltaicsystems.com/2-watt-panel">2 Watt solar panel</a> and Always On <a href="http://www.voltaicsystems.com/v15">V15 USB Battery Pack</a>. Simply tell us your project description below. It can cover robotics, art, IoT, lighting, sensing and use an Arduino, Raspberry Pi or no controller at all.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-10865" src="https://blog.voltaicsystems.com/wp-content/uploads/2019/11/maker-solar-projects-1500x599.jpg" alt="maker solar project" width="750" height="300" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2019/11/maker-solar-projects-1500x599.jpg 1500w, https://blog.voltaicsystems.com/wp-content/uploads/2019/11/maker-solar-projects-750x299.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2019/11/maker-solar-projects-768x307.jpg 768w" sizes="auto, (max-width: 750px) 100vw, 750px" /></p>
<p><strong>Why Are You Giving Away So Many Kits? </strong>These panels will have minor physical blemishes. We want these panels and batteries to find a loving home.</p>
<p><strong>How Can I Win?</strong> We will choose winners based on completeness of description and likelihood of project completion. Clearly describe what you want to build and you have a pretty good chance of winning.</p>
<p><strong>Who Can Enter?</strong> Due to shipping constraints, we will only ship to addresses in the United States (lower 48).</p>
<p><!--<strong>What is The Deadline? </strong>We will select the 20 winners by January 5th.--></p>
<p><!--<iframe loading="lazy" src="https://docs.google.com/forms/d/e/1FAIpQLSd9sWi8Y-fa16xlb8I_4s3jKs2j8BkCrHavh-7zWYXAJ_CJxw/viewform?embedded=true" width="640" height="1089" frameborder="0" marginwidth="0" marginheight="0">Loading…</iframe>--></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.voltaicsystems.com/solar-kit-for-makers-giveaway-20-winners/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>FieldKit Wins Grand Prize at Hackaday 2019</title>
		<link>https://blog.voltaicsystems.com/fieldkit-wins-grand-prize-at-hackaday-2019/</link>
					<comments>https://blog.voltaicsystems.com/fieldkit-wins-grand-prize-at-hackaday-2019/#respond</comments>
		
		<dc:creator><![CDATA[Voltaic Systems]]></dc:creator>
		<pubDate>Sat, 16 Nov 2019 17:52:53 +0000</pubDate>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Sustainability]]></category>
		<category><![CDATA[environmental monitoring]]></category>
		<category><![CDATA[IoT]]></category>
		<guid isPermaLink="false">http://80ca4ebf1c.nxcli.io/?p=10876</guid>

					<description><![CDATA[FieldKit, a core project of Conservify, was recently awarded the Grand Prize of the 2019 Hackaday Prize. Conservify works to build and develop tools and technologies that make it easy for communities to implement effective conservation practices. The FieldKit system was originally developed after the team&#8217;s work in Botswana, Angola, and Namibia left them struggling [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>FieldKit, a core project of <a href="http://conservify.org/">Conservify</a>, was recently awarded the Grand Prize of the 2019 <a href="https://hackaday.io/prize">Hackaday Prize</a>. Conservify works to build and develop tools and technologies that make it easy for communities to implement effective conservation practices. The FieldKit system was originally developed after the team&#8217;s work in Botswana, Angola, and Namibia left them struggling to find good quality open source tools that meet the needs of their field research. This <em>standardized, open-source software and hardware platform</em> allows for local agencies, activists, schools and communities to easily collect and share data throughout their own projects.</p>
<div id="attachment_10879" style="width: 760px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10879" class="size-large wp-image-10879" src="https://blog.voltaicsystems.com/wp-content/uploads/2019/11/EJlEHR5W4AALIcC-1400x1000.jpg" alt="fieldkit, hackaday, conservify, solar powered sensor" width="750" height="536" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2019/11/EJlEHR5W4AALIcC-1400x1000.jpg 1400w, https://blog.voltaicsystems.com/wp-content/uploads/2019/11/EJlEHR5W4AALIcC-700x500.jpg 700w, https://blog.voltaicsystems.com/wp-content/uploads/2019/11/EJlEHR5W4AALIcC-768x549.jpg 768w" sizes="auto, (max-width: 750px) 100vw, 750px" /><p id="caption-attachment-10879" class="wp-caption-text">Image Courtesy of Conservify.org</p></div>
<p>Designed as a complete system, FieldKit&#8217;s team thought of everything to make to this system user-friendly from deployment to data collection and exporting. The team has also integrated our high performance <a href="https://voltaicsystems.com/5-5-watt-panel/">5.5 Watt ETFE Solar Panel</a> for a reliable, rugged power solution in the field.</p>
<div id="attachment_10878" style="width: 1210px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10878" class="size-full wp-image-10878" src="https://blog.voltaicsystems.com/wp-content/uploads/2019/11/D9nSKLwVUAEpicl.jpg" alt="fieldkit, hackaday, conservify, solar powered sensor" width="1200" height="450" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2019/11/D9nSKLwVUAEpicl.jpg 1200w, https://blog.voltaicsystems.com/wp-content/uploads/2019/11/D9nSKLwVUAEpicl-750x281.jpg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2019/11/D9nSKLwVUAEpicl-768x288.jpg 768w" sizes="auto, (max-width: 1200px) 100vw, 1200px" /><p id="caption-attachment-10878" class="wp-caption-text">Image Courtesy of Conservify.org</p></div>
<div id="attachment_10877" style="width: 1010px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10877" class="size-full wp-image-10877" src="https://blog.voltaicsystems.com/wp-content/uploads/2019/11/FieldKit.jpeg" alt="fieldkit, hackaday, conservify, solar powered sensor" width="1000" height="435" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2019/11/FieldKit.jpeg 1000w, https://blog.voltaicsystems.com/wp-content/uploads/2019/11/FieldKit-750x326.jpeg 750w, https://blog.voltaicsystems.com/wp-content/uploads/2019/11/FieldKit-768x334.jpeg 768w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /><p id="caption-attachment-10877" class="wp-caption-text">Image Courtesy of Conservify.org</p></div>
<p>To learn more about FieldKit and the work that Conservify does, visit their website here: <a href="http://conservify.org">http://conservify.org</a> or follow them on <a href="http://www.instagram.com/conservify/">Instagram</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.voltaicsystems.com/fieldkit-wins-grand-prize-at-hackaday-2019/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Spoondrift Launches Solar Powered Ocean Monitor</title>
		<link>https://blog.voltaicsystems.com/spoondrift-launches-solar-powered-ocean-monitor/</link>
					<comments>https://blog.voltaicsystems.com/spoondrift-launches-solar-powered-ocean-monitor/#respond</comments>
		
		<dc:creator><![CDATA[Voltaic Systems]]></dc:creator>
		<pubDate>Wed, 07 Jun 2017 17:15:52 +0000</pubDate>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Sustainability]]></category>
		<category><![CDATA[2.0W]]></category>
		<category><![CDATA[environmental monitoring]]></category>
		<category><![CDATA[ocean monitoring]]></category>
		<guid isPermaLink="false">http://80ca4ebf1c.nxcli.io/?p=9050</guid>

					<description><![CDATA[Spoondrift just launched their Spotter, a real-time ocean monitoring device. The Spotter collects ocean wave and surface current data and reports it via satellite to a web dashboard. They also use our 2 Watt small solar panels to power the Spotter from the sun. We&#8217;ve been working with the team at Spoondrift from prototype through [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Spoondrift just launched their Spotter, a real-time ocean monitoring device. The Spotter collects ocean wave and surface current data and reports it via satellite to a web dashboard. They also use our 2 Watt <a href="https://www.voltaicsystems.com/solar-panels">small solar panels</a> to power the Spotter from the sun.</p>
<p><a href="https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature-header.jpg"><img loading="lazy" decoding="async" src="https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature-header.jpg" alt="wave and current measurements" width="1600" height="683" class="alignnone size-full wp-image-9054" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature-header.jpg 1600w, https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature-header-300x128.jpg 300w, https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature-header-768x328.jpg 768w, https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature-header-1024x437.jpg 1024w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /></a></p>
<p>We&#8217;ve been working with the team at Spoondrift from prototype through production and have been impressed by their dedication to the product design and passion for ocean monitoring.</p>
<p><a href="https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature1-left-right-2-image.png"><img loading="lazy" decoding="async" src="https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature1-left-right-2-image.png" alt="wave measurements buoy" width="1020" height="700" class="alignnone size-full wp-image-9053" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature1-left-right-2-image.png 1020w, https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature1-left-right-2-image-300x206.png 300w, https://blog.voltaicsystems.com/wp-content/uploads/2017/06/feature1-left-right-2-image-768x527.png 768w" sizes="auto, (max-width: 1020px) 100vw, 1020px" /></a></p>
<p>The result of their efforts is a compact, portable ocean monitor that uses the latest sensing and web technologies to be affordable (in the realm of professional oceanography equipment) and easy to use.</p>
<p><a href="https://blog.voltaicsystems.com/wp-content/uploads/2017/06/product-specification-image.png"><img loading="lazy" decoding="async" src="https://blog.voltaicsystems.com/wp-content/uploads/2017/06/product-specification-image.png" alt="spotter ocean monitor" width="960" height="659" class="alignnone size-full wp-image-9052" srcset="https://blog.voltaicsystems.com/wp-content/uploads/2017/06/product-specification-image.png 960w, https://blog.voltaicsystems.com/wp-content/uploads/2017/06/product-specification-image-300x206.png 300w, https://blog.voltaicsystems.com/wp-content/uploads/2017/06/product-specification-image-768x527.png 768w" sizes="auto, (max-width: 960px) 100vw, 960px" /></a></p>
<p>The Spotter, including a year of Iridium service, is now available for pre-order on <a href="https://spoondrift.co">Spoondrift&#8217;s site</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.voltaicsystems.com/spoondrift-launches-solar-powered-ocean-monitor/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
