<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-999906212197085612</id><updated>2026-05-27T11:06:40.789-07:00</updated><category term="quadcopter"/><category term="ATmega"/><category term="Gyro"/><category term="IMU"/><category term="RC Plane"/><category term="hobbyking"/><category term="stabilization"/><category term="Remote Control"/><category term="Ubuntu"/><category term="X-QUAD"/><category term="ardupilot"/><category term="drone"/><category term="multiwii"/><category term="raspberry pi"/><category term="sourcecode"/><category term="32 bit"/><category term="ACRO mode"/><category term="ARM"/><category term="AVR"/><category term="Arduino DUE"/><category term="Calibration"/><category term="Collatz Conjecture"/><category term="Complementary filter"/><category term="DX7"/><category term="Equation"/><category term="Fail Safe"/><category term="FailSafe Mux"/><category term="FailSafe UAV"/><category term="KK2"/><category term="Kakutani&#39;s Problem"/><category term="LAMP"/><category term="Orange Receiver"/><category term="PID tuning"/><category term="SoundCard"/><category term="Spektrum DX7"/><category term="Tricopter"/><category term="WebRTC"/><category term="Windows7"/><category term="apache"/><category term="blink LED"/><category term="building quadcopter"/><category term="cheaper"/><category term="compressed"/><category term="control algorithm"/><category term="control theory"/><category term="data streaming"/><category term="expanding hobbyking"/><category term="gyro sensor"/><category term="hacking"/><category term="handmade"/><category term="hefnycopter"/><category term="hobbyking control board"/><category term="image"/><category term="install"/><category term="kalman filter"/><category term="kkmulticopter"/><category term="mavlink"/><category term="mysql"/><category term="nodejs"/><category term="noise"/><category term="p2p"/><category term="php"/><category term="raspberry pi&#xa;ethernet over usb&#xa;raspberry pi Zero W 2"/><category term="vibrations"/><category term="video streaming"/><title type='text'>Technical Adventures</title><subtitle type='html'>Many times I want to share different technical experiences to try to help out others, as others help me through sharing their experience with me.&#xa;&#xa;This blog could contain SW/HW and technical issue I find it useful.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-8161749748531980515</id><published>2022-04-03T07:34:00.005-07:00</published><updated>2022-04-03T07:58:28.299-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="raspberry pi&#xa;ethernet over usb&#xa;raspberry pi Zero W 2"/><title type='text'>Connecting Raspberry Pi Zero W with Raspberry Pi Zero 2 W via USB-Ethernet</title><content type='html'>&lt;div&gt;&lt;span style=&quot;color: #0bbe41; font-size: medium;&quot;&gt;&lt;b&gt;Surprisingly it is easy!!!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6aa84f; font-size: medium;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;In this article we will learn how to connect two raspberry pi zeros together.&amp;nbsp;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
  &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqgTYBU1ydZ9wC5q4oey2Y34visSSCPUetHaogjTQ8SR-4NKCHpzE7yoVcAiNjqof3xrJ_78rdK27veNohnb8bv4_973jzjuH7e5rIk_VBkzlO9NJXJ2QCCKjL9RpVtbBVyyqs6FdytNrHFvNNlCyLUTYfuOLLmAkmN-WEnFtQt7xb7alEkpnKhWwgNg/s1140/RPI2RPI.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; data-original-height=&quot;500&quot; data-original-width=&quot;1140&quot; height=&quot;282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqgTYBU1ydZ9wC5q4oey2Y34visSSCPUetHaogjTQ8SR-4NKCHpzE7yoVcAiNjqof3xrJ_78rdK27veNohnb8bv4_973jzjuH7e5rIk_VBkzlO9NJXJ2QCCKjL9RpVtbBVyyqs6FdytNrHFvNNlCyLUTYfuOLLmAkmN-WEnFtQt7xb7alEkpnKhWwgNg/w640-h282/RPI2RPI.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;In this example we will use one &lt;b&gt;Raspberry Zero W&lt;/b&gt;&amp;nbsp; &amp;amp; the other &lt;b&gt;Raspberry Zero 2 W&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;you need to power only the &lt;b&gt;Raspberry Zero W &lt;/b&gt;&amp;amp; the cable will power&amp;nbsp;&lt;b&gt;Raspberry Zero 2 W&lt;/b&gt;, of course you can provide a separate power source especially if you want to connect sensors and other hardware on the other board.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;Same configuration can be implemented between two&amp;nbsp;&lt;b&gt;Raspberry Zero W.&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;h2 style=&quot;clear: both; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;Steps :&lt;/span&gt;&lt;/b&gt;&lt;/h2&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;For you need to enable Ethernet over USB.&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;sudo nano /boot/config.txt&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjI5OlDo0y_55AdLjchFTndsecFE9wW7Yn3ctFSo57YeIWOLvtQRoK_CrxSQ63E8m22ekJMhgkzPJpYXumP0ARde9Grfs6TFqWzfjAOdzvwOxXcMK41t0ptymACHxbDG9qoAmFF59ybr8zIt09dvcdVKJBGVKrEa4ycYKv-dosz8hSW7ZEMoEZnXuobRA&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;573&quot; data-original-width=&quot;845&quot; height=&quot;271&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjI5OlDo0y_55AdLjchFTndsecFE9wW7Yn3ctFSo57YeIWOLvtQRoK_CrxSQ63E8m22ekJMhgkzPJpYXumP0ARde9Grfs6TFqWzfjAOdzvwOxXcMK41t0ptymACHxbDG9qoAmFF59ybr8zIt09dvcdVKJBGVKrEa4ycYKv-dosz8hSW7ZEMoEZnXuobRA=w400-h271&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;as in the above picture at the end of the file just add&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;b&gt;dtoverlay=dwc2&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;Now you need to edit &lt;span style=&quot;color: #444444;&quot;&gt;&lt;b&gt;cmdline.txt&lt;/b&gt;&lt;/span&gt;.&amp;nbsp; Look for &lt;span style=&quot;color: #444444;&quot;&gt;&lt;b&gt;rootwait&lt;/b&gt;&lt;/span&gt; and add &lt;span style=&quot;color: #444444;&quot;&gt;&lt;b&gt;modules-load=dwc2,g_ether&lt;/b&gt;&lt;/span&gt; after it immediately.&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: Rubik, Helvetica, Arial, sans-serif; font-size: 20px; font-variant-ligatures: no-common-ligatures;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: Rubik, Helvetica, Arial, sans-serif; font-size: 20px; font-variant-ligatures: no-common-ligatures;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjWYa6RNCVJWAbb7h30odBOauwhOqN3DDVeVJnXWkrEpwMXt8mCassZx091w68qC6RagEA0hTAvslI2oVOJQjSRVzn-PfVyWH_gcR0bs5z15EUKAkJkJPHhIU5uDXTBX5E3NLjrGntvrlp22qDhWc8DDDaXeLrXk-euQwiF8PGj1hDuGBRDOWdtLAYFWw&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;54&quot; data-original-width=&quot;964&quot; height=&quot;22&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjWYa6RNCVJWAbb7h30odBOauwhOqN3DDVeVJnXWkrEpwMXt8mCassZx091w68qC6RagEA0hTAvslI2oVOJQjSRVzn-PfVyWH_gcR0bs5z15EUKAkJkJPHhIU5uDXTBX5E3NLjrGntvrlp22qDhWc8DDDaXeLrXk-euQwiF8PGj1hDuGBRDOWdtLAYFWw=w400-h22&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: Rubik, Helvetica, Arial, sans-serif; font-size: 20px; font-variant-ligatures: no-common-ligatures;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Now we will assign IPs to both boards. One of the boards will be the gateway. In our case it could be any board. but if you are using a RPI-4 where you can connect many boards together then the main board should be the gateway.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;b&gt;sudo nano /etc/dhcpcd.config&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;You need to edit the file by adding the following to the end&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;for the router:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;interface usb0&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444; font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;static ip_address=&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 14.6667px; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;192.168.11.1  # should be equal to router as this is the router&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;static routers=&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;192.168.11.1 &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;static domain_name_Servers=192.168.11.1&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;metric 400 &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b style=&quot;font-family: Arial; font-size: 14.6667px; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;# determines priority of using this net compared to wifi and others&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;for other boards:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span id=&quot;docs-internal-guid-d02f7406-7fff-792a-4a2f-4749560f3a34&quot;&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;interface usb0&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;static ip_address=192.168.11.123 # can be any ip within the subnet domain.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;static routers=&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;192.168.11.1&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;static domain_name_Servers=192.168.11.1&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;metric 400  # determines priority of using this net compared to wifi and others&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;After Restarting &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: black; font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; white-space: normal;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;b&gt;sudo reboot now&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;Both boards you can see the &lt;b&gt;&lt;span style=&quot;color: #0bb931;&quot;&gt;usb0&lt;/span&gt;&lt;/b&gt; section with the static IP&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: red; font-family: Arial; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjYZb4hfeUjHaEw7ECUqMxBIwkBdEHBnxZ1TMc-huIdp6TG5R4L1h6A1fjWVkpyA3DZhw8rGs6X-UgoBA8iyNm4il593-ElNIGhuclpNAQRHsH_UfdJBsc1j2uPXhWGURBtiDBvq2qGPfZivkbaik7gi6WO5t89FJuiEJBqOU79zv07TsN1YaNwxwcn-w&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;645&quot; data-original-width=&quot;776&quot; height=&quot;332&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjYZb4hfeUjHaEw7ECUqMxBIwkBdEHBnxZ1TMc-huIdp6TG5R4L1h6A1fjWVkpyA3DZhw8rGs6X-UgoBA8iyNm4il593-ElNIGhuclpNAQRHsH_UfdJBsc1j2uPXhWGURBtiDBvq2qGPfZivkbaik7gi6WO5t89FJuiEJBqOU79zv07TsN1YaNwxwcn-w=w400-h332&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;It is very easy and very useful. As serial communication will allows only one app to communication. But connecting via Ethernet&amp;nbsp;means there is a many-to-many communication between applications on both boards in a reliable fashion.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;Thank you....&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/8161749748531980515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2022/04/connecting-raspberry-pi-zero-w-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/8161749748531980515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/8161749748531980515'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2022/04/connecting-raspberry-pi-zero-w-with.html' title='Connecting Raspberry Pi Zero W with Raspberry Pi Zero 2 W via USB-Ethernet'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqgTYBU1ydZ9wC5q4oey2Y34visSSCPUetHaogjTQ8SR-4NKCHpzE7yoVcAiNjqof3xrJ_78rdK27veNohnb8bv4_973jzjuH7e5rIk_VBkzlO9NJXJ2QCCKjL9RpVtbBVyyqs6FdytNrHFvNNlCyLUTYfuOLLmAkmN-WEnFtQt7xb7alEkpnKhWwgNg/s72-w640-h282-c/RPI2RPI.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-8242483177181223738</id><published>2022-01-11T00:54:00.000-08:00</published><updated>2022-01-11T00:54:01.635-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Collatz Conjecture"/><category scheme="http://www.blogger.com/atom/ns#" term="Kakutani&#39;s Problem"/><title type='text'>3N+1 Problem</title><content type='html'>&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&amp;nbsp;This topic is very different than many of my previous topics. It is about math!! First I am not a mathematician and not a big fan of fan. It is hard.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The story started here when I saw this video. I love this channel and I have watched most of its video.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;266&quot; src=&quot;https://www.youtube.com/embed/094y1Z2wpJg&quot; width=&quot;320&quot; youtube-src-id=&quot;094y1Z2wpJg&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;I was excited to know that such simple problem has not been solved. So I decided to start to play with it.&lt;div&gt;No No I have not solved it. But I came with nice graph that it might be useful.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;p&gt;First let&#39;s mention the rule here, take any positive integer number:&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; if number is odd then multiply it by 3 and add 1.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;base&quot; style=&quot;display: inline-block; font-family: KaTeX_Main, &amp;quot;Times New Roman&amp;quot;, serif; font-size: 1.21em; position: relative; text-align: center; white-space: nowrap; width: min-content;&quot;&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic; margin-right: 0.10903em;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;N&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;−&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.277778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mrel&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.277778em;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;base&quot; style=&quot;display: inline-block; font-family: KaTeX_Main, &amp;quot;Times New Roman&amp;quot;, serif; font-size: 1.21em; position: relative; text-align: center; white-space: nowrap; width: min-content;&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;display: inline-block; height: 0.76666em; vertical-align: -0.08333em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic; margin-right: 0.10903em;&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.222222em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mbin&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.222222em;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;base&quot; style=&quot;display: inline-block; font-family: KaTeX_Main, &amp;quot;Times New Roman&amp;quot;, serif; font-size: 1.21em; position: relative; text-align: center; white-space: nowrap; width: min-content;&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;display: inline-block; height: 0.64444em; vertical-align: 0em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if number is even then divide it by two.&lt;/p&gt;&lt;table style=&quot;color: black; font-family: Arial, Helvetica, sans-serif; font-size: 14px; height: 90px;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;&lt;div id=&quot;latex_html&quot;&gt;&lt;span class=&quot;katex-display&quot; style=&quot;display: block; margin: 1em 0px; text-align: center;&quot;&gt;&lt;span class=&quot;katex&quot; style=&quot;display: block; font-family: KaTeX_Main, &amp;quot;Times New Roman&amp;quot;, serif; font-size: 1.21em; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: 1.2; text-rendering: auto; white-space: nowrap;&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;katex-html&quot; style=&quot;display: block; position: relative;&quot;&gt;&lt;span class=&quot;base&quot; style=&quot;display: inline-block; position: relative; width: min-content;&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;display: inline-block; height: 0.76666em; vertical-align: -0.08333em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic; margin-right: 0.10903em;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;N&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;−&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.277778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mrel&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.277778em;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;base&quot; style=&quot;display: inline-block; position: relative; width: min-content;&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;display: inline-block; height: 1em; vertical-align: -0.25em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic; margin-right: 0.10903em;&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span&gt;&amp;nbsp; let us take some examples:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; 7 :&amp;nbsp; 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;11:&amp;nbsp; 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp;easy !&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp; Now let us focus only on the last digit of any number not the whole number. Let&#39;s rewrite the above number again:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;7&lt;/span&gt; :&amp;nbsp; 2&lt;span style=&quot;color: #cc0000;&quot;&gt;2&lt;/span&gt;, 1&lt;span style=&quot;color: #cc0000;&quot;&gt;1&lt;/span&gt;, 3&lt;span style=&quot;color: #cc0000;&quot;&gt;4&lt;/span&gt;, 1&lt;span style=&quot;color: #cc0000;&quot;&gt;7&lt;/span&gt;, 5&lt;span style=&quot;color: #cc0000;&quot;&gt;2&lt;/span&gt;, 2&lt;span style=&quot;color: #cc0000;&quot;&gt;6&lt;/span&gt;, 1&lt;span style=&quot;color: #cc0000;&quot;&gt;3&lt;/span&gt;, 4&lt;span style=&quot;color: #cc0000;&quot;&gt;0&lt;/span&gt;, 2&lt;span style=&quot;color: #cc0000;&quot;&gt;0&lt;/span&gt;, 1&lt;span style=&quot;color: #cc0000;&quot;&gt;0&lt;/span&gt;, &lt;span style=&quot;color: #cc0000;&quot;&gt;5&lt;/span&gt;, 1&lt;span style=&quot;color: #cc0000;&quot;&gt;6&lt;/span&gt;, &lt;span style=&quot;color: #cc0000;&quot;&gt;8&lt;/span&gt;, &lt;span style=&quot;color: #cc0000;&quot;&gt;4&lt;/span&gt;, &lt;span style=&quot;color: #cc0000;&quot;&gt;2&lt;/span&gt;, &lt;span style=&quot;color: #cc0000;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;span style=&quot;color: #cc0000;&quot;&gt;1&lt;/span&gt;:&amp;nbsp; 3&lt;span style=&quot;color: #cc0000;&quot;&gt;4&lt;/span&gt;, 1&lt;span style=&quot;color: #cc0000;&quot;&gt;7&lt;/span&gt;, 5&lt;span style=&quot;color: #cc0000;&quot;&gt;2&lt;/span&gt;, 2&lt;span style=&quot;color: #cc0000;&quot;&gt;6&lt;/span&gt;, 1&lt;span style=&quot;color: #cc0000;&quot;&gt;3&lt;/span&gt;, 4&lt;span style=&quot;color: #cc0000;&quot;&gt;0&lt;/span&gt;, 2&lt;span style=&quot;color: #cc0000;&quot;&gt;0&lt;/span&gt;, 1&lt;span style=&quot;color: #cc0000;&quot;&gt;0&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;5&lt;/span&gt;, 1&lt;span style=&quot;color: #cc0000;&quot;&gt;6&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;8&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;4&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;2&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;1&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;We can deduce a sequence here:&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; A digit ends with 1 will always gives a digit ends with 4. because&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;div id=&quot;div_latex&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 14px;&quot;&gt;&lt;table style=&quot;height: 90px;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;&lt;div id=&quot;latex_html&quot;&gt;&lt;span class=&quot;katex-display&quot; style=&quot;display: block; margin: 1em 0px; text-align: center;&quot;&gt;&lt;span class=&quot;katex&quot; style=&quot;display: block; font-family: KaTeX_Main, &amp;quot;Times New Roman&amp;quot;, serif; font-size: 1.21em; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: 1.2; text-rendering: auto; white-space: nowrap;&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;katex-html&quot; style=&quot;display: block; position: relative;&quot;&gt;&lt;span class=&quot;base&quot; style=&quot;display: inline-block; position: relative; width: min-content;&quot;&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;n&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic;&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic;&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic;&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic;&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.222222em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mbin&quot;&gt;∗&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.222222em;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;base&quot; style=&quot;display: inline-block; position: relative; width: min-content;&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;display: inline-block; height: 0.76666em; vertical-align: -0.08333em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic; margin-right: 0.10903em;&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.222222em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mbin&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.222222em;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;base&quot; style=&quot;display: inline-block; position: relative; width: min-content;&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;display: inline-block; height: 0.64444em; vertical-align: 0em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.277778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mrel&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;display: inline-block; margin-right: 0.277778em;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;base&quot; style=&quot;display: inline-block; position: relative; width: min-content;&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;display: inline-block; height: 0.64444em; vertical-align: 0em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic;&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic;&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic;&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;mord mathdefault&quot; style=&quot;font-family: KaTeX_Math; font-style: italic;&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;4&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;base&quot; style=&quot;display: inline-block; position: relative; width: min-content;&quot;&gt;&lt;span class=&quot;mord&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;div_latex&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 14px;&quot;&gt;&amp;nbsp; We can apply same technique to other odd numbers and we get the following table:&lt;/div&gt;&lt;div id=&quot;div_latex&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;div_latex&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;google-sheets-html-origin&gt;&lt;/google-sheets-html-origin&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; dir=&quot;ltr&quot; style=&quot;border-collapse: collapse; border: none; font-family: Arial; font-size: 10pt; table-layout: fixed; width: 0px;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:1}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;1&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;x3 + 1&amp;quot;}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;x3 + 1&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:4}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;4&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:3}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;3&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;x3 + 1&amp;quot;}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;x3 + 1&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:0}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:5}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;5&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;x3 + 1&amp;quot;}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;x3 + 1&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:6}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;6&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:7}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;7&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;x3 + 1&amp;quot;}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;x3 + 1&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:2}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:9}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;9&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;x3 + 1&amp;quot;}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;x3 + 1&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:8}&quot; style=&quot;border: 1px solid rgb(204, 204, 204); color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;8&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; For even numbers; we can deduce them using the following tables:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;google-sheets-html-origin&gt;&lt;/google-sheets-html-origin&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; dir=&quot;ltr&quot; style=&quot;border-collapse: collapse; border: none; font-family: Arial; font-size: 10pt; table-layout: fixed; width: 0px;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:2}&quot; style=&quot;border: 1px solid rgb(0, 0, 0); font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;2&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;/2&amp;quot;}&quot; style=&quot;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;/2&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:1}&quot; style=&quot;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:12}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;12&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:6}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;6&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:22}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;22&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:11}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;11&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:32}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;32&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:16}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;16&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:42}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;42&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:21}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;21&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:52}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;52&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:26}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;26&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:62}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;62&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:31}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;31&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:72}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;72&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:36}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;36&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:82}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;82&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:41}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;41&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:92}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;92&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:46}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;46&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:102}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;102&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:51}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;51&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;google-sheets-html-origin&gt;&lt;/google-sheets-html-origin&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; dir=&quot;ltr&quot; style=&quot;border-collapse: collapse; border: none; font-family: Arial; font-size: 10pt; table-layout: fixed; width: 0px;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:4}&quot; style=&quot;border: 1px solid rgb(0, 0, 0); font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;4&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;/2&amp;quot;}&quot; style=&quot;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;/2&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:2}&quot; style=&quot;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:14}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;14&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:7}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;7&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:24}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;24&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:12}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;12&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:34}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;34&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:17}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;17&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:44}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;44&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:22}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;22&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:54}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;54&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:27}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;27&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:64}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;64&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:32}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;32&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:74}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;74&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:37}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;37&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:84}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;84&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:42}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;42&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:94}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;94&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:47}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;47&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:104}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;104&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:52}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;52&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;google-sheets-html-origin&gt;&lt;/google-sheets-html-origin&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; dir=&quot;ltr&quot; style=&quot;border-collapse: collapse; border: none; font-family: Arial; font-size: 10pt; table-layout: fixed; width: 0px;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:6}&quot; style=&quot;border: 1px solid rgb(0, 0, 0); font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;6&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;/2&amp;quot;}&quot; style=&quot;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;/2&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:3}&quot; style=&quot;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:16}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;16&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:8}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;8&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:26}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;26&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:13}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;13&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:36}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;36&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:18}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;18&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:46}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;46&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:23}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;23&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:56}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;56&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:28}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;28&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:66}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;66&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:33}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;33&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:76}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;76&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:38}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;38&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:86}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;86&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:43}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;43&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:96}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;96&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:48}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;48&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:106}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;106&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:53}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;53&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;google-sheets-html-origin&gt;&lt;/google-sheets-html-origin&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; dir=&quot;ltr&quot; style=&quot;border-collapse: collapse; border: none; font-family: Arial; font-size: 10pt; table-layout: fixed; width: 0px;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:8}&quot; style=&quot;border: 1px solid rgb(0, 0, 0); font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;8&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;/2&amp;quot;}&quot; style=&quot;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;/2&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:4}&quot; style=&quot;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;4&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:18}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;18&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:9}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;9&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:28}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;28&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:14}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;14&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:38}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;38&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:19}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;19&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:48}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;48&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:24}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;24&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:58}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;58&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:29}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;29&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:68}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;68&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:34}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;34&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:78}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;78&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:39}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;39&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:88}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;88&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:44}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;44&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:98}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;98&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:49}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;49&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:108}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;108&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:54}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;54&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;google-sheets-html-origin&gt;&lt;/google-sheets-html-origin&gt;&lt;/p&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; dir=&quot;ltr&quot; style=&quot;border-collapse: collapse; border: none; font-family: Arial; font-size: 10pt; table-layout: fixed; width: 0px;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;col width=&quot;100&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:0}&quot; style=&quot;border: 1px solid rgb(0, 0, 0); font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;0&lt;/td&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;/2&amp;quot;}&quot; style=&quot;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;/2&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:0}&quot; style=&quot;border-color: rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:10}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;10&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:5}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;5&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:20}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;20&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:10}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;10&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:30}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;30&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:15}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;15&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:40}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;40&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:20}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;20&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:50}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;50&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:25}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;25&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:60}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;60&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:30}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;30&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:70}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;70&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:35}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;35&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:80}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;80&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:40}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;40&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:90}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;90&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:45}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;45&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 21px;&quot;&gt;&lt;td data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:100}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0); border-image: initial; border-style: solid; border-width: 1px; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: center; vertical-align: bottom;&quot;&gt;100&lt;/td&gt;&lt;td style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; overflow: hidden; padding: 2px 3px; vertical-align: bottom;&quot;&gt;&lt;/td&gt;&lt;td data-sheets-formula=&quot;=R[0]C[-2]/2&quot; data-sheets-value=&quot;{&amp;quot;1&amp;quot;:3,&amp;quot;3&amp;quot;:50}&quot; style=&quot;border-color: rgb(204, 204, 204) rgb(0, 0, 0) rgb(0, 0, 0) rgb(204, 204, 204); border-image: initial; border-style: solid; border-width: 1px; color: #cc0000; font-weight: bold; overflow: hidden; padding: 2px 3px; text-align: right; vertical-align: bottom;&quot;&gt;50&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now we have all the information we need to draw a state machine diagram for these numbers:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhw5E_iFUA1xGAyahEzD85MZ9BxN-18CDQR87180Ua2DvYQ8Bhioo5Q9HFb36M7ggxXKhQLiJOxBS1z5GxF3k9uj1JXk_PLnGn0_DDmxmoDHP9C8_0uEoqkVfHSNO9afjE5AW0Qtu_nPJl3YOMZaQLxXIrYiHaLijpheuT3hx2Hrl10dzrL8zBBo8kNmg=s814&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;814&quot; data-original-width=&quot;764&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhw5E_iFUA1xGAyahEzD85MZ9BxN-18CDQR87180Ua2DvYQ8Bhioo5Q9HFb36M7ggxXKhQLiJOxBS1z5GxF3k9uj1JXk_PLnGn0_DDmxmoDHP9C8_0uEoqkVfHSNO9afjE5AW0Qtu_nPJl3YOMZaQLxXIrYiHaLijpheuT3hx2Hrl10dzrL8zBBo8kNmg=w600-h640&quot; title=&quot;State Machine Diagram of First Digit Relations&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;you can verify this with any number generated by the 3N+1 problem and the sequence will always be valid.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;What can we see in this graph:&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; 1-&amp;nbsp;&lt;/span&gt;The blue lines are where we divide by 2 hence reduce the value. The red lines are where we multiply by 3 and add 1 hence increase the value.&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; 2- Blue lines are 10 and red lines are only 5. &lt;span style=&quot;color: #cc0000;&quot;&gt;That means overall the value should decrease even if it is increased for sometime&lt;/span&gt;.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjbRo7nkBNm7PCbduI76alFwujuplZxbZSfmsDTtCwqHcEop2v8CWr92AamGL0V2JAKKBM-EBizQTRgMyWRq0oWeme2gr856blZXBmUAythdhkOm7zYWPc4aQTXsOhv6BjXOFlgXNCEQ4U7RPtMoGfpg1MIuMSFmcIuO62lEtX73Wt4NH5Nj9lpKmMBog=s166&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;153&quot; data-original-width=&quot;166&quot; height=&quot;153&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjbRo7nkBNm7PCbduI76alFwujuplZxbZSfmsDTtCwqHcEop2v8CWr92AamGL0V2JAKKBM-EBizQTRgMyWRq0oWeme2gr856blZXBmUAythdhkOm7zYWPc4aQTXsOhv6BjXOFlgXNCEQ4U7RPtMoGfpg1MIuMSFmcIuO62lEtX73Wt4NH5Nj9lpKmMBog&quot; width=&quot;166&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; 3- Loops with same number of arrows of different colors leads to increase in values. for example loop {6,3,0,5,6,3,0,5,6...} but the loop will break as divide by two at a moment will give a number ended by 8.&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;4- Loops {6,3,0,5,6,...} can never be broken except at number 6 only. Loops {9,8,9,8...} can be broken at number 8 only. &lt;span style=&quot;color: #cc0000;&quot;&gt;Loops can only be broken at even numbers only&lt;/span&gt;.&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp;5- Loop {1,4,2,1,4,2,....} there are two blue lines and one red line. &lt;span style=&quot;color: #cc0000;&quot;&gt;The result is 1 when n =1 that is why it loops forever.&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEigdrL9TTp_S_ecwCkgDGhhxti2fXMul8RGtW76R4grqYoQt_qafxCOynqqEYSpYELq466XayFNPYwJWMIfro5Zbvwpl_MlW3mTwFlfKkl-32N0GDeGr02ynZeyZz4Yg2yimHabRwURmg5dgYJaeBWwSDM9WsDWDOkiSomfxBoQ19j7ae3GbJS-QvRG2w=s153&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;121&quot; data-original-width=&quot;153&quot; height=&quot;121&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEigdrL9TTp_S_ecwCkgDGhhxti2fXMul8RGtW76R4grqYoQt_qafxCOynqqEYSpYELq466XayFNPYwJWMIfro5Zbvwpl_MlW3mTwFlfKkl-32N0GDeGr02ynZeyZz4Yg2yimHabRwURmg5dgYJaeBWwSDM9WsDWDOkiSomfxBoQ19j7ae3GbJS-QvRG2w&quot; width=&quot;153&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&amp;nbsp;6- If someone can prove that loop {6,3,0,5,6} can be repeated forever which I do not believe it is possible, as each time you multiply you get the following assuming you do not loop in the Zero loop.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiMOhJYTNI4Q75uBK_R9sp8k8ZQ6cVIdjniq0oDsx82YOM1asr5CNGvUJQawSIUD-ndFGdOlYrBOo1WVnAUHNHDc8jtzjvPxS-O1QqzpwesW0v-IbLxDR1IGCXtBqm1H4ta2oaPjj7-eqc2uyWl82S-7FxVlpU_-CZOb6LPl8u5zhSPC9xkyWQz6GGKqg=s362&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;195&quot; data-original-width=&quot;362&quot; height=&quot;172&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiMOhJYTNI4Q75uBK_R9sp8k8ZQ6cVIdjniq0oDsx82YOM1asr5CNGvUJQawSIUD-ndFGdOlYrBOo1WVnAUHNHDc8jtzjvPxS-O1QqzpwesW0v-IbLxDR1IGCXtBqm1H4ta2oaPjj7-eqc2uyWl82S-7FxVlpU_-CZOb6LPl8u5zhSPC9xkyWQz6GGKqg=s320&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;which is&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiODWnN7fVJ7CDYnG9tG5DkL8_E-2CSS3Jaoifc_HZbqPq5potrPtqfkXcNmKGlQm9W7kAvDIHHmnVmPouW4b0AfRWwKH5hJ0RydLxkhTzBwFcUPDw4bj6foI4zoQYLdvKElLbY2eGnF6oO_aAX-nDvxxTaxFIWVNC-UT_d-6csGQCdleHrbxlGUphKLA=s224&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;147&quot; data-original-width=&quot;224&quot; height=&quot;147&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiODWnN7fVJ7CDYnG9tG5DkL8_E-2CSS3Jaoifc_HZbqPq5potrPtqfkXcNmKGlQm9W7kAvDIHHmnVmPouW4b0AfRWwKH5hJ0RydLxkhTzBwFcUPDw4bj6foI4zoQYLdvKElLbY2eGnF6oO_aAX-nDvxxTaxFIWVNC-UT_d-6csGQCdleHrbxlGUphKLA&quot; width=&quot;224&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;The number will either loop in Zero or get out&lt;/span&gt; in 6 to 8 because incrementing by 10/4 is 2.5&amp;nbsp;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;Similar rules is applied to {8,9} and {4,7,2,1} loops. remember only balanced loop is {4,2,1} when n is {4,2,1}.&amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;7- If you get out of a loop then to get in again you pass one or more blue lines. &lt;span style=&quot;color: #cc0000;&quot;&gt;if you are in loop 6 and move to loop 8 and come back to 6 using worst path you need to move on {6, 8, 9, 4, 7, 2, 6} which is 2 red lines and five blue lines. The number is ALWAYS reduce.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So you have thre main rules guide the behavior here.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;A- You cannot loop in one loop forever except {4,2,1}.&lt;/p&gt;&lt;p&gt;B- Jumping from one loop to another reduces the value.&lt;/p&gt;&lt;p&gt;C- Moving back and forth from loop 6 to loop 8 requires passing on loop 4. &lt;span style=&quot;color: #cc0000;&quot;&gt;It is a Must&lt;/span&gt;.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So as value gets smaller and passes via 4 from 8 that explains the 4 ,2 ,1.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I know this is NOT a scientific mathematical proof. But it explains to certain extend the behavior of this formula.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/8242483177181223738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2022/01/3n1-problem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/8242483177181223738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/8242483177181223738'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2022/01/3n1-problem.html' title='3N+1 Problem'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/094y1Z2wpJg/default.jpg" height="72" width="72"/><thr:total>0</thr:total><georss:featurename>Cairo, Cairo Governorate, Egypt</georss:featurename><georss:point>30.0444196 31.2357116</georss:point><georss:box>1.7341857638211557 -3.9205384000000016 58.35465343617885 66.3919616</georss:box></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-7225190974487535371</id><published>2021-05-09T14:17:00.002-07:00</published><updated>2021-05-09T14:17:15.733-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="compressed"/><category scheme="http://www.blogger.com/atom/ns#" term="image"/><category scheme="http://www.blogger.com/atom/ns#" term="raspberry pi"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>How to make your Own SD Raspberry Image</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;Why Do I need This ?&amp;nbsp;&lt;/h2&gt;&lt;p&gt;Here is the problem. Raspberry Pi SD image is less than 4GBs and you copy it on SD memory card of size 8, 16, 32 GB. It expands and you can install and customize your raspberry pi.&lt;/p&gt;&lt;p&gt;Now you have your own SD card with your own software that you want to reproduce. If you use &lt;b&gt;dd&lt;/b&gt; command only for your 16GB SD card you will get a 16 GB image file. You need a 16 GB SD card to restore it again. Although the software itself can be restored in 8GB card -assuming the card is not full- and the remaining size is unused space !!!&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Here are the steps to produce a compressed raspberry pi image version:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Steps:&lt;/h3&gt;&lt;p&gt;1- Insert SD-Card you want to clone into your laptop.&lt;/p&gt;&lt;p&gt;2- Run &lt;span style=&quot;color: #666666;&quot;&gt;&lt;b&gt;lsblk&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;you should see something like:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;b&gt; sdb\sdb1&amp;nbsp; \media\$USER\boot&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;b&gt;sdb\sdb2&amp;nbsp; \media\$USER\rootfs&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;3- Unmount partitions&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;b&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; sudo umount&amp;nbsp;&lt;/span&gt;\media\$USER\boot&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; sudo umount&amp;nbsp;\media\$USER\rootfs&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;4- Now copy the full sd-card:&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;sudo dd if=/dev/sdX&amp;nbsp; &amp;nbsp;of=~/my_large_image.img&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;5- Now Compress Image using pishrink&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; pishrink.sh ~/my_large_image.img&amp;nbsp; ~/my_compressed_image.img&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;Further more&amp;nbsp; you can compress it to zip file.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;How to Get pishrink&lt;/h2&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;1- Download:&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: Arial; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b id=&quot;docs-internal-guid-9141302f-7fff-b3a5-1833-0ca3315e8aaf&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;2- Change Permission:&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: Arial; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;chmod +x pishrink.sh&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;3- Move it:&amp;nbsp;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.74; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; font-family: Arial; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;sudo mv pishrink.sh /usr/local/bin&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/7225190974487535371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2021/05/how-to-make-your-own-sd-raspberry-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/7225190974487535371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/7225190974487535371'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2021/05/how-to-make-your-own-sd-raspberry-image.html' title='How to make your Own SD Raspberry Image'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-7550323850438881727</id><published>2020-09-26T08:22:00.000-07:00</published><updated>2020-09-26T08:22:15.104-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ardupilot"/><category scheme="http://www.blogger.com/atom/ns#" term="mavlink"/><category scheme="http://www.blogger.com/atom/ns#" term="nodejs"/><title type='text'>Mavlink 3D-Map</title><content type='html'>&lt;p&gt;&amp;nbsp;This is nice and easy. And you can expand it as you need.&lt;/p&gt;&lt;p&gt;Mavlink is communication protocol&amp;nbsp; used by many autopilot including the very famous &lt;a href=&quot;https://ardupilot.org/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;ardupilot.&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://Three.js&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Three.js&lt;/a&gt; is a very famous&amp;nbsp; corss-browser JavaScript library used to develop animated&amp;nbsp; 3D computer graphics in web browser using WebGL.&lt;/p&gt;&lt;p&gt;If we combine these two things together we get &lt;a href=&quot;https://github.com/HefnySco/Mavlink3DMap&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Mavlink3DMap&lt;/a&gt;, this is a simple static site that receives parsed mavlink&amp;nbsp; messages and create correspondent vehicles and set their position and orientation.&lt;/p&gt;&lt;p&gt;SITL or a real vehicle sends Mavlink messages received by a UDP listener socket. the&amp;nbsp; UDP socket redirects these messages to the static web page via websocket connection.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtG4dooTww154tr8mrWRSD55liAaGyDagmUAsSW4Xf3X32bz46qBmwG2W-BO1H1a0q0eCFM0nnamobY7gvJxzCq0lBiQfOoQHVOMdmT0HUvyiZ8SVjVg4Jhj3vEp5VXID9q7TFMgPovYjP/s736/screen4.png&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;731&quot; data-original-width=&quot;736&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtG4dooTww154tr8mrWRSD55liAaGyDagmUAsSW4Xf3X32bz46qBmwG2W-BO1H1a0q0eCFM0nnamobY7gvJxzCq0lBiQfOoQHVOMdmT0HUvyiZ8SVjVg4Jhj3vEp5VXID9q7TFMgPovYjP/s320/screen4.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;The 3D Map create a vehicle with a camera attached to each vehicle. The main screen shows 4 view ports -that you can change easily- each view port has a world camera that you can move using mouse.&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;P &amp;amp; O&lt;/b&gt; buttons used to switch between cameras. If there is SITL connected to the map then it will have its own camera and you can switch to it using P &amp;amp; W. then you can control it using &lt;b&gt;W, S , A , D&lt;/b&gt;. You can press R to reset camera orientation.&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;The image shows 4 view ports the top left is from a world camera, then the top right is from a plane camera, the bottom left shows both a plane and a drone, then the bottom right is the drone camera.&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGC2vlnJXRV3Ouooedw9iM8LPP4H7cIO3PYlVwKH3uwUlhDvyUHAw43-S4GCxbevFJB0iS3s6CBhQl70hnHOXzQx4n2R3XvKRNkb19YVIGpVDWLuIfI3KvdWdRpaAjVUGmyStUJxOpxDed/s366/screen6.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;362&quot; data-original-width=&quot;366&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGC2vlnJXRV3Ouooedw9iM8LPP4H7cIO3PYlVwKH3uwUlhDvyUHAw43-S4GCxbevFJB0iS3s6CBhQl70hnHOXzQx4n2R3XvKRNkb19YVIGpVDWLuIfI3KvdWdRpaAjVUGmyStUJxOpxDed/s320/screen6.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;The next image shows a quadcopter with a camera pointing forward. while the image below it shows a plane. These vehicles are defined automatically in the world as mavlink messages are received by the static webpage.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Different vehicles should have different &lt;b&gt;SYSID_THISMAV&lt;/b&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Running the simulation is very easy. you need to run udp2websocket.js using node. and use http-server to run the static website. That is it. &lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: right;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJkg9BeEWajMryzFYC3VQUn24MacdgQgNyrQhjUdXiT2nkE_SVEXIvRN-j0dZ4VKAb7u8KeA_tuMmOnmEeFo4ginEcsM6w01JREZEdCrMkWaG7t2s3TnJHfppHOlW03T8WcM7LQvTnYM5i/s363/screen5.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;363&quot; data-original-width=&quot;361&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJkg9BeEWajMryzFYC3VQUn24MacdgQgNyrQhjUdXiT2nkE_SVEXIvRN-j0dZ4VKAb7u8KeA_tuMmOnmEeFo4ginEcsM6w01JREZEdCrMkWaG7t2s3TnJHfppHOlW03T8WcM7LQvTnYM5i/s320/screen5.png&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGC2vlnJXRV3Ouooedw9iM8LPP4H7cIO3PYlVwKH3uwUlhDvyUHAw43-S4GCxbevFJB0iS3s6CBhQl70hnHOXzQx4n2R3XvKRNkb19YVIGpVDWLuIfI3KvdWdRpaAjVUGmyStUJxOpxDed/s366/screen6.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;Then you need to run simulators or redirect data from a real vehicles. running SITL&amp;nbsp; could be like the following sample:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;sim_vehicle.py&amp;nbsp; -j4 -v ArduPlane&amp;nbsp; -M --map --console --instance 80 --out=udpout:127.0.0.1:14550 --out=udpout:192.168.1.139:&lt;b&gt;16450&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Port 16450 is used by the 3DMapView and port 14550 I keep it for &lt;a href=&quot;http://qgroundcontrol.com/&quot;&gt;QGC&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Your are welcome to join to enhance this &lt;a href=&quot;https://github.com/HefnySco/Mavlink3DMap&quot;&gt;simulator&lt;/a&gt;. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/7550323850438881727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/7550323850438881727'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2020/09/mavlink-3d-map.html' title='Mavlink 3D-Map'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtG4dooTww154tr8mrWRSD55liAaGyDagmUAsSW4Xf3X32bz46qBmwG2W-BO1H1a0q0eCFM0nnamobY7gvJxzCq0lBiQfOoQHVOMdmT0HUvyiZ8SVjVg4Jhj3vEp5VXID9q7TFMgPovYjP/s72-c/screen4.png" height="72" width="72"/><georss:featurename>Cairo, Cairo Governorate, Egypt</georss:featurename><georss:point>30.0444196 31.2357116</georss:point><georss:box>1.7341857638211557 -3.9205384000000016 58.35465343617885 66.3919616</georss:box></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-8455649386287825587</id><published>2020-08-21T20:22:00.006-07:00</published><updated>2020-09-09T00:35:48.367-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ardupilot"/><category scheme="http://www.blogger.com/atom/ns#" term="drone"/><category scheme="http://www.blogger.com/atom/ns#" term="Gyro"/><category scheme="http://www.blogger.com/atom/ns#" term="IMU"/><category scheme="http://www.blogger.com/atom/ns#" term="raspberry pi"/><category scheme="http://www.blogger.com/atom/ns#" term="RC Plane"/><category scheme="http://www.blogger.com/atom/ns#" term="sourcecode"/><title type='text'>Raspberry Pi-Zero ArduPilot PCA9685</title><content type='html'>&lt;span id=&quot;docs-internal-guid-757c4055-7fff-c8ca-3c33-f7efc99398cd&quot;&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 26pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Raspberry Pi-Zero ArduPilot&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 18pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;RZero&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b id=&quot;docs-internal-guid-6d43fdd2-7fff-0e3e-8a82-9967fb462f1d&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;span style=&quot;border: 2pt solid rgb(0, 0, 0); display: inline-block; height: 487px; overflow: hidden; width: 333px;&quot;&gt;&lt;img height=&quot;554&quot; src=&quot;https://lh3.googleusercontent.com/6R75gPe2rL-blRFg5Ol1q5UFWEFFTjqBZBdzRcYV35ymTasMRgVyY9-A-DMoNiupfQLjA_vrNnih8pn2mOrSYZjpItNcmZJykreyYhYfqheMg13y8Xt5vh7IRTxrPnMQARGe2gjw&quot; style=&quot;margin-left: -48px; margin-top: 0px;&quot; width=&quot;416&quot; /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h1 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 20pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 20pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Index&lt;/span&gt;&lt;/h1&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.2; margin-bottom: 0pt; margin-top: 4pt;&quot;&gt;&lt;a href=&quot;https://docs.google.com/document/d/1zJuc8f6dEI-Z0wipTIvnBvrtsz7WsDGsTthw7d__MLo/edit#heading=h.sw6oonpus0cs&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Index&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;2&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.2; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;&lt;a href=&quot;https://docs.google.com/document/d/1zJuc8f6dEI-Z0wipTIvnBvrtsz7WsDGsTthw7d__MLo/edit#heading=h.x0xjbbqtbp5v&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Introduction&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;3&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.2; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;&lt;a href=&quot;https://docs.google.com/document/d/1zJuc8f6dEI-Z0wipTIvnBvrtsz7WsDGsTthw7d__MLo/edit#heading=h.1tw9e9j7f9a7&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;DIY Raspberry Pi Zero Ardupilot&amp;nbsp; “R-ZERO”&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;6&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.2; margin-bottom: 0pt; margin-left: 18pt; margin-top: 3pt;&quot;&gt;&lt;a href=&quot;https://docs.google.com/document/d/1zJuc8f6dEI-Z0wipTIvnBvrtsz7WsDGsTthw7d__MLo/edit#heading=h.fkw4rafrwwkz&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Design Decisions&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;6&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.2; margin-bottom: 0pt; margin-left: 18pt; margin-top: 3pt;&quot;&gt;&lt;a href=&quot;https://docs.google.com/document/d/1zJuc8f6dEI-Z0wipTIvnBvrtsz7WsDGsTthw7d__MLo/edit#heading=h.7ll2do603jjn&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;I2C ServoDriver&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;7&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.2; margin-bottom: 0pt; margin-left: 18pt; margin-top: 3pt;&quot;&gt;&lt;a href=&quot;https://docs.google.com/document/d/1zJuc8f6dEI-Z0wipTIvnBvrtsz7WsDGsTthw7d__MLo/edit#heading=h.oevqncmelgg8&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Technical Specification:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;9&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.2; margin-bottom: 0pt; margin-left: 18pt; margin-top: 3pt;&quot;&gt;&lt;a href=&quot;https://docs.google.com/document/d/1zJuc8f6dEI-Z0wipTIvnBvrtsz7WsDGsTthw7d__MLo/edit#heading=h.7twdzyart5vc&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;How to Start&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;10&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.2; margin-bottom: 0pt; margin-left: 36pt; margin-top: 3pt;&quot;&gt;&lt;a href=&quot;https://docs.google.com/document/d/1zJuc8f6dEI-Z0wipTIvnBvrtsz7WsDGsTthw7d__MLo/edit#heading=h.c3wqd768uops&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Important Notice:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;10&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.2; margin-bottom: 0pt; margin-top: 10pt;&quot;&gt;&lt;a href=&quot;https://docs.google.com/document/d/1zJuc8f6dEI-Z0wipTIvnBvrtsz7WsDGsTthw7d__MLo/edit#heading=h.f6f9674794dx&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Conclusion&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;11&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.2; margin-bottom: 4pt; margin-top: 10pt;&quot;&gt;&lt;a href=&quot;https://docs.google.com/document/d/1zJuc8f6dEI-Z0wipTIvnBvrtsz7WsDGsTthw7d__MLo/edit#heading=h.6gcn8nvakxu2&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Useful Links&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;11&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;h1 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 20pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 20pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span style=&quot;display: inline-block; position: relative; width: 100px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;&lt;h1 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 20pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 20pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Introduction&lt;/span&gt;&lt;/h1&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Flight Control Board FCB is essentially a microcontroller board that reads input from sensors and &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;remote control&amp;nbsp; and processes these inputs based on algorithms that determine the output signals &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: left;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;that rotate servos and motors to drive/fly the vehicle.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;/p&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;p&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span style=&quot;border: 1pt solid rgb(11, 83, 148); display: inline-block; height: 468px; overflow: hidden; width: 624px;&quot;&gt;&lt;img height=&quot;468&quot; src=&quot;https://lh4.googleusercontent.com/c3tmaZJPr9NGaj7T8gkERxdRmjQSm-ht89SLcNRgrNp7VjENGNAogSX_K84eGxsXRZ-DAmwNxm62iAASa3eBweRQbygM854cpSNscsqKV2uLNtpgmy38Eathc1qIF0V8RNIbGWLX&quot; style=&quot;margin-left: 0px; margin-top: 0px;&quot; width=&quot;624&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;FCB board normally contains beside a microcontroller some of sensors mainly gyro, acc, mag &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&amp;amp; barometer on the same board. While GPS normally comes as a separate part and connects &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;to a socket on the board.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;So almost any board can be turned to FCB if we attach the right sensors and provide a way for &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;RC-in &amp;amp; RC-out. This is true. But from a Software perspective writing autopilot systems using &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;today&#39;s features is almost an impossible task for one person. And even if we have the talent.&amp;nbsp; &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;we will never have the time spent in testing and validating features by all ardupilot users.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Fortunately,&amp;nbsp; Ardupilot, the best open source autopilot already supports running on Linux. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Please check this &lt;/span&gt;&lt;a href=&quot;https://ardupilot.org/copter/docs/common-autopilots.html&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; we find the following list:&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;a href=&quot;https://ardupilot.org/copter/docs/common-autopilots.html&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span style=&quot;border: 1pt solid rgb(11, 83, 148); display: inline-block; height: 544px; overflow: hidden; width: 405px;&quot;&gt;&lt;img height=&quot;544&quot; src=&quot;https://lh3.googleusercontent.com/iy__QjzbC63noF2WmAHHSFcP3T754EPa66V1GCGV9FTPSnfADWHsDKqJWRBVE41si3eus6vi6F6GJcpYqENecoK6HbryGtMO5YPcLQfnl2d8g6McgCjU39sOH9UbMm7faE98kl7q&quot; style=&quot;margin-left: 0px; margin-top: 0px;&quot; width=&quot;405&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;The very nice thing about the above list is the existence of Raspberry Pi based boards such as &lt;/span&gt;&lt;a href=&quot;https://ardupilot.org/copter/docs/common-navio2-overview.html&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;NAVIO2&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;.
