<?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>Atomic Pi Archives - Learning to Pi</title>
	<atom:link href="https://www.learningtopi.com/category/sbc/atomic-pi/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.learningtopi.com/category/sbc/atomic-pi/</link>
	<description>Programming Python on SBC&#039;s and Microcontrollers</description>
	<lastBuildDate>Fri, 28 Jul 2023 06:58:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://www.learningtopi.com/wp-content/uploads/2022/04/cropped-circuit-150x150.png</url>
	<title>Atomic Pi Archives - Learning to Pi</title>
	<link>https://www.learningtopi.com/category/sbc/atomic-pi/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Atomic Pi Pros, but mostly Cons</title>
		<link>https://www.learningtopi.com/sbc/atomic-pi/atomic-pi-pros-but-mostly-cons/</link>
					<comments>https://www.learningtopi.com/sbc/atomic-pi/atomic-pi-pros-but-mostly-cons/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Wed, 19 Jul 2023 04:54:33 +0000</pubDate>
				<category><![CDATA[Atomic Pi]]></category>
		<category><![CDATA[SBC]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=1145</guid>

					<description><![CDATA[<p>I purchased the Atomic Pi at a stellar price. Currently you can still get it for $50 at Amazon with the camera and breakout board. An incredible price for an x86_64 SBC! The Atomic Pi does have some Pros, but mostly cons. I&#8217;ll walk through what I found here. Scoring and Specs Here is a...</p>
<p>The post <a href="https://www.learningtopi.com/sbc/atomic-pi/atomic-pi-pros-but-mostly-cons/">Atomic Pi Pros, but mostly Cons</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I purchased the Atomic Pi at a stellar price.  Currently you can still get it for <a href="https://www.amazon.com/DLI-APi-Atomic-Developers-Kit/dp/B08CGFM2B1/ref=sr_1_2?crid=2NNPYC6CAA4F1&amp;keywords=atomic+pi&amp;qid=1689315435&amp;sprefix=atomicpi%2Caps%2C133&amp;sr=8-2" target="_blank" rel="noreferrer noopener">$50 at Amazon</a> with the camera and breakout board.  An incredible price for an x86_64 SBC!  The Atomic Pi does have some Pros, but mostly cons.  I&#8217;ll walk through what I found here.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<div class="wp-block-ht-block-toc  is-style-outline htoc htoc--position-left toc-list-style-plain" data-htoc-state="expanded"><span class="htoc__title"><span class="ht_toc_title">Table of Contents</span></span><div class="htoc__itemswrap"><ul class="ht_toc_list"><li class=""><a href="#htoc-s">Scoring and Specs</a></li><li class=""><a href="#htoc-sbc-scoring-results">SBC Scoring Results</a></li><li class=""><a href="#htoc-gpio-s">GPIO&#8217;s (1/1)</a><ul class="ht_toc_child_list"><li class=""><a href="#htoc-updated-gpio-table">Updated GPIO Table</a></li><li class=""><a href="#htoc-major-limitations">Major GPIO limitations:</a></li></ul></li><li class=""><a href="#htoc-ir-0-1">IR (0/1)</a></li><li class=""><a href="#htoc-i2c-0-1"> I2C (0/1)</a></li><li class=""><a href="#htoc-spi-1-1">SPI (0/2)</a></li><li class=""><a href="#htoc-uart-1-1">UART (1/1)</a></li><li class=""><a href="#htoc-subjective-performance-1-2">Subjective Performance (1/2)</a></li><li class=""><a href="#htoc-e">Ease of Use (1/2)</a></li><li class=""><a href="#htoc-software-updates-1-2">Software Updates (1/2)</a></li><li class=""><a href="#htoc-community-0-2">Community (0/2)</a></li><li class=""><a href="#htoc-issues">Issues</a><ul class="ht_toc_child_list"><li class=""><a href="#htoc-power-issues">Power Issues</a></li><li class=""><a href="#htoc-cmos-battery">CMOS Battery</a></li><li class=""><a href="#htoc-emmc">eMMC</a></li></ul></li><li class=""><a href="#htoc-overall-5-14">Overall (5/14)</a></li></ul></div></div>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="712" height="547" src="https://www.learningtopi.com/wp-content/uploads/2022/04/atompic-pi.jpg" alt="" class="wp-image-75" srcset="https://www.learningtopi.com/wp-content/uploads/2022/04/atompic-pi.jpg 712w, https://www.learningtopi.com/wp-content/uploads/2022/04/atompic-pi-300x230.jpg 300w, https://www.learningtopi.com/wp-content/uploads/2022/04/atompic-pi-150x115.jpg 150w" sizes="(max-width: 712px) 100vw, 712px" /></figure>
</div>
</div>



<h2 class="wp-block-heading" id="htoc-s">Scoring and Specs</h2>



<p>Here is a breakdown of the scoring.  I&#8217;ll cover each section below to describe how I came to the numbers.</p>



<h2 class="wp-block-heading" id="htoc-sbc-scoring-results">SBC Scoring Results</h2>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<table id="tablepress-10" class="tablepress tablepress-id-10">
<thead>
<tr class="row-1">
	<th class="column-1" style="width:50%;">Category</th><th class="column-2" style="width:50%;">Atomic Pi</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">Tests &#8211; GPIO&#8217;s (1pt)</td><td class="column-2">1/1</td>
</tr>
<tr class="row-3">
	<td class="column-1">Tests &#8211; IR (1pt)</td><td class="column-2">0/1</td>
</tr>
<tr class="row-4">
	<td class="column-1">Tests &#8211; I2C (1pt)</td><td class="column-2">0/1</td>
</tr>
<tr class="row-5">
	<td class="column-1">Tests &#8211; SPI (2pt)</td><td class="column-2">0/2</td>
</tr>
<tr class="row-6">
	<td class="column-1">Tests &#8211; UART (1pt)</td><td class="column-2">1/1</td>
</tr>
<tr class="row-7">
	<td class="column-1">Subjective Performance (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-8">
	<td class="column-1">Ease of Use (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-9">
	<td class="column-1">Software Updates (2pt)</td><td class="column-2">1/2</td>
</tr>
<tr class="row-10">
	<td class="column-1">Community (2pt)</td><td class="column-2">0/2</td>
</tr>
</tbody>
<tfoot>
<tr class="row-11">
	<th class="column-1">Overall (14pt)</th><th class="column-2">5/14</th>
</tr>
</tfoot>
</table>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<p>Scoring the SBC for comparison purposes. Scoring will be based on the following criteria:<br><strong>&#8211; GPIO (1pt) &#8211;</strong> LED and button tests passed and there are at least 8 usable GPIO&#8217;s<br><strong>&#8211; I2C (1pt) &#8211;</strong> I2C display tests passed<br><strong>&#8211; SPI (1pt) &#8211;</strong> SPI tests passed (BME280 and DHT11 over SPI)<br><strong>&#8211; UART (1pt) &#8211;</strong> UART tests passed and multiple UARTs are available<br><strong>&#8211; Subjective Performance (1pt) &#8211;</strong> Was the system responsive and functional overall<br><strong>&#8211; Ease of Use (1pt) &#8211;</strong> How easy was it to setup and use for the sbc_gpio tests? Can it be reconfigured quickly?<br><strong>&#8211; Software Updates (2pt) &#8211;</strong> How frequently does the system get updates? 1pt for base system, 1pt for kernel<br><strong>&#8211; Community (2pt) &#8211;</strong> Finding answers to questions, getting recommendations and help is an important part of using a SBC</p>
</div>
</div>



<p>The specifications for the Atomic Pi that I was able to collect are available below:</p>



<table id="tablepress-6" class="tablepress tablepress-id-6">
<thead>
<tr class="row-1">
	<td class="column-1" style="width:20%;"></td><th class="column-2" style="width:80%;">Atomic Pi</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">CPU</td><td class="column-2">Intel Atom x5-Z8350<br />
4 Core (480Mhz &#8211; 1.92Ghz)</td>
</tr>
<tr class="row-3">
	<td class="column-1">NPU</td><td class="column-2">N/A</td>
</tr>
<tr class="row-4">
	<td class="column-1">Memory</td><td class="column-2">2GB DDR3L-1600 </td>
</tr>
<tr class="row-5">
	<td class="column-1">GPU</td><td class="column-2">Intel Integrated HD Graphics<br />
12 execution units (200-500Mhz)</td>
</tr>
<tr class="row-6">
	<td class="column-1">Video Decoding</td><td class="column-2">H.263, MPEG4, H.264, H.265 (HEVC,8bit), VP8, VP9, MVC, MPEG2, VC1, JPEG</td>
</tr>
<tr class="row-7">
	<td class="column-1">Video Encoding</td><td class="column-2">H.264, H.263, VP8, MVC, JPEG</td>
</tr>
<tr class="row-8">
	<td class="column-1">GPU FP16/FP32/FP64</td><td class="column-2">? / 17.8 / ? GFLOPS</td>
</tr>
<tr class="row-9">
	<td class="column-1">Video Out</td><td class="column-2">1x HDMI</td>
</tr>
<tr class="row-10">
	<td class="column-1">Video In</td><td class="column-2">5pin webcam connector (can be used for USB 2.0)</td>
</tr>
<tr class="row-11">
	<td class="column-1">Storage</td><td class="column-2">16GB eMMC<br />
MicroSD</td>
</tr>
<tr class="row-12">
	<td class="column-1">USB</td><td class="column-2">1x USB 3.0 Type-A (on CPU board)<br />
1x USB 2.0 Type-A (on carrier board)</td>
</tr>
<tr class="row-13">
	<td class="column-1">PCIe</td><td class="column-2">N/A</td>
</tr>
<tr class="row-14">
	<td class="column-1">Networking</td><td class="column-2">1Gbps Realtek RTL8111G-CG<br />
MediaTek RT5572 2.5/5GHz/2&#215;2 MMC connectors (requires external antenna not included)</td>
</tr>
<tr class="row-15">
	<td class="column-1">Bluetooth</td><td class="column-2">CSR CSR8510</td>
</tr>
<tr class="row-16">
	<td class="column-1">I2C</td><td class="column-2">Software only &#8211; configurable on GPIO</td>
</tr>
<tr class="row-17">
	<td class="column-1">SPI</td><td class="column-2">Software only &#8211; configurable on GPIO</td>
</tr>
<tr class="row-18">
	<td class="column-1">UART</td><td class="column-2">3x (fixed, GPIO pins can&#8217;t be re-purposed)</td>
</tr>
<tr class="row-19">
	<td class="column-1">PWM</td><td class="column-2">N/A</td>
</tr>
<tr class="row-20">
	<td class="column-1">ADC (analog to digital)</td><td class="column-2">N/A</td>
</tr>
<tr class="row-21">
	<td class="column-1">CAN Bus</td><td class="column-2">N/A</td>
</tr>
<tr class="row-22">
	<td class="column-1">General GPIO / Other</td><td class="column-2">8x (6x + 2x for volume control that can be used as GPIO) + BNO055 (accelerometer, gyroscope, geomagnetic sensor)</td>
</tr>
<tr class="row-23">
	<td class="column-1">Power</td><td class="column-2">5v DC 3-4A (power from 26pin connector on CPU board, or from a carrier board)</td>
</tr>
<tr class="row-24">
	<td class="column-1">Kernel Support</td><td class="column-2">Supports Windows 10<br />
Digital Loggers image runs Linux 5.4</td>
</tr>
<tr class="row-25">
	<td class="column-1">Purchase Links</td><td class="column-2"><a href="https://www.amazon.com/DLI-APi-Atomic-Developers-Kit/dp/B08CGFM2B1/ref=sr_1_2?crid=2NNPYC6CAA4F1&amp;keywords=atomic+pi&amp;qid=1689315435&amp;sprefix=atomicpi%2Caps%2C133&amp;sr=8-2" target="_blank" rel="noopener">Amazon</a></td>
</tr>
</tbody>
</table>



<h2 class="wp-block-heading" id="htoc-gpio-s">GPIO&#8217;s (1/1)</h2>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<p>The main set of IO on the breakout board is the 11 screw terminals that connect off the 26-pin plug on the bottom of the main board.  Here we have the following:</p>



<ul class="wp-block-list">
<li>6x general GPIO pins
<ul class="wp-block-list">
<li>GPIO1 and GPIO2 also connect to LEDs on the breakout board</li>
</ul>
</li>



<li>2x UART (RXD1/TXD1 and RXD2/TXD2)
<ul class="wp-block-list">
<li>These <strong>CANNOT </strong>be repurposed</li>
</ul>
</li>
</ul>



<p>In addition to the main IO block, there are two additional 3-pin blocks on the back of the board.  J9 has 2 pins for volume that can be repurposed as general GPIO&#8217;s.  J10 has another UART (also <strong>CANNOT </strong>be repurposed).</p>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<figure class="wp-block-image size-full"><img decoding="async" width="224" height="255" src="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio.png" alt="" class="wp-image-1155" srcset="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio.png 224w, https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio-132x150.png 132w" sizes="(max-width: 224px) 100vw, 224px" /></figure>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio2.png" alt="" class="wp-image-1156" width="254" height="146" srcset="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio2.png 254w, https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio2-150x86.png 150w" sizes="(max-width: 254px) 100vw, 254px" /></figure>



<p>Schematics here: <a href="https://www.digital-loggers.com/enchillada.pdf" target="_blank" rel="noreferrer noopener">https://www.digital-loggers.com/enchillada.pdf</a></p>
</div>
</div>



<p>I&#8217;ll note this again later with documentation, but the GPIO info listed in the official documentation appears to be wrong.  The main GPIO documentation (<a href="https://download.fosc.space/atomic_pi/guide/html/gpio.html" target="_blank" rel="noreferrer noopener">https://download.fosc.space/atomic_pi/guide/html/gpio.html</a>) says that the GPIO&#8217;s are on GPIO chip 3, when they are actually on GPIO chip 2.  It DOES list global pin numbers that are correct, but modern Python libraries using gpiod use the Chip/Pin combo which threw my testing for a loop.</p>



<h3 class="wp-block-heading" id="htoc-updated-gpio-table">Updated GPIO Table</h3>



<figure class="wp-block-table"><table><tbody><tr><td><strong>Name</strong></td><td><strong>Chip</strong></td><td><strong>Pin</strong></td><td><strong>Global Pin</strong></td><td><strong>Connected Devices</strong></td></tr><tr><td>GPIO0</td><td>2</td><td>21</td><td>335</td><td>Breakout Board Green LED (active LOW)</td></tr><tr><td>GPIO1</td><td>2</td><td>18</td><td>332</td><td>Breakout Board Yellow LED (active LOW)</td></tr><tr><td>GPIO2</td><td>2</td><td>24</td><td>338</td><td></td></tr><tr><td>GPIO3</td><td>2</td><td>15</td><td>329</td><td></td></tr><tr><td>GPIO4</td><td>2</td><td>22</td><td>336</td><td></td></tr><tr><td>GPIO7</td><td>2</td><td>16</td><td>330</td><td></td></tr><tr><td>GPIO_DFX_2</td><td>1</td><td>7</td><td>348</td><td>Volume Up</td></tr><tr><td>GPIO_DFX_4</td><td>1</td><td>5</td><td>346</td><td>Volume Down</td></tr></tbody></table></figure>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<p>The Green and Yellow LEDs are connected to VCC3 (3.3v) and the GPIO through a 1k resistor.  Using GPIO1 and GPIO2 as an input is essentially impossible as these GPIO&#8217;s will be pulled high at all times.</p>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:50%">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="251" height="135" src="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio-led-2.png" alt="" class="wp-image-1160" srcset="https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio-led-2.png 251w, https://www.learningtopi.com/wp-content/uploads/atomic-pi-gpio-led-2-150x81.png 150w" sizes="auto, (max-width: 251px) 100vw, 251px" /></figure>
</div>
</div>



<h3 class="wp-block-heading" id="htoc-major-limitations">Major GPIO limitations:</h3>



<ul class="wp-block-list">
<li>As noted, UART pins cannot be reused as GPIO</li>



<li>There are no pull up/pull down options available (can&#8217;t say if the hardware itself is capable, there does not appear to be any way to set it using the 5.4 kernel that the Atomic Pi is running).  External pull up/down must be used</li>



<li>Limited numbers &#8211; only 8 total GPIO&#8217;s can be used</li>



<li>GPIO1 and GPIO2 are connected to 3.3v via the LEDs which means they are usable for output only.</li>
</ul>



<p>I am technically passing the GPIO category, since there are 8 usable GPIO&#8217;s, but the limitations make it a tough call.</p>



<h2 class="wp-block-heading" id="htoc-ir-0-1">IR (0/1)</h2>



<p>Enabling the GPIO UART was relatively simple.  The 5.4 kernel has compiled in a patch that exposes the ability to create and delete (although deleting is not recommended) overlays on the fly.  This means we just needed to create the DTS files, compile them, then load using the following:</p>



<pre class="wp-block-code"><code>sudo mkdir /sys/kernel/config/device-tree/overlays/{overlay-name}
sudo cat {overlay}.dtbo &gt; /sys/kernel/config/device-tree/overlays/{overlay-name}/dtbo</code></pre>



<p>You can find copy of the DTS files as well as the application script on our GitHub:  <a href="https://github.com/LearningToPi/learningtopi.github.io/tree/main/files/atomicpi" target="_blank" rel="noreferrer noopener">https://github.com/LearningToPi/learningtopi.github.io/tree/main/files/atomicpi</a></p>



<p>Applying the overlay was simple, however the receiver would only occasionally pick up the transmitted signal.  I was a bit surprised at this but given other issues didn&#8217;t see digging deeper as necessary.</p>



<h2 class="wp-block-heading" id="htoc-i2c-0-1"> I2C (0/1)</h2>



<p>The Atomic Pi has no hardware I2C or SPI capabilities.  Digital Logger provides a software-based driver that can be used to create I2C or SPI on the limited number of GPIOs.  The I2C driver uses a daemon to load overlays based on files located in the <code>/etc/i2c-gpio-custom.d</code> folder.  There is an existing bus for the BNO055 sensor built into the board.  You can&#8217;t use the  I2C bus used for the BNO055, so simply create a new file and provide the parameters outlined in the README file.  I used pins 476 and 480 for my SDA and SCL pins (creating a new bus 41).  Simply restart the board or restart the daemon:</p>



<pre class="wp-block-code"><code>sudo systemctl restart i2c-gpio-custom</code></pre>



<p>The I2C bus shows up, and I&#8217;m able to see the device using <code>i2cdetect</code>.  I am also able to connect to my 16&#215;2 LCD and write content to the display!  However, as soon as I loaded up the system with other tasks (in particular the IR) the number of successful writes to the I2C device plummeted.  In the end a 52% success rate was all I could manage with IR enabled.  Also note that due to the lack of GPIO&#8217;s, I was unable to run I2C and SPI at the same time.  The best I could manage was simple GPIO in and out, UART and I2C together.</p>



<p>Please note that even the aged Raspberry Pi 3B+ is able to run the I2C bus with no issues since there is a hardware controller available.  I have found numerous posts on the internet of people having success with I2C on the Atomic Pi, so before you call foul, your experience will vary depending on how busy the system is with other tasks.  I wouldn&#8217;t depend on the software driver.</p>



<h2 class="wp-block-heading" id="htoc-spi-1-1">SPI (0/2)</h2>



<p>The SPI driver works exactly the same as the I2C above.  The SPI driver is configured using files in the <code>/etc/spi-gpio-custom.d</code> folder.  Here you need to provide a bit more info.  This includes a bus ID (0), CLK (335), MOSI (329), MISO (336), mode (0), max frequency (500,000), and CS pin (338).  Restarting the service or the board will create your SPI bus:</p>



<pre class="wp-block-code"><code>sudo systemctl restart spi-gpio-custom</code></pre>



<p>For reasons unknown this well for my BME280 sensor with no load.  Under load I saw that the reads were successful, but the BME280 sensor was reporting my office was below freezing or approaching the boiling point of water.  This is most likely due to bits getting flipped or mismatches in the timing.  I would say that it is hard to trust your sensor data if you are reading over a software SPI interface.</p>



<p>When attempting to use my DHT22 over SPI (<a href="https://www.learningtopi.com/sbc/python_dht11_spi/">Python dht11_spi</a> for details if this is new for you) was a complete failure.  From what I can gather, the software SPI bus is not able to process the data quickly enough.</p>



<h2 class="wp-block-heading" id="htoc-uart-1-1">UART (1/1)</h2>



<p>With UART we had great success!  There are 3 available HARDWARE UART ports available.  Two are available on the main breakout (J1) and one on the debug header (CN10).  I left the debug header as a console interface and used UART1 on the breakout.</p>



<p>Traffic between the UART and USB CP2102 ran perfectly in both directions.  With IR running I consistently saw 98% success (out of 14760 tests).  With IR disabled it went to 100%.  I can say that this was a complete success and performs even better than the RPi4B did.</p>



<p>UART was the ONLY test that passed with flying colors.</p>



<h2 class="wp-block-heading" id="htoc-subjective-performance-1-2">Subjective Performance (1/2)</h2>



<p>This category is a bit open.  I have 3 possible values:</p>



<ul class="wp-block-list">
<li>0:  The system is extraordinarily slow.  It may be functional, but performance was an issue</li>



<li>1:  The system works about like we would expect from an SBC.  It was not excessivly slow and booted quickly.  However, it doesn&#8217;t have any &#8220;wow&#8221;.</li>



<li>2:  This is reserved for the &#8220;wow&#8221; devices.  So far one device (the Radxa Rock 5B) fits into this category.</li>
</ul>



<p>The Atomic Pi boots relatively quick.  The BIOS POST is certainly slower than UBOOT on an ARM device.  Out of the box the Atomic Pi comes with a built-in eMMC that was significantly quicker than a Micro SD Card and gave it a bit of an edge in performance.  However, the eMMC failed and left me with SD.  I&#8217;ll talk about the eMMC under the problems category below.</p>



<h2 class="wp-block-heading" id="htoc-e">Ease of Use (1/2)</h2>



<p>This wasn&#8217;t hard to grade.  The software SPI and I2C buses are easy to set up and use.  The sysfs driver for the overlays makes adding overlays for IR easy.  Since we don&#8217;t have the ability to load overlays during the boot process on x86 like we do with ARM this is a must have.</p>



<p>I did have to doc a point for incorrect documentation.  Not having correct GPIO Chip / Pin numbers listed for the few GPIOs that are available made using the system significantly more difficult than it should have been.</p>



<h2 class="wp-block-heading" id="htoc-software-updates-1-2">Software Updates (1/2)</h2>



<p>This was a tough category.  Given the issues that I have seen of late in the IOT world, any project should be able to be maintained and updated with security patches.  On the plus side, as an x86 board, the Atomic Pi can run vanilla Ubuntu or really any other distribution that you want.  The DOWNSIDE is that to maintain the &#8220;ease of use&#8221; we talked about above; you need to run the Digital Loggers kernel and here is where the problem comes in.  The kernel is 5.4.30 and doesn&#8217;t appear to ever get updated.  Digital Loggers GitHub does NOT have a repo for their kernel either.</p>



<p>5.4 is a long-term release, but 5.4.30 is from April in 2020.  Since it is July 2023, it seems likely that this isn&#8217;t being actively maintained.  This leaves you with a choice:</p>



<ol class="wp-block-list">
<li>Keep the functionality for I2C/SPI and the ability to load overlays</li>



<li>Keep your system up to date on a supported kernel</li>
</ol>



<h2 class="wp-block-heading" id="htoc-community-0-2">Community (0/2)</h2>



<p>I was able to find others that had purchased and used this board, but don&#8217;t expect anything like the community available for Raspberry Pi products.  There is really only one &#8220;community&#8221; page here: <a href="http://ehxz.tk/atomicpi" target="_blank" rel="noreferrer noopener">http://ehxz.tk/atomicpi</a>.  There are some downloads available with different Ubuntu / Debian images as well as BIOS files, but that&#8217;s really about it.  Don&#8217;t expect a large community with examples to pull from.</p>



<h2 class="wp-block-heading" id="htoc-issues">Issues</h2>



<p>During setup, testing, or normal usage I ran into a few problems.</p>



<h3 class="wp-block-heading" id="htoc-power-issues">Power Issues</h3>



<p>I tried using Pi 4B adapters and numerous other 5V power supplies to no avail.  I even tried running the power directly into the pins on the bottom of the board (bypassing the breakout).  The documentation says to use MULTIPLE pins if powering directly, which made me leery.  In the end I ended up using my bench power supply (an <a href="https://www.amazon.com/gp/product/B07WNXY6T5/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1" target="_blank" rel="noreferrer noopener">EVGA SuperNova 550</a> ATX power supply).</p>



<p>I did find several other power supplies that would work, but quickly ran into stability issues (Atomic Pi would simply lock up after running for a period of time).  Once I had the power sorted out, I had no issues with locking up.</p>



<h3 class="wp-block-heading" id="htoc-cmos-battery">CMOS Battery</h3>



<p>Since the Atomic Pi is basically just a small Intel computer, it has a CMOS battery.  Mine was dead out of the box and resulted in a reset of the BIOS and clock every time I removed power.  I couldn&#8217;t find one with a matching plug, so ended up splicing a new battery in.</p>



<h3 class="wp-block-heading" id="htoc-emmc">eMMC</h3>



<p>I was happy that the Atomic Pi came with a built-in eMMC.  These aren&#8217;t typically super fast but are generally way faster than running from an SD card.  The downside here is that my eMMC went belly up after a while and stopped being recognized in the BIOS.  I followed all the instructions I found on the web and couldn&#8217;t get it back working again.  Eventually I gave up and reverted to an SD card.</p>



<p>I suppose if I ever decide to use this device long term, I could connect an external USB to eMMC similar to what I do with the Raspberry Pi 4B.  SD cards are just not fast enough to run a graphical interface.  Headless systems might work well enough, but GUI&#8217;s will just slow the system to a crawl.</p>



<h2 class="wp-block-heading" id="htoc-overall-5-14">Overall (5/14)</h2>



<p>Overall, I would say that the Atomic Pi performs poorly in most circumstances.  There are a few use cases though that I think the Atomic Pi could really shine (particularly given the low price):</p>



<ul class="wp-block-list">
<li>If you MUST have x86 for software binary compatibility</li>



<li>If you need to run Windows (NOTE:  I didn&#8217;t test any GPIO / I2C or SPI under Windows)</li>



<li>If you have a project that needs 3x UARTs and only a couple of GPIOs</li>
</ul>



<p>Unless you fit in the use cases above, you could probably do better with another system.  As I wrap up testing on a range of different platforms, I&#8217;ll add a page to compare and contrast the different systems available.</p>
<p>The post <a href="https://www.learningtopi.com/sbc/atomic-pi/atomic-pi-pros-but-mostly-cons/">Atomic Pi Pros, but mostly Cons</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/sbc/atomic-pi/atomic-pi-pros-but-mostly-cons/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Python ADC Current Logger (ammeter_logger)</title>
		<link>https://www.learningtopi.com/sbc/raspberry-pi/python-adc-current-logger-ammeter_logger/</link>
					<comments>https://www.learningtopi.com/sbc/raspberry-pi/python-adc-current-logger-ammeter_logger/#respond</comments>
		
		<dc:creator><![CDATA[tdunteman]]></dc:creator>
		<pubDate>Sun, 10 Jul 2022 04:36:30 +0000</pubDate>
				<category><![CDATA[Atomic Pi]]></category>
		<category><![CDATA[Load Testing]]></category>
		<category><![CDATA[Raspberry Pi SBC]]></category>
		<category><![CDATA[SBC]]></category>
		<category><![CDATA[ammeter_logger]]></category>
		<category><![CDATA[CP2102]]></category>
		<category><![CDATA[load testing]]></category>
		<category><![CDATA[UART]]></category>
		<guid isPermaLink="false">https://www.learningtopi.com/?p=218</guid>

					<description><![CDATA[<p>Overview&#160; Latest code is available on GitHub, view the other articles in our load testing series This project is part 2 of 2 to capture current data for our load testing.&#160; An ESP32 microcontroller will be used as a sender, and this project will cover the SBC device setup to receive. The device will be...</p>
<p>The post <a href="https://www.learningtopi.com/sbc/raspberry-pi/python-adc-current-logger-ammeter_logger/">Python ADC Current Logger (ammeter_logger)</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading" id="htoc-overview">Overview&nbsp;</h2>



<p><em>Latest code is available on <a href="https://github.com/LearningToPi/ammeter_logger" target="_blank" rel="noreferrer noopener">GitHub</a>, view the other articles in our <a href="https://www.learningtopi.com/load-testing/" target="_blank" rel="noreferrer noopener">load testing series</a></em></p>



<div class="wp-block-ht-block-toc  is-style-outline htoc htoc--position-wide toc-list-style-plain" data-htoc-state="closed"><span class="htoc__title"><span class="ht_toc_title">Table of Contents</span><span class="htoc__toggle"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#444"><path d="M15 7H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1z"></path><path d="M15 1H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1zM15 13H1c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1z"></path></g></svg></span></span><div class="htoc__itemswrap"><ul class="ht_toc_list"><li class=""><a href="#htoc-overview">Overview&nbsp;</a></li><li class=""><a href="#htoc-installing-the-module">Installing the module&nbsp;</a></li><li class=""><a href="#htoc-running-from-the-cli">Running from the CLI&nbsp;</a><ul class="ht_toc_child_list"><li class=""><a href="#htoc-cli-example-get-microcontroller-configuration">CLI Example: Get Microcontroller Configuration</a></li><li class=""><a href="#htoc-cli-example-get-current-microcontroller-status">CLI Example: Get Current Microcontroller Status</a></li><li class=""><a href="#htoc-cli-example-initialize-the-microcontroller-sensor">CLI Example: Initialize the microcontroller sensor</a></li><li class=""><a href="#htoc-cli-example-start-the-logging">CLI Example: Start the logging</a></li></ul></li><li class=""><a href="#htoc-importing-and-using-the-module">Importing and using the module&nbsp;</a></li><li class=""><a href="#htoc-cabling">Cabling</a></li><li class=""><a href="#htoc-breakdown-of-the-code">Breakdown of the code&nbsp;</a><ul class="ht_toc_child_list"><li class=""><a href="#htoc-ammeterrecvserial-init">AmmeterRecvSerial.__init__(…)&nbsp;</a></li><li class=""><a href="#htoc-ammeterrecvserial-ammeter-report">AmmeterRecvSerial.ammeter_report()&nbsp;</a></li><li class=""><a href="#htoc-property-ammeterrecvserial-ammeter-status">(property) AmmeterRecvSerial.ammeter_status()&nbsp;</a></li><li class=""><a href="#htoc-property-ammeterrecvserial-ammeter-initialized">(property) AmmeterRecvSerial.ammeter_initialized()&nbsp;</a></li><li class=""><a href="#htoc-property-ammeterrecvserial-ammeter-running">(property) AmmeterRecvSerial.ammeter_running()&nbsp;</a></li><li class=""><a href="#htoc-property-ammeterrecvserial-ammeter-ready">(property) AmmeterRecvSerial.ammeter_ready()&nbsp;</a></li><li class=""><a href="#htoc-property-ammeterrecvserial-ammeter-config">(property) AmmeterRecvSerial.ammeter_config()&nbsp;</a></li><li class=""><a href="#htoc-property-setter-ammeterrecvserial-ammeter-interval">(property+setter) AmmeterRecvSerial.ammeter_interval()&nbsp;</a></li><li class=""><a href="#htoc-ammeterrecvserial-ammeter-init">AmmeterRecvSerial.ammeter_init()&nbsp;</a></li><li class=""><a href="#htoc-ammeterrecvserial-ammeter-start">AmmeterRecvSerial.ammeter_start()&nbsp;</a></li><li class=""><a href="#htoc-ammeterrecvserial-ammeter-stop">AmmeterRecvSerial.ammeter_stop()&nbsp;</a></li><li class=""><a href="#htoc-ammeterrecvserial-ammeter-current">AmmeterRecvSerial.ammeter_current()&nbsp;</a></li><li class=""><a href="#htoc-ammeterrecvserial-ammeter-read">AmmeterRecvSerial._ammeter_read()&nbsp;</a></li><li class=""><a href="#htoc-ammeterrecvserial-ammeter-parse-read-line">AmmeterRecvSerial._ammeter_parse_read_line()&nbsp;</a></li></ul></li></ul></div></div>



<p>This project is part 2 of 2 to capture current data for our load testing.&nbsp; An ESP32 microcontroller will be used as a sender, and this project will cover the SBC device setup to receive. The device will be connected to the ESP32 via USB connected to a CP2102 USB to UART serial converter. At a later point I may add TCP connectivity, but for now we will use a serial interface. The python code will be running on a Raspberry Pi 4B, however since it is basic Python code using a USB serial interface, any computer with Python and a USB port can be used (NOTE: this has been tested on SBC&#8217;s running Linux only at this point).&nbsp;</p>



<p>Commands will be sent, and data received via the USB serial interface. Since we are using our Raspberry Pi 4 in this example, we will be using port /dev/ttyUSB0. The code is written as a Python module that can be installed into your Python virtual environment. The code can be run directly from the command line, or the module can be imported into another project. The end goal is to incorporate the current data into the Python SBC <a href="https://www.learningtopi.com/load-testing/" target="_blank" rel="noreferrer noopener">load testing tool</a> (stay tuned!).</p>



<h2 class="wp-block-heading" id="htoc-installing-the-module">Installing the module&nbsp;</h2>



<p>The package is available on PyPi or can be installed manually using the why/tar.gz file in the dist folder.</p>



<pre class="wp-block-code has-small-font-size"><code>pip3 install ammeter_logger</code></pre>



<h2 class="wp-block-heading" id="htoc-running-from-the-cli">Running from the CLI&nbsp;</h2>



<p>After installing the module, from the command line the code can be executed using the following:&nbsp;</p>



<pre class="wp-block-code has-small-font-size"><code>(venv) pi@pi:~/dev/ammeter_recv $ python3 -m ammeter_logger --help 
usage: __main__.py &#91;-h] &#91;--get-config] &#91;--get-status] &#91;--skip-init] &#91;--force-init] &#91;--init-only] 
                   &#91;--sample-interval SAMPLE_INTERVAL] &#91;--capture-time CAPTURE_TIME] &#91;--baudrate BAUDRATE] 
                   &#91;--log-level LOG_LEVEL] 
                   DEVICE OUTPUT_FILE 

Start the ammeter data collector. Requires the sender to be running (provided sender is Micropython for a microcontroller) 
  
positional arguments: 
  DEVICE                Serial device connected to the microcontroller (i.e. /dev/ttyUSB0 
  OUTPUT_FILE           File to save captured data to 
  
optional arguments: 
  -h, --help            show this help message and exit 
  --get-config          (False) Get the configuration from the microcontroller and quit 
  --get-status          (False) Get the current status of the microcontroller and quit 
  --skip-init           (False) Skip initializing the ammeter (not recommended!) 
  --force-init          (False) Force init of the ammeter 
  --init-only           (False) Only initalize the ammeter, print the config and status and quit (implies --force-init)
  --sample-interval SAMPLE_INTERVAL 
                        Set the sampling interval, overrides the config on the microcontroller 
  --capture-time CAPTURE_TIME 
                        Set the max time to capture before stopping, overrides the config on the microcontroller 
  --baudrate BAUDRATE   (115200) Set the baudrate for the serial interface 
  --log-level LOG_LEVEL 
                        (INFO) Specify the logging level for the console 
(venv) pi@pi:~/dev/ammeter_recv $ </code></pre>



<p>Most of the options are self-explanatory. You must specify a device (I.e. /dev/ttyUSB0) and a csv file to log your data to. If the sensor has not been initialized, the initialization will run first. This needs to be done with no load to get a solid baseline. After initialization is complete, the sampling can be run for a number of seconds specified. Below are some examples that can be used:&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-cli-example-get-microcontroller-configuration">CLI Example: Get Microcontroller Configuration</h3>



<pre class="wp-block-code has-small-font-size"><code>(venv) pi@pi:~/dev/ammeter_recv $ python3 -m ammeter_logger /dev/ttyUSB0 out.csv --get-config 
2022-06-15 16:20:07,410 - root - INFO - AmmeterRecvSerial: /dev/ttyUSB0: 115200: 8N1: Starting backgroup ammeter read. 
Current Config: {'interval': 50, 'timeout': 30, 'init_timeout': 30, 'pins': &#91;{'pin': 32, 'name': 'sensor1pin32', 'baseline': 2884}]} </code></pre>



<h3 class="wp-block-heading" id="htoc-cli-example-get-current-microcontroller-status">CLI Example: Get Current Microcontroller Status</h3>



<pre class="wp-block-code has-small-font-size"><code>(venv) pi@pi:~/dev/ammeter_recv $ python3 -m ammeter_logger /dev/ttyUSB0 out.csv --get-status 
2022-06-15 16:20:33,899 - root - INFO - AmmeterRecvSerial: /dev/ttyUSB0: 115200: 8N1: Starting backgroup ammeter read. 
Current Status: {'status': 'READY', 'timeout': 0, 'noinit_pin': None} </code></pre>



<h3 class="wp-block-heading" id="htoc-cli-example-initialize-the-microcontroller-sensor">CLI Example: Initialize the microcontroller sensor</h3>



<pre class="wp-block-code has-small-font-size"><code>(venv) pi@pi:~/dev/ammeter_recv $ python3 -m ammeter_logger /dev/ttyUSB0 out.csv --init-only 
2022-06-15 16:22:28,026 - root - INFO - AmmeterRecvSerial: /dev/ttyUSB0: 115200: 8N1: Starting backgroup ammeter read. 
Waiting for ammeter to initialize. {'status': 'READY', 'timeout': 0, 'noinit_pin': None} 
Waiting for ammeter to initialize. {'status': 'INITIALIZING', 'timeout': '30', 'noinit_pin': None} 
Waiting for ammeter to initialize. {'status': 'INITIALIZING', 'timeout': '28', 'noinit_pin': None} 
Waiting for ammeter to initialize. {'status': 'INITIALIZING', 'timeout': '26', 'noinit_pin': None} 
… 
Waiting for ammeter to initialize. {'status': 'INITIALIZING', 'timeout': '4', 'noinit_pin': None} 
Waiting for ammeter to initialize. {'status': 'INITIALIZING', 'timeout': '2', 'noinit_pin': None} 
Current Config: {'interval': 50, 'timeout': 30, 'init_timeout': 30, 'pins': &#91;{'pin': 32, 'name': 'sensor1pin32', 'baseline': 2782}]} 
Current Status: {'status': 'READY', 'timeout': 0, 'noinit_pin': None} </code></pre>



<h3 class="wp-block-heading" id="htoc-cli-example-start-the-logging">CLI Example: Start the logging</h3>



<pre class="wp-block-code has-small-font-size"><code>(venv) pi@pi:~/dev/ammeter_recv $ python3 -m ammeter_logger /dev/ttyUSB0 out.csv --capture-time 30 
2022-06-15 16:23:30,004 - root - INFO - AmmeterRecvSerial: /dev/ttyUSB0: 115200: 8N1: Starting backgroup ammeter read. 
Starting data collection.  Collection will run for 30 seconds.  You can stop at any point and write the captured data using CTRL+C. 
Waiting for logging run to complete.  Last amp read: -0.03868132.  Current status: {'status': 'RUNNING', 'timeout': '30', 'noinit_pin': None} 
Waiting for logging run to complete.  Last amp read: -0.03142858.  Current status: {'status': 'RUNNING', 'timeout': '29', 'noinit_pin': None} 
Waiting for logging run to complete.  Last amp read: 0.06285715.  Current status: {'status': 'RUNNING', 'timeout': '27', 'noinit_pin': None} 
… 
Waiting for logging run to complete.  Last amp read: -0.0410989.  Current status: {'status': 'RUNNING', 'timeout': '5', 'noinit_pin': None} 
Waiting for logging run to complete.  Last amp read: 0.029011.  Current status: {'status': 'RUNNING', 'timeout': '3', 'noinit_pin': None} 
Waiting for logging run to complete.  Last amp read: 0.003223445.  Current status: {'status': 'RUNNING', 'timeout': '1', 'noinit_pin': None} 
Writing log to file out.csv... 
Writing complete. </code></pre>



<h2 class="wp-block-heading" id="htoc-importing-and-using-the-module">Importing and using the module&nbsp;</h2>



<p>The code can also be imported into another project. This will be used as a part of our Python SBC <a href="https://www.learningtopi.com/load-testing/" target="_blank" rel="noreferrer noopener">load testing</a>. The ammeter_logger module will be used to capture amperage data while other load tests are running, This will allow us to map power usage to each of our tests.&nbsp;</p>



<pre class="wp-block-code has-small-font-size"><code>from ammeter_logger import AmmeterRecvSerial&nbsp;
ser = AmmeterRecvSerial(device=’/dev/ttyUSB0’, baudrate=115200) </code></pre>



<p>Since the AmmeterRecvSerial class inherits the serial.Serial class, any paramter available in the serial.Serial class can be use. See the <a href="https://pyserial.readthedocs.io/en/latest/shortintro.html" target="_blank" rel="noreferrer noopener">pySerial</a> project for details on supported parameters.&nbsp;</p>



<h2 class="wp-block-heading" id="htoc-cabling">Cabling</h2>



<p>Since we used a CP2102 in our ADC Current Sensor Project [LINK], for this project we need only to connect the serial port on the CP2102 to a USB port on the device that will be collecting the data. The CP2102 will appear as a USB serial interface.&nbsp;</p>



<p>For logging amperage data during the boot of an SBC or microcontroller, we will use a Raspberry Pi 4B to collect the data, however any device running a modern version of Linux with a USB port will suffice (I have not tested the Python code on Windows or Mac).&nbsp;</p>



<p>For logging amperage data during the load test (keep an eye on our load testing [LINK] series for more), we will connect the USB port of the CP2102 directly to the device we are load testing. This will allow our load testing package to collect amperage data for each phase of testing in real-time.&nbsp;</p>



<h2 class="wp-block-heading" id="htoc-breakdown-of-the-code">Breakdown of the code&nbsp;</h2>



<p>The AmmeterRecvSerial extends the serial.Serial class since all of our communication will be using the serial bus. This allows us to add just the functions we need that are specific to the <a href="https://www.learningtopi.com/microcontroller/micropython-adc-current-sensor/">microcontroller current sensor</a>.&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-ammeterrecvserial-init">AmmeterRecvSerial.__init__(…)&nbsp;</h3>



<p>The init function pops the logger parameter before calling the serial.Serial init function using the “super().__init__(*args, **kwargs)” call. This will pass all parameters (other than the logger) to the base class to initialize the serial device. All serial parameters supported by serial.Serial like device, baudrate, stop bits, etc can be passed to the AmmeterRecvSerial class.&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-ammeterrecvserial-ammeter-report">AmmeterRecvSerial.ammeter_report()&nbsp;</h3>



<p>The report function returns the actual data that was collected. The report will be returned as a dictionary that consists of the following:</p>



<pre class="wp-block-code has-small-font-size"><code>{ 
	‘start’: (datetime object representing the start time of the data), 
	‘stop’: (datetime object representing the stop time of the data), 
	‘data’: &#91; (list of data entries that were received) 
		{ 
			‘received’: (EPOCH time the data was received), 
			‘name’: (name of the sensor from the microcontroller), 
			‘ticks’: (number of microseconds from the start reported by the microcontroller), 
			‘current_amps’: (latest reading, not averaged), 
			‘last_reads’: &#91;(list of readings that were used for the average)], 
			‘average’: (average amperage from the list of reads above) 
		}, 
		… (repeat for all received data points) 
	] 
} </code></pre>



<p>If you would like to export to CSV, you can take a look at the write_log_data function in the __main__.py file. This function is used to export the data when calling the module directly using “python3 -m ammeter_logger …&#8221;&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-property-ammeterrecvserial-ammeter-status">(property) AmmeterRecvSerial.ammeter_status()&nbsp;</h3>



<p>The status property will clear the currently cached status and query the microcontroller for an updated status. The data will be returned as a dict with the following:&nbsp;</p>



<pre class="wp-block-code has-small-font-size"><code>{ 
	‘status’: (string showing the current status: RUNNING, NOINIT, INITIALIZING, READY) 
	‘timeout’: (number of seconds remaining in initialization or run if applicable else 0), 
	‘noinit_pin’: (if status is NOINIT, reports the input pin that isn’t initialized, else None) 
} </code></pre>



<h3 class="wp-block-heading" id="htoc-property-ammeterrecvserial-ammeter-initialized">(property) AmmeterRecvSerial.ammeter_initialized()&nbsp;</h3>



<p>Returns a True / False after querying the microcontroller for a status.&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-property-ammeterrecvserial-ammeter-running">(property) AmmeterRecvSerial.ammeter_running()&nbsp;</h3>



<p>Returns a True / False after querying the microcontroller for a status.&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-property-ammeterrecvserial-ammeter-ready">(property) AmmeterRecvSerial.ammeter_ready()&nbsp;</h3>



<p>Returns a True / False after querying the microcontroller for a status.&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-property-ammeterrecvserial-ammeter-config">(property) AmmeterRecvSerial.ammeter_config()&nbsp;</h3>



<p>Returns the configuration from the microcontroller in the following format:&nbsp;</p>



<pre class="wp-block-code has-small-font-size"><code>{ 
	‘interval’: (read interval in milliseconds) 
	‘timeout’: (timeout for reading data in seconds) 
	‘init_timeout’: (timeout for initializing the ADC sensor and creating the baseline) 
	‘pins’: &#91; (list of pins to read data from) 
		{ 
			‘pin’: (pin number on the microcontroller) 
			‘name’:  (friendly name to use for the sensor on this pin) 
			‘baseline’: (baseline ‘0’ calculated after the initialization) 
	] 
} </code></pre>



<h3 class="wp-block-heading" id="htoc-property-setter-ammeterrecvserial-ammeter-interval">(property+setter) AmmeterRecvSerial.ammeter_interval()&nbsp;</h3>



<p>The property and setter can be used to get the currently configured read interval and to set a new read interval. After setting the interval, the setter will check the interval from the microcontroller to ensure that the configuration was accepted. True is returned from the setter if the value was successfully applied, false if not.&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-ammeterrecvserial-ammeter-init">AmmeterRecvSerial.ammeter_init()&nbsp;</h3>



<p>Requests the initialization to run on the microcontroller. This is intended to get a zero baseline, so there should be no load on the sensor prior to running the initialization. The initialization will run for the ‘init_timeout’ length in seconds from the configuration (see above).&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-ammeterrecvserial-ammeter-start">AmmeterRecvSerial.ammeter_start()&nbsp;</h3>



<p>Requests the microcontroller to start the read. Once the read is started, the microcontroller will start returning data at each read interval that the receiver will need to record and store. The microcontroller does not maintain any data beyond the last few reads needed to create an average.&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-ammeterrecvserial-ammeter-stop">AmmeterRecvSerial.ammeter_stop()&nbsp;</h3>



<p>Requests the microcontroller to stop any read currently in progress. The microcontroller may take 1-2 read intervals to stop and return the final stop message.&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-ammeterrecvserial-ammeter-current">AmmeterRecvSerial.ammeter_current()&nbsp;</h3>



<p>Requests the microcontroller to perform a single read. The single read will still make multiple reads based on the configuration, will discard the highest and lowest value, then average and return the result.&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-ammeterrecvserial-ammeter-read">AmmeterRecvSerial._ammeter_read()&nbsp;</h3>



<p>This is an internal use function that runs as a thread to check the serial ports input queue every 100ms for received data.&nbsp;</p>



<h3 class="wp-block-heading" id="htoc-ammeterrecvserial-ammeter-parse-read-line">AmmeterRecvSerial._ammeter_parse_read_line()&nbsp;</h3>



<p>This is an internal use function that will parse any data that has been received on the serial port. This function will parse the return data to determine what type of message was received, then store the data.&nbsp;</p>
<p>The post <a href="https://www.learningtopi.com/sbc/raspberry-pi/python-adc-current-logger-ammeter_logger/">Python ADC Current Logger (ammeter_logger)</a> appeared first on <a href="https://www.learningtopi.com">Learning to Pi</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.learningtopi.com/sbc/raspberry-pi/python-adc-current-logger-ammeter_logger/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
