{"id":3203,"date":"2024-01-01T15:38:08","date_gmt":"2024-01-01T14:38:08","guid":{"rendered":"https:\/\/www.macerobotics.com\/?p=3203"},"modified":"2024-01-05T07:00:55","modified_gmt":"2024-01-05T06:00:55","slug":"utilisation-dun-encodeur-magnetique-as5048-avec-la-raspberry-pi-pico","status":"publish","type":"post","link":"https:\/\/www.macerobotics.com\/?p=3203","title":{"rendered":"Utilisation d&#8217;un encodeur magn\u00e9tique AS5048 avec la Raspberry Pi Pico"},"content":{"rendered":"<p>Un exemple d\u2019utilisation d&#8217;un encodeur magn\u00e9tique de r\u00e9f\u00e9rence AS5048 avec la carte Raspberry Pi Pico.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-01-154357.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3208 aligncenter\" src=\"http:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-01-154357.png\" alt=\"\" width=\"173\" height=\"179\" srcset=\"https:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-01-154357.png 402w, https:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-01-154357-290x300.png 290w\" sizes=\"auto, (max-width: 173px) 100vw, 173px\" \/><\/a><a href=\"http:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-05-070006.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-3210 aligncenter\" src=\"http:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-05-070006.png\" alt=\"\" width=\"421\" height=\"233\" srcset=\"https:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-05-070006.png 574w, https:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-05-070006-300x166.png 300w\" sizes=\"auto, (max-width: 421px) 100vw, 421px\" \/><\/a><\/p>\n<ul>\n<li>Utilisation de la librairie <a href=\"https:\/\/www.simplefoc.com\/\">simpleFOC<\/a><\/li>\n<\/ul>\n<p>L&#8217;encodeur est reli\u00e9 en SPI au Pico via les pins :<\/p>\n<ul>\n<li>GPIO4 =&gt; MISO<\/li>\n<li>GPIO3 =&gt; MOSI<\/li>\n<li>GPIO6 =&gt; SCK<\/li>\n<li>GPIO5 =&gt; CS<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-01-154101.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3207 aligncenter\" src=\"http:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-01-154101.png\" alt=\"\" width=\"542\" height=\"423\" srcset=\"https:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-01-154101.png 985w, https:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-01-154101-300x234.png 300w, https:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-01-154101-768x600.png 768w, https:\/\/www.macerobotics.com\/wp-content\/uploads\/2024\/01\/Capture-decran-2024-01-01-154101-600x468.png 600w\" sizes=\"auto, (max-width: 542px) 100vw, 542px\" \/><\/a><\/p>\n<h2>Exemple de lecture<\/h2>\n<p>[code language=&#8221;python&#8221;]<br \/>\n#include &lt;SimpleFOC.h&gt;<br \/>\n#include &lt;SPI.h&gt;<\/p>\n<p>#define SPI_MISO 4<br \/>\n#define SPI_MOSI 3<br \/>\n#define SPI_SCK 6<br \/>\n#define SPI_CS 5<\/p>\n<p>MagneticSensorSPI sensor = MagneticSensorSPI(SPI_CS, 14, 0x3FFF);<\/p>\n<p>void setup()<br \/>\n{<\/p>\n<p>SPI.setCS(SPI_CS);<br \/>\nSPI.setSCK(SPI_SCK);<br \/>\nSPI.setRX(SPI_MISO);<br \/>\nSPI.setTX(SPI_MOSI);<\/p>\n<p>SPI.begin();<\/p>\n<p>\/\/ initialise magnetic sensor hardware<br \/>\nsensor.init();<br \/>\n}<\/p>\n<p>void loop()<br \/>\n{<\/p>\n<p>sensor.update();<\/p>\n<p>\/\/ display the angle and the angular velocity to the terminal<br \/>\nSerial.print(sensor.getAngle());<br \/>\nSerial.print(&quot;\\t&quot;);<br \/>\nSerial.println(sensor.getVelocity());<\/p>\n<p>delay(1000);<br \/>\n}<br \/>\n[\/code]<\/p>\n<p>FIN !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Un exemple d\u2019utilisation d&#8217;un encodeur magn\u00e9tique de r\u00e9f\u00e9rence AS5048 avec la carte Raspberry Pi Pico. &nbsp; Utilisation de la librairie simpleFOC L&#8217;encodeur est reli\u00e9 en SPI au Pico via les pins : GPIO4 =&gt; MISO GPIO3 =&gt; MOSI GPIO6 =&gt; SCK GPIO5 =&gt; CS Exemple de lecture [code language=&#8221;python&#8221;] #include &lt;SimpleFOC.h&gt; #include &lt;SPI.h&gt; #define SPI_MISO &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[87,46],"tags":[],"class_list":["post-3203","post","type-post","status-publish","format-standard","hentry","category-raspberry-pico","category-robot"],"_links":{"self":[{"href":"https:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/posts\/3203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.macerobotics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3203"}],"version-history":[{"count":5,"href":"https:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/posts\/3203\/revisions"}],"predecessor-version":[{"id":3211,"href":"https:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/posts\/3203\/revisions\/3211"}],"wp:attachment":[{"href":"https:\/\/www.macerobotics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.macerobotics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.macerobotics.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}