That is what we are looking for because since ardupilot is open source then we will find many reusable &lt;br /&gt;modules for RPI and a model to follow to define our board.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;a href=&quot;https://ardupilot.org/copter/docs/common-navio2-overview.html&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span style=&quot;border: 1pt solid rgb(11, 83, 148); display: inline-block; height: 335px; overflow: hidden; width: 389px;&quot;&gt;&lt;img height=&quot;350.46153846153845&quot; src=&quot;https://lh6.googleusercontent.com/zA27lPf94SIps-vOlMLbEmeNj62PJ1UdMyFpEShJIILLCJnr7DAgbYsvbK6sRpczRePtGAzpEZSoQPxMqegj7m7icQrwz289M9NSkg_esD0NmrMDhZkBOCm241bGQi98jLRh4iIX&quot; style=&quot;margin-left: 0px; margin-top: 0px;&quot; width=&quot;401.2165289256198&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Even better we can find &lt;/span&gt;&lt;a href=&quot;https://ardupilot.org/copter/docs/common-pxfmini.html&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;PXFmini&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; board. It is a Raspberry PI Zero based board.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;a href=&quot;https://ardupilot.org/copter/docs/common-pxfmini.html&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span style=&quot;border: 1pt solid rgb(0, 0, 0); display: inline-block; height: 342px; overflow: hidden; width: 382px;&quot;&gt;&lt;img height=&quot;342&quot; src=&quot;https://lh6.googleusercontent.com/_KWGvoIyLNLqsJ4NtYFZnFhX1RyCP7RxnGKBfrDT5l7FSBgxQEltCB4r4khEigQ9DWrMhEMAUmQqP3p0w6C-aqeKjY4NjFFaemUqjTdes4BBJfEFaLHHMhmpVTB7WC_1T8TPt1QA&quot; style=&quot;margin-left: 0px; margin-top: 0px;&quot; width=&quot;382&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;h1 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 20pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 20pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;DIY Raspberry Pi Zero Ardupilot&amp;nbsp; “R-ZERO”&lt;/span&gt;&lt;/h1&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;From this point it seems we have a very good start. We will see how there are many reusable &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Raspberry Pi codes. Most of them are very critical and not an easy task to write from scratch. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;However as we mention above in our pseudo definition of FCB, FCB is processor &amp;amp; sensors &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;which is not the case for RPi-Zero. PXFmini consists of two boards, one of them is Raspberry Pi Zero &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;and the other is a board that holds sensors, RC-in &amp;amp; RC-out pins.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Now we only have Raspberry Pi Zero, and we need to make our second board.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Our second board should contains:&lt;/span&gt;&lt;/p&gt;&lt;ol style=&quot;margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;RC-in: to read signals from RX.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;RC-out: to output signals to motors.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Sensors: to identify vehicle status and location.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;ol style=&quot;margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Gyro&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Acc&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Compass&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Barometer&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;GPS&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Volt &amp;amp; Amp sensor for battery.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;LEDS to display status.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 18pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 16pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Design Decisions&lt;/span&gt;&lt;/h2&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Let us first start with GPS as it is the easiest part. We only need to connect GPS TX/RX with &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Raspberry Pi Zero TX/RX and it will work with no code changes. We only need to add a parameter &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;in the ardurover command to initialize the serial port. So no extra hardware is needed here.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;For RC-In the good news is that Ardupilot already has a reusable code, a class called &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot/blob/ppr_RaspberryZ/libraries/AP_HAL_Linux/RCInput_RPI.cpp&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;RCInput_RPI&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;for this part, you can even edit GPIO ports to use and even determine if you want to use 4 or 8 channels&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; or a number in between. This class is complex and advanced. I am glad I found it ready to use. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Again no extra hardware is needed here.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;For LEDs again we can find a reusable code, a class called &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot/blob/ppr_RaspberryZ/libraries/AP_HAL_Linux/GPIO_RPI.cpp&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;GPIO_RPI&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; that is ready to use. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Although there is no extra hardware interface but we had to add LEDs each LED is connected in &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;series with a 10K resistor to limit the current and avoid burning out GPIO bin.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Now let&#39;s discuss harder parts. I used &lt;/span&gt;&lt;a href=&quot;https://artofcircuits.com/product/10dof-gy-80-4-in-1-multi-sensor-module&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;GY-80&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; with the following sensors:&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol style=&quot;margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;a href=&quot;http://www.st.com/web/en/resource/technical/document/datasheet/CD00265057.pdf&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;L3G4200D&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; (3Axis Gyroscope&amp;nbsp; 2.4-3.6V)&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;a href=&quot;http://www.analog.com/static/imported-files/data_sheets/ADXL345.pdf&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;ADXL345&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; (3 Axis Accelerometer. 2v- 3.6v)&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;a href=&quot;http://www51.honeywell.com/aero/common/documents/myaerospacecatalog-documents/Defense_Brochures-documents/HMC5883L_3-Axis_Digital_Compass_IC.pdf&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;HMC5883L&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; (3-Axis Magnetic compass 2.16v-3.6v)&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; margin-left: 36pt; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;a href=&quot;http://media.digikey.com/pdf/Data%20Sheets/Bosch/BMP085.pdf&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;BMP085&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&amp;nbsp; (Pressure Sensor. 1.62v- 3.6v)&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Again we are lucky as all these drivers already exist in Ardupilot code. Unfortunately Gyro &amp;amp; Acc &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;composite driver has some issues in implementation in the original Ardupilot repository. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;So I had to rewrite it in a new way that is compatible with the way Ardupilot handles drivers &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;and their definitions. Technical details of these changes can be found &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot/tree/pr_AP_InertialSensor_L3G4200D&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;The reason I believe why this driver was somewhat buggy is due to it not used at all in the code so &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;it seems to be obsolete. However I found later an upgrade for this driver in another forked repository &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;but I believe my update is more compatible with the latest code style they use to call drivers.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;This part was the first part I work on in this project, so I spent some time figuring out how to define a &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;board and attach sensors to it. Also what a correct driver software layout is. The problem I faced here &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;was that I use a composite sensor with I2C connection. PXFmini uses SPI connection and another &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;MPU sensor which is by the way available to buy but it was not available in the store at that time.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;RC-out: This should not be the hardest part. Actually it should be a trivial part. Raspberry Pi boards &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;uses a &lt;/span&gt;&lt;a href=&quot;https://cdn-learn.adafruit.com/downloads/pdf/16-channel-pwm-servo-driver.pdf&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;16-channel-pwm-servo-driver called PCA9685&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&amp;nbsp; this part has a defined driver in Ardupilot code &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;in a class named &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot/blob/ppr_RaspberryZ/libraries/AP_HAL_Linux/RCOutput_PCA9685.cpp&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;RCOutput_PCA9685&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;. The last piece of this driver was sold moments before I asked &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;for it. And I failed to find it in electronic shops where I live. So I decided to build my own RC-output. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;The system I have built is actually heavily based on &lt;/span&gt;&lt;a href=&quot;https://github.com/multiwii/multiwii-firmware&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;multiwii code&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Multiwii is a very famous quadcopter firmware that can run other vehicles. It has been left with no &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;updates since 2016. &lt;/span&gt;&lt;a href=&quot;https://github.com/cleanflight/cleanflight&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;CrazyFlight&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; and similar firmwares are descended from Multiwii but support &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;STM32FX based flight controllers.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 18pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 16pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span style=&quot;display: inline-block; position: relative; width: 100px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 18pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 16pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;I2C ServoDriver&lt;/span&gt;&lt;/h2&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Well, this is considered an independent project that can be used in many other projects. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;However, I had to build it as part of R-Zero project.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;As I mentioned Multiwii is a very famous flight control firmware. However its feature is &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;not our concern here. What we really care about is its code for controlling actuators such as &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;servo and motors. And its built in configurations for many vehicles. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Besides it is a relatively very easy code to explore compared to Ardupilot. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;I used to play with Multiwii many years ago, I have even&amp;nbsp; &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/MultiWii_DUE&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;transferred it to ArduinoDUE&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Anyway this was in the past, now we need to think of this code as a motor driver, &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;that we can send to it commands via I2C and it translates it to meaningful signals for &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;motors and servos. So I started by removing all unnecessary code from Multiwii. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;And I added I2C slave code that receives code from Raspberry Pi via I2C. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Received values are directly injected into motors and servos with no mixing. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;A safety feature was added to send MINCOMMAND value to motors if no signal is received &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;from I2C with a defined timeout.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;I also had to write a driver basically cloned from &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot/blob/ppr_RaspberryZ/libraries/AP_HAL_Linux/RCOutput_PCA9685.cpp&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;RCOutput_PCA9685&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;called &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot/blob/ppr_RaspberryZ/libraries/AP_HAL_Linux/RCOutput_MW_I2C.cpp&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;RCOutput_MW_I2C&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;. It uses simpler commands but basically the same approach.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Using &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/i2c_servo_driver/blob/master/config.h&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;config.h&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; we can define our vehicle actuators. I had to add MW_I2C_Rover as rovers &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;were not defined in this code. But many other vehicles are defined. However I must highlight that &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;I tested only on rover. So please check it carefully before you connect motors and propellers. &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;You can use simple small blue servos for testing, and you might need to remap output channels &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;in a function called &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/i2c_servo_driver/blob/master/Output.cpp&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;mixTable()&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Code for this project can be found &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/i2c_servo_driver&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 4pt; margin-top: 16pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Problems&lt;/span&gt;&lt;/h3&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;I found some problems with I2CServoDriver maybe because of conflicts between i2c slave &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;and timers used to generate pwm. Servos glitches with no good reason.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Anyway I could finally get &lt;/span&gt;&lt;a href=&quot;https://www.adafruit.com/product/815&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;PC9685&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; board and I activated &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot/blob/ppr_RaspberryZ/libraries/AP_HAL_Linux/RCOutput_PCA9685.cpp&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;RCOutput_PCA9685&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; and it worked &lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;like a charm.&lt;/span&gt;&lt;/p&gt;&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 18pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 16pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span style=&quot;display: inline-block; position: relative; width: 100px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 18pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 16pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Technical Specification:&lt;/span&gt;&lt;/h2&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;ol style=&quot;margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;MPU GY-80 communication using I2C protocol with I2C Device Addresses:&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;ol style=&quot;margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;I2C Address 0x1E is the HMC5883L&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;I2C Address 0x53 is the ADXL345&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;I2C Address 0x69 is the L3G4200D&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;I2C Address 0x77 is the BMP085&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;GPS UBlox connected to TX/RX directly.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;RC-In: using GPIO:&amp;nbsp; GPIO 5, 6, 12, 22, 27, 20, 21, 26.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;RC-out: using Arduino D11, D9, D3 &amp;amp; D10. where D9 is a motor output for Throttle. &amp;amp; D11 for 
Steering in the rover.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;For PCA9685 channels 1 &amp;amp; 3 are used and GPIO27 is used for enable the chip (not used in 
my code).&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;border: 1pt solid rgb(17, 85, 204); display: inline-block; height: 564px; overflow: hidden; width: 479px;&quot;&gt;&lt;img height=&quot;564&quot; src=&quot;https://lh6.googleusercontent.com/AeQLrGNrVFTlemQgnDoapHA7da81vleptQuLi3oXf7C_nyg-G36taUjMyo9nRBIE-APpuNU56JYyyBTmy89nmjR5CkkhpYAEqL4sO6FK7mLWTUtjnGxF_pXdX1_tlMw4GJs8YCQW&quot; style=&quot;margin-left: 0px; margin-top: 0px;&quot; width=&quot;479&quot; /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;h2 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 18pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 16pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;How to Start&lt;/span&gt;&lt;/h2&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;First we need to compile ardupilot &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot.git&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;RZero branch&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;. Using command: &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #38761d; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;$ make rzero-rover&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Then we can find the binary in subfolder &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #38761d; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;ardupilot/build/rzero/bin/ardurover&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #38761d; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span style=&quot;border: medium none; display: inline-block; height: 77px; overflow: hidden; width: 624px;&quot;&gt;&lt;img height=&quot;77&quot; src=&quot;https://lh3.googleusercontent.com/kDhiuCb214f4M3rUhaqbX0HXO9OBBURewOEu6W-gGj4Uqz1J7nXFMxbZ4UyXWT799GsB5JulLfvhNqp7ICigxQUws1T33ZfZ1C806LGSomyixqBmxl_dIcAr9Up_WbTf39ZZycXF&quot; style=&quot;margin-left: 0px; margin-top: 0px;&quot; width=&quot;624&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;We need to copy this file to Raspberry Pi Zero in /home/pi you can copy it in many ways, 
one of them is to open SDCard on your laptop and manually copy the file. 
Another easier way is to copy it using scp command.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #38761d; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;scp ./build/rzero/bin/ardurover pi@YourRPI_IP:.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;That is it.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;When I run ardurover I choose it not to start until I connect to it using MissionPlanner or 
QGroundControl -my favorite- so that I can monitor each and every step.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #38761d; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;sudo ./ardurover -A tcp:MyLapIP:wait -C:/ttyAMA0&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;You can also use other options such as:&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #38761d; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;sudo ./ardurover -A udp:MyLapIP:&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;courier new&amp;quot;; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;bcast&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #38761d; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; -C:/ttyAMA0&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #4a86e8; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Notice:&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #3d85c6; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; If you make your mobile Wifi Hotspot&amp;nbsp; it will take IP 192.168.43.246 which so you can 
add this network to your RPI zero and make it connect to your QGC on your mobile phone.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;You can choose to remove “wait” and ignore initializing GPS in your first tests.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 4pt; margin-top: 16pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;AutoRun Service&lt;/span&gt;&lt;/h3&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Create a file at: &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;/lib/systemd/system/ardurover.service&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;courier new&amp;quot;; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;[Unit]&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;courier new&amp;quot;; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Description=My Sample Service&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;courier new&amp;quot;; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;After=multi-user.target&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;courier new&amp;quot;; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;[Service]&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;courier new&amp;quot;; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Type=forking&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;courier new&amp;quot;; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;ExecStart=/home/pi/ardurover -A udp:192.168.1.100:10100:bcast -C udp:192.168.1.139:14550:bcast&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;courier new&amp;quot;; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Restart=on-failure&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;courier new&amp;quot;; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;[Install]&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;courier new&amp;quot;; font-size: 9pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;WantedBy=multi-user.target&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;h3 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 4pt; margin-top: 16pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: #434343; font-family: Arial; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Important Notice:&lt;/span&gt;&lt;/h3&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;In the above version I ran ardupilot on pure linux. But Ardupilot need RealTime OS so we need to 
update the Raspberry PI OS and add Real Time Features.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;To do that you need to follow steps from this &lt;/span&gt;&lt;a href=&quot;http://www.frank-durr.de/?p=203&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;link&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;. It is straightforward yet not easy.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;IMPORTANT &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;real-time OS is not mandatory if you only run ardupilot without running extra apps. 
At least for rovers.&lt;/span&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h1 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 20pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 20pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;The Fatal Bug&lt;/span&gt;&lt;/h1&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;This was totally unexpected. I found a bug that crashes ardupilot on RPIZero randomly. 
I was due to using &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot/commit/908b5f197cb7099699ce47322264116eafdec6e6#diff-820c1c58c342184aa7b04039e0cfe79c&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;RCInput_RPI&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt; class. I took me a while to figure it out but I could finally fix it in this &lt;br /&gt; &lt;/span&gt;&lt;a href=&quot;https://github.com/ArduPilot/ardupilot/pull/14842&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;[AP_HAL_Linux: Fix RCInput_RPI Segmentation Fault #14842]&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;h1 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 20pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 20pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Conclusion&lt;/span&gt;&lt;/h1&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;In this project I learnt how to define a board of in Ardupilot, adding and updating sensors. 
It also required decisions about design and wiring.&lt;/span&gt;&lt;/p&gt;&lt;h1 dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 6pt; margin-top: 20pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 20pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Useful Links&lt;/span&gt;&lt;/h1&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;b style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;ol style=&quot;margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;a href=&quot;https://discuss.ardupilot.org/t/building-an-autopilot-from-scratch-using-a-raspberrypi-zero-mini-zee/11722/8&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;Building an autopilot from scratch using Raspberry Pi Zero: Mini Zee&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;a href=&quot;https://ardupilot.org/copter/docs/common-pxfmini.html&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;PXFmini&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Code with PCA9685 enabled with segmentation fault fixed &lt;/span&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot/tree/ppr_RaspberryZ_PCA9685&quot; style=&quot;font-size: 11pt; text-decoration-line: none;&quot;&gt;&lt;span style=&quot;color: #1155cc; font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;https://github.com/HefnySco/ardupilot/tree/ppr_RaspberryZ_PCA9685&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;p dir=&quot;ltr&quot; role=&quot;presentation&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;Code with Arduino MW-I2C enabled with segmentation fault fixed&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt;&quot;&gt;&lt;a href=&quot;https://github.com/HefnySco/ardupilot/tree/ppr_RaspberryZ&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre;&quot;&gt;https://github.com/HefnySco/ardupilot/tree/ppr_RaspberryZ&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt; text-align: center;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/8455649386287825587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2020/08/raspberry-pi-zero-ardupilot-rev2.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/8455649386287825587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/8455649386287825587'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2020/08/raspberry-pi-zero-ardupilot-rev2.html' title='Raspberry Pi-Zero ArduPilot PCA9685'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/6R75gPe2rL-blRFg5Ol1q5UFWEFFTjqBZBdzRcYV35ymTasMRgVyY9-A-DMoNiupfQLjA_vrNnih8pn2mOrSYZjpItNcmZJykreyYhYfqheMg13y8Xt5vh7IRTxrPnMQARGe2gjw=s72-c" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-7260654699980040296</id><published>2017-10-01T12:41:00.002-07:00</published><updated>2017-10-01T12:50:17.409-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="data streaming"/><category scheme="http://www.blogger.com/atom/ns#" term="p2p"/><category scheme="http://www.blogger.com/atom/ns#" term="video streaming"/><category scheme="http://www.blogger.com/atom/ns#" term="WebRTC"/><title type='text'>Compiling WebRTC on Ubuntu</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In this topic I want to share an experience in details. Maybe it helps someone trying to compile &lt;a href=&quot;https://webrtc.org/&quot; target=&quot;_blank&quot;&gt;WebRTC&lt;/a&gt;. If you do not know aht is WebRTC then this topic is definitely not interested for you.&lt;br /&gt;
&lt;br /&gt;
Compiling WebRTC is a nightmare experience that you do not need to go through in order to use WebRTC in your application. But some rare times you have to and this where this topic becomes vital.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following steps are for compiling WebRTC branch 50 on Ubuntu 16.04.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
1- Preparing Environment:&lt;/h3&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;1.1 Goto page: &lt;a href=&quot;https://cs.chromium.org/chromium/src/build/install-build-deps.sh&quot;&gt;https://cs.chromium.org/chromium/src/build/install-build-deps.sh&lt;/a&gt;&amp;nbsp;and download script from it named &lt;b&gt;install-build-deps.sh you cannot use wget, you need to open the page and copy the script into a file.&lt;/b&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;1.2 Run this script that will install all prerequisites needed for compiling process.&lt;br /&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ ./build/install-build-deps.sh&amp;nbsp; --no-chromeos-fonts&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;2-&amp;nbsp; &amp;nbsp;Install Depot Tools&lt;/h3&gt;
&lt;div&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;1.1 Download&amp;nbsp;&lt;a href=&quot;https://chromium.googlesource.com/chromium/tools/depot_tools.git&quot; target=&quot;_blank&quot;&gt;depot_tools&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;1.2 now add path of depot tools to $PATH by running the following command&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;$&amp;nbsp;&lt;/b&gt;&lt;b&gt;export PATH=`pwd`/depot_tools:&quot;$PATH&quot;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
3- Download &amp;amp; Compile WebRTC&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;1.1 Download Source Code&amp;nbsp;&lt;/h4&gt;
&lt;div&gt;
this steps takes looooong time to download source code, without a good Internet connection you have no hope in completing this. I myself decided to get a VPS on net with extra 50GB HD for about $10 per month to be able to compile this code.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ mkdir webrtc-checkout&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ cd webrtc-checkout&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ gclient config https://chromium.googlesource.com/external/webrtc.git@branch-heads/50 --name=src&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ gclient sync --force --with_branch_heads&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ gclient sync --force --with_branch_heads --nohooks&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
1.2 Define Building Parameters&lt;/h4&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ export GYP_DEFINES=&quot;target_arch=x64 host_arch=x64 build_with_chromium=0 use_openssl=0 use_gtk=0 use_x11=0 include_examples=0 include_tests=1 fastbuild=1 remove_webcore_debug_symbols=1 include_pulse_audio=0 include_internal_video_render=0 clang=1 &quot;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
given you are in&lt;b&gt;&amp;nbsp;./webrtc-checkout&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ cd src&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ git checkout branch-heads/50&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;1.3 Generate Build Script&amp;nbsp;&lt;/b&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ gclient runhooks&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
1.4 Compile Code&lt;/h4&gt;
&lt;div&gt;
after running above commands you can find two folders ./webrtc-checkout/src/out/Release and&amp;nbsp; ./webrtc-checkout/src/out/Debug contain build scripts for building WebRTC based on the GYP_DEFINES that you chose above.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ ninja -C ./out/Release&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
or&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ninja -C ./out/Debug&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You will wait for a 2923 files to be compiled. On that small machine I used it took around 30 min to compile.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
1.5 Generate Headers &amp;amp; Libraries&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now you finally have WebRTC compiled. Assuming you chose to compile Release the you will find&amp;nbsp; binaries in /src/out/Release&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now you need to archive all .o objects into libwebrtc_full.a&amp;nbsp; and you need to have .h headers in a directory.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
to generate libwebrtc_full.a in a folder lib assuming you are still in&amp;nbsp;&lt;b&gt;./webrtc-checkout/src&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;$ mkdir ../lib/&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;$ find&amp;nbsp; ./ -name &quot;*.o&quot; -and -not -name do_not_use -and -not -name protoc -and -not -name genperf -exec ar crs ../lib/libwebrtc_full.a {} +&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;$ mkdir ../include&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;$ find ./ -name *.h -exec cp --parents &#39;{}&#39; ../include &#39;;&#39;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://github.com/HefnySco/node-webrtc-native&quot; target=&quot;_blank&quot;&gt;Please Check GitHUB for more details on sources &amp;amp; samples covering this topic&amp;nbsp;&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
For higher branch numbers such as 58, 60 ...etc. you need to replace step &quot;1.3 Generate Build Scripts&quot; commands with:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ gn clean out/Release&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ rm -rf ./out&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$ gn gen out/Release&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;b&gt;Problems does not end here... but above steps should work straight forward .&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/7260654699980040296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2017/10/compiling-webrtc-on-ubuntu.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/7260654699980040296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/7260654699980040296'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2017/10/compiling-webrtc-on-ubuntu.html' title='Compiling WebRTC on Ubuntu'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total><georss:featurename>Egypt</georss:featurename><georss:point>26.820553 30.802498000000014</georss:point><georss:box>12.435578 10.148201000000014 41.205528 51.456795000000014</georss:box></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-8235709070634558550</id><published>2015-09-15T23:35:00.001-07:00</published><updated>2015-09-15T23:35:31.041-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="apache"/><category scheme="http://www.blogger.com/atom/ns#" term="install"/><category scheme="http://www.blogger.com/atom/ns#" term="LAMP"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Linux Experience</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This Year I was very busy with developing &lt;a href=&quot;http://andruav.com/&quot;&gt;Andruav.com&lt;/a&gt; an RC related android application. This September &amp;nbsp;2015 I finish 1 year working on it. It is a sophisticated app to develop, however I hope it is alot easier to be used.&lt;br /&gt;
&lt;br /&gt;
I have been a Windows developer for more than&amp;nbsp;+15 years, a C++ anti-java person. Well I regret that, I do love windows, however Java is a very nice language, especially when it comes to Android. Also Linux is an excellent platform that I was away from. Now my Laptop is Ubuntu :)&lt;br /&gt;
&lt;br /&gt;
Anyway when I was looking for an inexpensive server for Andruav.com I had to go to Linux, at first I thought buying a VPS Ubuntu means a remote desktop with GUI, but I found my self lonely in front of back screen and all I have is ssh to connect :(. &amp;nbsp;That was horrible at the beginning, but later I was very comfort with it. I had to go through alot of issues that I will summaries here for other people who want to use Linux easily.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
The platform I use is Ubuntu 12.04&lt;/h3&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;Steps of installing LAMP on Ubuntu 14.04&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
1. Install Apache&lt;/h4&gt;
sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
2. Install MySQL&lt;/h4&gt;
sudo apt-get install mysql-server&lt;br /&gt;
* reconfig&lt;br /&gt;
/usr/sbin/dpkg-reconfigure: mysql-server-5.5&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
3. Install PHP&lt;/h4&gt;
sudo apt-get install php5 libapache2-mod-php5&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
4. Restart Server&lt;/h4&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
5. Check Apache&lt;/h4&gt;
http://localhost/.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
7. Installing MySQLAdmin&lt;/h4&gt;
apt-get install php5-mysql http://www.thetechrepo.com/main-articles/488.html&lt;br /&gt;
sudo apt-get install phpmyadmin&lt;br /&gt;
&lt;br /&gt;
*reconfig phpmyadmin database:&lt;br /&gt;
sudo dpkg-reconfigure phpmyadmin&lt;br /&gt;
&lt;br /&gt;
Add extension=mysqli.so (near other &#39;extension=&#39; lines) line to your php.ini&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
8. Restart Server&lt;/h4&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you execute these commands in order you will have LAMP on your Ubuntu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/8235709070634558550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2015/09/linux-experience.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/8235709070634558550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/8235709070634558550'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2015/09/linux-experience.html' title='Linux Experience'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-3009120415724639597</id><published>2015-09-15T22:58:00.000-07:00</published><updated>2015-09-15T23:04:47.221-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Calibration"/><category scheme="http://www.blogger.com/atom/ns#" term="drone"/><category scheme="http://www.blogger.com/atom/ns#" term="Gyro"/><category scheme="http://www.blogger.com/atom/ns#" term="IMU"/><title type='text'>A Python Experiment in Gyro Calibration &amp; Drift Cancelling</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRDVtkwNnoprtc9yOAMFKvg48w0kqIb-mgf4qfnPdy7sFEiak4TIbWuDiii8NsUQXeJd7Umqt3jAtKVyY1799VIwtpih3MzgBS0OpngKrHfKNqownB0VtCcyB-SnIu7Yf-AuCdmxtl1ZFA/s1600/p4.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;459&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRDVtkwNnoprtc9yOAMFKvg48w0kqIb-mgf4qfnPdy7sFEiak4TIbWuDiii8NsUQXeJd7Umqt3jAtKVyY1799VIwtpih3MzgBS0OpngKrHfKNqownB0VtCcyB-SnIu7Yf-AuCdmxtl1ZFA/s640/p4.JPG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
This article is to share my findings in gyro calibration. I tried to make a python script that uses data comes from mobile phone [S5 that has 6050 IMU]. It was a good chance to write simple code and visualize results much easier than doing so on Arduino with IMU 6050 attached. But still the concept is the same.&lt;br /&gt;
I used this&amp;nbsp;&lt;a href=&quot;https://play.google.com/store/search?q=IMU%20%2B%20GPS%20Stream&quot; target=&quot;_blank&quot;&gt;mobile app&lt;/a&gt;, this is not the only one, so you can choose other if you want.&lt;br /&gt;
&lt;br /&gt;
I used three approaches for Gyro calibration.&lt;br /&gt;
&lt;span class=&quot;font-size-4&quot; style=&quot;color: #003366;&quot;&gt;&lt;strong&gt;First Approach:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot;&gt;This is the normal approach where you read values from Gyro and then divide total by number of reads. This is the average value. Almost all quadcopter firmwares do this step before arming to make sure that the value that is read from gyro represents zero rad/s i.e. no rotations.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot;&gt;gyro from value will be:&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #339966;&quot;&gt;&lt;strong&gt;Gyro = (gyro_raw - gyro_avg ) * timediff&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;strong&gt;where gyro_avg is the average measured by reading a sample values and divide over count.&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot;&gt;There is nothing wrong in above approach, it is simple, and really can make your quad flies.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-4&quot; style=&quot;color: #003366;&quot;&gt;&lt;strong&gt;Second Approach:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot;&gt;The second approach was almost the same, but in this trial, I took values from First averaging algorithm as a first guess, &amp;nbsp;then I ran an inner loop that tries to get error based on the original average, and tries to add correction to it.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot;&gt;gyro of value will be:&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot;&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #339966;&quot;&gt;Gyro = (gyro_raw - gyro_avg_dyn) * timediff&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot;&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; where&amp;nbsp;&lt;/strong&gt;gyro_avg_dyn: is the best average with least error.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot;&gt;I find this is a equivalent of running the first approach method multiple time and try to get the best average with least error. It could be smarter than blindly get an average after n counts -first method- where you can test some values in between. This also may be more useful when using integers rather than decimal in 8-bit chips.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-4&quot; style=&quot;color: #003366;&quot;&gt;&lt;strong&gt;Third Approach:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;This approach was a bit different. It assumes that original average will give zero error for the noise, however drift will still occur, and it is in one direction. So if you integrate values from gyro it will keep either increasing or decreasing in one direction -as an overall behaviour-.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;The idea was to try to read the rate of which drift occurs and store it in a value called Gyro_AvrDriftRate. The unit of this value will be rad/sec^2.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;So the Value of Gyro will be: &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #339966;&quot;&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Gyro = (gyro_raw - gyro_avg -&amp;nbsp;&lt;em&gt;(gyro_avgdriftrate * timediff)&amp;nbsp;&lt;/em&gt;) * timediff&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where gyro_avg is the average measured by reading a sample values and divide over count.&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; and&amp;nbsp;gyro_avgdriftrate is drift rate per second&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;Drift already affects the original average value, as gyro_raw is not random values with normal distribution around an offset value; as it has drift component inside. and so the original average has a skew from the zero offset. In the third approach the drift will appear clearly in the integration of readings and using time-difference one can estimate a rate for the drift.&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span class=&quot;font-size-4&quot; style=&quot;color: #003366;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;
&lt;strong&gt;&lt;span class=&quot;font-size-4&quot; style=&quot;color: #003366;&quot;&gt;Actual Results:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style=&quot;color: #ff6600;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;font-size-2&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;
&lt;span style=&quot;color: #ff6600;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;font-size-2&quot;&gt;Script Logic:&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1- calculate average and drift using the three methods.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJehe233kX9KRm27RlRi__u8xBNzeYSGAGn-VXRJUPYCUKodv1BZLT_xl1b8FvnEn_HxDqqBrV74ePcDrXVroFv6dnTMKz2V_NL1jWVypUJsG-aRhSqQxYxNTk1oTax80RSQZjHPAEjZtv/s1600/p2.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;330&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJehe233kX9KRm27RlRi__u8xBNzeYSGAGn-VXRJUPYCUKodv1BZLT_xl1b8FvnEn_HxDqqBrV74ePcDrXVroFv6dnTMKz2V_NL1jWVypUJsG-aRhSqQxYxNTk1oTax80RSQZjHPAEjZtv/s640/p2.JPG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&amp;nbsp;2- while loop:&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a. read gyro_raw&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b. calculate gyro_value_method1,2,3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&lt;a href=&quot;http://api.ning.com/files/Lf1B3Uv2G4vIUSTlTALkWpwdvxKw6jkKiFQvA2fk1TA980NlGG*eBzc0uPG2p*lzTa*HvLESBeslq2jFEBwxgnVH1XPss1xy/p1.JPG&quot; target=&quot;_self&quot;&gt;&lt;img class=&quot;align-center&quot; src=&quot;http://api.ning.com:80/files/Lf1B3Uv2G4vIUSTlTALkWpwdvxKw6jkKiFQvA2fk1TA980NlGG*eBzc0uPG2p*lzTa*HvLESBeslq2jFEBwxgnVH1XPss1xy/p1.JPG?width=750&quot; style=&quot;padding: 2px;&quot; width=&quot;750&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c. integrate these values into three different variables&amp;nbsp;gyro_x1_int,&amp;nbsp;gyro_x3_int,&amp;nbsp;gyro_x3_int&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&lt;a href=&quot;http://api.ning.com/files/Lf1B3Uv2G4trix7xytgXJD2ijhi6tT92FWsT3BC7wfxNnHsxh683KBlFlT7rUTyki9KjYi5ik4NLbco8DT1cDXtr4aiW*o9k/p2.JPG&quot; target=&quot;_self&quot;&gt;&lt;img class=&quot;align-center&quot; src=&quot;http://api.ning.com:80/files/Lf1B3Uv2G4trix7xytgXJD2ijhi6tT92FWsT3BC7wfxNnHsxh683KBlFlT7rUTyki9KjYi5ik4NLbco8DT1cDXtr4aiW*o9k/p2.JPG?width=750&quot; width=&quot;750&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; d. print result&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;The best approach should have the least absolute value i.e. the nearest to zero.&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;
&lt;strong&gt;&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;Results:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;I ran the code several times, the result is not the same every time. but in general the third method is promising, as in&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;many cases it gives less drift than the other methods.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUkGWcazpGNRBpH4bi8au9tKXkvaO_IfXB7mTmEN09BfAdbhwfur2fUB8NnrAkfvXBDl4s66AKKe6ivVcGYqoxu2TkiF4xLcvEaxJmOOq3gU35VMzgocwiKW3rqt_Nh7_ozREO5GBYcMrp/s1600/p1.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;256&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUkGWcazpGNRBpH4bi8au9tKXkvaO_IfXB7mTmEN09BfAdbhwfur2fUB8NnrAkfvXBDl4s66AKKe6ivVcGYqoxu2TkiF4xLcvEaxJmOOq3gU35VMzgocwiKW3rqt_Nh7_ozREO5GBYcMrp/s640/p1.JPG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;the third method is the one has x_rad/s2 label.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;Also the second method sometimes get stuck in local minimum, as it reads less values in the inner loop, and sometimes get worst that normal average.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;This is not always the case. A&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;nyway I hope this could be a small start for others to make much more investigation.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&lt;strong&gt;Note:&lt;/strong&gt; sometimes values sent from mobile jumps in crazy way without movements, so I just added a skip statement to skip those values, and I assume you run this script while leaving your mobile with no movement at all.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;imu_gyroCalibration.py&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class=&quot;font-size-2&quot; style=&quot;color: black;&quot;&gt;Latest Code version is available at&amp;nbsp;&lt;a href=&quot;https://drive.google.com/file/d/0B4u6QLI5Cj8NZlZLek9SYVZSUzA/view?usp=sharing&quot; target=&quot;_blank&quot;&gt;this link&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/3009120415724639597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2015/09/a-python-experiment-in-gyro-calibration.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/3009120415724639597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/3009120415724639597'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2015/09/a-python-experiment-in-gyro-calibration.html' title='A Python Experiment in Gyro Calibration &amp; Drift Cancelling'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRDVtkwNnoprtc9yOAMFKvg48w0kqIb-mgf4qfnPdy7sFEiak4TIbWuDiii8NsUQXeJd7Umqt3jAtKVyY1799VIwtpih3MzgBS0OpngKrHfKNqownB0VtCcyB-SnIu7Yf-AuCdmxtl1ZFA/s72-c/p4.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-2328313374304490838</id><published>2014-08-07T06:16:00.000-07:00</published><updated>2014-08-07T06:16:50.695-07:00</updated><title type='text'>ZERO_PID Tunes for Multirotors Part#2</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;font-size-4&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;510&quot; src=&quot;//www.youtube.com/embed/BN_LnSfSUL0&quot; width=&quot;854&quot;&gt;&lt;/iframe&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;font-size-4&quot;&gt;Introduction&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From more than a month from now Aug 2014, I posted a blog titled&amp;nbsp;&lt;a href=&quot;http://diydrones.com/profiles/blog/list?user=2n54dpylzf0rx&quot; rel=&quot;&quot; target=&quot;_blank&quot;&gt;ZERO_PID Tune for Multicopter&lt;/a&gt;&amp;nbsp;and also &lt;a href=&quot;http://technicaladventure.blogspot.com/2014/06/zero-pids-tuner-for-multirotors.html&quot; target=&quot;_blank&quot;&gt;here &lt;/a&gt;on my blog, It was about an algorithm I developed that allows quadcopter pilot to reset Gyro PIDs to ZERO, and fly! Using this algorithm, the quadcopter was able to generate valid values for P &amp;amp; I, and can successfully fly, the demo was on Multiwii code. Since then I was working on enhancing this algorithm, as I discovered some opportunities for improvment.&lt;br /&gt;
&amp;nbsp;&lt;a href=&quot;http://api.ning.com/files/cwh76f0Jjbk-9X76UYNCxux8x*x5JLXqoZkdtIl4l38JBfRk5DX-EoIvSnfYzgHw9hYOsXtFofsmNfioiPKMhhPlC5JgE90r/Multiwii_GTune1.0.2.zip&quot; target=&quot;_self&quot;&gt;Multiwii_GTune1.0.2.zip&lt;/a&gt;&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;font-size-4&quot;&gt;First Version Issues&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/h3&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Although as you can see in the&amp;nbsp;&lt;a href=&quot;https://www.youtube.com/watch?v=dimQX0tqrxs&quot; target=&quot;_blank&quot;&gt;video&lt;/a&gt;&amp;nbsp;that quadcopter really flies, there was a devil in the details.&amp;nbsp;&lt;b&gt;P-factor&lt;/b&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;b&gt;I-factor&lt;/b&gt;&amp;nbsp;would saturate if you fly long enough – I discovered this later few days after the video-. Although quadcopter was safely taking off, but flying for a long time -1 to 2 min- in this mode will make&amp;nbsp;&lt;b&gt;P&lt;/b&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;b&gt;I&lt;/b&gt;&amp;nbsp;saturate especially if you play with sticks hard.&lt;br /&gt;
Another issue I have discovered in the first version was calculating&amp;nbsp;&lt;b&gt;I-factor&lt;/b&gt;&amp;nbsp;assuming it is a percentage of P&lt;b&gt;-factor&lt;/b&gt;. Although it was calculated separately from&amp;nbsp;&lt;b&gt;P-factor&lt;/b&gt;, it ended up as a percentage of&amp;nbsp;&lt;b&gt;P-factor&lt;/b&gt;.&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;font-size-4&quot;&gt;ZERO_PID Model&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Although my background is engineering, but I am not a big fan of mathJ, so I started to simplify the problem as much as possible, and avoid complex math. The model depends on angular velocity of gyros only. It assumes there is no interference between different axes –which is true theoretically at least- as actual Gyro MEMS has slight interactions between axes. &lt;br /&gt;
&lt;a href=&quot;http://api.ning.com/files/cwh76f0JjbkUi*gaU-jqbJkiOy2OqCtzPV48AVmj-q3-eA9BrnsijlqeVNGIRenVE4MvB0XbDeXe6dfg4HK19lWXhcoC8IXA/img1.JPG&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot; target=&quot;_self&quot;&gt;&lt;img class=&quot;align-right&quot; src=&quot;http://api.ning.com/files/cwh76f0JjbkUi*gaU-jqbJkiOy2OqCtzPV48AVmj-q3-eA9BrnsijlqeVNGIRenVE4MvB0XbDeXe6dfg4HK19lWXhcoC8IXA/img1.JPG?width=314&quot; width=&quot;314&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;First, let us start by a quad arm with a motor on it as in the figure, initially the motor is running, but you do not know if it is running fast enough to generate exact thrust to keep the arm with angular velocity zero. Again let’s assume that the motor is not producing enough thrust, so when reading the gyro we will get V1 = v1. With single value you cannot judge, you need to read two values, so you wait until the next IMU loop and read V2=v2.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Now assume that&lt;span style=&quot;color: teal;&quot;&gt;&amp;nbsp;&lt;b&gt;both V1 &amp;amp; V2 have the same signs&lt;/b&gt;&lt;/span&gt;. This means the same direction, which is falling down –counter clockwise in the figure-.&lt;br /&gt;
&lt;span style=&quot;color: #993300;&quot;&gt;&lt;b&gt;Condition#1:&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If&amp;nbsp;&lt;span style=&quot;color: teal;&quot;&gt;&lt;strong&gt;V2 &amp;gt; V1&lt;/strong&gt;&lt;/span&gt;&amp;nbsp;: this means the arm is accelerating and the quad in danger of flip. So let us reduce the P value by one if the difference is&amp;nbsp;&lt;b&gt;&lt;u&gt;high enough&lt;/u&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;span style=&quot;color: #993300;&quot;&gt;&lt;b&gt;Condition#2:&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If&amp;nbsp;&lt;span style=&quot;color: teal;&quot;&gt;&lt;strong&gt;V2 &amp;lt; V1&lt;/strong&gt;&lt;/span&gt;&amp;nbsp;: this means the arm is decelerating and the quad is trying to adjust itself to reach angular velocity zero. However there is a danger here that the deceleration is so fast so that it will not only stop the arm but will move in the other direction and start oscillations. So let’s decrease P value by one if the difference is&amp;nbsp;&lt;b&gt;&lt;u&gt;high enough&lt;/u&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;b&gt;Please note&lt;/b&gt;&amp;nbsp;that by design, quad stability is active stability, i.e. you need to monitor and adjust to keep it stable, so whatever the P value is, it will oscillate, the idea here is the oscillation amplitude should be minimal.&lt;br /&gt;
&lt;span style=&quot;color: #993300;&quot;&gt;&lt;b&gt;Condition#3:&lt;/b&gt;&lt;/span&gt;&amp;nbsp;What if V1 &amp;amp; V2 has different signs, i.e. our quad arm has reversed its rotation direction. This case is ignored as it will always happen due to oscillations as I mentioned in the previous paragraph. And we rely on&amp;nbsp;&lt;b&gt;condition 2&lt;/b&gt;&amp;nbsp;to minimize oscillations.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
What if the arm –in the figure- rotation direction is clockwise, in this case we are calculating the right arm that is falling down. That is why we use&amp;nbsp;&lt;b&gt;abs(Error)&lt;/b&gt;&amp;nbsp;. So we always consider the falling arm.&lt;br /&gt;
&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;b&gt;ZERO_PID&lt;/b&gt;&lt;/span&gt;&amp;nbsp;algorithm can be written now as follows:&lt;br /&gt;
void&amp;nbsp;&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;b&gt;G_Tune&lt;/b&gt;&amp;nbsp;&lt;/span&gt;(Error) &amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;If&lt;/b&gt;&amp;nbsp;(&lt;b&gt;&lt;span style=&quot;color: #3366ff;&quot;&gt;Sign&lt;/span&gt;(Error)&lt;/b&gt;&amp;nbsp;==&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: #3366ff;&quot;&gt;Sign&lt;/span&gt; (OldError)&lt;/b&gt;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;If&lt;/b&gt;&amp;nbsp;((&lt;b&gt;&lt;span style=&quot;color: #3366ff;&quot;&gt;abs&lt;/span&gt;(Error)&lt;/b&gt;&amp;nbsp;-&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: #3366ff;&quot;&gt;abs&lt;/span&gt; (OldError)&lt;/b&gt;) &amp;gt; High_Enough _1)&amp;nbsp;&lt;span style=&quot;color: #339966;&quot;&gt;// we are falling down.&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;P = P + 1;&lt;br /&gt;
 &lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If&lt;/b&gt;&amp;nbsp;((&lt;b&gt;&lt;span style=&quot;color: #3366ff;&quot;&gt;abs&lt;/span&gt;(Error)&lt;/b&gt;&amp;nbsp;-&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: #3366ff;&quot;&gt;abs&lt;/span&gt; (OldError)&lt;/b&gt;) &amp;lt; &amp;nbsp;- High_Enough_2 )&lt;span style=&quot;color: #339966;&quot;&gt;&amp;nbsp;// we may oscillate.&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;P = P - 1;&lt;br /&gt;
 &lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;strong&gt;OldError&lt;/strong&gt;&amp;nbsp;=&amp;nbsp;&lt;strong&gt;Error&lt;/strong&gt;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Simple :) and yet it works. Well almost :)&lt;br /&gt;
As we can see the above algorithm changes&amp;nbsp;&lt;b&gt;P-factor&lt;/b&gt;&amp;nbsp;only. In the first version I used a parallel condition for I&lt;b&gt;-factor&lt;/b&gt;&amp;nbsp;that increases and decreases it with 0.1 steps. Later I discovered this was not the best approach.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;font-size-4&quot;&gt;Challenges&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
Algorithm idea looks simple; however we need to consider some points that affect the performance of the algorithm.&lt;br /&gt;
&lt;ol&gt;&lt;ol&gt;&lt;ol&gt;
&lt;li&gt;&lt;b&gt;&lt;span style=&quot;color: #993300;&quot;&gt;Aerodynamic Factor:&lt;/span&gt; &amp;nbsp;&lt;/b&gt;The above algorithm updates OldError = Error, actually it is not reasonable to assume that applying the updated&amp;nbsp;&lt;b&gt;P&lt;/b&gt;&amp;nbsp;factor once in the PID and read the very next value will reflect the instant correct response, we need to consider motor acceleration and deceleration, as well as frame/propellers inertia, a lot of factor that makes our assumption not solid enough.&lt;a href=&quot;http://api.ning.com/files/cwh76f0JjbmSi5qO6aJbRdrgpyuUMX2WTnIlMdfEizndHnlq4avDqvB4zPVycnGNaDYOMN*MZzwqTFOP2Wq-TWdCEodeQYfX/img3.JPG&quot; target=&quot;_self&quot;&gt;&lt;img class=&quot;align-center&quot; src=&quot;http://api.ning.com/files/cwh76f0JjbmSi5qO6aJbRdrgpyuUMX2WTnIlMdfEizndHnlq4avDqvB4zPVycnGNaDYOMN*MZzwqTFOP2Wq-TWdCEodeQYfX/img3.JPG?width=582&quot; width=&quot;582&quot; /&gt;&lt;/a&gt; In the first version I tried to use complementary filter, and give a large weight for the new value, however keeping the old values so that we can have idea of the average performance. However we still read the very next action and update&amp;nbsp;&lt;b&gt;P-factor&lt;/b&gt;&amp;nbsp;after one read. In the latest version I have defined&amp;nbsp;&lt;b&gt;time_skip&lt;/b&gt;&amp;nbsp;parameter that make sure that the algorithm is executed one time each&amp;nbsp;&lt;b&gt;n&lt;/b&gt;times of PID calls. See the figure, the curve are the values from gyro while the bar chart shows samples taken by the algorithm. In practice I found&amp;nbsp;&lt;b&gt;time_skip&lt;/b&gt;&amp;nbsp;&amp;nbsp;from 7 to 20 i.e. 14ms to ms gives the correct response, out of this range the quad still flies but the model assumption is not valid and it either saturate or stay in Zero. For low value of&amp;nbsp;&lt;b&gt;time_skip&lt;/b&gt;&amp;nbsp;it stays in zero because V2 – V1 is small and within a safe range so quad assumes that this is a normal speed. Also V2 in this case does not represent the effect of previous updated&amp;nbsp;&lt;b&gt;P&lt;/b&gt;. also when&amp;nbsp;&lt;b&gt;time_skip&lt;/b&gt;&amp;nbsp;is high, quad reads random values with large difference, and in this case condition #1 wins and&amp;nbsp;&lt;b&gt;P&lt;/b&gt;&amp;nbsp;saturates, also still this is a fake reading. So time_skip is a critical parameter, which works well as long as we are in this range 7 – 20.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;b&gt;Taking-Off &amp;amp; Landing:&lt;/b&gt;&lt;/span&gt;&amp;nbsp;When you land with your quadcopter, once the quad hit the ground –even smoothly-, you will be able to see sudden peeks on the accelerometer graph. It is more clear on the Acc-Z, and this means calculated&amp;nbsp;&lt;b&gt;P&lt;/b&gt;&amp;nbsp;could be corrupted during take-off or landing especially. Handling this was relatively easy. I just added a condition not to calculate P when Thrust is less than one third throttle. So now you can land and then switch from G_Tune to ACRO mode, you don’t need to do that in the air, however you can still do it safely as in the first version.&lt;br /&gt;
 &lt;br /&gt;
 &lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;b&gt;What is Error Input Parameter:&lt;/b&gt;&lt;/span&gt;&amp;nbsp;PID takes Error as an input, error could be gyro reading as in&amp;nbsp;&lt;a href=&quot;http://diydrones.com/profiles/blogs/pid-diagram-for-hefnycopter-ii-firmware&quot; target=&quot;_blank&quot;&gt;hefnycopter firmware&lt;/a&gt;&amp;nbsp;, or as in multiwii it is the difference between stick value and correspondent gyro, i.e. between aileron value and the x-axes gyro. In the first version as used the same Error value as in multiwii, but this was not very good, as it means that when you make sudden stick change it will give error and the algorithm will correct P accordingly, although the current P value could be enough and correct. First I tried to define high and low boundaries for Error values, but after more thinking I was convinced that we need to consider only gyro reading as an input, and leave stick for multiwii algorithm. &lt;br /&gt;
 &lt;br /&gt;
 &lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;b&gt;Condition #2:&lt;/b&gt;&amp;nbsp;&lt;/span&gt;Please re-read that condition again&amp;nbsp;&lt;i&gt;“However there is a danger here that the deceleration is so fast so that it will not only stop the arm”&lt;/i&gt;&amp;nbsp;there is a vague word “danger”. Well how can we know if the deceleration is healthy and arm is slowing down in a proper speed, or it is slowing down too fast, well I don’t J. I tried some ranges and I found that&lt;b&gt;High_Enough _2&lt;/b&gt;&amp;nbsp;should be&amp;nbsp;&lt;strong&gt;1.5 to 2 times larger&lt;/strong&gt;&amp;nbsp;than&amp;nbsp;&lt;b&gt;High_Enough _1&lt;/b&gt;. Lower value for High_Enough_2 will make P always ZERO which is logic. And high value of it will make P saturate as condition #2 is hardly achieved because of the large barrier value.&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;font-size-4&quot;&gt;Calculating I-Factor&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/h3&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; As I mentioned in the beginning of this article, I was calculating&amp;nbsp;&lt;b&gt;I&lt;/b&gt;&amp;nbsp;as a percentage of&amp;nbsp;&lt;b&gt;P&lt;/b&gt;. Well in an article about&amp;nbsp;&lt;a href=&quot;http://hefnycopter.net/index.php?option=com_content&amp;amp;view=article&amp;amp;id=22:quadcopter-control-function-layers&amp;amp;catid=9&amp;amp;Itemid=103&quot;&gt;sensors &amp;amp; PIDs&lt;/a&gt;&amp;nbsp;I mentioned that&amp;nbsp;&lt;b&gt;I&lt;/b&gt;&amp;nbsp;component in PID for gyro is used for restoring, it acts as a memory, because it is based on many values not the most recent one as P or the difference as D. I think about I component as the DC current in a signal or as a trim in your TX. Try to fly in Acro mode with I factor equal to Zero, you will find that if you tilt your try then take your hand of the sticks it will not get back, if you add some values to I-factor, it will tend to restore itself. And this is obvious because the I-component –i.e. the integration value not the I factor value- that was accumulated to overcome your stick need to be reduced back to zero. To have this effect I used a simple average variable to calculate the average value of gyro readings in a time window, and if the value is not Zero –higher or lower than a certain range- I is incremented otherwise it is decremented.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;font-size-4&quot;&gt;A Workable Code&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I attached a&amp;nbsp;&lt;a href=&quot;http://api.ning.com/files/cwh76f0Jjbk-9X76UYNCxux8x*x5JLXqoZkdtIl4l38JBfRk5DX-EoIvSnfYzgHw9hYOsXtFofsmNfioiPKMhhPlC5JgE90r/Multiwii_GTune1.0.2.zip&quot; target=&quot;_self&quot;&gt;working code&lt;/a&gt;, you can use it to fly in ACRO mode only, as I used other PID parameters to as ZERO_PIDs parameters in order to study the effects above.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LEVEL_P: represents High_Enough _1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LEVEL _I: represents High_Enough_2&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ALT_P: represents time_skip counts.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ALT_I: represents number of samples used for averaging Error for calculating I factor.&lt;br /&gt;
&lt;strong&gt;Note:&lt;/strong&gt;&amp;nbsp;if you put value ALT_I = 0.01 this means actually 10, as the minimum value is 0.001 which is 1. Same for other values, for example LEVEL_P = 1.0 means 10 and value 0.1 means 1 as there is no 0.001 and this is the minimum value for P, so take care when you play with values.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;span style=&quot;color: #3366ff;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;font-size-4&quot;&gt;My Samples&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/h3&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; These figures are taken from&amp;nbsp;&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.ezio.multiwii&quot; target=&quot;_blank&quot;&gt;MultiWii EZ-GUI&lt;/a&gt;&amp;nbsp;for 3 flights:&lt;br /&gt;
&lt;a href=&quot;http://api.ning.com/files/cwh76f0Jjbl4A3TpLu02IvvPaxot3fOpO4nKH2VHYH-vx9j2VvouqKM*J0AEaE5iVTj*n62TkaNvEqrqYnkEFqlNFuDbPCJI/img2.JPG&quot; target=&quot;_self&quot;&gt;&lt;img class=&quot;align-center&quot; src=&quot;http://api.ning.com/files/cwh76f0Jjbl4A3TpLu02IvvPaxot3fOpO4nKH2VHYH-vx9j2VvouqKM*J0AEaE5iVTj*n62TkaNvEqrqYnkEFqlNFuDbPCJI/img2.JPG&quot; width=&quot;562&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;as we can see High_Enough_1 = 10 &amp;amp; High_Enough_2 = 15 works very nice. time_skip here is 10 and values that are read for averaging to calculate I-factor is 100.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;as I increased High_Enough_2 to 20 P values started to raise, especially in the third trial where I played more aggressive with quad compared to the calm first two flights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;font-size-4&quot; style=&quot;color: #3366ff;&quot;&gt;&lt;strong&gt;Final Notice&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Still everything is experimental, and try it on your OWN RISK, try to fly smoothly and dont take off suddenly, let it leave ground easy.&lt;br /&gt;
&amp;nbsp;Latest Code is&amp;nbsp;&lt;a href=&quot;http://api.ning.com/files/cwh76f0Jjbk-9X76UYNCxux8x*x5JLXqoZkdtIl4l38JBfRk5DX-EoIvSnfYzgHw9hYOsXtFofsmNfioiPKMhhPlC5JgE90r/Multiwii_GTune1.0.2.zip&quot; target=&quot;_self&quot;&gt;Here&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/2328313374304490838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2014/08/zeropid-tunes-for-multirotors-part2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/2328313374304490838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/2328313374304490838'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2014/08/zeropid-tunes-for-multirotors-part2.html' title='ZERO_PID Tunes for Multirotors Part#2'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-5387747086779506127</id><published>2014-06-02T22:38:00.000-07:00</published><updated>2014-06-02T22:38:06.255-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ACRO mode"/><category scheme="http://www.blogger.com/atom/ns#" term="Gyro"/><category scheme="http://www.blogger.com/atom/ns#" term="multiwii"/><category scheme="http://www.blogger.com/atom/ns#" term="PID tuning"/><title type='text'>ZERO - PIDs  Tuner for Multirotors</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/dimQX0tqrxs?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This topic is about PID auto tuning algorithm that can tune your Quadcopter from PIDs&amp;nbsp;&lt;strong style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ZERO&lt;/strong&gt;&amp;nbsp;as a start value.&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;strong style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Introduction&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; color: #666066; line-height: 16.224000930786133px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #666066; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 16.224000930786133px;&quot;&gt;Adjusting PIDs is a problem for many of Quadcopter’ pilots, it would be nice to get your quadcopter to adjust PIDs for itself. I made some investigation in this area, and found many complex algorithms that are related to Adaptive PIDs, and Fuzzy Logic. Although my background is engineering but I don’t like complex math when you can make simple solutions :)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666066; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 16.224000930786133px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666066; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 16.224000930786133px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666066; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 16.224000930786133px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I started with multiwii version 2.3, I chose it because its code is not that complex, while it has many GUI tools and debug facilities to trace, and it has one of the largest community that can test and verify the results. Anyway I have developed a new mode that I called &lt;b&gt;G_TUNE&lt;/b&gt;, which enables quadcopter to calculate flyable PIDs values for ACRO mode. i.e. PIDs for GYRO.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px;&quot;&gt;
&lt;strong style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;How to Use&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px;&quot;&gt;
&lt;strong style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;span style=&quot;color: #666066; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 16.224000930786133px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; G_Tune mode starts by resetting all Gyro&#39; PIDs for Roll, Pitch &amp;amp; Yaw to Zero’s. &amp;nbsp;Then pilot needs to takeoff !! &amp;nbsp;yes it will take off as the algorithm will start instantly to correct errors and update PIDs parameters accordingly. Pilot should try not to make aggressive maneuvers. That is because the error in multiwii is calculated as (RC_Stick - Gyroreading) as stick position acts as rotation speed target i.e. the target rpm, so moving stick suddenly generates false errors.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666066; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background: transparent; border: 0px; line-height: 16.224000930786133px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666066; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 16.224000930786133px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666066; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 16.224000930786133px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #666066; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 16.224000930786133px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;The algorithm mainly works as our human eye. what you do is that if you find your quad tilt you give thrust to motor to adjust this tilt.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #666066; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 16.224000930786133px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Below is the state machine for the new mode.&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://api.ning.com/files/CrfMSzuE5d5jfsG2ibWwuWCAWFgd4PE5bl5ntwMxqOOZrDKo-3wa-Q2YpFZh7RfoGqFf9v4xoTfUoDTaj9z-XxZzqC3-E5sM/AutoTuning.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;State Diagram of G-Tune&quot; border=&quot;0&quot; src=&quot;http://api.ning.com/files/CrfMSzuE5d5jfsG2ibWwuWCAWFgd4PE5bl5ntwMxqOOZrDKo-3wa-Q2YpFZh7RfoGqFf9v4xoTfUoDTaj9z-XxZzqC3-E5sM/AutoTuning.JPG&quot; height=&quot;313&quot; title=&quot;State Diagram of G-Tune&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;State Diagram of G-Tune&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;1- As we can see from above state diagram, You need to disarm your quadcopter, then you switch to G_Tune mode. once you do that all PIDs will be Zero and you can test that by switch back to ACRO mode again and try to fly&amp;nbsp;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; color: maroon; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;em style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;be careful as you have no control because all PIDs are ZERO&quot;&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&amp;nbsp; 2- You can then switch back to G_TUNE the arm your quadcopter. Try to fly carefully, do not make aggressive moves, your quadcopter should fly reasonably stable.&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&amp;nbsp; 3- Now switch to GYRO mode in AIR to stop updating the values. dont try to land first.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&amp;nbsp; 4- Now fly again in ACRO mode and this time it will fly.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
The algorithm was able to generate the following PIDs values for ACRO mode:&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://api.ning.com/files/3QWN5yhdbacCghngNF-JvkY7knugmhn-ytUTQO2qxmLr7VRVJWf7IvgTaScpLUUkb9RZ8Znp-V0dULwfAyYn1Il36O5iCOK2/Screenshot_20140602000121.png?width=320&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://api.ning.com/files/3QWN5yhdbacCghngNF-JvkY7knugmhn-ytUTQO2qxmLr7VRVJWf7IvgTaScpLUUkb9RZ8Znp-V0dULwfAyYn1Il36O5iCOK2/Screenshot_20140602000121.png?width=320&quot; height=&quot;320&quot; width=&quot;180&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://api.ning.com/files/CrfMSzuE5d7u5bkFOUzmYN76XSn6rbmofcda4-pFDFkgd9MntUhCuwrUjcn7B9OqSVg1ifQqFj3BTdX7vbAVTvhnKrDE8QCc/Screenshot_20140602014942.png?width=320&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://api.ning.com/files/CrfMSzuE5d7u5bkFOUzmYN76XSn6rbmofcda4-pFDFkgd9MntUhCuwrUjcn7B9OqSVg1ifQqFj3BTdX7vbAVTvhnKrDE8QCc/Screenshot_20140602014942.png?width=320&quot; height=&quot;320&quot; width=&quot;180&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;strong style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Both values in the two screen shots flythe quadcopter&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;strong style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background: transparent; border: 0px; color: maroon; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; font-size: 16px; font-size: x-small; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;strong style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background: transparent; border: 0px; color: maroon; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;strong style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; color: maroon; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;strong style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background: transparent; border: 0px; color: maroon; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;strong style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background: transparent; border: 0px; color: maroon; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Caution&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;1- This is a test mode that I tested only on my quadcopter with Simonk ESC, 10x4.5 props and Turnigy 1100 KV. It should work on other configuration, but I have not try it myself.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;2- Moving ELE &amp;amp; ALE sticks just before changing from G_TUNE to ACRO mode could corrupt the values, so please try to fly as stable as possible and switch to ACRO while sticks are almost released for best results.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: rgb(255, 255, 255); border: 0px; color: #666066; font-family: Verdana, sans-serif; line-height: 16.224000930786133px; margin-bottom: 0.5em; min-height: 1em; outline: 0px; padding: 0px; text-align: justify; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;3- Switching back from GYRO to G_Tune mode in AIR could be dangerous -however the correction is very fast and it normally works- because PIDs are reset to ZEROs in AIR.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/5387747086779506127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2014/06/zero-pids-tuner-for-multirotors.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/5387747086779506127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/5387747086779506127'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2014/06/zero-pids-tuner-for-multirotors.html' title='ZERO - PIDs  Tuner for Multirotors'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-4012635128520878033</id><published>2014-05-19T20:17:00.001-07:00</published><updated>2014-05-22T14:15:32.301-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="32 bit"/><category scheme="http://www.blogger.com/atom/ns#" term="Arduino DUE"/><category scheme="http://www.blogger.com/atom/ns#" term="ARM"/><category scheme="http://www.blogger.com/atom/ns#" term="multiwii"/><category scheme="http://www.blogger.com/atom/ns#" term="quadcopter"/><category scheme="http://www.blogger.com/atom/ns#" term="Tricopter"/><title type='text'>Porting MultiWii to Arduino DUE</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;border-bottom: solid #4F81BD 1.0pt; border: none; mso-border-bottom-themecolor: accent1; mso-element: para-border-div; padding: 0cm 0cm 4.0pt 0cm;&quot;&gt;
&lt;div class=&quot;MsoTitle&quot;&gt;
&lt;div style=&quot;border-bottom: solid #4F81BD 1.0pt; border: none; mso-border-bottom-themecolor: accent1; mso-element: para-border-div; padding: 0cm 0cm 4.0pt 0cm;&quot;&gt;
&lt;div class=&quot;MsoTitle&quot;&gt;
Porting MultiWii to Arduino DUE&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;a href=&quot;https://github.com/HefnySco/MultiWii_DUE&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;GitHub is here&lt;/a&gt;&amp;nbsp; please compile code on&amp;nbsp;&lt;a href=&quot;http://arduino.cc/en/Main/Software&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Arduino-1.5.6r2&lt;/a&gt; or later.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;a href=&quot;http://arduino.cc/en/Main/ArduinoBoardDue&quot;&gt;Arduino
DUE&lt;/a&gt; is a microcontroller board based on the Atmel SAM3X8E ARM Cortex-M3 CPU.
It is the next generation of Arduino boards “UNO, Nano, Mini”…etc. It is a very
attractive platform for building quadcopter firmware on for the following
reasons:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Symbol; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot; style=&quot;text-indent: -18pt;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;A 32-bit core, that allows
operations on 4 bytes wide data within a single CPU clock.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;CPU Clock at 84Mhz compared
to 16MHz for other Arduino.&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Symbol; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot; style=&quot;text-indent: -18pt;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;96 KBytes of SRAM compared
to 8Kbytes for &lt;/span&gt;&lt;a href=&quot;http://arduino.cc/en/Main/ArduinoBoardMega2560&quot; style=&quot;text-indent: -18pt;&quot;&gt;Arduino
Mega 2560&lt;/a&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Symbol; text-indent: -18pt;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot; style=&quot;text-indent: -18pt;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;512 KBytes of Flash memory
for codecompared to 256Kbytes for the nearest giant Arduino Mega, and this
number is much less in other Arduinos.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;DMA controller, that can
relieve the CPU from doing memory intensive tasks.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l1 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
All these advantages do not come without a cost. The main
two disadvantages from current quadcopters firmware and hardware are:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-left: 54.0pt; mso-add-space: auto; mso-list: l2 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: kashida; text-kashida: 0%;&quot;&gt;
&lt;!--[if !supportLists]--&gt;1-&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;This warning message on &lt;a href=&quot;http://arduino.cc/en/Main/ArduinoBoardDue&quot;&gt;Arduino website&lt;/a&gt; &lt;b&gt;“Warning:
Unlike other Arduino boards, the Arduino Due board runs at 3.3V. The maximum
voltage that the I/O pins can tolerate is 3.3V. Providing higher voltages, like
5V to an I/O pin could damage the board.” &lt;/b&gt;This means that you cannot
just attach your current 5V logic hardware to Arduino DUE.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-left: 54.0pt; mso-add-space: auto; mso-list: l2 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: kashida; text-kashida: 0%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left: 54.0pt; mso-add-space: auto; mso-list: l2 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: kashida; text-kashida: 0%;&quot;&gt;
&lt;!--[if !supportLists]--&gt;2-&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;!--[endif]--&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;There is EEPROM memory in Arduino DUE &lt;span style=&quot;font-family: Wingdings; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;&quot;&gt;L&lt;/span&gt;. And this is another very sad
news as you need to have EEPROM in order to be able to save PIDs, sensors calibration
values and many other values used for quadcopters. They need to be saved
somewhere and without EEPROM you need to use external flash memory which is extra
hardware and extra interface.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left: 54.0pt; mso-add-space: auto; mso-list: l2 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: kashida; text-kashida: 0%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify; text-justify: kashida; text-kashida: 0%;&quot;&gt;
I can see that these two reasons strongly affected firmware developers to
use Arduino for quadcopters. But as we will see below these were only
illusions. &lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaXoF4q6ozL69DKRgzm7XFl9KEIBRKuY5vsHE4wRc5tQZJxJQ3WOgSRtLNNLx7xc6AODg_1Tqd7sOjR6UfBlyeFzCeLgqvZwWfdIkDdXP78HlKSblE5KZi2uxjT_Zca5xf8X1BTShyphenhyphen03Tb/s1600/2014-05-15+11.57.31.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaXoF4q6ozL69DKRgzm7XFl9KEIBRKuY5vsHE4wRc5tQZJxJQ3WOgSRtLNNLx7xc6AODg_1Tqd7sOjR6UfBlyeFzCeLgqvZwWfdIkDdXP78HlKSblE5KZi2uxjT_Zca5xf8X1BTShyphenhyphen03Tb/s1600/2014-05-15+11.57.31.jpg&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify; text-justify: kashida; text-kashida: 0%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;Problem Solved&lt;/span&gt;&lt;/h3&gt;
&lt;h1&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.multiwii.com/forum/viewtopic.php?f=22&amp;amp;t=2387&quot;&gt;Naze32&lt;/a&gt;
was the first 32-bit board I see for MultiWii. When I found the code for the
first time, the first thing I searched for is that EEPROM problem and how can
we solve it. Well the solution was obvious; you can use Flash memory instead of
EEPROM. You can store the data together with the code. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
WAW; I said to myself. It is very
nice simple approach. So I searched for similar code for Arduino DUE, and I
found one written by &lt;a href=&quot;https://github.com/cmaglie/Flash&quot;&gt;cmaglie&lt;/a&gt;. That
is 50% of the problem solved &lt;span style=&quot;font-family: Wingdings; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;&quot;&gt;J&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Now back to the 3.3V issue, well
it seems someone has the courage to try the 3.3V and guess what, &lt;a href=&quot;https://github.com/fluentart/drone2&quot;&gt;it worked&lt;/a&gt; &lt;span style=&quot;font-family: Wingdings; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;&quot;&gt;J&lt;/span&gt;. I contacted &lt;a href=&quot;https://github.com/fluentart/drone2&quot;&gt;Rouan&lt;/a&gt; to make sure that there is
no 3.3V tweeks that I need to make, and the answer was no. I believe the 3.3V
works with no problems for the following reasons:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-left: 54.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;1-&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;For ESC logical 1 is less
than 3.3V so 3.3V as input signal for ESC is more than enough to control it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left: 54.0pt; mso-add-space: auto; mso-list: l5 level1 lfo3; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;2-&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;For RX seems that logical 1
is either less than 5V of maybe because the input is a pulse of with 2ms max
with frequency 50Hz makes the average DC is not enough to burn the input pin. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Again the 3.3V is not an issue
anymore &lt;span style=&quot;font-family: Wingdings; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;&quot;&gt;J&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;Why MultiWii?&lt;/span&gt;&lt;/h3&gt;
&lt;h1&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify; text-justify: kashida; text-kashida: 0%;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Well, I am no longer
the first one –I know- to write quadcopter code on Arduino DUE, Rouan has
already made it. So I decided to pick for myself a new challenge, and I chose
to convert MultiWii firmware for the following reasons:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-left: 54.0pt; mso-add-space: auto; mso-list: l3 level1 lfo4; text-align: justify; text-indent: -18.0pt; text-justify: kashida; text-kashida: 0%;&quot;&gt;
&lt;!--[if !supportLists]--&gt;1-&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;!--[endif]--&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;It is a very famous firmware, well known and not so complex.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 54.0pt; mso-add-space: auto; mso-list: l3 level1 lfo4; text-align: justify; text-indent: -18.0pt; text-justify: kashida; text-kashida: 0%;&quot;&gt;
&lt;!--[if !supportLists]--&gt;2-&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;!--[endif]--&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;It is already built to talk with Arduino boards, so supporting
Arduino DUE is a natural extend for the firmware.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left: 54.0pt; mso-add-space: auto; mso-list: l3 level1 lfo4; text-align: justify; text-indent: -18.0pt; text-justify: kashida; text-kashida: 0%;&quot;&gt;
&lt;!--[if !supportLists]--&gt;3-&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;!--[endif]--&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;Arduino community as well as MultiWii community might find this
conversion useful to start with to build much powerful updates, as the current
code takes only &lt;b&gt;9%&lt;/b&gt; of the available Flash memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;Steps of porting MultiWii to Arduino DUE&lt;/span&gt;&lt;/h3&gt;
&lt;h1&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; My
target is to build MultiWii code that you can still compile it on 8-bit Arduino
boards. It is not a dedicated version for Arduino DUE –although a next version
might be so-.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; So I
first need to figure out where to put changes and where to keep old code. In
the remaining part, I will mention the major changes as well as major
challenges I faced during this process.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #b45f06;&quot;&gt;#if defined (ARDUINO_DUE)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
As in all MultiWii code, you need to define specific code
for specific board, and I have chosen to use ARDUINO_DUE as the mark. All code
under ARDUINO_DUE is specifically compiled when you choose to compile for
Arduino DUE only. Some code in MultiWii is generic for all boards, but I can
only be executed for 8-bit microprocessors not ARM, for these parts I use &lt;b&gt;#if
!defined (ARDUINO_DUE)&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #b45f06;&quot;&gt;Def.H&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This is the file you need to edit to define now sensors,
vehicle, board ...etc. It is a core file. I started with it and defined:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l0 level1 lfo5; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;1-&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;When ARDUINO_DUE is active.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;
&lt;span style=&quot;color: #c0504d; mso-themecolor: accent2;&quot;&gt;#if defined (&lt;/span&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;ARDUINO_ARCH_SAM&lt;/span&gt;&lt;span style=&quot;color: #c0504d; mso-themecolor: accent2;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #c0504d; mso-themecolor: accent2;&quot;&gt;#define&lt;/span&gt; &lt;span style=&quot;color: #0070c0;&quot;&gt;ARDUINO_DUE&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;
&lt;span style=&quot;color: #c0504d; mso-themecolor: accent2;&quot;&gt;#endif&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;
&lt;span style=&quot;color: #0070c0;&quot;&gt;ARDUINO_ARCH_SAM&lt;/span&gt;
is what you need to look for to detect an ARDUINO_DUE.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l0 level1 lfo5; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;2-&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;Define alternatives for pgmspace
by including &amp;lt;arm/ pgmspace.h&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l0 level1 lfo5; text-indent: -18.0pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;3-&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;ARDUINO_DUE board &lt;b&gt;pin
assignments&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;THR:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIN
62 &amp;nbsp;- A8&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;ALE:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
PIN 63 &amp;nbsp;- A9&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;ELE:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIN
64 &amp;nbsp;- A10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;RUD:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIN
65 &amp;nbsp;- A11&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;AUX1:&amp;nbsp;&amp;nbsp; PIN
66 &amp;nbsp;-DAC0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;AUX2:&amp;nbsp;&amp;nbsp; PIN
67 - DAC1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #00b050;&quot;&gt;Motor 1:&amp;nbsp;
PIN 34&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #00b050;&quot;&gt;Motor 2:&amp;nbsp;
PIN 36&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #00b050;&quot;&gt;Motor 3:&amp;nbsp;
PIN 38&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #00b050;&quot;&gt;Motor 4 / Servo 4:&amp;nbsp;
PIN 40 &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;Other parts of the definition are just
code from ARDUINO_MEGA that will make error if activated as it is not converted
yet.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-left: 72.0pt; mso-add-space: auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left; text-indent: -18pt;&quot;&gt;
&lt;span style=&quot;font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #b45f06;&quot;&gt;&lt;b&gt;&amp;nbsp;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;&lt;b&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;Code Changes&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l0 level1 lfo5; text-indent: -18.0pt;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I used Multiwii version 2.3 as my starting point. Most of the
other code is same as MultiWii, Dramatic changes where in &lt;span style=&quot;color: #0b5394;&quot;&gt;EEPROM.cpp&lt;/span&gt; &lt;span style=&quot;color: #0b5394;&quot;&gt;Sensors.cpp&lt;/span&gt;,
&lt;span style=&quot;color: #0b5394;&quot;&gt;RX.cpp&lt;/span&gt; and &lt;span style=&quot;color: #0b5394;&quot;&gt;Output.cpp&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l0 level1 lfo5; text-indent: -18.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;EEPROM.cpp&lt;/b&gt; I used &lt;a href=&quot;https://github.com/cmaglie/Flash&quot;&gt;cmaglie&lt;/a&gt; Flash class –I updated a
paging issue in it- to save configuration structures.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;RX.cpp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/b&gt;I used &lt;a href=&quot;https://github.com/fluentart/drone2&quot;&gt;Rouan&lt;/a&gt;
code, and it was very useful and straight forward.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Output.cpp&lt;/b&gt; Again I used &lt;a href=&quot;https://github.com/fluentart/drone2&quot;&gt;Rouan&lt;/a&gt; code, but this time it was
more tricky to embed with original code of MultiWii due to logic of motor/servo
selection and different PWM signal generation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 18.0pt;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Sensors.cpp &lt;/b&gt;I used original
wire.h library, however I renamed it Wire_DUE.h and included as part of the
project as I intend to update it later to make it fast. I replicated the same I2C
functions that is used in MultiWii so that sensors logic stay untouched. Functions
used Wire_DUE.h instead of original code when compiling for Arduino_DUE.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;Main Issues I Faced&lt;/span&gt;&lt;/h3&gt;
&lt;h3&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l4 level1 lfo6; text-align: justify; text-indent: -18.0pt;&quot;&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-size: 7pt; text-indent: -18pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span dir=&quot;LTR&quot; style=&quot;text-indent: -18pt;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;I first used __CM3_REV instead of ARDUINO_ARCH_SAM to check for
DUE, and it made linking errors. I have not run through the root cause yet, but
I took couple of days to solve this issue.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: 7pt; text-indent: -18pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span dir=&quot;LTR&quot; style=&quot;text-indent: -18pt;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;Types from uint8_t &amp;amp; int16_t in functions _getADC() in &lt;/span&gt;&lt;b style=&quot;text-indent: -18pt;&quot;&gt;sensors.cpp
&lt;/b&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;. You need to make explicit type casting. Without doing so you will get
rubbish data from GYRO. This is due the &lt;/span&gt;&lt;b style=&quot;text-indent: -18pt;&quot;&gt;&amp;lt;&amp;lt;&lt;/b&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt; operation acts without
caring about the sign.&lt;br /&gt;&lt;div style=&quot;text-indent: -24px;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;Alignment !!!!! This was a very wicked tricky issue that I faced
when trying to connect to WiiGUI. The application displays data correctly but
gives false alarm of suiting to BARO mode –Altitude Hold- for example. And I
found that this error was due to serializing structures in &lt;/span&gt;&lt;b style=&quot;text-indent: -18pt;&quot;&gt;protocol.cpp&lt;/b&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;,
and&lt;/span&gt;&lt;b style=&quot;text-indent: -18pt;&quot;&gt; &lt;/b&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;the 32bit compiler stored structure items 4byte-aligned, This makes
gaps between different variables and translated wrongly by WinGUI. This is why
you found &lt;/span&gt;&lt;b style=&quot;text-indent: -18pt;&quot;&gt;&lt;span style=&quot;color: #953735; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-color: #953735; mso-style-textfill-fill-colortransforms: lumm=75000; mso-style-textfill-fill-themecolor: accent2; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;__attribute__ ((packed))&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #953735; text-indent: -18pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;at each and every
structure and union. This was a very time consuming bug, and very random and
distributed between C# code on PC and C++ code in firmware&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;GYRO Hopping.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l4 level1 lfo6; text-indent: -18.0pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #953735; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-color: #953735; mso-style-textfill-fill-colortransforms: lumm=75000; mso-style-textfill-fill-themecolor: accent2; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scale&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #953735; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-color: #953735; mso-style-textfill-fill-colortransforms: lumm=75000; mso-style-textfill-fill-themecolor: accent2; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt; &lt;/span&gt;= (&lt;b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;currentT&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt; &lt;/span&gt;- &lt;b&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;previousT&lt;/span&gt;&lt;/b&gt;)
* (GYRO_SCALE * 65536);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;text-align: justify;&quot;&gt;
Scale variable
that is vital for measuring angular velocity of Gyro was giving hopping from 0
to 100 even without touching any sensor. The behavior disappeared when I used
int32_t for both &lt;b&gt;currentT&lt;/b&gt; &amp;amp; &lt;b&gt;previousT &lt;/b&gt;as used in the main
loop in Multiwii.cpp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;Code Status&lt;/span&gt;&lt;/h3&gt;
&lt;h1&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The
code is not 100% converted i.e. not all features, &lt;b&gt;however you compile it for Quadcopter or Tricopter and
fly in different modes&lt;/b&gt;. I have not test GPS, sonar. I only used GY_80 as well as the HK 328 board.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;510&quot; src=&quot;//www.youtube.com/embed/pC63jnBSacs&quot; width=&quot;854&quot;&gt;&lt;/iframe&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code
is &lt;span style=&quot;color: red;&quot;&gt;still under development&lt;/span&gt;, and as any firmware it can contain serious issues,
so fly safe and on your own risk. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Good Luck &lt;span style=&quot;font-family: Wingdings; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;&quot;&gt;J&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify; text-justify: kashida; text-kashida: 0%;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/4012635128520878033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2014/05/porting-multiwii-to-arduino-due.html#comment-form' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/4012635128520878033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/4012635128520878033'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2014/05/porting-multiwii-to-arduino-due.html' title='Porting MultiWii to Arduino DUE'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaXoF4q6ozL69DKRgzm7XFl9KEIBRKuY5vsHE4wRc5tQZJxJQ3WOgSRtLNNLx7xc6AODg_1Tqd7sOjR6UfBlyeFzCeLgqvZwWfdIkDdXP78HlKSblE5KZi2uxjT_Zca5xf8X1BTShyphenhyphen03Tb/s72-c/2014-05-15+11.57.31.jpg" height="72" width="72"/><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-540490158974294000</id><published>2013-06-30T11:52:00.000-07:00</published><updated>2013-07-21T15:19:50.082-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Equation"/><category scheme="http://www.blogger.com/atom/ns#" term="hobbyking"/><category scheme="http://www.blogger.com/atom/ns#" term="IMU"/><category scheme="http://www.blogger.com/atom/ns#" term="KK2"/><category scheme="http://www.blogger.com/atom/ns#" term="quadcopter"/><category scheme="http://www.blogger.com/atom/ns#" term="sourcecode"/><category scheme="http://www.blogger.com/atom/ns#" term="stabilization"/><category scheme="http://www.blogger.com/atom/ns#" term="X-QUAD"/><title type='text'>KK2 v1.5  Firmware Explained Part#1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Yes, it has been a long time since I published my &lt;a href=&quot;http://technicaladventure.blogspot.com/2012/03/quadrocopter-firmware-4-rotor-explained.html&quot; target=&quot;_blank&quot;&gt;Article &quot;Quadrocopter Firmware (4 Rotor) Explained&quot;&lt;/a&gt;&amp;nbsp;. Actually it was long enough to develop my own system on KK2 and get it listed in KK2FlashTool.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJrShdljBEcVhClHR7okWj1B6rsdsETp_uVaKZ8GDc6KuYuA5hirUxyJ-0UsJY30LjFZ_TIoW1dzcyygkimC70HFh4MEmUrrsiw_2rCOj4iIvGLPil6z3pRN_K04IUG5PWKbU4y_Eww6lm/s680/FlashTool.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;377&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJrShdljBEcVhClHR7okWj1B6rsdsETp_uVaKZ8GDc6KuYuA5hirUxyJ-0UsJY30LjFZ_TIoW1dzcyygkimC70HFh4MEmUrrsiw_2rCOj4iIvGLPil6z3pRN_K04IUG5PWKbU4y_Eww6lm/s400/FlashTool.JPG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;HefnyCopter-II Firmware for KK2 Board&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
Although my &lt;a href=&quot;http://www.hefnycopter.net/&quot; target=&quot;_blank&quot;&gt;firmware &lt;/a&gt;has lots of new features, but KK2 code is very mature and respectable and I know that a lot of us wants to explore.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Well KK2 firmware is much more complicated that its parent firmware of KK. This is mainly because KK2 has more sensors, also has LCD which consumes big part of memory and code. So in this article I will only concentrate on stabilization algorithms of KK2.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
KK2 has two flying modes, first the ACRO mode where we use only gyros to make balancing. This is fairly easy, all &amp;nbsp;you need is to read data from gyro and scale it then use a simple PID control to control motors. the other mode is Stabilization mode. This mode uses gyros and accelerometers together to calculate the angle of quadcopter &quot;pitch-roll&quot; and then uses PID control to calculate motor actions.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I will not go into details of gyro and acc here as you can find many articles in talks about this subject in details. but let us take an idea that enable us to proceed with code.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Gyro:&lt;/b&gt; sensors that detect quadcopter rotation, its output is deg/sec. so it detects rotation of quadcopter in three dimensions. Gyros are great, accurate and fast, so you can integrate the reading to get the absolute angle, but this is not the real case :( . as gyros has a problem called drift, if you leave the board not touchable and try to integrate gyro readings it will not be zero, although it is not moving or rotating in any way. but for a short time -less than a second- gyro drift can be considered zero.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Acc&lt;/b&gt;: sensors that detect acceleration i.e. forces. because &quot;g&quot; is earth acceleration you can use acc sensor to detect pitch and roll directly using simple calculations. however because quadcopter is not fixed, there are other forces such as linear acceleration and centrifugal forces that make acceleration sensors not accurate for fast readings, so you need to apply low pass filter to get a reliable value.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So what we do is to calculate angles using gyro, then use accelerometers to correct the drift.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #943634; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;Imu:&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- Get Sensor Data ---&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;Step#1: Read Gyro &amp;amp;
Acc values and refer them to Zero&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;call&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt; &lt;/span&gt;AdcRead&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Calculate gyro output&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;---M.Hefny&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
Gyro = Gyro - GyroZero for Roll,Pitch &amp;amp; YAW&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
GyroRoll, GyroRoll, GyroRollZero&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
GyroPitch, GyroPitch, GyroPitchZero&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
GyroYaw, GyroYaw, GyroYawZero&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;---M.Hefny&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
Acc = Acc - AccZero for X Y &amp;amp; Z&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
AccX, AccX, AccXZero&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;remove offset from Acc&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
AccY, AccY, AccYZero&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
AccZ, AccZ, AccZZero&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;---M.Hefny&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
AccX = AccX + AccTrimPitch&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
AccX, AccX, AccTrimPitch&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;add trim&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
AccY, AccY, AccTrimRoll&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;Step#2: Apply
complementary filter to Acc to remove noise.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;---M.Hefny&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
Low Pass Filter&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16ldi
Temper, 0.03&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;SF LP filter the accerellometers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;---M.Hefny&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
AccXfilter = AccXfilter + Temper * (AccX - AccXFilter)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
Error, AccX, AccXfilter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Error, Error, Temper&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
AccXfilter, AccXfilter, Error&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;---M.Hefny&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
AccYfilter = AccYfilter + Temper * (AccY - AccYFilter)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub Error,
AccY, AccYfilter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Error, Error, Temper&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
AccYfilter, AccYfilter, Error&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;---M.Hefny&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
AccZfilter = AccZfilter + Temper * (AccZ - AccZFilter)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
Error, AccZ, AccZfilter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Error, Error, Temper&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
AccZfilter, AccZfilter, Error&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;Step#3: Correct Gyro-Based
calculated angles using Acc readings.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;---&amp;nbsp; calculate
tilt angle with the acc. (this approximation is good to about 20 degrees) --&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16ldi
Temp, 0.7&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
AccAngleRoll, AccYfilter, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
AccAnglePitch, AccXfilter, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- Add correction data to gyro inputs based on
difference between Euler angles and acc angles ---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16ldi
Temp, 20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;skip correction at angles&lt;/span&gt; &lt;span style=&quot;color: #00b050;&quot;&gt;greater than +-20&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16cmp
AccAnglePitch, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; longbrge
im40&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16cmp
AccAngleRoll, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; longbrge
im40 &lt;span style=&quot;color: #00b050;&quot;&gt;;M.Hefny: Skip correction&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16neg
Temp&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;M.Hefny
compare -20&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16cmp
AccAnglePitch, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; longbrlt
im40 &lt;span style=&quot;color: #00b050;&quot;&gt;;M.Hefny: Skip correction&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16cmp
AccAngleRoll, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; longbrlt
im40 &lt;span style=&quot;color: #00b050;&quot;&gt;;M.Hefny: Skip correction&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16ldi
Temp, 60&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;skip correction if vertical&lt;/span&gt; &lt;span style=&quot;color: #00b050;&quot;&gt;acceleration is outside 0.5 to 1.5 G&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16cmp
AccZfilter, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; longbrge
im40 ;M.Hefny: Skip correction&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16neg
Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16cmp
AccZfilter, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; longbrlt
im40 ;M.Hefny: Skip correction&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;---- M.Hefny&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
GyroRoll = GyroRoll + (EulerAngleRoll - AccAngleRoll) / 2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
Temp, EulerAngleRoll, AccAngleRoll&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;add
roll correction&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
Temp, 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
GyroRoll, GyroRoll, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;---- M.Hefny&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
GyroPitch = GyroPitch + (EulerAnglePitch - AccAnglePitch) / 2;b16sub Temp,
EulerAnglePitch, AccAnglePitch&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;add
pitch correction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
Temp, 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
GyroPitch, GyroPitch, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;rvsetflagtrue flagDebugBuzzerOn&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;rjmp&lt;/span&gt;&lt;/b&gt; im41&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #943634; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;im40:&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;rvsetflagfalse flagDebugBuzzerOn&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;----
M.Hefny&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
im40 skipping to im40 means skipping correction.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #0070c0;&quot;&gt;Step#4: Calculate
Gyro-Based calculated angles.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #943634; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;im41:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- Rotate up-direction 3D vector with gyro inputs ---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;call &lt;/span&gt;&lt;/b&gt;Rotate3dVector&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;call &lt;/span&gt;&lt;/b&gt;Lenght3dVector&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;call &lt;/span&gt;&lt;/b&gt;ExtractEulerAngles&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--debug&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- Calculate Stick and Gyro&amp;nbsp; ---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rvbrflagfalse
flagThrottleZero, im7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;reset integrals if throttle closed &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16clr
IntegralRoll&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16clr
IntegralPitch&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16clr
IntegralYaw&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #943634; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;im7:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
RxRoll, 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Right align to the 16.4 multiply usable bit limit.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
RxPitch, 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
RxYaw, 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
RxRoll, RxRoll, StickScaleRoll&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;scale Stick input. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
RxPitch, RxPitch, StickScalePitch&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
RxYaw, RxYaw, StickScaleYaw&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
RxThrottle, RxThrottle, StickScaleThrottle&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;-----
Self level ----&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rvbrflagtrue
flagSelflevelOn, im31&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;skip if false&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rjmp
im30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #943634; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;im31:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;--- Calculate Self Leveling PID
using P only factor.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;--- Roll Axis Self-level P ---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16neg
RxRoll&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
RxRoll = RxRoll / 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
RxRoll, 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
TargetAngleRoll = (QuadRoll - StickRollAngle)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /
16&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
Error, EulerAngleRoll, RxRoll&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;calculate
error&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
Error, 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
calculate P term of PID.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Value, Error, SelflevelPgain&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;Proposjonal
gain&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;----
Limit value to SelflevelPlimit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
LimitV, SelflevelPlimit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;Proposjonal
limit&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;rcall &lt;/span&gt;&lt;/b&gt;limiter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
RxRoll = Limit(SelfLevelPgain * (EulerAngle-RXRoll)/16,SelflevelPlimit)/2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
RxRoll, Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
RxRoll, 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;--- Pitch Axis Self-level P ---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16neg
RxPitch&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
RxPitch = RxPitch / 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
RxPitch, 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
TargetAnglePitch = (QuadPitch - StickPitchAngle) / 16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
Error, EulerAnglePitch, RxPitch&amp;nbsp;&amp;nbsp; ;calculate
error&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
Error, 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
calculate P term of PID.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Value, Error, SelflevelPgain&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;Proposjonal
gain&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;----
Limit value to SelflevelPlimit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
LimitV, SelflevelPlimit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;Proposjonal
limit&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;rcall &lt;/span&gt;&lt;/b&gt;limiter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
RxPitch = Limit(SelfLevelPgain * (EulerAngle-RXPitch)/16,SelflevelPlimit)/2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
RxPitch, Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
RxPitch, 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
EOF leveling procedure.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #943634; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;im30:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;--- Roll Axis PI ---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;---
Calculate GYRO ... Gyro is used for stabilization only.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
Error, GyroRoll, RxRoll&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;calculate
error&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
Error, 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Value, Error, PgainRoll&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;Proposjonal
gain&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
LimitV, PlimitRoll&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;Proposjonal
limit&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;rcall &lt;/span&gt;&lt;/b&gt;limiter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
CommandRoll, Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
Error, 3&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Temp, Error, IgainRoll&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Integral gain&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
Value, IntegralRoll, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
LimitV, IlimitRoll &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Integral limit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;rcall &lt;/span&gt;&lt;/b&gt;limiter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
IntegralRoll, Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
CommandRoll, CommandRoll, IntegralRoll&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;--- Pitch Axis PI ---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
Error, RxPitch, GyroPitch&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;calculate error&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
Error, 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Value, Error, PgainPitch&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Proposjonal gain&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
LimitV, PlimitPitch&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Proposjonal limit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;rcall&lt;/span&gt;&lt;/b&gt; limiter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
CommandPitch, Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
Error, 3&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Temp, Error, IgainPitch&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Integral gain&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
Value, IntegralPitch, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
LimitV, IlimitPitch &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Integral limit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;rcall &lt;/span&gt;&lt;/b&gt;limiter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
IntegralPitch, Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
CommandPitch, CommandPitch, IntegralPitch&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;--- Yaw Axis PI ---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16sub
Error, RxYaw, GyroYaw&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;calculate error&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
Error, 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Value, Error, PgainYaw&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Proposjonal gain&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
LimitV, PlimitYaw&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Proposjonal limit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;rcall &lt;/span&gt;&lt;/b&gt;limiter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
CommandYaw, Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16fdiv
Error, 3&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mul
Temp, Error, IgainYaw&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Integral gain&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
Value, IntegralYaw, Temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
LimitV, IlimitYaw &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #00b050;&quot;&gt;;Integral limit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;rcall &lt;/span&gt;&lt;/b&gt;limiter&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
IntegralYaw, Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16add
CommandYaw, CommandYaw, IntegralYaw&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;ret&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;--- M.Hefny &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #00b050;&quot;&gt;;--- Function to limit value
between high and low limits &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #943634; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;limiter:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16cmp
Value, LimitV&amp;nbsp;&amp;nbsp;&amp;nbsp; ;high limit&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brlt
lim5&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
Value, LimitV&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #943634; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;lim5:&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16neg
LimitV&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;low limit&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16cmp
Value, LimitV&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brge
lim6&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b16mov
Value, LimitV&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #943634; mso-themecolor: accent2; mso-themeshade: 191;&quot;&gt;lim6:&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: #1f497d; mso-themecolor: text2;&quot;&gt;ret&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/540490158974294000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2013/06/kk2-v15-firmware-explained-part1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/540490158974294000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/540490158974294000'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2013/06/kk2-v15-firmware-explained-part1.html' title='KK2 v1.5  Firmware Explained Part#1'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJrShdljBEcVhClHR7okWj1B6rsdsETp_uVaKZ8GDc6KuYuA5hirUxyJ-0UsJY30LjFZ_TIoW1dzcyygkimC70HFh4MEmUrrsiw_2rCOj4iIvGLPil6z3pRN_K04IUG5PWKbU4y_Eww6lm/s72-c/FlashTool.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-4046714193453450860</id><published>2012-10-06T02:20:00.002-07:00</published><updated>2012-10-31T22:58:34.712-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ATmega"/><category scheme="http://www.blogger.com/atom/ns#" term="Complementary filter"/><category scheme="http://www.blogger.com/atom/ns#" term="Gyro"/><category scheme="http://www.blogger.com/atom/ns#" term="noise"/><category scheme="http://www.blogger.com/atom/ns#" term="quadcopter"/><category scheme="http://www.blogger.com/atom/ns#" term="stabilization"/><category scheme="http://www.blogger.com/atom/ns#" term="vibrations"/><title type='text'>HefnyCopter2 Gyro Noise Filtering</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;h1&gt;
HefnyCopter&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
HefnyCopter is a firmware specially designed for KK boards.
There are two types of this firmware.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
HefnyCopter&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This
version targets the green and blue KK boards from HobbyKing. The main feature
of this version is that it allows awitching your Quadcopter from X to PLUS mode
without the need to reorient the board. The main concept of this feature
explained in &lt;a href=&quot;http://technicaladventure.blogspot.com/2012/09/quadcopter-stabilization-control-system.html&quot; rel=&quot;&quot; target=&quot;_blank&quot;&gt;this topic “quadcopter-stabilization-control-system”&lt;/a&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The hex
&amp;amp; sourcecode is available &lt;a href=&quot;http://code.google.com/p/hefnycopter/downloads/list&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; . Please
make sure that you read the manual well before flying as POTS functions are not
the same as the original firmware of KK boards.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
HefnyCopter2&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This is
a complete new version and goes in parallel with HefnyCopter, i.e. there are
still updates on HefnyCopter so they are two parallel tracks.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This
firmware targets KK2 board. The board has LCD, Accelerometers, and Gyro. As
well as a beter processor ATMega324. This means you have better capabilities
here to help you to build a better firmware.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HefnyCopter2
still has the feature of mode switching from X to Plus. But now you can connect
your board via XBEE to your PC and receive telemetry data, you can work better
on you stabilization algorithm and enhance your quadcopter stability.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HefnyCopter2
also has the feature of supporting two TX, that means you can fly it with a
friend and train him/her how to fly the quad.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;h1&gt;
How HefnyCopter2 Helps to Improve Stabilization&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Because of the ability of sending data to PC using XBEE, I
was able to visualize the data and try different approaches to filter out the
noise.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;object class=&quot;BLOGGER-youtube-video&quot; classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot; data-thumbnail-src=&quot;http://0.gvt0.com/vi/S_AxThJYa2g/0.jpg&quot; height=&quot;366&quot; width=&quot;420&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/S_AxThJYa2g&amp;fs=1&amp;source=uds&quot; /&gt;&lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;embed width=&quot;320&quot; height=&quot;266&quot;  src=&quot;http://www.youtube.com/v/S_AxThJYa2g&amp;fs=1&amp;source=uds&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The Windows application that connects to XBEE has nice GUI interface for realtime display, however the more useful part is the CSV file that it dumps for the received data. In the below figure we can see the received data. Columns in order are:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Gyro_X, Gyro_Y, GyroX, Acc_X, Acc_Y, Acc_Z, M1, M2, M3, M4&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH96Q4MnGil8QVsYh8fdYM166jaZxNy5f989Vu2bn_9McBSTgMn4Ncm0jY297PN6BzWsgoB-1PPf-AKjjxpe4o7t7UJd7hn4LtFjjuFoujgjwLnPBrqL1tnEtvFKulwRE8GwuchuByONc0/s1600/CSV.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Raw Data as received from XBEE in csv format&quot; border=&quot;0&quot; height=&quot;247&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH96Q4MnGil8QVsYh8fdYM166jaZxNy5f989Vu2bn_9McBSTgMn4Ncm0jY297PN6BzWsgoB-1PPf-AKjjxpe4o7t7UJd7hn4LtFjjuFoujgjwLnPBrqL1tnEtvFKulwRE8GwuchuByONc0/s400/CSV.PNG&quot; title=&quot;Raw Data as received from XBEE in csv format&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Raw Data as received from XBEE in csv format&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Please note that Acc_X represent the pitch so it goes with Gyro_Y, also Gyro_Y increase when quadcopter rotates forward, while Acc_X increase while quadcopter rotates backward. i.e. Acc_X is related to Gyro_Y and with negative sign. Same applied for Acc_Y &amp;amp; Gyro_Y.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Acc_Z represents the gravity effects that is why it is not 0, it is 100 which is&amp;nbsp;equivalent&amp;nbsp;to 9.8 m/s, Gyro_Z is used to detect YAW so it has nothing to do with Acc_Z.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Values ranges from 500 to -500, while motor ranges from 0 to 1000. To keep logged data at&amp;nbsp;reasonable&amp;nbsp;size data is only transmitted when quadcopter is armed and motors are on. that is why the&amp;nbsp;minimum&amp;nbsp;values of motors Ms is 100 here in the sheet as below this values quadcopter ignores TX signal and send Zero to motors.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Let now study Gyro_Y values and apply some math on it.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5EuG5CN5tDuRBz6AZbMcGct-sy5pfafGFHreVg7bldj3034XRkTSnxIFTEXycKVmhaU0dklzRIQgQs0LF-hExkrVrQOksfuB8-bZ-S3Q7MvWdmDhJFIdW3s882c15J8XfN31oSAzlJiQD/s1600/GY_Data.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Gyro_Y data only&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5EuG5CN5tDuRBz6AZbMcGct-sy5pfafGFHreVg7bldj3034XRkTSnxIFTEXycKVmhaU0dklzRIQgQs0LF-hExkrVrQOksfuB8-bZ-S3Q7MvWdmDhJFIdW3s882c15J8XfN31oSAzlJiQD/s1600/GY_Data.PNG&quot; title=&quot;Gyro_Y data only&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Gyro_Y Data received from XBEE&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
as we can see above this is Gyro_Y data, I added three more columns:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Move Avg&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; This is a moving average column, which means each value is added to the total and then divide the total over two.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Gyro_Y_Total = (Gyro_Y_Total + Gyro_Y ) /2&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;LPF&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; &amp;nbsp; LPF stands for Low-Pass-Filter, here i used a complementary filter to reduce noise. Complementary filter is not a complex math at all, at least if we focus on the formula not the derivation, and try to understand it from the simple view point. The formula is as follows:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Gyro_Y_Total = (0.95 * Gyro_Y_Total) + (0.05 * Gyro_Y)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; &amp;nbsp;Each time we take small part of the signal and sum it to the total. assuming that the signal has high frequency noise, so we need to smooth it by taking part of the signal and accumulate it, to avoid taking peaks that represents high frequency.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; Yes there are better ways to filter noise and at specific frequencies -as we can find in sound equalizer-, but computation is&amp;nbsp;difficult&amp;nbsp;and time consuming. If you are interested for more complex algorithms try &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_Filter&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Kalman Filter&lt;/a&gt;, or read topics about &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectrum_analyzer&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Fast&amp;nbsp;Fourier&amp;nbsp;Transform&lt;/a&gt;.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;LPF2&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;/b&gt;This is the same as LPF. I only changed the factors, and took double the amount in LPF.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Gyro_Y_Total = (0.90 * Gyro_Y_Total) + (0.10 * Gyro_Y)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihLCYlgwXxj0fUOHozjAsr_zQXAVt7xwfaiJvDh-K-NzXTw13qur313nS3XxbuUdYqVVHkVz65f1bc9KqcUaau3KQWtsfgUrn9-4VUKEeMzQl-G_HmeclPuBaYC9Bd78ObQEgBarzH3hLF/s1600/GY_Graph.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Gyro_Y under different filters &quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihLCYlgwXxj0fUOHozjAsr_zQXAVt7xwfaiJvDh-K-NzXTw13qur313nS3XxbuUdYqVVHkVz65f1bc9KqcUaau3KQWtsfgUrn9-4VUKEeMzQl-G_HmeclPuBaYC9Bd78ObQEgBarzH3hLF/s1600/GY_Graph.PNG&quot; title=&quot;Gyro_Y under different filters &quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Gyro_Y under different filters&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
You can see clearly from above how complementary filter does remove noise from signal. There are two lines red &amp;amp; blue in the complementary filter the one with some noise is LPF2 and the red smoother one is LPF where we take only 0.05 of the signal value.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
HefnyCopter2 now implements complementary filters for Gyro_X, Gyro_Y &amp;amp; Gyro_Z and the result was a much smooth flying.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
I am still working on studying different behaviors and values received from my quadcopter. I believe there is a much yet to be&amp;nbsp;discovered&amp;nbsp;-at least for me-.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Data Analysis Files can be downloaded from &lt;a href=&quot;http://www.4shared.com/zip/j8jAjxjr/QuadCopter_Data_Analysis_Sheet.html?&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Please follow up with us on &lt;a href=&quot;http://hefnycopter.net/index.php/developing-source-code.html&quot;&gt;HefnyCopter.net&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/4046714193453450860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2012/10/hefnycopter2-gyro-noise-filtering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/4046714193453450860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/4046714193453450860'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2012/10/hefnycopter2-gyro-noise-filtering.html' title='HefnyCopter2 Gyro Noise Filtering'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH96Q4MnGil8QVsYh8fdYM166jaZxNy5f989Vu2bn_9McBSTgMn4Ncm0jY297PN6BzWsgoB-1PPf-AKjjxpe4o7t7UJd7hn4LtFjjuFoujgjwLnPBrqL1tnEtvFKulwRE8GwuchuByONc0/s72-c/CSV.PNG" height="72" width="72"/><thr:total>0</thr:total><georss:featurename>Cairo, Cairo Governorate, Egypt</georss:featurename><georss:point>30.0444196 31.2357116</georss:point><georss:box>29.9894721 31.1567476 30.099367100000002 31.314675599999998</georss:box></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-3059905658265111994</id><published>2012-09-04T15:28:00.000-07:00</published><updated>2012-11-30T10:03:20.001-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="control algorithm"/><category scheme="http://www.blogger.com/atom/ns#" term="control theory"/><category scheme="http://www.blogger.com/atom/ns#" term="gyro sensor"/><category scheme="http://www.blogger.com/atom/ns#" term="IMU"/><category scheme="http://www.blogger.com/atom/ns#" term="kalman filter"/><category scheme="http://www.blogger.com/atom/ns#" term="quadcopter"/><category scheme="http://www.blogger.com/atom/ns#" term="stabilization"/><title type='text'>QuadCopter Stabilization &amp; Control System  &quot;X &amp; Plus Configuration&quot;</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;h1&gt;
QuadCopter Balancing &amp;amp; Controlling Separation&lt;/h1&gt;
&lt;h1&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This topic discusses how to separate between balancing
quadcopter and controlling it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
First let us discuss the balancing control techniques in
different quadcopter modes. Quadcopter can fly in (+) configuration and (X)
configuration. The only difference between these modes is where the front of
the quad is.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;The following diagram
illustrates the difference.&lt;/span&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh403nnhprxSWOGKY-Q3NEGDK0gdQ4mj1rkGZpwwAVIPrQfLaXNBdg-1sR32u9I1i9rNTdfYpvUn1HwGhMzAL7iHFEbjGlA5aEs0HVOLdSvQxD0wCyjvGDE1Mom2jghKKuyi5lv2JB5ozTH/s1600/quadcopter+configurations.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;217&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh403nnhprxSWOGKY-Q3NEGDK0gdQ4mj1rkGZpwwAVIPrQfLaXNBdg-1sR32u9I1i9rNTdfYpvUn1HwGhMzAL7iHFEbjGlA5aEs0HVOLdSvQxD0wCyjvGDE1Mom2jghKKuyi5lv2JB5ozTH/s400/quadcopter+configurations.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Quadcopter Configuration &quot;X &amp;amp; Plus&quot;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h2&gt;
Plus (+) Configuration Control&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In this configuration the control as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #6aa84f;&quot;&gt;// Pitch Control&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;
M1 = M1 + RX(Elevator);&lt;br /&gt;
M4 = M4 - RX(Elevator);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #6aa84f;&quot;&gt;// Roll Control&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;
M2 = M2 + RX(Aileron);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;
M3 = M3 - RX(Aileron);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This is very simple control and is found in all quadcopter
code. Sure there are some checks here and there to avoid motor stopping or
saturating.&amp;nbsp; But the flying logic is
always as above. There is also a scaling factor that is used to determine the
sensitivity of the sticks and a Divide factor that limits the value range. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
X Configuration Control&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In this configuration the control as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #6aa84f;&quot;&gt;// Pitch Control&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;
M1 = M1 + RX(Elevator) /2;&lt;br /&gt;
M3 = M3 + RX(Elevator) /2;&lt;br /&gt;
M4 = M4 - RX(Elevator) /2;&lt;br /&gt;
M2 = M2 - RX(Elevator) /2;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: #6aa84f;&quot;&gt;// Roll Control&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;M1 = M1 + RX(Aileron)/2;&lt;br /&gt;
M2 = M2 + RX(Aileron) /2;&lt;br /&gt;
M3 = M3 - RX(Aileron) /2;&lt;br /&gt;
M4 = M4 - RX(Aileron) /2;&lt;/span&gt;&lt;br /&gt;
&lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt;
&lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
As we can see this is the same logic, we only assumes that
M1 &amp;amp; M3 together acts as a single virtual motor in the front, and M2 &amp;amp;
M4 together acts as a virtual motor in the rear. Other than that it is the very
same logic.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Same considerations and factors applied in the PLUS configuration
go here as well.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;
Stabilization System&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Now let us see the stabilization system. The idea is simple,
if the quad is falling to the right then speed up the right motor and slow the
left one with the same amount and vice versa. Also if the quad is falling down
from the front arm then speed up the M1 motor and slow down&amp;nbsp; M4. The rule is written as follows.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;M1 = M1 + PitchAmount &amp;nbsp;* &amp;nbsp;PitchGain&lt;br /&gt;
M4 = M4 - &amp;nbsp;PitchAmount &amp;nbsp;* &amp;nbsp;PitchGain&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;M2 = M2 + RollAmount &amp;nbsp; * &amp;nbsp; RollGain&lt;br /&gt;
M3 = M3 &amp;nbsp;- RollAmount &amp;nbsp; * &amp;nbsp; RollGain&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
This is the basic rule that should be found in all
quadcopter programs. The main difference between the different firmware approaches is how to calculate PitchAmount and RollAmount. This can simply be read from a
Gyro sensor and multiply it by a constant factor to adjust the range, or we can
use PID approach or even Kalman filter and combine Gyro with Acc sensors to get
the exact degree.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
The Gain factor is used to determine the sensitivity. Other checks
such as trimming are common in quadcopter code.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;
Do we need Different Stabilization for X-Configuration?&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Well in almost all quadcopter programs you will find that
stabilization and control calculation follows the same concept. i.e. if we use
X-Quadcopter then we add the PitchAmount to both motors M1 &amp;amp; M2. Also
RollAmount is added to motors M1 &amp;amp; M3. This is valid approach but in fact
it is not necessary at all, also there is a major drawback here. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
It is not necessary because the stabilization control of
Plus configuration can stabilize quadcopter if there is a simultaneous picth
&amp;amp; roll forces, that means if the Control System is Plus of X the Stabilization
System can stabilize both using the same PLUS configuration. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The main drawback is that Stabilization control requires the
orient the control board so that its onboard gyro and acc are in the right
directions, so you cannot switch between PLUS configuration to X-Configuration
without reorient the board. So if we can keep the Stabilization System and only
change the Control System we don’t need to reorient the board as Control System
has nothing to do with the board sensors it only change the signal values sent
to different motors.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;a href=&quot;http://code.google.com/p/hefnycopter/&quot; target=&quot;_blank&quot;&gt;HefnyCopter&lt;/a&gt; has implemented this idea successfully as in the
below video.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/55Ab4BfcQss?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Also please read my other topic about &lt;a href=&quot;http://hefnycopter.net/index.php/developing-source-code/16-hefnycopter2-gyro-noise-filtering.html&quot; target=&quot;_blank&quot;&gt;Gyro Noise Filtering&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;See newest article &lt;a href=&quot;http://hefnycopter.net/index.php/developing-source-code/22-quadcopter-control-function-layers.html&quot;&gt;Quadcopter Flight-Control &amp;nbsp;Framework&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/3059905658265111994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2012/09/quadcopter-stabilization-control-system.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/3059905658265111994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/3059905658265111994'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2012/09/quadcopter-stabilization-control-system.html' title='QuadCopter Stabilization &amp; Control System  &quot;X &amp; Plus Configuration&quot;'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh403nnhprxSWOGKY-Q3NEGDK0gdQ4mj1rkGZpwwAVIPrQfLaXNBdg-1sR32u9I1i9rNTdfYpvUn1HwGhMzAL7iHFEbjGlA5aEs0HVOLdSvQxD0wCyjvGDE1Mom2jghKKuyi5lv2JB5ozTH/s72-c/quadcopter+configurations.PNG" height="72" width="72"/><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-5341747874435543506</id><published>2012-07-31T18:34:00.004-07:00</published><updated>2012-09-09T15:03:16.488-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="building quadcopter"/><category scheme="http://www.blogger.com/atom/ns#" term="hefnycopter"/><category scheme="http://www.blogger.com/atom/ns#" term="hobbyking"/><category scheme="http://www.blogger.com/atom/ns#" term="quadcopter"/><category scheme="http://www.blogger.com/atom/ns#" term="X-QUAD"/><title type='text'>My X-525 QuadCopter</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
This is my second trial of building a quadcopter. The first quadcopter -is the one we can see below- was totally homemade, the arms were too thin and U-shape so motors were twisting the bars and it was unstable.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;object class=&quot;BLOGGER-youtube-video&quot; classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot; data-thumbnail-src=&quot;http://i.ytimg.com/vi/qT__4gboErU/0.jpg&quot; height=&quot;266&quot; width=&quot;320&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/qT__4gboErU?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata&quot; /&gt;&lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;embed width=&quot;320&quot; height=&quot;266&quot;  src=&quot;http://www.youtube.com/v/qT__4gboErU?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRQd6OgA-WL-gJnT8SfFjEhXeB-Cee70vaqOvi7BFl23q00CkckTObfgv8_kcvXce31MDD7P_uDO6l17-No4KhRk2RqP6B7hr9K0gKC1auw3OhLGbVd6qgPBtandv9AcMxBYUXgVpq0RvU/s1600/2012-03-30+20.03.00.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRQd6OgA-WL-gJnT8SfFjEhXeB-Cee70vaqOvi7BFl23q00CkckTObfgv8_kcvXce31MDD7P_uDO6l17-No4KhRk2RqP6B7hr9K0gKC1auw3OhLGbVd6qgPBtandv9AcMxBYUXgVpq0RvU/s400/2012-03-30+20.03.00.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;early steps in building frame&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhii-fndZlWlX0NtyVDlZatbwFeo8p2qy56vi7GCmT2AtD-wh615l1ij5OPYqI7DQCLHVOAw4quW6YlWHy8wTN6QwEy_8fbTTOMK2o6E4NVLplc4coJzAXoDbJFwzIYGvu3QXT-wDzm7XK5/s1600/DSCN3885.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhii-fndZlWlX0NtyVDlZatbwFeo8p2qy56vi7GCmT2AtD-wh615l1ij5OPYqI7DQCLHVOAw4quW6YlWHy8wTN6QwEy_8fbTTOMK2o6E4NVLplc4coJzAXoDbJFwzIYGvu3QXT-wDzm7XK5/s400/DSCN3885.JPG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;My hand-made frame&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
My second quadcopter uses exactly the same motors and board, I&amp;nbsp;decided&amp;nbsp;to use &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=24227&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;Hobby King X-525 Quadcopter Frame&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuQ1e4jvLUUfy9006iVbyrRY0hHyzT_O0pDLkdvco4q1Pojkge5OAfWzxXkzBJZtgXX1i_YELSdMLxSIhSpUoenlaSQXXRnXc7FqTJOcUr2gThH2zN6mah9oqAOrfD1UjJOitFwU-Iti4o/s1600/20120713_180611.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuQ1e4jvLUUfy9006iVbyrRY0hHyzT_O0pDLkdvco4q1Pojkge5OAfWzxXkzBJZtgXX1i_YELSdMLxSIhSpUoenlaSQXXRnXc7FqTJOcUr2gThH2zN6mah9oqAOrfD1UjJOitFwU-Iti4o/s400/20120713_180611.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Building the body was easy it took 40 min to assemble it. and another 4 hours in mounting motors and soldering connections.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTbEqMJF-8v_B3B03bT29wRFussXtj4mPQrhpAzzxcPDeUDDmtmar-xmH6NR8hHBRjVBRsdRRA4W_a5QqmIWKU-VnL8JH40gZQUIhJsU3T7QmIargOWcDeOYbV_V-vNrgSHPj6alNUnD8C/s1600/20120713_173534.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTbEqMJF-8v_B3B03bT29wRFussXtj4mPQrhpAzzxcPDeUDDmtmar-xmH6NR8hHBRjVBRsdRRA4W_a5QqmIWKU-VnL8JH40gZQUIhJsU3T7QmIargOWcDeOYbV_V-vNrgSHPj6alNUnD8C/s400/20120713_173534.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;rubber to reduce vibrations&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Flying results was different, QuadCopter is much stable now.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq7gZ37IVt30CA0maFu9h_jyf1iazOztaI5XnuA32aXut2bUJ05u8qUQRlZFez6kdo-kZfV-4IioGOJd9hRxs4hXgugDIK1OwZJcHVI66oDOx7Qm6aBDQcBRWKW-JIkEoZXeDwn9PnLO9k/s1600/20120713_200006_HDR.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq7gZ37IVt30CA0maFu9h_jyf1iazOztaI5XnuA32aXut2bUJ05u8qUQRlZFez6kdo-kZfV-4IioGOJd9hRxs4hXgugDIK1OwZJcHVI66oDOx7Qm6aBDQcBRWKW-JIkEoZXeDwn9PnLO9k/s400/20120713_200006_HDR.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;X-525 Frame with folding bars&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Still I need training, below was my first trial, now I fly it much better however still a beginner.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/Mzf2OwEGMrU?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
If you are interested in building your quad, below is a complete list of items you need to buy. Building a quadcopter is an interesting task, although it does not require as high skills as building a scale RC plane or a helicopter where mechanics are too complex. Quadcopter are very easy to balance as well, they mainly depends on their control board for balancing so minor mismatch in CG is not an issue at all.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Bill of Materials:&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- Quadcopter Frame&amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=24227&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;Hobbyking X666 Glass Fiber Quadcopter Frame 666mm &lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- Propellers you need two propellers CW &amp;amp; two propellers CCW. I tried both GWS 9x5 &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=5248&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;CW&lt;/a&gt;&amp;nbsp;&amp;amp; &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=5250&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;CCW&lt;/a&gt;&amp;nbsp;as well as SF 10x45 &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=22448&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;CW &lt;/a&gt;&amp;amp; &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=22447&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;CCW&lt;/a&gt;. if you are a&amp;nbsp;newbie here, then you need to get at least extra 4 propeller of each type i.e. CW &amp;amp; CCW as you should expect that the first thing you will break here are propellers.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- 4 x Brushless &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=5354&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;FC28-22&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- 4 x ESC &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=13430&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;HobbyKing 20A BlueSeries Brushless Speed Controller&lt;/a&gt;&amp;nbsp;or&amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=9483&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;Mystery 30A BEC Brushless Speed Controller (Blue Series)&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- Hobby King &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=21977&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;Multi-Rotor Control Board V3.0 (Atmega 328 PA)&lt;/a&gt;&amp;nbsp;or the newer&amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=24723&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;Hobbyking KK2.0 Multi-rotor LCD Flight Control Board&lt;/a&gt;&amp;nbsp;with LCD and additional accelerometer sensors.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- 1 x LIPO Battery &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=10279&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;Turnigy 2200mAh 3S 40C Lipo Pack&lt;/a&gt;&amp;nbsp;.&amp;nbsp;The quad flies for +10 min.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; - 1 x Receiver 6CH such as&amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=11965&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;OrangeRx R610 Spektrum DSM2 6Ch 2.4Ghz Receiver (w/ Sat Port)&lt;/a&gt;&amp;nbsp;it is fully compatible with Spektrum &amp;amp; JR yet it costs lest that 1/10 of the price of original&amp;nbsp;receivers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Other Misc. Stuff are:&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- 1 x&amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=66&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;2mm Gold Connectors 10 pairs (20pc)&lt;/a&gt;&amp;nbsp;These connectors are slim and very suitable for your FC 28-22 wires. You will need them to connect motor to ESC.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- 1 x&amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=21758&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;10CM Male to Male Servo Lead (JR) 26AWG (10pcs/set)&lt;/a&gt;&amp;nbsp;the set contains 10 pieces which are enough for the quadcopter . . . actually you will need four or five based on the control board you choose.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- 1 x&amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=23140&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;Hobby King Quadcopter Power Distribution Board&lt;/a&gt;&amp;nbsp;This links your power wires from ESCs together to connect them to the battery. You can also use &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=21734&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;Single Male to 4 x 3.5mm Female adapter&lt;/a&gt;&amp;nbsp;instead based on your quadcopter size.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; - 1 x&amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=3833&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;Turnigy 5mm Heat Shrink Tube - BLACK (1mtr)&lt;/a&gt;&amp;nbsp;This is important and easy to use as well. It keeps your connections tight and clean. you need a simple air drier to shrink them. It is great to isolate connectors and keep them together.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;- 1 x&amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=13431&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;HobbyKing Programming card for BlueSeries Brushless Speed Controller&lt;/a&gt;&amp;nbsp;This is important to avoid the hassle of programming your ESC using transmitters and magical beeps. The quad has four ESC, you need easy and accurate programming tool to make your life easier.&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;b&gt;&lt;i&gt;Extra Stuff:&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;
&lt;b style=&quot;font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/b&gt;- 1 x&amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=18987&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;On Board Lipoly Low Voltage Alarm (2s~4s)&lt;/a&gt;&amp;nbsp;actually I would not say it is all extra, it is important if you plan to fly your quad high. . . you need an alarm to tell you that your battery is about to finish and you need to bring your quad down before it gets down by itself :)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; - LEDs exists in different types &amp;nbsp;&lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=23342&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;RED &lt;/a&gt;- &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=23345&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;GREEN &lt;/a&gt;- &lt;a href=&quot;http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=23344&amp;amp;aff=569826&quot; target=&quot;_blank&quot;&gt;BLUE &lt;/a&gt;they are great if you plan to fly quad at night&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;HefnyCopter Code&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&amp;nbsp; &lt;/b&gt;The video below show my quad flying using my own &lt;a href=&quot;http://code.google.com/p/hefnycopter/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;Hefny Copter Firmware&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;. The&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;&lt;i&gt; new feature&lt;/i&gt;&lt;/b&gt;&lt;/span&gt; in this firmware is that your ability to &lt;b&gt;&lt;i&gt;switch between X-Quad configuration and + Quad &lt;/i&gt;&lt;/b&gt;Configuration using your remote TX only. no need to reorient the board or recompile the code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/55Ab4BfcQss?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/5341747874435543506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2012/07/my-x-525-quadcopter.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/5341747874435543506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/5341747874435543506'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2012/07/my-x-525-quadcopter.html' title='My X-525 QuadCopter'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRQd6OgA-WL-gJnT8SfFjEhXeB-Cee70vaqOvi7BFl23q00CkckTObfgv8_kcvXce31MDD7P_uDO6l17-No4KhRk2RqP6B7hr9K0gKC1auw3OhLGbVd6qgPBtandv9AcMxBYUXgVpq0RvU/s72-c/2012-03-30+20.03.00.jpg" height="72" width="72"/><thr:total>6</thr:total><georss:featurename>Cairo, Cairo Governorate, Egypt</georss:featurename><georss:point>30.0444196 31.2357116</georss:point><georss:box>29.9894721 31.1567476 30.099367100000002 31.314675599999998</georss:box></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-4145510142542740488</id><published>2012-07-18T09:57:00.000-07:00</published><updated>2012-08-02T08:49:12.122-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ATmega"/><category scheme="http://www.blogger.com/atom/ns#" term="Fail Safe"/><category scheme="http://www.blogger.com/atom/ns#" term="FailSafe Mux"/><category scheme="http://www.blogger.com/atom/ns#" term="FailSafe UAV"/><category scheme="http://www.blogger.com/atom/ns#" term="RC Plane"/><category scheme="http://www.blogger.com/atom/ns#" term="Remote Control"/><title type='text'>N-Channel Switch</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;h1&gt;




&lt;/h1&gt;
&lt;h1&gt;




&lt;span style=&quot;color: #3d85c6; font-size: large;&quot;&gt;What is N-Channel Switch&lt;/span&gt;&lt;/h1&gt;
&lt;div&gt;
&lt;span style=&quot;color: #3d85c6; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;object style=&quot;height: 390px; width: 640px;&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/3QT6u4LE8_s?version=3&amp;feature=player_detailpage&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/3QT6u4LE8_s?version=3&amp;feature=player_detailpage&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot; allowScriptAccess=&quot;always&quot; width=&quot;640&quot; height=&quot;360&quot;&gt;&lt;/object&gt;

&lt;br /&gt;
&lt;h1&gt;




&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;N-Channel Switch is a hardware device that is very much like multiplexer that takes input from two sources and based on a select signal it outputs on of these two signals.&lt;/span&gt;&lt;/h1&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFu0PA2bh-_tcISD-9EuheymsdgHJv-lN_RyKQ8d3zNIYPSmuBKwvfF8SHS08lVKOd1uxZbnmQe08gfJCaUmXlUif4mpexW3dzHa7UNkgVIqQ0EE01cBSQjFNmRLLRjooQlD_uZewWIrtT/s1600/N-Channel+Switch+1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;237&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFu0PA2bh-_tcISD-9EuheymsdgHJv-lN_RyKQ8d3zNIYPSmuBKwvfF8SHS08lVKOd1uxZbnmQe08gfJCaUmXlUif4mpexW3dzHa7UNkgVIqQ0EE01cBSQjFNmRLLRjooQlD_uZewWIrtT/s320/N-Channel+Switch+1.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;General Function&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h1&gt;




&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1&gt;




&lt;span style=&quot;color: #3d85c6; font-size: large;&quot;&gt;Domains of Application&lt;/span&gt;&lt;/h1&gt;
&lt;h1&gt;




&lt;span style=&quot;background-color: white; font-size: small; font-weight: normal; text-align: justify;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;This is a general purpose device, so it can be used in different fields; however it was specifically designed to target RC planes.&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
&lt;h1 style=&quot;text-align: justify;&quot;&gt;




&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;In UAV planes you may need to &lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;take-off and land using your own skills not autonomously&lt;/span&gt;&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt; using plane computer. You can easily and instantly take control from your plan. Same need when testing your UAV you need to make sure that if something went wrong you are still able to get it back again. The idea here is that this switch is completely isolated from your complex UAV logic, so if main processor hangs due to software bug you can still access this switch and get your plan back.&lt;/span&gt;&lt;/h1&gt;
&lt;h1 style=&quot;text-align: justify;&quot;&gt;




&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Another use of this switch is when trainer a new pilot on RC Planes. &lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;You no longer need to have the same type of transmitters; you can even use your FM together with his 2.4 GHz in a master slave combination.&lt;/span&gt;&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt; &amp;nbsp;All you need to do is to put two receivers on that plane, connect them to the switch and you can start your training session safely.&lt;/span&gt;&lt;/h1&gt;
&lt;h1&gt;




&lt;span style=&quot;background-color: white; color: #3d85c6; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1&gt;




&lt;span style=&quot;background-color: white; color: #3d85c6; font-size: large;&quot;&gt;Features and Specification&lt;/span&gt;&lt;/h1&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Takes Throttle, Elevator, Rudder &amp;amp; Aileron input from two sources. This can be two receivers or a receiver and a UAV board.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Use PWM signal to switch from first input to the second. You can use gear, Aux1, Aux2 …etc. to make switching.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Two digital output ports can be used to turn lights or other devices on and off by using a control signal.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Failsafe Switching. In case one source stops sending valid data the switch automatically switches to the other source.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #3d85c6; font-size: x-large;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h1&gt;




&lt;span style=&quot;background-color: white; color: #3d85c6; font-size: large;&quot;&gt;Pin Assignment&lt;/span&gt;&lt;/h1&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeU6uuj3jA2PvUWAdrtC9MycbOX9nivCfMitUKsVqkgmafyJs9XkaKrgu25zY7xVfAjpZKSX6o1m4Ns16QOYsnlktAVxXqf1DMSurqzmQ7hZNMvSSc_Be8W0Tq-0Q4wx43QqIZmHaMqgY-/s1600/N-ChannelSwitch++-+Code+1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeU6uuj3jA2PvUWAdrtC9MycbOX9nivCfMitUKsVqkgmafyJs9XkaKrgu25zY7xVfAjpZKSX6o1m4Ns16QOYsnlktAVxXqf1DMSurqzmQ7hZNMvSSc_Be8W0Tq-0Q4wx43QqIZmHaMqgY-/s1600/N-ChannelSwitch++-+Code+1.PNG&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Input Ports&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7C2mMzbsMQGfeP1nsTat55w-MQK1mU9sMRD0qdvqCvXI92g3KiuAcXPIb7QHRneZKxeErGXW6zXZfI4cYLxjvYo5mfGAF7OA-EKUFYePQX_GFQWXIQ4NoDDWT948uDdB_Ti3LhWXUF3tl/s1600/N-ChannelSwitch++-+Code+2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7C2mMzbsMQGfeP1nsTat55w-MQK1mU9sMRD0qdvqCvXI92g3KiuAcXPIb7QHRneZKxeErGXW6zXZfI4cYLxjvYo5mfGAF7OA-EKUFYePQX_GFQWXIQ4NoDDWT948uDdB_Ti3LhWXUF3tl/s320/N-ChannelSwitch++-+Code+2.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Output Ports&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h1&gt;




&lt;span style=&quot;background-color: white; color: #3d85c6; font-size: large;&quot;&gt;Circuit Diagram&lt;/span&gt;&lt;/h1&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh4dDtma2XQzHu9kisGONU9oiTeWAvO7ou5Pe0VOkrDtWfzGIFNiDKAhHta-R-NV61wlT5ypMyPCfy31_WZGrJvobvx781X1lZrHN0hxaJof6qQToMuE0I3FuZW4BbHprZhq8-MNdmTuka/s1600/N-ChannelSwitch.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;256&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh4dDtma2XQzHu9kisGONU9oiTeWAvO7ou5Pe0VOkrDtWfzGIFNiDKAhHta-R-NV61wlT5ypMyPCfy31_WZGrJvobvx781X1lZrHN0hxaJof6qQToMuE0I3FuZW4BbHprZhq8-MNdmTuka/s640/N-ChannelSwitch.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Circuit Diagram&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Source Code &amp;amp; Hex&lt;br /&gt;
&lt;br /&gt;
HEX file is &lt;a href=&quot;http://www.4shared.com/file/xzG_u7sD/N-Channel_Switch.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;br /&gt;
Also Source Code is &lt;a href=&quot;http://www.4shared.com/zip/FCamedwz/NChannelSwitch.html?refurl=d1url&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/4145510142542740488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2012/07/n-channel-switch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/4145510142542740488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/4145510142542740488'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2012/07/n-channel-switch.html' title='N-Channel Switch'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFu0PA2bh-_tcISD-9EuheymsdgHJv-lN_RyKQ8d3zNIYPSmuBKwvfF8SHS08lVKOd1uxZbnmQe08gfJCaUmXlUif4mpexW3dzHa7UNkgVIqQ0EE01cBSQjFNmRLLRjooQlD_uZewWIrtT/s72-c/N-Channel+Switch+1.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-4328015214815495172</id><published>2012-06-20T13:21:00.001-07:00</published><updated>2012-06-20T13:43:33.004-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ATmega"/><category scheme="http://www.blogger.com/atom/ns#" term="AVR"/><category scheme="http://www.blogger.com/atom/ns#" term="blink LED"/><category scheme="http://www.blogger.com/atom/ns#" term="cheaper"/><category scheme="http://www.blogger.com/atom/ns#" term="handmade"/><title type='text'>Handmade Arduino</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
When I first read about Arduino, I liked how compact it is, and how much processing power I can get. Also I loved the library and the idea of standard pins. I decided to buy a Mini-Arduino to play with. It costs me 160 L.E. in Egypt, that is about 27 USD. I&amp;nbsp;decided&amp;nbsp;to buy an ATMega 328 chip and try to imitate the board. I bought a crystal and couple of&amp;nbsp;ceramic&amp;nbsp;capacitors and some resistors, and started to build up an identical circuit.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvW6Wkq4stiIbP-KzstLHwElm_kpdvcq41ACW4P6g6F5SL5LI2FXD3Gk0tT0C1gSxoq_jv9GC5BWejBpXRsFiRZPt9faZmNEI7W9VBw7Dp82JT7BcwTggLDehyXu1nu7fTiO-cSFIjT5xG/s1600/Android+Equivelant+using+ATMega_bb.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;193&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvW6Wkq4stiIbP-KzstLHwElm_kpdvcq41ACW4P6g6F5SL5LI2FXD3Gk0tT0C1gSxoq_jv9GC5BWejBpXRsFiRZPt9faZmNEI7W9VBw7Dp82JT7BcwTggLDehyXu1nu7fTiO-cSFIjT5xG/s400/Android+Equivelant+using+ATMega_bb.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Circuit Diagram using Fritzing&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUfmZo13NxtuDLvIFMjlQ6-LR4QWfCDOQpknbyFzb-W1amFRCoPE7dsBoLybmGn2fJQ8vG3iZqSeIGBEvCGFwFJPMq1t_XdviM0EzY5WAeGkhWCcRpvxacqpAQ5uodUYh-c5DXf9ASNC4q/s1600/2012-06-19+21.35.06.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUfmZo13NxtuDLvIFMjlQ6-LR4QWfCDOQpknbyFzb-W1amFRCoPE7dsBoLybmGn2fJQ8vG3iZqSeIGBEvCGFwFJPMq1t_XdviM0EzY5WAeGkhWCcRpvxacqpAQ5uodUYh-c5DXf9ASNC4q/s400/2012-06-19+21.35.06.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;My Actual Circuit identical to the diagram&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;&amp;nbsp;[extra wires you can see connected to Arduino are for AVR programming&lt;span style=&quot;background-color: white;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The end result is using ATMEGA-326 alone with nothing connecting to it except a resistor in the reset pin.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
to make sure that they run at the same speed I developed a simple application that blinks the LED on a certain rate, and I uploaded the application to both chips using AVR. LEDs started to blink on the same rate.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh00Ep2aC8FE2YWClH-3WNyzPMJTwkKva_HjheISd4Mvc1IWYhmugzAU03WYbyEQXMrNJVsTHhWfnYP7HEWT93aji16AErxZKsbwF05_XmFpHBJLef5TWswXn7OmeLtg9z8BivM_j6VUuR7/s1600/ATMegaCode.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;236&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh00Ep2aC8FE2YWClH-3WNyzPMJTwkKva_HjheISd4Mvc1IWYhmugzAU03WYbyEQXMrNJVsTHhWfnYP7HEWT93aji16AErxZKsbwF05_XmFpHBJLef5TWswXn7OmeLtg9z8BivM_j6VUuR7/s400/ATMegaCode.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Application Source Code&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The good side is that the handmade version costed me only 40 L.E. which &lt;b&gt;6.67&lt;/b&gt; USD only.&lt;/div&gt;
&lt;div&gt;
Application can be downloaded from &lt;a href=&quot;http://www.4shared.com/rar/CVJHEjab/ATMEGA_OnlyBlink.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/4328015214815495172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2012/06/handmade-arduino.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/4328015214815495172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/4328015214815495172'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2012/06/handmade-arduino.html' title='Handmade Arduino'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvW6Wkq4stiIbP-KzstLHwElm_kpdvcq41ACW4P6g6F5SL5LI2FXD3Gk0tT0C1gSxoq_jv9GC5BWejBpXRsFiRZPt9faZmNEI7W9VBw7Dp82JT7BcwTggLDehyXu1nu7fTiO-cSFIjT5xG/s72-c/Android+Equivelant+using+ATMega_bb.png" height="72" width="72"/><thr:total>0</thr:total><georss:featurename>Abd El-Hameed Badawi, Sheraton Al Matar, Qism El-Nozha, Cairo Governorate, Egypt</georss:featurename><georss:point>30.108305899054287 31.373519897460938</georss:point><georss:box>30.053355899054285 31.294555897460938 30.163255899054288 31.452483897460937</georss:box></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-1986348749237404875</id><published>2012-06-11T03:36:00.002-07:00</published><updated>2012-11-13T04:49:09.242-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="hacking"/><category scheme="http://www.blogger.com/atom/ns#" term="hobbyking"/><category scheme="http://www.blogger.com/atom/ns#" term="Orange Receiver"/><category scheme="http://www.blogger.com/atom/ns#" term="Spektrum DX7"/><title type='text'>What is Inside Spektrum DX7 Receiver</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1 style=&quot;text-align: left;&quot;&gt;




&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;/h1&gt;
&lt;h1 style=&quot;text-align: left;&quot;&gt;




&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;In this document I try to go through my findings and my expectation of board structure and behavior.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj51p4_zQXRw9yre2kIjOTYDBAL9ujJ831-BTkjlkCICUZXW97p7Sm_7TIlQH30QfEm3lp2KYGpgfppwxqK04OyRSisaJjIEErTLH58S1wwkQAOa1PPo6c7mxAiPsSHyaTpNtt_a0nWg3aC/s1600/Title.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;301&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj51p4_zQXRw9yre2kIjOTYDBAL9ujJ831-BTkjlkCICUZXW97p7Sm_7TIlQH30QfEm3lp2KYGpgfppwxqK04OyRSisaJjIEErTLH58S1wwkQAOa1PPo6c7mxAiPsSHyaTpNtt_a0nWg3aC/s320/Title.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Overview&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;My Tiger Trainer plane was completely destroyed in a crash. Even the muffler and the receiver were destroyed.&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;font-weight: normal;&quot;&gt;I took this as an opportunity to know what is inside Receiver DX7, and how much is it different than much cheaper receivers such as Orange Receiver.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Boards Structure&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;After some investigation I came out with the following outputs:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;1-&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;The receiver of DX7 consists of two main boards attached to each other as in figure 1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsHrhW4vdcTadHYkrK6y-oN36UhR_MOp86KvahmlbVMrg6m-x5OSUQXTySFeTz4XPNUqGg-KY6SzSb4ilZxDINX-ll-YUbRLcmq1OH2mgf8Y8JI3dgF2gzjKlh1ArQDgJFez4OvkLBd7oJ/s1600/Fig1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsHrhW4vdcTadHYkrK6y-oN36UhR_MOp86KvahmlbVMrg6m-x5OSUQXTySFeTz4XPNUqGg-KY6SzSb4ilZxDINX-ll-YUbRLcmq1OH2mgf8Y8JI3dgF2gzjKlh1ArQDgJFez4OvkLBd7oJ/s1600/Fig1.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;div class=&quot;MsoCaption&quot;&gt;
Figure 1: DX7
Receiver Board&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h1 style=&quot;text-align: left;&quot;&gt;






&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;The two boards are:&lt;/span&gt;&lt;/h1&gt;
&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;a.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;The smaller upper board is the actual receiving board and has two antenna attached to it – one of them was detached in my plane crash-.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;b.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;The bottom bigger board is the main board. It takes receiver output and decodes it and sends output signals through output pins to servos.&lt;/span&gt;&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH8z2oE_AFSaPsytylyvGJxdcEVvaaNl0s86ByhQG13Iydz1BgCm5-7wDjwUjsZsu1pSJHlr5hCIX34Y8nPPCCHzBeqW7sa9b-k7on36BfOrbD_7_121ObQD8yV7hN88_SXA1xg12jrO2F/s1600/Fig2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH8z2oE_AFSaPsytylyvGJxdcEVvaaNl0s86ByhQG13Iydz1BgCm5-7wDjwUjsZsu1pSJHlr5hCIX34Y8nPPCCHzBeqW7sa9b-k7on36BfOrbD_7_121ObQD8yV7hN88_SXA1xg12jrO2F/s1600/Fig2.jpg&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;Figure 2: Block diagram of the main board of DX7&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;&lt;u&gt;Things to notice on this board:&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;1-&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;font-size: small; text-align: left; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;The first thing I noticed is that the satellite external circuit is identical to the receiver circuit –smaller upper board- inside the DX7 body. To prove that I took the receiver out and solder satellite circuit wires to pins where the receiver board was connected. When I turned on the receiver and the transmitter they could connect to each other.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;2-&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;There is three receiver points on this board. One in the middle where the main board connects, one on the left where the satellite socket exists, and another one on the right that is active but cannot be used unless you take the cover and solder your wires there.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;
&lt;/span&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;&lt;/span&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;I expect this will give extra coverage because you will be able to a receiver board for each dimension and you will cover reliably 3D, so whatever the position of your plane the link will be very reliable.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;
&lt;/span&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhigWL8VsjN-r85IlSUBlqGMUwR65vT0zRV6g1mBfmoF9FnjOIWUt27GDRlBFUraSHD_4jFe3vuwZHWQq3-BQyshcQbAYdFROQ4MpykjMHG8gnOjQzXya4AiRV94U4vPolTiOJMsaJfuenp/s1600/Fig3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;482&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhigWL8VsjN-r85IlSUBlqGMUwR65vT0zRV6g1mBfmoF9FnjOIWUt27GDRlBFUraSHD_4jFe3vuwZHWQq3-BQyshcQbAYdFROQ4MpykjMHG8gnOjQzXya4AiRV94U4vPolTiOJMsaJfuenp/s640/Fig3.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;div class=&quot;MsoCaption&quot;&gt;
Figure 3: Main
Board, and pin assignment of each receiver.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Figure #3 shows how receivers are connected to CY8C27443 microcontroller.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Datasheet for this microcontroller can be found &lt;a href=&quot;http://pdf1.alldatasheet.com/datasheet-pdf/view/84306/CYPRESS/CY8C27443.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Output Pins:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Throttle: &amp;nbsp; Pin 26 &amp;nbsp; &amp;nbsp; P0[6]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Aileron:&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Pin 4 - &amp;nbsp; &amp;nbsp;P0[1]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Elevator:&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Pin 1 - &amp;nbsp; &amp;nbsp;P0[7]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Rudder:&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Pin 24 - &amp;nbsp;P0[0]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Gear: &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Pin 25 - &amp;nbsp;P0[2]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Aux 1:&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Pin 3 - &amp;nbsp; &amp;nbsp;P0[3]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Aux 2: &amp;nbsp; &amp;nbsp; &amp;nbsp;Pin 6 – &amp;nbsp; P2[5]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;What is can we conclude here is that the microcontroller receive signals from multiple receivers and determine which signal is valid. Then it simply converts serial data to PWM signal for each output. I found interesting topic here discussing details of this point by connecting satellite to Arduino http://www.dogfight.no/2011/01/spectrum-receiver-satellite-to-arduino.html&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;b&gt;Orange Receiver&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Although Orange receiver looks much more simple than DX7, but infact we can see many commons here. There is only two ICs the receiver, we should expect three here, but it seems that the second IC performs the decoding function as well, because at the end of the day they are microcontrollers and it is a matter of software updates.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg68OgqFsvm60pOeTgCivaKD6QseQTO-_2Ofb0YVjKiESEPi2AwTAkoEJzkljlyrepBzTDIH63J902nVM_TpKcwBqbUmGH88HHTXrccunmNezQEOuxOem83roGEZjDzudWoK2OOunkznFLy/s1600/Fig4.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;195&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg68OgqFsvm60pOeTgCivaKD6QseQTO-_2Ofb0YVjKiESEPi2AwTAkoEJzkljlyrepBzTDIH63J902nVM_TpKcwBqbUmGH88HHTXrccunmNezQEOuxOem83roGEZjDzudWoK2OOunkznFLy/s320/Fig4.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;The regulator is another difference, we have only one capacitor and a small regulator which gives an indication of the maximum current they can stand.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Another interested part I noticed is the signals that you receive from channels. Signals are originally send and received in series, then these signals are demultiplexed into their original channels. This means we never get&amp;nbsp;any overlap between any two PWM signals&amp;nbsp;&amp;nbsp; if we measure them from RX output channels. Channels can never overlap.&lt;/span&gt;&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Cf9C8MucNKGGrnsFVPqqy-YGb1gin_C1yAOZnlf4Etyy-CrMopwLSNDOnPwmJx8UQ3N73BI5mLUTU6gzL_FE_JNJytCH3UMQhyphenhyphenEgbwcv3oUmZlIFtA1SZLKghawLxHqGZ-LsCkWsXjvF/s1600/receiver_code_9_signals_Ele_Rud.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;190&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Cf9C8MucNKGGrnsFVPqqy-YGb1gin_C1yAOZnlf4Etyy-CrMopwLSNDOnPwmJx8UQ3N73BI5mLUTU6gzL_FE_JNJytCH3UMQhyphenhyphenEgbwcv3oUmZlIFtA1SZLKghawLxHqGZ-LsCkWsXjvF/s320/receiver_code_9_signals_Ele_Rud.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Throttle - ALI&quot;green-red&quot;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;The above figure shows how signals Throttle and ALI are adjacent signals, but they never over lap, as we can see in the next figure&lt;/span&gt;&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiwNb2KK_GCIArJwwPFK8cgkhG83gP28sqGrZWznxCb21Maf2QLTpPc18qGW788GsDqSQzfu0no2SXAYE0Pt59DkvJ3D_KoJxrbRUXgil7_GJQCx1QR2jMdHu6zrzpymo4PaAGCGsSTGiV/s1600/receiver_code_9_signals_Thr_Ele_Max.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;194&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiwNb2KK_GCIArJwwPFK8cgkhG83gP28sqGrZWznxCb21Maf2QLTpPc18qGW788GsDqSQzfu0no2SXAYE0Pt59DkvJ3D_KoJxrbRUXgil7_GJQCx1QR2jMdHu6zrzpymo4PaAGCGsSTGiV/s320/receiver_code_9_signals_Thr_Ele_Max.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;No Signal Overlapping&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;The same characteristics appears between ELE &amp;amp; Rudder signals, if you choose THR &amp;amp; ELE or rudder you will notice that the distance between these to signals are far.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;If you are interested in more details about signal handling in your firmware and how to protect your quadcopter from losing TX signal while armed please check this link &lt;a href=&quot;http://hefnycopter.net/index.php/developing-source-code/21-how-to-detect-that-rx-signal-is-lost-explained.html&quot;&gt;Receiver Handling and Signal Lost Detection Explained&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;h1&gt;






&lt;/h1&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/1986348749237404875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2012/06/in-this-document-i-try-to-go-through-my.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/1986348749237404875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/1986348749237404875'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2012/06/in-this-document-i-try-to-go-through-my.html' title='What is Inside Spektrum DX7 Receiver'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj51p4_zQXRw9yre2kIjOTYDBAL9ujJ831-BTkjlkCICUZXW97p7Sm_7TIlQH30QfEm3lp2KYGpgfppwxqK04OyRSisaJjIEErTLH58S1wwkQAOa1PPo6c7mxAiPsSHyaTpNtt_a0nWg3aC/s72-c/Title.jpg" height="72" width="72"/><thr:total>2</thr:total><georss:featurename>Omarat Rabaa, Al Golf, Nasr City, Cairo Governorate, Egypt</georss:featurename><georss:point>30.069688200656845 31.336441040039062</georss:point><georss:box>30.014721700656846 31.257477040039063 30.124654700656844 31.415405040039062</georss:box></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-678670492805536246</id><published>2012-04-07T04:18:00.001-07:00</published><updated>2012-06-11T03:37:58.730-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DX7"/><category scheme="http://www.blogger.com/atom/ns#" term="RC Plane"/><category scheme="http://www.blogger.com/atom/ns#" term="Remote Control"/><category scheme="http://www.blogger.com/atom/ns#" term="SoundCard"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows7"/><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Controlling your RC Plane from Computer using SoundCard&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Controlling your RC Plane using your PC is surprisingly easy&lt;br /&gt;
&lt;br /&gt;
The main idea is that RC Transmitter generates audio signals that are carried by the Radio signals using FM or spread spectrum. The receiver decode these signals and output audio signals PMM that servo understands and moves accordingly.&lt;br /&gt;
&lt;br /&gt;
This&lt;a href=&quot;https://www.insecure.ws/2010/03/09/control-rc-aircrafts-from-your-computer-for-0&quot;&gt; link explains &lt;/a&gt;every thing in good details.&lt;br /&gt;
&lt;br /&gt;
However the sample is for Linux, another person who helped to develop a window version in&lt;a href=&quot;https://www.insecure.ws/2010/03/19/control-rc-aircrafts-from-your-computer-even-if-you-use-windows&quot;&gt; this link&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;What is New ?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Well the C# code above reads from a joystick and generates an audio signal. My application is basically depends on the&amp;nbsp;SoundPlay.cs but allows you to control your plane from the screen directly.&lt;br /&gt;
&lt;br /&gt;
I tested it on my Spektrum DX7, and an Orange RX and it worked great.&lt;br /&gt;
&lt;br /&gt;
Main Things to Remember:&lt;br /&gt;
&lt;br /&gt;
1- Remember to set your voice setting to 192000 Hz in your Windows settings as in the image below.&lt;br /&gt;
2- Set your TX to in the Trainer menu P-Link.&lt;br /&gt;
3- Change Windows sound volume till DX7 detects that it is connected to another Remote.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then you can enjoy controlling your RC&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEH0a8uEsSCt9l62R6OPpKEl8VX9W4lYpZHUSlFZqCIFsisxlZ94FwYUoXf8NA39Zdj3xdfAU1W3WMxo9LpbXXAiROIkM5Up1lBF6-c7gWaqWbT1G_Tppro32Ih4NYcG4hKcXfXlVQ3xHi/s1600/RC+Control.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;308&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEH0a8uEsSCt9l62R6OPpKEl8VX9W4lYpZHUSlFZqCIFsisxlZ94FwYUoXf8NA39Zdj3xdfAU1W3WMxo9LpbXXAiROIkM5Up1lBF6-c7gWaqWbT1G_Tppro32Ih4NYcG4hKcXfXlVQ3xHi/s320/RC+Control.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1sg5KZaJNsdGyelaX_c0_pBeHxPfQc1RYrKxvRE8BcmyHaE48Z-JLzY4n72GDWkOSpevPGH9FFMK9QjSE4qEoqNslEUs4F5yqn36L3AT1Z8tPgo0OafFsSHv9wZ-A3rGXXy95z8HzBfT4/s1600/Voice+Setting.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1sg5KZaJNsdGyelaX_c0_pBeHxPfQc1RYrKxvRE8BcmyHaE48Z-JLzY4n72GDWkOSpevPGH9FFMK9QjSE4qEoqNslEUs4F5yqn36L3AT1Z8tPgo0OafFsSHv9wZ-A3rGXXy95z8HzBfT4/s320/Voice+Setting.JPG&quot; width=&quot;258&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
You can download &lt;a href=&quot;http://www.4shared.com/zip/9-kJDfzf/RC_Control_src.html&quot;&gt;source code from here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
and &lt;a href=&quot;http://www.4shared.com/zip/IL6cebb_/RC_Control_binaries.html&quot;&gt;binaries&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks for the guys who wrote the original linux and windows version.
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/678670492805536246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2012/04/controlling-your-rc-plane-from-computer_8337.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/678670492805536246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/678670492805536246'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2012/04/controlling-your-rc-plane-from-computer_8337.html' title=''/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEH0a8uEsSCt9l62R6OPpKEl8VX9W4lYpZHUSlFZqCIFsisxlZ94FwYUoXf8NA39Zdj3xdfAU1W3WMxo9LpbXXAiROIkM5Up1lBF6-c7gWaqWbT1G_Tppro32Ih4NYcG4hKcXfXlVQ3xHi/s72-c/RC+Control.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-999906212197085612.post-2913221468902545105</id><published>2012-03-25T11:12:00.000-07:00</published><updated>2012-09-09T13:52:08.429-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ATmega"/><category scheme="http://www.blogger.com/atom/ns#" term="expanding hobbyking"/><category scheme="http://www.blogger.com/atom/ns#" term="hobbyking control board"/><category scheme="http://www.blogger.com/atom/ns#" term="kkmulticopter"/><category scheme="http://www.blogger.com/atom/ns#" term="quadcopter"/><title type='text'>Quadrocopter Firmware (4 Rotor) Explained</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I just downloaded the code for my QuadCopter with hobbyking board from&amp;nbsp;&lt;a href=&quot;http://www.kkmulticopter.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=52:quadrocopter-firmware&amp;amp;catid=58:firmware-downloads&amp;amp;Itemid=65&quot; target=&quot;_blank&quot;&gt;http://www.kkmulticopter.com&lt;/a&gt;&amp;nbsp;.&lt;br /&gt;
I went through the code, and tried to understand each line as this is my first experience with ATmega&amp;nbsp;micro controllers.&lt;br /&gt;
&lt;br /&gt;
I simply downloaded a data sheet for ATmega &lt;a href=&quot;http://www.atmel.com/Images/doc8161.pdf&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&amp;nbsp;and went through the code line by line, it took me a while but I could understand it, it is not that complex.&lt;br /&gt;
&lt;br /&gt;
The code is the same as &lt;a href=&quot;http://www.kkmulticopter.com/downloads/firmware/QuadControllerV4_5.zip&quot; target=&quot;_blank&quot;&gt;the original&lt;/a&gt; I only added comments -alot of comments - so that the reader can understand what happens. a minor change i did is adding a function&amp;nbsp;&lt;i&gt;FlashLEDnTimes&lt;/i&gt; that is a replacement of code in many places.&lt;br /&gt;
&lt;br /&gt;
If you need to know what items exactly you need to build a quadcopter please check &lt;a href=&quot;http://technicaladventure.blogspot.com/2012/07/my-x-525-quadcopter.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;float: left; margin-right: 1em; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikHjSUMuVQWzubdz8fgCRtR6thQ-q5-IJWFpAhGJ_kbUV0zoK0O5zKDfqz7dlL5W2jtuaCmNZ5klNeOnP4WJMtRRZ02p1XEonfHO1qLcm3BxtYSOxu_jvW27BemxESfQMzcJLL_X7I8DDE/s1600/ADCComments.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;ADC routine after adding comments.&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikHjSUMuVQWzubdz8fgCRtR6thQ-q5-IJWFpAhGJ_kbUV0zoK0O5zKDfqz7dlL5W2jtuaCmNZ5klNeOnP4WJMtRRZ02p1XEonfHO1qLcm3BxtYSOxu_jvW27BemxESfQMzcJLL_X7I8DDE/s1600/ADCComments.JPG&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;ADC Routine Description&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;I also reviewed the board looking for extensions that we can connect &amp;nbsp;extra sensors to hobbyking board and I found the following ports are free:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Port B: &amp;nbsp;PB3,PB4, PB5.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Port D: PD0, PD4, PD5, PD6&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Below is the complete code:&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;overflow: auto;&quot;&gt;
&lt;pre style=&quot;background: #ffffff; color: black;&quot;&gt;&lt;span style=&quot;color: dimgrey;&quot;&gt;;-*- Quadrocopter (Quadrotor) Controller V4.5 -*-&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;-*-     All Code And Hardware Design         -*-&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;-*-      By Rolf R Bakke,  April, juli 2010  -*-&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; (I have not peeked in others projects or code :-)&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; Code is best viewed in monospace font and tab = 8&lt;/span&gt;


&lt;span style=&quot;color: dimgrey;&quot;&gt;; Added gyro direction reversing.&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; Added calibration delay.&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; Added potmeter reversing&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; Added stick scaling&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; Added Yaw command limiting&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; Changed gain pot scaling&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; Added arming/disarming&lt;/span&gt;




&lt;span style=&quot;color: dimgrey;&quot;&gt;;   View from above&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;;      Forward&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;;       M1,CW&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;         *&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;         |&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; M2,CCW  |   M3,CCW&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;   *-----+-----*&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;         |&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;         |&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;         *&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;       M4,CW&lt;/span&gt;





&lt;span style=&quot;color: dimgrey;&quot;&gt;;******************* SETTINGS **************************&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; This one determines the range of the gain potmeters.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; Reducing the value by one doubles the range.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; Increasing the value by one halves the range.&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    PotScaleRoll    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    PotScalePitch    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    PotScaleYaw    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;


&lt;span style=&quot;color: dimgrey;&quot;&gt;; This one determines the stick sensitivity.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; Reducing the value by one doubles the sensitivity.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; Increasing the value by one halves the sensitivity.&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    StickScaleRoll    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;11&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    StickScalePitch    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;11&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    StickScaleYaw    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;11&lt;/span&gt;


&lt;span style=&quot;color: dimgrey;&quot;&gt;; This one determines the maximum Yaw command applied, in percent.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; Less gives less yaw autority, but also less possibility of motor saturation.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; More gives more yaw autority, but also more possibility of motor saturation during full rudder stick.&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    YawLimit    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;30&lt;/span&gt;


&lt;span style=&quot;color: dimgrey;&quot;&gt;; This one should be set to the chip you are using.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; Atmega48  = &quot;m48def.inc&quot;&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; Atmega88  = &quot;m88def.inc&quot;&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; Atmega168 = &quot;m168def.inc&quot;&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; Atmega328 = &quot;m328def.inc&quot;&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;m48def.inc&quot;&lt;/span&gt;    

&lt;span style=&quot;color: dimgrey;&quot;&gt;;*******************************************************&lt;/span&gt;
    


&lt;span style=&quot;color: dimgrey;&quot;&gt;;---  16.16 bit signed registers ---&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    Temp                &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    RxInRoll            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    RxInPitch            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    RxInYaw                &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    RxInCollective        &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    RxChannel            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    GyroZeroRoll        &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    GyroZeroPitch        &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    GyroZeroYaw            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;11&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    MotorOut1            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;12&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    MotorOut2            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;13&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    MotorOut3            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;14&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    MotorOut4            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;15&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    GyroRoll            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;17&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    GyroPitch            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;18&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    GyroYaw                &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;19&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    GainInRoll            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;26&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    GainInPitch            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;27&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    GainInYaw            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;28&lt;/span&gt;



.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    B16_RegAdd&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0x0100&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;base address for the math library register array&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    B16_WorkAdd&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0x0200&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;base address for the math library work area&lt;/span&gt;


.def    RxChannel1StartL    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r0
.def    RxChannel1StartH    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r1

.def    RxChannel2StartL    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r2
.def    RxChannel2StartH    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r3

.def    RxChannel3StartL    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r4
.def    RxChannel3StartH    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r5
    
.def    RxChannel4StartL    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r6
.def    RxChannel4StartH    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r7

.def    RxChannel1L            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r8
.def    RxChannel1H            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r9

.def    RxChannel2L            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r1&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
.def    RxChannel2H            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r1&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;

.def    RxChannel3L            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r1&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
.def    RxChannel3H            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r1&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;

.def    RxChannel4L            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r1&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;
.def    RxChannel4H            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r1&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;



.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;     FlagGyroCalibrated    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;b16_workadd&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;24&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    RollGyroDirection    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;b16_workadd&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;26&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    PitchGyroDirection    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;b16_workadd&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;27&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    YawGyroDirection    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;b16_workadd&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;28&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    CalibrationDelayCounter    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;b16_workadd&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;29&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    PotReverser            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;b16_workadd&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;30&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    FlagFcArmed            &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;b16_workadd&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;31&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    CounterFcArm        &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;b16_workadd&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;32&lt;/span&gt;
.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    CounterFcDisarm        &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;b16_workadd&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;33&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;equ&lt;/span&gt;    FlagCollectiveZero    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;b16_workadd&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;34&lt;/span&gt;



.def    t&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r1&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;                &lt;span style=&quot;color: dimgrey;&quot;&gt;;Main temporary register&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;;r16,r17,r18,r19 is destroyed by the math lib&lt;/span&gt;


.def    counterl                &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r2&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
.def    counterh                &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r2&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;

.def    RxChannelsUpdatingFlag    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r2&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;ISR (do not read channels while this is true) &lt;/span&gt;

.def    tisp                    &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;r2&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;ISR temporary register&lt;/span&gt;

                    &lt;span style=&quot;color: dimgrey;&quot;&gt;;the registers marked ISR is not to be used for any other purpose &lt;/span&gt;

    


.&lt;span style=&quot;color: #004a43;&quot;&gt;macro&lt;/span&gt; led0_on            &lt;span style=&quot;color: dimgrey;&quot;&gt;;macros for the LED&#39;s&lt;/span&gt;
    sbi portb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;
.endmacro
.&lt;span style=&quot;color: #004a43;&quot;&gt;macro&lt;/span&gt; led0_off
    cbi portb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;
.endmacro
.&lt;span style=&quot;color: #004a43;&quot;&gt;macro&lt;/span&gt; led2_on
    sbi portd&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;
.endmacro
.&lt;span style=&quot;color: #004a43;&quot;&gt;macro&lt;/span&gt; led2_off
    cbi portd&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;
.endmacro
.&lt;span style=&quot;color: #004a43;&quot;&gt;macro&lt;/span&gt; led3_on
    sbi portd&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;
.endmacro
.&lt;span style=&quot;color: #004a43;&quot;&gt;macro&lt;/span&gt; led3_off
    cbi portd&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;
.endmacro


&lt;span style=&quot;color: dimgrey;&quot;&gt;; Motor-Out Ports/Pins&lt;/span&gt;
#define motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt; portb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;motor output pin assignments&lt;/span&gt;
#define motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt; portb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
#define motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt; portb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
#define motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt; portd&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;


.&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;1616mathlib_ram_macros_v1.asm&quot;&lt;/span&gt;

.&lt;span style=&quot;color: #004a43;&quot;&gt;org&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; ------------------------------------- Interrupt Table&lt;/span&gt;
#&lt;span style=&quot;color: #004a43;&quot;&gt;if&lt;/span&gt; defined&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;__ATmega48__&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt; defined&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;__ATmega88__&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
#message &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;rjmp&quot;&lt;/span&gt;
    rjmp reset
    rjmp RxChannel2
    rjmp RxChannel3
    rjmp RxChannel4
    rjmp unused
    rjmp RxChannel1
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused
    rjmp unused

#&lt;span style=&quot;color: #004a43;&quot;&gt;elif&lt;/span&gt; defined&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;__ATmega168__&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;|&lt;/span&gt; defined&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;__ATmega328__&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
#message &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;jmp&quot;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;reset&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;RxChannel2&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;IRQ 0 Handler&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;RxChannel3&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;IRQ 1 Handler&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;RxChannel4&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;PCINT0 Handler: will be triggered if any enabled PCINT07..0 pin toggles.&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;PCINT1 Handler: will be triggered if any enabled PCINT14..8 pin toggles.&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;RxChannel1&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;PCINT2 Handler: will be triggered if any enabled PCINT23..16 pin toggles.&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;jmp&lt;/span&gt; &lt;span style=&quot;color: #e34adc;&quot;&gt;unused&lt;/span&gt;
#&lt;span style=&quot;color: #004a43;&quot;&gt;else&lt;/span&gt;
#error &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;Unsupported part:&quot;&lt;/span&gt; __PART_NAME__
#&lt;span style=&quot;color: #004a43;&quot;&gt;endif&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; ------------------------------------- Interrupt Table END&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; ------------------------------------- Interrupt Handling Functions&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; -- Handle unused Intrrupts&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;unused:&lt;/span&gt;    
    reti

&lt;span style=&quot;color: dimgrey;&quot;&gt;; -- Handle Reset Intrrupt    &lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;reset:&lt;/span&gt;    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; -- Initialize Stack Pointer&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;low&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ramend&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;initalize stack pointer&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; spl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;high&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;ramend&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; sph&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t


    &lt;span style=&quot;color: dimgrey;&quot;&gt;; ------------ Setup IO&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; ------- Port B&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Motor 3    :    PB0-w&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Motor 2    :    PB1-w&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Motor 1    :    PB2-w&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; LED        :    PB6-w&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Rudder    :    PB7-r&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;1111111&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; ddrb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t 
    
    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; ------- Port C&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Gyro-Yaw    :    PC0-r ADC&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Gyro-Pitch:    PC1-r ADC        &lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Gyro-Roll    :    PC2-r ADC&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Gain-Roll    :    PC3-r ADC&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Gain-Pitch:    PC4-r ADC&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Gain-Yaw    :    PC5-r ADC&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b1&lt;span style=&quot;color: #008c00;&quot;&gt;1000000&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; ddrc&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; ------- Port D&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Motor 4    :    PD7-w&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Roll        :     PD1-r&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Pitch        :     PD2-r&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Throttle    :     PD3-r&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b1&lt;span style=&quot;color: #008c00;&quot;&gt;1110001&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; ddrd&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t    
    
    
    
    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; ------------ EOF Setup IO&lt;/span&gt;

    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;-- Setup pin change interrupt on PD1, PD2, PD3, PB4&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;&lt;/span&gt;
    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Bit(0) = 1 : Pin Change Interrupt is enabled [PCINT07..0 pin will cause an interrupt.]&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Bit(2) = 1 : Pin Change Interrupt is enabled [PCINT23..16 pin will cause an interrupt.]&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; PCMSK0 enables those pins individually.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000101&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;PB7, PB1&lt;/span&gt;
    sts pcicr&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    &lt;span style=&quot;color: dimgrey;&quot;&gt;; PCMSK0 enables those pins individually. [only PB7 makes interrupt]&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210    &lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b1&lt;span style=&quot;color: #008c00;&quot;&gt;0000000&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;PB7&lt;/span&gt;
    sts pcmsk0&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; PCMSK1 enables those pins individually. [only PD1 makes interrupt]&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; please note that PD2 &amp;amp; PD3 is handled throuhj INT0 &amp;amp; INT1 directly.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000010&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;PD1&lt;/span&gt;
    sts pcmsk2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    &lt;span style=&quot;color: dimgrey;&quot;&gt;; for INT0 bit [1,0]: value = 01: any logical change generate interrupt&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; either from high to low or from low to high. This is done to detect rising and falling edges.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; for INT0 bit [3,2]: value = 01: any logical change generate interrupt&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000101&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;PD2, PD3&lt;/span&gt;
    sts eicra&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Enable both INT0 &amp;amp; INT1&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000011&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;PD2, PD3&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; eimsk&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t        &lt;span style=&quot;color: dimgrey;&quot;&gt;;STS? OUT?  Come on!&lt;/span&gt;



    &lt;span style=&quot;color: dimgrey;&quot;&gt;;-- Setup timer1 to run at 1MHz ----&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; bits:     7        6      5        4        3        2       1      0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;        ICNC1 - ICES1 - NA - WGM13 - WGM12 - CS12 - CS11 - CS10&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; clkIO 1/8 From Prescaler&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000010&lt;/span&gt;
    sts tccr1b&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;-- Initalize variables ---&lt;/span&gt;

    clr t
    sts FlagGyroCalibrated&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t    &lt;span style=&quot;color: dimgrey;&quot;&gt;;FlagGyroCalibrated = false&lt;/span&gt;
    sts FlagFcArmed&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t            &lt;span style=&quot;color: dimgrey;&quot;&gt;;FlagFcArmed = false&lt;/span&gt;

    sts CounterFcArm&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    sts CounterFcDisarm&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    
    clr RxChannelsUpdatingFlag
    
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;low&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1520&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;prime the channels&lt;/span&gt;
    ldi xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;high&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1520&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; RxChannel1L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; RxChannel1H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xh
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; RxChannel2L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; RxChannel2H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xh
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; RxChannel3L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; RxChannel3H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xh
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; RxChannel4L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; RxChannel4H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xh


    sei &lt;span style=&quot;color: dimgrey;&quot;&gt;; enable interrupt&lt;/span&gt;

    led0_on                &lt;span style=&quot;color: dimgrey;&quot;&gt;;Flash LED once, I am alive!&lt;/span&gt;

    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
    rcall waitms

    led0_off

    ldi zh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;100&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;2 second delay&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;ca6:&lt;/span&gt;    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;200&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;delay of waitms = zl * 0.1ms &lt;/span&gt;
    rcall waitms
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;dec&lt;/span&gt; zh
    brne ca6





&lt;span style=&quot;color: dimgrey;&quot;&gt;;---- Gyro direction reversing ----&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;---- 1: Set roll gain pot to zero.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;---- 2: Turn on flight controller.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;---- 3: LED flashes rapidly 10 times.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;---- 4: Move the stick for the gyro you want to reverse.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;---- 5: LED will blink continually.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;---- 6: Turn off flight controller.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;---- 7: If there is more gyros to be reversed, goto step 2, else set roll gain pot back. &lt;/span&gt;

    rcall ReadGainPots
    rcall ReadGainPots

    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;51&lt;/span&gt;
    b16cmp GainInRoll&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brlt GyroDirectionReversing            &lt;span style=&quot;color: dimgrey;&quot;&gt;;enter gyro direction reversing?&lt;/span&gt;
    rjmp ca1

&lt;span style=&quot;color: #e34adc;&quot;&gt;GyroDirectionReversing:&lt;/span&gt;
    ldi counterl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;yes, flash led 10 times&lt;/span&gt;
    rcall FlashLEDnTimes




&lt;span style=&quot;color: #e34adc;&quot;&gt;ca5:&lt;/span&gt;    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;180&lt;/span&gt;
    rcall waitms

    rcall RxGetChannels

    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;30&lt;/span&gt;

    b16cmp RxInRoll&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp        &lt;span style=&quot;color: dimgrey;&quot;&gt;;Roll TX stick moved?&lt;/span&gt;
    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
    brge ca8

    b16cmp RxInPitch&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp        &lt;span style=&quot;color: dimgrey;&quot;&gt;;Pitch TX stick moved?&lt;/span&gt;
    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    brge ca8

    b16cmp RxInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp            &lt;span style=&quot;color: dimgrey;&quot;&gt;;Yaw TX stick moved?&lt;/span&gt;
    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
    brge ca8

    b16cmp RxInCollective&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp    &lt;span style=&quot;color: dimgrey;&quot;&gt;;Throttle TX stick moved?&lt;/span&gt;
    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;
    brge ca8

    rjmp ca5            &lt;span style=&quot;color: dimgrey;&quot;&gt;;no&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;ca8:&lt;/span&gt;    ldi zh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;yes, reverse direction&lt;/span&gt;
    rcall ReadEeprom

    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0x80&lt;/span&gt;
    eor t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xl                    

    rcall WriteEeprom        &lt;span style=&quot;color: dimgrey;&quot;&gt;;Store gyro direction to EEPROM&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;ca4:&lt;/span&gt;    led0_on                &lt;span style=&quot;color: dimgrey;&quot;&gt;;flash LED&lt;/span&gt;
    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
    rcall waitms
    led0_off
    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
    rcall waitms
    rjmp ca4



&lt;span style=&quot;color: dimgrey;&quot;&gt;;---- ESC Throttle range calibration. This outputs collective input to all motor outputs ---&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;---- This mode is entered by turning yaw gain pot to zero and turning on the flight controller. ---&lt;/span&gt;
    
&lt;span style=&quot;color: #e34adc;&quot;&gt;ca1:&lt;/span&gt;    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;51&lt;/span&gt;
    b16cmp GainInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brge Mainloop            &lt;span style=&quot;color: dimgrey;&quot;&gt;;enter ESC throttle range calibration?&lt;/span&gt;

    ldi counterl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;yes, flash led 10 times&lt;/span&gt;
    rcall FlashLEDnTimes

&lt;span style=&quot;color: #e34adc;&quot;&gt;ca3:&lt;/span&gt;    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;180&lt;/span&gt;
    rcall waitms

    rcall RxGetChannels

    b16mov MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxInCollective        &lt;span style=&quot;color: dimgrey;&quot;&gt;;output collective to all ESC&#39;s&lt;/span&gt;
    b16mov MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxInCollective
    b16mov MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxInCollective
    b16mov MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxInCollective
    rcall output_motor_ppm
    rjmp ca3                 &lt;span style=&quot;color: dimgrey;&quot;&gt;;do until the cows come home.&lt;/span&gt;




    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Main loop ---&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;Mainloop:&lt;/span&gt;    rcall GetGyroDirections

    rcall ReadGainPots

    rcall RxGetChannels


    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Arming/Disarming ---&lt;/span&gt;


    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;FlagCollectiveZero
    tst t
    breq ma8&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;

    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;-50&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;Disarm?&lt;/span&gt;
    b16cmp RxInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brge ma8&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;CounterFcDisarm
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;inc&lt;/span&gt; t
    sts CounterFcDisarm&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    cpi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;50&lt;/span&gt;
    brne ma8&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;

    clr t
    sts FlagFcArmed&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    rjmp ma8&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma81:&lt;/span&gt;    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;50&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;Arm?&lt;/span&gt;
    b16cmp RxInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brlt ma8&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;CounterFcArm
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;inc&lt;/span&gt; t
    sts CounterFcArm&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    cpi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;50&lt;/span&gt;
    brne ma8&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;

    ser t
    sts FlagFcArmed&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma80:&lt;/span&gt;    clr t
    sts CounterFcDisarm&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; t
    sts CounterFcArm&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma82:&lt;/span&gt;    


    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Calibrate gyro when collective below 1% ---&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;FlagCollectiveZero
    tst t
    brne ma1&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;                    &lt;span style=&quot;color: dimgrey;&quot;&gt;;collective below 1% ?&lt;/span&gt;
    rjmp ma4

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma12:&lt;/span&gt;    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;CalibrationDelayCounter            &lt;span style=&quot;color: dimgrey;&quot;&gt;;yes, increase delay counter&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;inc&lt;/span&gt; t
    breq ma5&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;                    &lt;span style=&quot;color: dimgrey;&quot;&gt;;delay reached 256?&lt;/span&gt;
    
    sts CalibrationDelayCounter&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t            &lt;span style=&quot;color: dimgrey;&quot;&gt;;no, skip calibration.&lt;/span&gt;
    rjmp ma5&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma50:&lt;/span&gt;    b16clr GyroZeroRoll                &lt;span style=&quot;color: dimgrey;&quot;&gt;;yes, set gyro zero value (average of 16 readings)&lt;/span&gt;
    b16clr GyroZeroPitch
    b16clr GyroZeroYaw

    ldi counterl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;16&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma20:&lt;/span&gt;    rcall ReadGyros

    b16add GyroZeroRoll&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; GyroRoll
    b16add GyroZeroPitch&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; GyroPitch
    b16add GyroZeroYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; GyroYaw

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;dec&lt;/span&gt; counterl
    brne ma2&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;

    b16load GyroZeroRoll                &lt;span style=&quot;color: dimgrey;&quot;&gt;;divide by 16&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;
    rcall FastDivide
    b16store GyroZeroRoll

    b16load GyroZeroPitch                &lt;span style=&quot;color: dimgrey;&quot;&gt;;divide by 16&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;
    rcall FastDivide
    b16store GyroZeroPitch

    b16load GyroZeroYaw                &lt;span style=&quot;color: dimgrey;&quot;&gt;;divide by 16&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;
    rcall FastDivide
    b16store GyroZeroYaw

    ser t
    sts FlagGyroCalibrated&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t            &lt;span style=&quot;color: dimgrey;&quot;&gt;;FlagGyroCalibrated = true&lt;/span&gt;
    
    sts CalibrationDelayCounter&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t    

    rjmp ma5&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
            
&lt;span style=&quot;color: #e34adc;&quot;&gt;ma4:&lt;/span&gt;    clr t                        &lt;span style=&quot;color: dimgrey;&quot;&gt;;no, skip calibration, reset calibration delay&lt;/span&gt;
    sts CalibrationDelayCounter&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma51:&lt;/span&gt;




    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Read gyros ---&lt;/span&gt;


    rcall ReadGyros
    
    b16sub GyroRoll&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; GyroZeroRoll            &lt;span style=&quot;color: dimgrey;&quot;&gt;;remove offset from gyro output&lt;/span&gt;
    b16sub GyroPitch&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; GyroZeroPitch
    b16sub GyroYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; GyroZeroYaw
 

&lt;span style=&quot;color: dimgrey;&quot;&gt;;rcall ShowChannels&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;rcall ShowGyros&lt;/span&gt;


    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Start mixing by setting collective to motor input 1,2,3 and 4 ---&lt;/span&gt;

    b16mov MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxInCollective
    b16mov MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxInCollective
    b16mov MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxInCollective
    b16mov MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxInCollective



    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Calculate roll command output ---&lt;/span&gt;

    b16load GainInRoll                &lt;span style=&quot;color: dimgrey;&quot;&gt;;scale gyro output&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; PotScaleRoll
    rcall FastDivide                &lt;span style=&quot;color: dimgrey;&quot;&gt;;  divide by 2^t&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RollGyroDirection
    tst t
    brpl ma6&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
    
    rcall NegateXY

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma60:&lt;/span&gt;    b16store Temp

    b16mul GyroRoll&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp    

    
    b16load GainInRoll                &lt;span style=&quot;color: dimgrey;&quot;&gt;;scale stick output&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; StickScaleRoll
    rcall FastDivide                &lt;span style=&quot;color: dimgrey;&quot;&gt;;  divide by 2^t&lt;/span&gt;
    b16store Temp

    b16mul RxInRoll&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp


    b16add RxInRoll&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; GyroRoll            &lt;span style=&quot;color: dimgrey;&quot;&gt;;add gyro output to stick output&lt;/span&gt;


    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Add roll command output to motor 2 and 3 ---&lt;/span&gt;

    b16add MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxInRoll
    b16sub MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxInRoll



    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Calculate pitch command output ---&lt;/span&gt;

    b16load GainInPitch                &lt;span style=&quot;color: dimgrey;&quot;&gt;;scale gyro output&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; PotScalePitch
    rcall FastDivide                &lt;span style=&quot;color: dimgrey;&quot;&gt;;  divide by 2^t&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; PitchGyroDirection
    tst t
    brpl ma6&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    
    rcall NegateXY

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma61:&lt;/span&gt;    b16store Temp

    b16mul GyroPitch&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp    

    
    b16load GainInPitch                &lt;span style=&quot;color: dimgrey;&quot;&gt;;scale stick output&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; StickScalePitch
    rcall FastDivide                &lt;span style=&quot;color: dimgrey;&quot;&gt;;  divide by 2^t&lt;/span&gt;
    b16store Temp

    b16mul RxInPitch&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp


    b16add RxInPitch&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; GyroPitch            &lt;span style=&quot;color: dimgrey;&quot;&gt;;add gyro output to stick output&lt;/span&gt;


    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Add pitch command output to motor 1 and 4 ---&lt;/span&gt;

    b16add MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxInPitch
    b16sub MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxInPitch



    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Calculate yaw command output ---&lt;/span&gt;

    b16load GainInYaw                &lt;span style=&quot;color: dimgrey;&quot;&gt;;scale gyro output&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; PotScaleYaw
    rcall FastDivide                &lt;span style=&quot;color: dimgrey;&quot;&gt;;  divide by 2^t&lt;/span&gt;
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; YawGyroDirection
    tst t
    brpl ma6&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
    
    rcall NegateXY

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma62:&lt;/span&gt;    b16store Temp

    b16mul GyroYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp    

    
    b16load GainInYaw                &lt;span style=&quot;color: dimgrey;&quot;&gt;;scale stick output&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; StickScaleYaw
    rcall FastDivide                &lt;span style=&quot;color: dimgrey;&quot;&gt;;  divide by 2^t&lt;/span&gt;
    b16store Temp

    b16mul RxInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp


    b16add RxInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; GyroYaw                &lt;span style=&quot;color: dimgrey;&quot;&gt;;add gyro output to stick output&lt;/span&gt;


    
    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;-&lt;/span&gt;YawLimit                &lt;span style=&quot;color: dimgrey;&quot;&gt;;limit Yaw command to -YawLimit and YawLimit&lt;/span&gt;
    b16cmp RxInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp
    brge ma9&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
    b16mov RxInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma90:&lt;/span&gt;    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Yawlimit
    b16cmp RxInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp
    brlt ma9&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    b16mov RxInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp
&lt;span style=&quot;color: #e34adc;&quot;&gt;ma91:&lt;/span&gt;

    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Add yaw command output to motor 1,2,3 and 4 ---&lt;/span&gt;

    b16sub MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxInYaw
    b16add MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxInYaw
    b16add MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxInYaw
    b16sub MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxInYaw



    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Limit the lowest value to avoid stopping of motor if motor value is under-saturated ---&lt;/span&gt;

    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;10&lt;/span&gt;       &lt;span style=&quot;color: dimgrey;&quot;&gt;;this is the motor idle level&lt;/span&gt;

    b16cmp MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp
    brge ma4&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
    b16mov MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma40:&lt;/span&gt;    b16cmp MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp
    brge ma4&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    b16mov MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma41:&lt;/span&gt;    b16cmp MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp
    brge ma4&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
    b16mov MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma42:&lt;/span&gt;    b16cmp MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp
    brge ma4&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;
    b16mov MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma43:&lt;/span&gt;


    &lt;span style=&quot;color: dimgrey;&quot;&gt;;---- Update Status LED ----&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; FlagGyroCalibrated        &lt;span style=&quot;color: dimgrey;&quot;&gt;;LED on if (FlagGyroCalibrated &amp;amp;&amp;amp; FlagFcArmed) true&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; yl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; FlagFcArmed
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;and&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; yl
    brne ma7
    led0_off
    rjmp OutputToMotorESC
&lt;span style=&quot;color: #e34adc;&quot;&gt;ma7:&lt;/span&gt;    led0_on        


&lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Output to motor ESC&#39;s ---&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;OutputToMotorESC:&lt;/span&gt;


    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;FlagCollectiveZero        &lt;span style=&quot;color: dimgrey;&quot;&gt;;turn on motors if (FlagGyroCalibrated &amp;amp;&amp;amp; FlagFcArmed &amp;amp;&amp;amp; !FlagCollectiveZero) true&lt;/span&gt;
    com t
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;and&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    brne ma6

    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;                &lt;span style=&quot;color: dimgrey;&quot;&gt;;set motor 1-4 to zero&lt;/span&gt;
    b16mov MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    b16mov MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    b16mov MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    b16mov MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp

&lt;span style=&quot;color: #e34adc;&quot;&gt;ma6:&lt;/span&gt;    rcall output_motor_ppm            &lt;span style=&quot;color: dimgrey;&quot;&gt;;output ESC signal&lt;/span&gt;

    rjmp Mainloop


    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- End of main loop ---&lt;/span&gt;


    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Subroutines ---&lt;/span&gt;


&lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Output motor ppm channels 1-4 in parallell --- &lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Input is 0 to 100 part #1&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Trim if greater than 100 ot less than 0.&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;output_motor_ppm:&lt;/span&gt;

    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;limit to zero&lt;/span&gt;
    b16cmp MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brge ou1
    b16mov MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
&lt;span style=&quot;color: #e34adc;&quot;&gt;ou1:&lt;/span&gt;
    b16cmp MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brge ou2
    b16mov MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
&lt;span style=&quot;color: #e34adc;&quot;&gt;ou2:&lt;/span&gt;
    b16cmp MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brge ou3
    b16mov MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
&lt;span style=&quot;color: #e34adc;&quot;&gt;ou3:&lt;/span&gt;
    b16cmp MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brge ou4
    b16mov MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
&lt;span style=&quot;color: #e34adc;&quot;&gt;ou4:&lt;/span&gt;

    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;100&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;limit to 100&lt;/span&gt;
    b16cmp MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brlt ou5
    b16mov MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
&lt;span style=&quot;color: #e34adc;&quot;&gt;ou5:&lt;/span&gt;
    b16cmp MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brlt ou6
    b16mov MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
&lt;span style=&quot;color: #e34adc;&quot;&gt;ou6:&lt;/span&gt;
    b16cmp MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brlt ou7
    b16mov MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
&lt;span style=&quot;color: #e34adc;&quot;&gt;ou7:&lt;/span&gt;
    b16cmp MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brlt ou8
    b16mov MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
&lt;span style=&quot;color: #e34adc;&quot;&gt;ou8:&lt;/span&gt;

    
    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;100&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;add 1ms to all channels&lt;/span&gt;
    b16add MotorOut1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    b16add MotorOut2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    b16add MotorOut3&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    b16add MotorOut4&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp


    b16load MotorOut1        &lt;span style=&quot;color: dimgrey;&quot;&gt;;scale from 0-200 to 0-800 (multiply by 4)&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
    rcall FastMultiply
    b16store MotorOut1

    b16load MotorOut2
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
    rcall FastMultiply
    b16store MotorOut2

    b16load MotorOut3
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
    rcall FastMultiply
    b16store MotorOut3

    b16load MotorOut4
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
    rcall FastMultiply
    b16store MotorOut4


    b16load MotorOut4        &lt;span style=&quot;color: dimgrey;&quot;&gt;;transfer to 16bit counters&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; xh
    b16load MotorOut3        
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; xh
    b16load MotorOut2        
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; xh
    b16load MotorOut1        
    movw r2&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;r2&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xh&lt;span style=&quot;color: #808030;&quot;&gt;:&lt;/span&gt;xl

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; r2&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; r2&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; r2&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; r2&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; r3&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; r3&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;

    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Output Signals to ESC actual part #2&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Send &quot;1s&quot;  to all ESC.&lt;/span&gt;
    sbi motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;turn on pins&lt;/span&gt;
    sbi motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
    sbi motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;
    sbi motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;

    clr t
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- This is the total length of  square pulse sent to ESC.&lt;/span&gt;
    ldi counterl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;low&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;801&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    ldi counterh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;high&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;801&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;

    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Output Signals to ESC actual part #3&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- This is the monitor and control part: it keep watching the length of the &quot;on&quot; signal for each motor.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- The main logic is that there is a big loop that includes all motors.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- All pins are on, and each pin &quot;motor&quot; has its own Registry [R25,R26,R27,R28,R29,R30,R31] that &lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- defines the positive duration of the pulse &quot;duty cycle&quot;.&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;lbl_MotorOutPin1:&lt;/span&gt;    
    subi r2&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;                &lt;span style=&quot;color: dimgrey;&quot;&gt;;20 cycles (1ms = 400 counts)&lt;/span&gt;
    sbc r2&lt;span style=&quot;color: #008c00;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    brcc lbl_MotorOutPin2    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Have we reached the end of the &quot;on&quot; part; no then check the next ESC.&lt;/span&gt;
    cbi motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;; if yes then output &quot;0&quot;.&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;lbl_MotorOutPin2:&lt;/span&gt;    
    subi r2&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    sbc r2&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    brcc lbl_MotorOutPin3
    cbi motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;lbl_MotorOutPin3:&lt;/span&gt;
    subi r2&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    sbc r2&lt;span style=&quot;color: #008c00;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    brcc lbl_MotorOutPin4
    cbi motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;lbl_MotorOutPin4:&lt;/span&gt;    
    subi r3&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    sbc r3&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    brcc lbl_MotorOutPin5
    cbi motor_out_pin_&lt;span style=&quot;color: #008c00;&quot;&gt;4&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;lbl_MotorOutPin5:&lt;/span&gt;    
    subi counterl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    sbc counterh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    brcc lbl_MotorOutPin1    &lt;span style=&quot;color: dimgrey;&quot;&gt;; hefny:L continue go to first motor.&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;    





&lt;span style=&quot;color: dimgrey;&quot;&gt;;--- function: Read ADC&#39;s ---&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;ReadGyros:&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Digital Input Disable Registers (DIDR)&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; To reduce power by diable Digital Inpurt Register.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Correspondent digital pins will read Zero when diable DIR.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Bits:  7 - 6  -   5    -    4    -    3    -    2    -    1    -    0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;        NA - NA - ADC5D - ADC4D - ADC3D - ADC2D - ADC1D - ADC0D&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0111111&lt;/span&gt;
    sts didr0&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t &lt;span style=&quot;color: dimgrey;&quot;&gt;; Digital Input Disable Registers (DIDR)&lt;/span&gt;

    &lt;span style=&quot;color: dimgrey;&quot;&gt;; ADCSRB: ADC Control &amp;amp; Status Register B&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Enable ADC0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Bits:        7  -   6  -  5 - 4 -  3  -   2   -   1   -   0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;            NA - ACME - NA - NA - NA - ADTS2 - ADTS1 - ADTS0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;     ACME [0]: select the negative input of the Analog Comparator.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;    ADTS2 - ADTS1 - ADTS0 [0,0,0]: means Free Running Mode.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;                                 however [ADATE] is clearned so they have no effect here.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000000&lt;/span&gt;
    sts adcsrb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Enable ADC2&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210    ;read roll&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000010&lt;/span&gt;
    rcall read_adc
    b16store GyroRoll
    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Enable ADC1&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210    ;read pitch&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000001&lt;/span&gt;
    rcall read_adc
    b16store GyroPitch

    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Enable ADC0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210    ;read yaw&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000000&lt;/span&gt;
    rcall read_adc
    b16store GyroYaw

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;



&lt;span style=&quot;color: #e34adc;&quot;&gt;ReadGainPots:&lt;/span&gt;

    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;get PotReverser from EEPROM&lt;/span&gt;
    ldi zh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
    rcall ReadEeprom
    sts PotReverser&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t


    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Digital Input Disable Registers (DIDR)&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; To reduce power by diable Digital Inpurt Register.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Correspondent digital pins will read Zero when diable DIR.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Bits:  7 - 6  -   5    -    4    -    3    -    2    -    1    -    0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;        NA - NA - ADC5D - ADC4D - ADC3D - ADC2D - ADC1D - ADC0D&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0111111&lt;/span&gt;
    sts didr0&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    &lt;span style=&quot;color: dimgrey;&quot;&gt;; ADCSRB: ADC Control &amp;amp; Status Register B&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Enable ADC0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Bits:        7  -   6  -  5 - 4 -  3  -   2   -   1   -   0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;            NA - ACME - NA - NA - NA - ADTS2 - ADTS1 - ADTS0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;     ACME [0]: select the negative input of the Analog Comparator.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;    ADTS2 - ADTS1 - ADTS0 [0,0,0]: means Free Running Mode.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;                                 however [ADATE] is clearned so they have no effect here.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000000&lt;/span&gt;
    sts adcsrb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t


    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Enable ADC3&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210    ;read roll gain&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000011&lt;/span&gt;
    rcall read_adc

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;PotReverser
    tst t
    brmi ga1
    rcall invert
&lt;span style=&quot;color: #e34adc;&quot;&gt;ga1:&lt;/span&gt;    b16store GainInRoll

    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210    ;read pitch gain&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000100&lt;/span&gt;
    rcall read_adc

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;PotReverser
    tst t
    brmi ga2
    rcall invert
&lt;span style=&quot;color: #e34adc;&quot;&gt;ga2:&lt;/span&gt;    b16store GainInPitch

    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210    ;read yaw gain&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000101&lt;/span&gt;
    rcall read_adc

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;PotReverser
    tst t
    brmi ga3
    rcall invert
&lt;span style=&quot;color: #e34adc;&quot;&gt;ga3:&lt;/span&gt;    b16store GainInYaw
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;invert:&lt;/span&gt;    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0x03&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;Invert X&lt;/span&gt;
    eor xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0xff&lt;/span&gt;
    eor xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;


&lt;span style=&quot;color: #e34adc;&quot;&gt;read_adc:&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;x = adc    y = 0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; ADMUX: ADC Multiplexer Selection Register.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Bits:&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;        REFS1 - REFS0 - ADLAR - NA - MUX3 - MUX2 - MUX1 - MUX0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; for REFS1 - REFS0 [0,0]: means use AREF, Internal Vref &amp;amp; AVCC both are turned off.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; MUX2..0: selects ADC number.&lt;/span&gt;
    sts admux&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t        &lt;span style=&quot;color: dimgrey;&quot;&gt;;set ADC channel&lt;/span&gt;
    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; ADCSRA: ADC Control &amp;amp; Status Register.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Bits:&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;    ADEN - ADSC - ADATE - ADIF - ADIE - ADPES2 - ADPS1 - ADPS0&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;   ADCEnable : on&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;    ADSC: on - start reading . if done with ADEN then it takes 25 cycle instead of 13 &lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;          and first conversion pefromes initialization of the ADC.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;    ADATE &quot;auto trigger enables&quot; : off &lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;   ADIF &quot;ADC interrupt Flag&quot; : off&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;   ADIE &quot;ADC Interrupt Enable&quot; : off&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;   ADPS2..0: &quot;ADC Prescale Select Bits&quot; : division factor = 64.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b1&lt;span style=&quot;color: #008c00;&quot;&gt;1000110&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;start ADC&lt;/span&gt;
    sts adcsra&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

&lt;span style=&quot;color: #e34adc;&quot;&gt;re1:&lt;/span&gt;    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; ADSC turns back to zero when reading is finished.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;; Setting ADEN to zero while this loop will terminate the conversion process.&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;adcsra        &lt;span style=&quot;color: dimgrey;&quot;&gt;;wait for ADC to complete.&lt;/span&gt;
    sbrc t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;6&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;is ADSC is ZERO&lt;/span&gt;
    rjmp re1

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;adcl        &lt;span style=&quot;color: dimgrey;&quot;&gt;;read ADC Data High &amp;amp; Low ADC Data Register.&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;adch

    clr yl
    clr yh

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;





&lt;span style=&quot;color: dimgrey;&quot;&gt;;--- function: wait for n ms.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;--- wait time = zl * 0.1 ms&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;waitms:&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;wait zl * 0.1ms&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;199&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;wa1:&lt;/span&gt;    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;dec&lt;/span&gt; t
    brne wa1
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;dec&lt;/span&gt; zl
    brne waitms
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;





    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Read RX channels 1-4, pin change interrupt driven ---&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;these have to be fast as possible to minimize jitter in loop timed events&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;RxChannel1:&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_on&lt;/span&gt;
    ser RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;in&lt;/span&gt; tisp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; sreg

    sbis pind&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;                &lt;span style=&quot;color: dimgrey;&quot;&gt;;rising or falling?&lt;/span&gt;
    rjmp rx1m1


    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel1StartL&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1l        &lt;span style=&quot;color: dimgrey;&quot;&gt;;rising, store the start value&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel1StartH&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1h

    clr RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; sreg&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;tisp                &lt;span style=&quot;color: dimgrey;&quot;&gt;;exit    &lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_off&lt;/span&gt;
    reti


&lt;span style=&quot;color: #e34adc;&quot;&gt;rx1m1:&lt;/span&gt;    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel1L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1l            &lt;span style=&quot;color: dimgrey;&quot;&gt;;falling, calculate the pulse length&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel1H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1h

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;sub&lt;/span&gt; RxChannel1L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxChannel1StartL
    sbc RxChannel1H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxChannel1StartH

    clr RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; sreg&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;tisp                &lt;span style=&quot;color: dimgrey;&quot;&gt;;exit    &lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_off&lt;/span&gt;
    reti


&lt;span style=&quot;color: #e34adc;&quot;&gt;RxChannel2:&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_on&lt;/span&gt;
    ser RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;in&lt;/span&gt; tisp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; sreg

    sbis pind&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;                &lt;span style=&quot;color: dimgrey;&quot;&gt;;rising or falling?&lt;/span&gt;
    rjmp rx2m1


    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel2StartL&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1l        &lt;span style=&quot;color: dimgrey;&quot;&gt;;rising, store the start value&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel2StartH&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1h

    clr RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; sreg&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;tisp                &lt;span style=&quot;color: dimgrey;&quot;&gt;;exit    &lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_off&lt;/span&gt;
    reti


&lt;span style=&quot;color: #e34adc;&quot;&gt;rx2m1:&lt;/span&gt;    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel2L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1l            &lt;span style=&quot;color: dimgrey;&quot;&gt;;falling, calculate the pulse length&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel2H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1h

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;sub&lt;/span&gt; RxChannel2L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxChannel2StartL
    sbc RxChannel2H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxChannel2StartH

    clr RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; sreg&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;tisp                &lt;span style=&quot;color: dimgrey;&quot;&gt;;exit    &lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_off&lt;/span&gt;
    reti



&lt;span style=&quot;color: #e34adc;&quot;&gt;RxChannel3:&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_on&lt;/span&gt;
    ser RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;in&lt;/span&gt; tisp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; sreg

    sbis pind&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;                &lt;span style=&quot;color: dimgrey;&quot;&gt;;rising or falling?&lt;/span&gt;
    rjmp rx3m1


    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel3StartL&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1l        &lt;span style=&quot;color: dimgrey;&quot;&gt;;rising, store the start value&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel3StartH&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1h

    clr RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; sreg&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;tisp                &lt;span style=&quot;color: dimgrey;&quot;&gt;;exit    &lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_off&lt;/span&gt;
    reti


&lt;span style=&quot;color: #e34adc;&quot;&gt;rx3m1:&lt;/span&gt;    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel3L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1l            &lt;span style=&quot;color: dimgrey;&quot;&gt;;falling, calculate the pulse length&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel3H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1h

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;sub&lt;/span&gt; RxChannel3L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxChannel3StartL
    sbc RxChannel3H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxChannel3StartH

    clr RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; sreg&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;tisp                &lt;span style=&quot;color: dimgrey;&quot;&gt;;exit    &lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_off&lt;/span&gt;
    reti



&lt;span style=&quot;color: #e34adc;&quot;&gt;RxChannel4:&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_on&lt;/span&gt;
    ser RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;in&lt;/span&gt; tisp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; sreg

    sbis pinb&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;7&lt;/span&gt;                &lt;span style=&quot;color: dimgrey;&quot;&gt;;rising or falling?&lt;/span&gt;
    rjmp rx4m1


    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel4StartL&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1l        &lt;span style=&quot;color: dimgrey;&quot;&gt;;rising, store the start value&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel4StartH&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1h

    clr RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; sreg&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;tisp                &lt;span style=&quot;color: dimgrey;&quot;&gt;;exit    &lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_off&lt;/span&gt;
    reti

&lt;span style=&quot;color: dimgrey;&quot;&gt;; ------------------------------------- EOF Interrupt Handling Functions&lt;/span&gt;


&lt;span style=&quot;color: #e34adc;&quot;&gt;rx4m1:&lt;/span&gt;    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel4L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1l            &lt;span style=&quot;color: dimgrey;&quot;&gt;;falling, calculate the pulse length&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lds&lt;/span&gt; RxChannel4H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; tcnt1h

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;sub&lt;/span&gt; RxChannel4L&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxChannel4StartL
    sbc RxChannel4H&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; RxChannel4StartH

    clr RxChannelsUpdatingFlag

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; sreg&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;tisp                &lt;span style=&quot;color: dimgrey;&quot;&gt;;exit    &lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;;led2_off&lt;/span&gt;
    reti




    
    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Get and scale RX channel inputs ---&lt;/span&gt;


&lt;span style=&quot;color: #e34adc;&quot;&gt;RxGetChannels:&lt;/span&gt;
    tst RxChannelsUpdatingFlag    &lt;span style=&quot;color: dimgrey;&quot;&gt;;channel 1 (Roll)    &lt;/span&gt;
    brne RxGetChannels

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel1L
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel1H

    rcall XAbs

    clr yl
    clr yh
    b16store RxChannel

    rcall ScaleMinus100To1&lt;span style=&quot;color: #008c00;&quot;&gt;00&lt;/span&gt;

    b16mov RxInRoll&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel



&lt;span style=&quot;color: #e34adc;&quot;&gt;c2:&lt;/span&gt;    tst RxChannelsUpdatingFlag    &lt;span style=&quot;color: dimgrey;&quot;&gt;;channel 2 (Pitch)    &lt;/span&gt;
    brne c2

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel2L
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel2H

    rcall XAbs

    clr yl
    clr yh
    b16store RxChannel

    rcall ScaleMinus100To1&lt;span style=&quot;color: #008c00;&quot;&gt;00&lt;/span&gt;

    b16mov RxInPitch&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel



&lt;span style=&quot;color: #e34adc;&quot;&gt;c3:&lt;/span&gt;    tst RxChannelsUpdatingFlag    &lt;span style=&quot;color: dimgrey;&quot;&gt;;channel 3 (Collective)    &lt;/span&gt;
    brne c3

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel3L
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel3H

    rcall XAbs

    clr yl
    clr yh
    b16store RxChannel

    rcall Scale0To1&lt;span style=&quot;color: #008c00;&quot;&gt;00&lt;/span&gt;

    b16mov RxInCollective&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel



&lt;span style=&quot;color: #e34adc;&quot;&gt;c4:&lt;/span&gt;    tst RxChannelsUpdatingFlag    &lt;span style=&quot;color: dimgrey;&quot;&gt;;channel 4 (Yaw)    &lt;/span&gt;
    brne c4

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel4L
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel4H

    rcall XAbs

    clr yl
    clr yh
    b16store RxChannel

    rcall ScaleMinus100To1&lt;span style=&quot;color: #008c00;&quot;&gt;00&lt;/span&gt;

    b16mov RxInYaw&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;RxChannel

    

    clr t                &lt;span style=&quot;color: dimgrey;&quot;&gt;;Set FlagCollectiveZero true if collective is &amp;lt; 1&lt;/span&gt;
    sts FlagCollectiveZero&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    b16cmp RxInCollective&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;Temp
    brge c5

    ser t
    sts FlagCollectiveZero&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

&lt;span style=&quot;color: #e34adc;&quot;&gt;c5:&lt;/span&gt;    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;



&lt;span style=&quot;color: #e34adc;&quot;&gt;XAbs:&lt;/span&gt;    tst xh        &lt;span style=&quot;color: dimgrey;&quot;&gt;;X = ABS(X)&lt;/span&gt;
    brpl xa1

    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0xff&lt;/span&gt;
    eor xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    eor xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;add&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t
    clr t
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;adc&lt;/span&gt; xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

&lt;span style=&quot;color: #e34adc;&quot;&gt;xa1:&lt;/span&gt;    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;


&lt;span style=&quot;color: #e34adc;&quot;&gt;ScaleMinus100To100:&lt;/span&gt;
    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1520&lt;/span&gt;
    b16sub RxChannel&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp
    b16load RxChannel    &lt;span style=&quot;color: dimgrey;&quot;&gt;;divide RxChannel by 4&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;
    rcall FastDivide
    b16store RxChannel
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;


&lt;span style=&quot;color: #e34adc;&quot;&gt;Scale0To100:&lt;/span&gt;
    b16ldi Temp&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1120&lt;/span&gt;
    b16sub RxChannel&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; Temp
    brcc sc1
    b16ldi RxChannel&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;sc1:&lt;/span&gt;    b16load RxChannel    &lt;span style=&quot;color: dimgrey;&quot;&gt;;divide RxChannel by 8&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;3&lt;/span&gt;
    rcall FastDivide
    b16store RxChannel
    
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;



&lt;span style=&quot;color: #e34adc;&quot;&gt;FastDivide:&lt;/span&gt;
    asr xh        &lt;span style=&quot;color: dimgrey;&quot;&gt;;X.Y Fast divide by 2n&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ror&lt;/span&gt; xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ror&lt;/span&gt; yh
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ror&lt;/span&gt; yl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;dec&lt;/span&gt; t
    brne Fastdivide
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;


&lt;span style=&quot;color: #e34adc;&quot;&gt;FastMultiply:&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;lsl&lt;/span&gt; yl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;rol&lt;/span&gt; yh
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;rol&lt;/span&gt; xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;rol&lt;/span&gt; xh
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;dec&lt;/span&gt; t
    brne FastMultiply
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;



&lt;span style=&quot;color: #e34adc;&quot;&gt;ReadEeprom:&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; eearl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;zl    &lt;span style=&quot;color: dimgrey;&quot;&gt;;(Z) -&amp;gt; t&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;0x22&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;zh

    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0x01&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; eecr&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;in&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; eedr
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;


&lt;span style=&quot;color: #e34adc;&quot;&gt;WriteEeprom:&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;cli&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;t -&amp;gt; (Z)&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;wr1:&lt;/span&gt;    sbic eecr&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
    rjmp wr1

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; eearl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;zl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;0x22&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;zh

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; eedr&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000100&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; eecr&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    &lt;span style=&quot;color: dimgrey;&quot;&gt;;       76543210&lt;/span&gt;
    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;0b0&lt;span style=&quot;color: #008c00;&quot;&gt;0000010&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;out&lt;/span&gt; eecr&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    sei

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;


&lt;span style=&quot;color: #e34adc;&quot;&gt;GetGyroDirections:&lt;/span&gt;
    clr zl                &lt;span style=&quot;color: dimgrey;&quot;&gt;;Get roll gyro directions from EEPROM&lt;/span&gt;
    clr zh
    rcall ReadEeprom
    sts RollGyroDirection&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;Get pitch gyro directions from EEPROM&lt;/span&gt;
    clr zh
    rcall ReadEeprom
    sts PitchGyroDirection&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;            &lt;span style=&quot;color: dimgrey;&quot;&gt;;Get yaw gyro directions from EEPROM&lt;/span&gt;
    clr zh
    rcall ReadEeprom
    sts YawGyroDirection&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;t

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;


&lt;span style=&quot;color: #e34adc;&quot;&gt;NegateXY:&lt;/span&gt; clr t                &lt;span style=&quot;color: dimgrey;&quot;&gt;;Negate X:Y&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;sub&lt;/span&gt; t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; yl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; yl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; t

    clr t
    sbc t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; yh
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; yh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; t

    clr t
    sbc t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; t

    clr t
    sbc t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; xh
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; t

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;

&lt;span style=&quot;color: dimgrey;&quot;&gt;; -- function: flash LED n times.    &lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;; -- counterl is number of flashes&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;FlashLEDnTimes:&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;lblFlashLEDnTimes:&lt;/span&gt;    
    led0_on
    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
    rcall waitms
    led0_off
    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;
    rcall waitms
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;dec&lt;/span&gt; counterl
    brne lblFlashLEDnTimes
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;

    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Debug: ----&lt;/span&gt;
&lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;ShowGyros:&lt;/span&gt;
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0x0d&lt;/span&gt;
    rcall SerbyteOut

    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0x0a&lt;/span&gt;
    rcall SerbyteOut


    b16load GyroRoll
    rcall B1616Out
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;
    rcall SerByteOut

    b16load GyroPitch
    rcall B1616Out
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;
    rcall SerByteOut

    b16load GyroYaw
    rcall B1616Out
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;
    rcall SerByteOut

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;



&lt;span style=&quot;color: #e34adc;&quot;&gt;ShowChannels:&lt;/span&gt;
    
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0x0d&lt;/span&gt;
    rcall SerbyteOut

    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0x0a&lt;/span&gt;
    rcall SerbyteOut


    b16load RxInRoll
    rcall B1616Out
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;
    rcall SerByteOut

    b16load RxInPitch
    rcall B1616Out
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;
    rcall SerByteOut

    b16load RxInCollective
    rcall B1616Out
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;
    rcall SerByteOut

    b16load RxInYaw
    rcall B1616Out
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39; &#39;&lt;/span&gt;
    rcall SerByteOut

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;




&lt;span style=&quot;color: #e34adc;&quot;&gt;B1616Out:&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; yl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; yh
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; xl

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xh
    rcall SerByteAsciiOut
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; xl
    rcall SerByteAsciiOut
    ldi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&#39;.&#39;&lt;/span&gt;
    rcall SerByteOut
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; xl
    rcall SerByteAsciiOut
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; xl
    rcall SerByteAsciiOut
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;


&lt;span style=&quot;color: #e34adc;&quot;&gt;B16Out:&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; xl

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;mov&lt;/span&gt; xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xh
    rcall SerByteAsciiOut
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; xl
    rcall SerByteAsciiOut
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;



    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Debug: Output byte xl (ASCII) to serial port pin at 115200 8N1 ----&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;SerByteAsciiOut:&lt;/span&gt;


    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;push&lt;/span&gt; xl
    swap xl
    rcall su1        &lt;span style=&quot;color: dimgrey;&quot;&gt;;high nibble&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;pop&lt;/span&gt; xl
    rjmp su1        &lt;span style=&quot;color: dimgrey;&quot;&gt;;low nibble&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;su1:&lt;/span&gt;    andi xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;0x0f&lt;/span&gt;
    ldi zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;low&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;su2&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;    &lt;span style=&quot;color: dimgrey;&quot;&gt;;output one nibble in ASCII&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;add&lt;/span&gt; zl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xl
    ldi zh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #004a43;&quot;&gt;high&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;su2&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    clr xl
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;adc&lt;/span&gt; zh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;xl
    lpm xl&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;z
    rjmp SerByteOut

&lt;span style=&quot;color: #e34adc;&quot;&gt;su2:&lt;/span&gt;    .&lt;span style=&quot;color: #004a43;&quot;&gt;db&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;0123456789ABCDEF&quot;&lt;/span&gt;


        



    &lt;span style=&quot;color: dimgrey;&quot;&gt;;--- Debug: Output byte xl (binary) to serial port pin at 115200 8N1 ----&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;SerByteOut:&lt;/span&gt;
    led3_off        &lt;span style=&quot;color: dimgrey;&quot;&gt;;startbit&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;

    rcall BaudRateDelay    

    ldi xh&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;8&lt;/span&gt;        &lt;span style=&quot;color: dimgrey;&quot;&gt;;databits&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;se3:&lt;/span&gt;    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ror&lt;/span&gt; xl

    brcc se1
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;
    led3_on
    rjmp se2
&lt;span style=&quot;color: #e34adc;&quot;&gt;se1:&lt;/span&gt;    led3_off
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;se2:&lt;/span&gt;    rcall BaudRateDelay

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;dec&lt;/span&gt; xh
    brne se3

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;

    led3_on            &lt;span style=&quot;color: dimgrey;&quot;&gt;;stopbit&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt; 
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;nop&lt;/span&gt;
    rcall BaudRateDelay

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;

&lt;span style=&quot;color: #e34adc;&quot;&gt;BaudRatedelay:&lt;/span&gt;

    ldi t&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;17&lt;/span&gt;
&lt;span style=&quot;color: #e34adc;&quot;&gt;ba1:&lt;/span&gt;    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;dec&lt;/span&gt; t
    brne ba1
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;ret&lt;/span&gt;
    

&lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;/&lt;/span&gt;


.undef t

.&lt;span style=&quot;color: #004a43;&quot;&gt;include&lt;/span&gt; &lt;span style=&quot;color: #0000e6;&quot;&gt;&quot;1616mathlib_ram_v1.asm&quot;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;I hope you find this is useful.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
Months Later I built my second -and first truly flying- &lt;a href=&quot;http://technicaladventure.blogspot.com/2012/07/my-x-525-quadcopter.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;quadcopter&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&amp;nbsp;I also wrote &lt;a href=&quot;http://code.google.com/p/hefnycopter/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;a new code with a new features&lt;/span&gt;&lt;/b&gt;&lt;/a&gt; that allows you to switch between +Quad&amp;nbsp; &amp;amp; X-Quad using your remote control, without the need to recompile the code or orient the board.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://technicaladventure.blogspot.com/feeds/2913221468902545105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://technicaladventure.blogspot.com/2012/03/quadrocopter-firmware-4-rotor-explained.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/2913221468902545105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/999906212197085612/posts/default/2913221468902545105'/><link rel='alternate' type='text/html' href='http://technicaladventure.blogspot.com/2012/03/quadrocopter-firmware-4-rotor-explained.html' title='Quadrocopter Firmware (4 Rotor) Explained'/><author><name>Mohammad Hefny</name><uri>http://www.blogger.com/profile/03695270264894790755</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikHjSUMuVQWzubdz8fgCRtR6thQ-q5-IJWFpAhGJ_kbUV0zoK0O5zKDfqz7dlL5W2jtuaCmNZ5klNeOnP4WJMtRRZ02p1XEonfHO1qLcm3BxtYSOxu_jvW27BemxESfQMzcJLL_X7I8DDE/s72-c/ADCComments.JPG" height="72" width="72"/><thr:total>12</thr:total></entry></feed>