<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[Solved]How to use the angle sensor?]]></title><description><![CDATA[<p dir="auto">I'm trying to use the angle sensor but the output always show 0.<br />
Can anyone give me some tips?<br />
Thank you!!<br />
<img src="/assets/uploads/files/1538109826844-8d42e010-7387-47fd-bd5b-db648f303c38-image-resized.png" alt="0_1538109825279_8d42e010-7387-47fd-bd5b-db648f303c38-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/topic/339/solved-how-to-use-the-angle-sensor</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 23:20:21 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/339.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 Sep 2018 04:45:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Tue, 09 Oct 2018 03:03:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lukasmaximus" aria-label="Profile: lukasmaximus">@<bdi>lukasmaximus</bdi></a></p>
<p dir="auto">Thank you. I will try it again after buying the wire</p>
]]></description><link>https://community.m5stack.com/post/1693</link><guid isPermaLink="true">https://community.m5stack.com/post/1693</guid><dc:creator><![CDATA[ken57093]]></dc:creator><pubDate>Tue, 09 Oct 2018 03:03:25 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Tue, 09 Oct 2018 02:44:43 GMT]]></title><description><![CDATA[<p dir="auto">My apologies guys, I presumed you were using the m5go or fire as I am. If you are using the gray or black core models you will need to use jumper cables to attach the angle sensor to the pins on the bottom of the core as shown in this picture. it is not possible to connect the angle sensor to 22 or 23 as they are digital inputs, for the angle sensor we need an analog input or ADC (analog to digital converter) pin, so this is only possible on pins 35 and 36. try to connect as I show in these pictures and try again, it should display the numbers on both the serial monitor and the screen.![](<a href="http://imagehosting.biz/image/6ut" target="_blank" rel="noopener noreferrer nofollow ugc">http://imagehosting.biz/image/6ut</a><br />
<a href="http://imagehosting.biz/image/6u0" target="_blank" rel="noopener noreferrer nofollow ugc">http://imagehosting.biz/image/6u0</a>)</p>
]]></description><link>https://community.m5stack.com/post/1692</link><guid isPermaLink="true">https://community.m5stack.com/post/1692</guid><dc:creator><![CDATA[lukasmaximus]]></dc:creator><pubDate>Tue, 09 Oct 2018 02:44:43 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Tue, 09 Oct 2018 03:02:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a><br />
Haha, it's fine. I almost give up trying the angle sensor myself. Now I'm trying to use the SIM800L GSM module.</p>
]]></description><link>https://community.m5stack.com/post/1691</link><guid isPermaLink="true">https://community.m5stack.com/post/1691</guid><dc:creator><![CDATA[ken57093]]></dc:creator><pubDate>Tue, 09 Oct 2018 03:02:36 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Mon, 08 Oct 2018 19:19:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lukasmaximus" aria-label="Profile: lukasmaximus">@<bdi>lukasmaximus</bdi></a> 在 <a href="/post/1685">How to use the angle sensor?</a> 中说：</p>
<blockquote>
<p dir="auto">I can get a readout from the angle sensor on both the serial console and lcd with this sketch. Try it out and see if it works for you. I'm using the m5go but the pinout should be the same. Make sure you connect the black wire to gnd, the red wire to 5v and the white wire to 36</p>
<p dir="auto">&lt;code&gt;</p>
<p dir="auto">#include &lt;M5Stack.h&gt;</p>
<p dir="auto">void setup()<br />
{<br />
M5.begin();<br />
M5.Lcd.setBrightness(30);<br />
M5.Lcd.clear();</p>
<p dir="auto">}</p>
<p dir="auto">void loop()<br />
{<br />
M5.Lcd.setCursor(160, 120);<br />
int adc = analogRead(36);<br />
M5.Lcd.println(adc);<br />
Serial.println(adc);<br />
delay(2);<br />
}<br />
&lt;/code&gt;</p>
</blockquote>
<p dir="auto">My self and Ken are using the grove port which is pin 22&amp;23 and so can't move it over to a different port.<br />
<a class="plugin-mentions-user plugin-mentions-a" href="/user/ken57093" aria-label="Profile: ken57093">@<bdi>ken57093</bdi></a> - I haven't forgotten about you my friend, I just been busy trying to finish some of my backlog of projects which the M5Stack is proving to be very usefull for.</p>
]]></description><link>https://community.m5stack.com/post/1690</link><guid isPermaLink="true">https://community.m5stack.com/post/1690</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Mon, 08 Oct 2018 19:19:54 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Mon, 08 Oct 2018 10:04:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lukasmaximus" aria-label="Profile: lukasmaximus">@<bdi>lukasmaximus</bdi></a></p>
<p dir="auto">Thank you. But i just have this wire and I use your code still unsuccess.<br />
<a href="http://forum.m5stack.com/assets/uploads/files/1538465243067-20181002_152122-resized.jpg" target="_blank" rel="noopener noreferrer nofollow ugc">http://forum.m5stack.com/assets/uploads/files/1538465243067-20181002_152122-resized.jpg</a></p>
]]></description><link>https://community.m5stack.com/post/1688</link><guid isPermaLink="true">https://community.m5stack.com/post/1688</guid><dc:creator><![CDATA[ken57093]]></dc:creator><pubDate>Mon, 08 Oct 2018 10:04:14 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Mon, 08 Oct 2018 03:59:18 GMT]]></title><description><![CDATA[<p dir="auto">I can get a readout from the angle sensor on both the serial console and lcd with this sketch. Try it out and see if it works for you. I'm using the m5go but the pinout should be the same. Make sure you connect the black wire to gnd, the red wire to 5v and the white wire to 36</p>
<p dir="auto">&lt;code&gt;</p>
<p dir="auto">#include &lt;M5Stack.h&gt;</p>
<p dir="auto">void setup()<br />
{<br />
M5.begin();<br />
M5.Lcd.setBrightness(30);<br />
M5.Lcd.clear();</p>
<p dir="auto">}</p>
<p dir="auto">void loop()<br />
{<br />
M5.Lcd.setCursor(160, 120);<br />
int adc = analogRead(36);<br />
M5.Lcd.println(adc);<br />
Serial.println(adc);<br />
delay(2);<br />
}<br />
&lt;/code&gt;</p>
]]></description><link>https://community.m5stack.com/post/1685</link><guid isPermaLink="true">https://community.m5stack.com/post/1685</guid><dc:creator><![CDATA[lukasmaximus]]></dc:creator><pubDate>Mon, 08 Oct 2018 03:59:18 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Thu, 04 Oct 2018 19:46:54 GMT]]></title><description><![CDATA[<p dir="auto">OK analogue read does not work, the command is something like ADC1 get raw (or some such)</p>
]]></description><link>https://community.m5stack.com/post/1671</link><guid isPermaLink="true">https://community.m5stack.com/post/1671</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Thu, 04 Oct 2018 19:46:54 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Thu, 04 Oct 2018 19:45:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ken57093" aria-label="Profile: ken57093">@<bdi>ken57093</bdi></a> 在 <a href="/post/1669">How to use the angle sensor?</a> 中说：</p>
<p dir="auto">Ok, set up my test rig and getting the same results.<br />
This is my code and I think something is missing.</p>
<blockquote>
<p dir="auto">#include &lt;M5Stack.h&gt;<br />
/<em>macro definitions of Rotary angle sensor and LED pin</em>/<br />
#define ROTARY_ANGLE_SENSOR 36<br />
#define LED 3  //the Grove - LED is connected to PWM pin D3 of Arduino<br />
#define ADC_REF 3.3 //reference voltage of ADC is 5v.If the Vcc switch on the seeeduino<br />
//board switches to 3V3, the ADC_REF should be 3.3<br />
#define GROVE_VCC 3.3 //VCC of the grove interface is normally 5v<br />
#define FULL_ANGLE 180 //full value of the rotary angle is 300 degrees<br />
void setup()<br />
{<br />
M5.begin();<br />
Serial.begin(9600);<br />
pinMode(ROTARY_ANGLE_SENSOR, INPUT);<br />
pinMode(LED,OUTPUT);<br />
}<br />
void loop()<br />
{<br />
float voltage;<br />
int sensor_value = analogRead(ROTARY_ANGLE_SENSOR);<br />
voltage = (float)sensor_value<em>ADC_REF/1023;<br />
float degrees = (voltage</em>FULL_ANGLE)/GROVE_VCC;<br />
Serial.println("The angle between the mark and the starting position:");<br />
Serial.println(degrees);<br />
}</p>
</blockquote>
]]></description><link>https://community.m5stack.com/post/1670</link><guid isPermaLink="true">https://community.m5stack.com/post/1670</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Thu, 04 Oct 2018 19:45:50 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Thu, 04 Oct 2018 08:57:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a></p>
<p dir="auto">I had tried before. The output of 36 is similar to 39.</p>
]]></description><link>https://community.m5stack.com/post/1669</link><guid isPermaLink="true">https://community.m5stack.com/post/1669</guid><dc:creator><![CDATA[ken57093]]></dc:creator><pubDate>Thu, 04 Oct 2018 08:57:31 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Thu, 04 Oct 2018 08:22:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ken57093" aria-label="Profile: ken57093">@<bdi>ken57093</bdi></a> , sorry, will try setting up a test rig and test.<br />
Haybin said to try 36!</p>
]]></description><link>https://community.m5stack.com/post/1668</link><guid isPermaLink="true">https://community.m5stack.com/post/1668</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Thu, 04 Oct 2018 08:22:16 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Thu, 04 Oct 2018 01:28:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a><br />
Thank you.</p>
<p dir="auto">I had tried. There is no change when i steer the sensor, but the value will sometime auto change itself.</p>
<p dir="auto"><img src="/assets/uploads/files/1538616380865-a7f8a7a8-1392-43b3-900e-6c3c292aed61-image-resized.png" alt="0_1538616378269_a7f8a7a8-1392-43b3-900e-6c3c292aed61-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/1667</link><guid isPermaLink="true">https://community.m5stack.com/post/1667</guid><dc:creator><![CDATA[ken57093]]></dc:creator><pubDate>Thu, 04 Oct 2018 01:28:16 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Wed, 03 Oct 2018 17:37:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ken57093" aria-label="Profile: ken57093">@<bdi>ken57093</bdi></a> gpio22 in NOT on pin 22 gpio is on pin <s>49</s> according to the datasheet</p>
<p dir="auto">Opps there are only 48 pins. the define should be 39!</p>
<blockquote>
<p dir="auto">#define ROTARY_ANGLE_SENSOR 39</p>
</blockquote>
]]></description><link>https://community.m5stack.com/post/1661</link><guid isPermaLink="true">https://community.m5stack.com/post/1661</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Wed, 03 Oct 2018 17:37:32 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Wed, 03 Oct 2018 07:43:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a><br />
Thank you.<br />
Do you mean changing "#define ROTARY_ANGLE_SENSOR 22" to "#define ROTARY_ANGLE_SENSOR 21"?</p>
<p dir="auto">I changed 22 to 21 but there is no difference except digitalread() of 21 is always 1.</p>
]]></description><link>https://community.m5stack.com/post/1659</link><guid isPermaLink="true">https://community.m5stack.com/post/1659</guid><dc:creator><![CDATA[ken57093]]></dc:creator><pubDate>Wed, 03 Oct 2018 07:43:01 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Wed, 03 Oct 2018 05:42:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ken57093" aria-label="Profile: ken57093">@<bdi>ken57093</bdi></a><br />
Sorry posting while half asleep.<br />
According to the datasheet GPIO22 in on pin 39 however, grove specs should have it as not connected in analogue read mode.<br />
Just checking the various documents and according to them you may want GPIO 21 which is on pin 42 (again sorry, i'm half asleep and rushing to work.)</p>
<p dir="auto">Have you downloaded the esp32 data sheets and they are very usefull to read through?</p>
]]></description><link>https://community.m5stack.com/post/1657</link><guid isPermaLink="true">https://community.m5stack.com/post/1657</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Wed, 03 Oct 2018 05:42:05 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Wed, 03 Oct 2018 05:32:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a><br />
Yes, the white thing is the angle sensor and i connect it to the M5 Core. The Digitalread returns is 1.</p>
<p dir="auto">I had tried analogread() on 22 but cannot get the angle change on the serial monitor (Its always 0).</p>
<p dir="auto">Do you have any ideas?</p>
]]></description><link>https://community.m5stack.com/post/1656</link><guid isPermaLink="true">https://community.m5stack.com/post/1656</guid><dc:creator><![CDATA[ken57093]]></dc:creator><pubDate>Wed, 03 Oct 2018 05:32:47 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Wed, 03 Oct 2018 05:25:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ken57093" aria-label="Profile: ken57093">@<bdi>ken57093</bdi></a> 在 <a href="/post/1654">How to use the angle sensor?</a> 中说：</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a><br />
Okay... Thanks a lot!</p>
</blockquote>
<p dir="auto">your talking about the white thing?<br />
Sorry i was confused as i dont have the white thing</p>
<p dir="auto">Digitalread returns 1?</p>
<p dir="auto">Looks connected, try analogread() on 22 (not spelt correctly)</p>
]]></description><link>https://community.m5stack.com/post/1655</link><guid isPermaLink="true">https://community.m5stack.com/post/1655</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Wed, 03 Oct 2018 05:25:45 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Wed, 03 Oct 2018 01:33:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a><br />
Okay... Thanks a lot!</p>
]]></description><link>https://community.m5stack.com/post/1654</link><guid isPermaLink="true">https://community.m5stack.com/post/1654</guid><dc:creator><![CDATA[ken57093]]></dc:creator><pubDate>Wed, 03 Oct 2018 01:33:43 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Tue, 02 Oct 2018 18:33:28 GMT]]></title><description><![CDATA[<p dir="auto">As far as I am aware, the core doesn't have one!<br />
The silver, M5go and fire have them.</p>
]]></description><link>https://community.m5stack.com/post/1650</link><guid isPermaLink="true">https://community.m5stack.com/post/1650</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Tue, 02 Oct 2018 18:33:28 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Tue, 02 Oct 2018 08:05:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ajb2k3" aria-label="Profile: ajb2k3">@<bdi>ajb2k3</bdi></a><br />
<img src="/assets/uploads/files/1538465243067-20181002_152122-resized.jpg" alt="0_1538465242232_20181002_152122.jpg" class=" img-fluid img-markdown" /><br />
ESP32 M5 core</p>
]]></description><link>https://community.m5stack.com/post/1649</link><guid isPermaLink="true">https://community.m5stack.com/post/1649</guid><dc:creator><![CDATA[ken57093]]></dc:creator><pubDate>Tue, 02 Oct 2018 08:05:10 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Tue, 02 Oct 2018 05:52:41 GMT]]></title><description><![CDATA[<p dir="auto">What device are you using and have you tuned the sensor?</p>
]]></description><link>https://community.m5stack.com/post/1648</link><guid isPermaLink="true">https://community.m5stack.com/post/1648</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Tue, 02 Oct 2018 05:52:41 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Tue, 02 Oct 2018 04:36:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/heybin" aria-label="Profile: heybin">@<bdi>heybin</bdi></a> <img src="/assets/uploads/files/1538443672751-3594191f-351e-48e2-bb0a-3f26f0ca7af1-image-resized.png" alt="0_1538443658559_3594191f-351e-48e2-bb0a-3f26f0ca7af1-image.png" class=" img-fluid img-markdown" /><br />
Here is some different on the monitor. However the output still not controlled by the sensor.Will you have another idea? Thank you.<br />
update<br />
I had tried digitalread() for both 22 and 36. Only 22 return 0 or 1 and 36 only return 0</p>
]]></description><link>https://community.m5stack.com/post/1647</link><guid isPermaLink="true">https://community.m5stack.com/post/1647</guid><dc:creator><![CDATA[ken57093]]></dc:creator><pubDate>Tue, 02 Oct 2018 04:36:58 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Sat, 29 Sep 2018 03:27:08 GMT]]></title><description><![CDATA[<p dir="auto">hello<br />
try to connect sensor to 36, the PORTB,  test</p>
]]></description><link>https://community.m5stack.com/post/1625</link><guid isPermaLink="true">https://community.m5stack.com/post/1625</guid><dc:creator><![CDATA[heybin]]></dc:creator><pubDate>Sat, 29 Sep 2018 03:27:08 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved]How to use the angle sensor? on Fri, 28 Sep 2018 15:19:22 GMT]]></title><description><![CDATA[<p dir="auto">What does your code look like?</p>
]]></description><link>https://community.m5stack.com/post/1624</link><guid isPermaLink="true">https://community.m5stack.com/post/1624</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Fri, 28 Sep 2018 15:19:22 GMT</pubDate></item></channel></rss>