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

<channel>
	<title>rotary movement Archives - Nerd Corner</title>
	<atom:link href="https://nerd-corner.com/tag/rotary-movement/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerd-corner.com/tag/rotary-movement/</link>
	<description>Craft your dreams!</description>
	<lastBuildDate>Sat, 23 Apr 2022 23:34:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>

<image>
	<url>https://nerd-corner.com/wp-content/uploads/2019/10/cropped-LogoNerdCorner-2-32x32.png</url>
	<title>rotary movement Archives - Nerd Corner</title>
	<link>https://nerd-corner.com/tag/rotary-movement/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Hall Sensor Movement Detection</title>
		<link>https://nerd-corner.com/hall-sensor-movement-detection/</link>
					<comments>https://nerd-corner.com/hall-sensor-movement-detection/#comments</comments>
		
		<dc:creator><![CDATA[Nerds]]></dc:creator>
		<pubDate>Wed, 12 Aug 2020 14:51:16 +0000</pubDate>
				<category><![CDATA[Arduino projects]]></category>
		<category><![CDATA[Handcrafted]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Code]]></category>
		<category><![CDATA[arduino nano]]></category>
		<category><![CDATA[hall effect]]></category>
		<category><![CDATA[hall sensor]]></category>
		<category><![CDATA[hallsensor]]></category>
		<category><![CDATA[KY-024]]></category>
		<category><![CDATA[KY024]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[leds]]></category>
		<category><![CDATA[movement detection]]></category>
		<category><![CDATA[rotary]]></category>
		<category><![CDATA[rotary movement]]></category>
		<guid isPermaLink="false">https://nerd-corner.com/?p=695</guid>

					<description><![CDATA[<p>We built a test bench to detect a rotary movement. We call it the Hall Sensor Movement Detection. The necessary parts were 3D printed. You &#8230; </p>
<p>The post <a href="https://nerd-corner.com/hall-sensor-movement-detection/">Hall Sensor Movement Detection</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We built a test bench to detect a rotary movement. We call it the Hall Sensor Movement Detection. The necessary parts were 3D printed. You find the 3d parts at the end of this parts in the &#8220;Download files&#8221; section. The aim of the Hall sensor detection wheel is to detect a rotation and to keep the LEDs continuously lightning during the rotation. We need this set-up for our project to build a prayer wheel, because we are going to use the Arduino code here for the prayer wheel.</p>
<p><strong><em>This might also be interesting for you: </em></strong><a href="https://nerd-corner.com/hallsensor-ky-024-arduino-code/" target="_blank" rel="noopener noreferrer"><em>Simple guide on how to use a Hall Sensor with an Arduino</em></a></p>
<h2>List of components</h2>
<ul>
<li>Arduino Nano</li>
<li>Nano Terminal Adapter</li>
<li>6 magnets</li>
<li>Hall sensor KY024</li>
<li>LED strip</li>
<li>Jumper cables</li>
<li>Screws 2x M2 and 1x M3 for the sensor</li>
<li>Deep groove ball bearing 6807 2RS / 61807 2RS 35x47x7 mm</li>
<li>3D printing test setup (STL files in Download section)</li>
</ul>
<h2>Construction of test bench</h2>
<div style="width: 1200px;" class="wp-video"><!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->
<video class="wp-video-shortcode" id="video-695-1" width="1200" height="675" preload="metadata" controls="controls"><source type="video/mp4" src="https://nerd-corner.com/wp-content/uploads/2020/08/MagneranimationA.mp4?_=1" /><a href="https://nerd-corner.com/wp-content/uploads/2020/08/MagneranimationA.mp4">https://nerd-corner.com/wp-content/uploads/2020/08/MagneranimationA.mp4</a></video></div>
<p>First we glued the 6 magnets into the 3D printed wheel. Make sure that the magnets are aligned homogeneously. Then the deep groove ball bearing is inserted into the detection wheel. The wheel can now be connected to the 3D printed bracket. Next we attach the Hall sensor KY-024 to the bracket. The Arduino Nano is plugged onto the adapter terminal and also attached to the bracket. The LED strip does not have to be attached separately. So you can start with the wiring.</p>
<h2>Wiring</h2>
<p>The wiring is not very difficult. Proceed according to the <a href="https://fritzing.org/" target="_blank" rel="nofollow noopener noreferrer">fritzing</a> sketch. Connect the 4 jumper cables to the pins of the Hall sensor KY-024 and connect them to the Arduino Terminal Adapter. The 5V output of the Arduino is shared with both the Hall Sensor and the LEDs. Since there are only a few LEDs, no external power supply is required. For the LED strip you may have to solder them. We recommend to use a 220 Ohm resistor for the digital input of the LED strip.</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter wp-image-696 zoooom" src="https://nerd-corner.com/wp-content/uploads/2020/08/Hall-Sensor-Detektionsrad-Fritzing.png" alt="Hall Sensor movement detection wheel wiring fritzing hall effect" width="3071" height="1611" srcset="https://nerd-corner.com/wp-content/uploads/2020/08/Hall-Sensor-Detektionsrad-Fritzing.png 3072w, https://nerd-corner.com/wp-content/uploads/2020/08/Hall-Sensor-Detektionsrad-Fritzing-300x157.png 300w, https://nerd-corner.com/wp-content/uploads/2020/08/Hall-Sensor-Detektionsrad-Fritzing-1024x537.png 1024w, https://nerd-corner.com/wp-content/uploads/2020/08/Hall-Sensor-Detektionsrad-Fritzing-768x403.png 768w, https://nerd-corner.com/wp-content/uploads/2020/08/Hall-Sensor-Detektionsrad-Fritzing-1536x806.png 1536w, https://nerd-corner.com/wp-content/uploads/2020/08/Hall-Sensor-Detektionsrad-Fritzing-2048x1075.png 2048w" sizes="(max-width: 3071px) 100vw, 3071px" /></p>
<h2>Arduino Code Simple (with digital input)</h2>
<p>In this code example, the Hall sensor KY024 sends the digital value 1 (HIGH) if there is a magnet or 0 (LOW) if no magnet is nearby. As soon as a HIGH is detected, the LEDs start to light up. But if the a magnet stops in front of the Hall sensor, it will send a HIGH constantly and the LEDs won&#8217;t stop lightning.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c" data-enlighter-theme="beyond" data-enlighter-title="HallSensorDetectionWheelSimple.ino" data-enlighter-group="HallSensorDetectionWheelSimple">#include &lt;FastLED.h&gt;
#define LED_PIN     7
#define NUM_LEDS    6

CRGB leds[NUM_LEDS];

int digitalPin = 9; // Hall magnetic sensor input 1 (high) or 0 (low)
int digitalInputValue ; // digital readings

void setup ()
{
  FastLED.addLeds&lt;WS2812, LED_PIN, GRB&gt;(leds, NUM_LEDS);
  pinMode (digitalPin, INPUT); 
  
  Serial.begin(9600);
}

void loop ()
{
  
  digitalInputValue = digitalRead(digitalPin) ; 
  Serial.println(digitalInputValue); // print value
  if (digitalInputValue == HIGH) 
  {
    for (int i = 0; i &lt;= 5; i++) 
    {
    leds[i] = CRGB ( 255, 0, 0);
    FastLED.show();
    delay(40);
    }
  }

  else if (digitalInputValue ==LOW)
  {
    for (int i = 0; i &lt;= 5; i++) 
    {
      leds[i] = CRGB ( 0, 0, 0);
      FastLED.show();
      delay(30);
    }
  } 
}</pre>
<h2>Arduino code more advanced (with analog input)</h2>
<p>This code is a bit more advanced. The goal for the Hall Sensor Movement Detection is to let the LEDs light up as soon as a rotary movement is detected. Even if a magnet stops directly in front of the KY024 Hall sensor, the LEDs must not light up, because there is no movement.</p>
<p>For this reason, the analog value of the Hall sensor is considered instead of the digital value. If the analog value changes, a rotary movement takes place. A small offset has been integrated to compensate minor fluctuations that occur even without a rotary movement. A counter was programmed as a double safeguard, which also counts how often the analog value changes. The double protection is intended to prevent the Hall sensor from detecting a magnetic field at a standstill.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="c" data-enlighter-theme="beyond" data-enlighter-group="HallSensorDetectionWheelAnalog" data-enlighter-title="HallSensorDetectionWheelAnalog.ino">#include &lt;FastLED.h&gt;
#define LED_PIN 7
#define NUM_LEDS 6
CRGB leds[NUM_LEDS];


int analogPin =A0;
int analogVal; // analog readings
int detector =0;
int firstVal=0;
int HIGHcount=0;


void setup() {
  FastLED.addLeds&lt;WS2812, LED_PIN, GRB&gt;(leds, NUM_LEDS);//pinMode (led, OUTPUT); 
  pinMode (analogPin, INPUT); 
  Serial.begin(9600);
  
}

void loop() {
  analogVal= analogRead(analogPin);
  detector = abs(firstVal-analogVal);  //if there is a difference &gt;0 then the wheel might be spinning
  firstVal=analogVal;

  if (detector&gt;4)   //offset = 4 can be adjusted
  {
    HIGHcount++;  //counting the high to eleminate false positives  
    }
  else if (detector&lt;=10)
  {
    HIGHcount=0;
  }

  if (HIGHcount&gt;1)
  {
    YellowToRed(0); 
    delay(1000);
    HIGHcount=0;
    }

  else
  {
     for (int i = 0; i &lt;= 5; i++) 
  {
    leds[i] = CRGB ( 0, 0, 0);
    FastLED.show();
    delay(30);
  } 
    }

}


void YellowToRed(int colorStep)
{
  for( colorStep; colorStep&lt;250; colorStep+=5 ) {

      int r = 255;  // Redness starts at zero and goes up to full
      int b = 0;  // Blue starts at full and goes down to zero
      int g = 255-colorStep;              // No green needed to go from blue to red

      // Now loop though each of the LEDs and set each one to the current color

      for(int x = 0; x &lt; NUM_LEDS; x++){
          leds[x] = CRGB(r,g,b);
          leds[x].maximizeBrightness(255-colorStep);
      }

      // Display the colors we just set on the actual LEDs
      FastLED.show();

      delay(50); 
  }
}</pre>
<h2>Pictures of the Hall Sensor Movement Detection</h2>
<p><img decoding="async" class="zoooom aligncenter wp-image-702" src="https://nerd-corner.com/wp-content/uploads/2020/08/Magnetrad1.jpg" alt="Hall Sensor Movement Detection wheel" width="1745" height="1383" srcset="https://nerd-corner.com/wp-content/uploads/2020/08/Magnetrad1.jpg 1746w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnetrad1-300x238.jpg 300w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnetrad1-1024x812.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnetrad1-768x609.jpg 768w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnetrad1-1536x1218.jpg 1536w" sizes="(max-width: 1745px) 100vw, 1745px" /> <img decoding="async" class="aligncenter wp-image-703 zoooom" src="https://nerd-corner.com/wp-content/uploads/2020/08/Magnetradkpl1-scaled.jpg" alt="magnet wheel for movement detection" width="2559" height="1396" srcset="https://nerd-corner.com/wp-content/uploads/2020/08/Magnetradkpl1-scaled.jpg 2560w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnetradkpl1-300x164.jpg 300w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnetradkpl1-1024x559.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnetradkpl1-768x419.jpg 768w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnetradkpl1-1536x838.jpg 1536w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnetradkpl1-2048x1117.jpg 2048w" sizes="(max-width: 2559px) 100vw, 2559px" /> <img loading="lazy" decoding="async" class="aligncenter wp-image-704 zoooom" src="https://nerd-corner.com/wp-content/uploads/2020/08/MagnettestradStander.jpg" alt="" width="1183" height="1421" srcset="https://nerd-corner.com/wp-content/uploads/2020/08/MagnettestradStander.jpg 1184w, https://nerd-corner.com/wp-content/uploads/2020/08/MagnettestradStander-250x300.jpg 250w, https://nerd-corner.com/wp-content/uploads/2020/08/MagnettestradStander-853x1024.jpg 853w, https://nerd-corner.com/wp-content/uploads/2020/08/MagnettestradStander-768x922.jpg 768w" sizes="auto, (max-width: 1183px) 100vw, 1183px" /> <img loading="lazy" decoding="async" class="zoooom aligncenter wp-image-706" src="https://nerd-corner.com/wp-content/uploads/2020/08/Magnettestradz.jpg" alt="construction magnet wheel Hall Sensor Movement Detection" width="1692" height="1639" srcset="https://nerd-corner.com/wp-content/uploads/2020/08/Magnettestradz.jpg 1693w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnettestradz-300x291.jpg 300w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnettestradz-1024x992.jpg 1024w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnettestradz-768x744.jpg 768w, https://nerd-corner.com/wp-content/uploads/2020/08/Magnettestradz-1536x1488.jpg 1536w" sizes="auto, (max-width: 1692px) 100vw, 1692px" /></p>
<h2>Download files</h2>
<ul>
<li><a href="https://www.thingiverse.com/thing:5259642" target="_blank" rel="noopener">Magnet Wheel (STL)</a></li>
</ul>
<p>The post <a href="https://nerd-corner.com/hall-sensor-movement-detection/">Hall Sensor Movement Detection</a> appeared first on <a href="https://nerd-corner.com">Nerd Corner</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nerd-corner.com/hall-sensor-movement-detection/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		<enclosure url="https://nerd-corner.com/wp-content/uploads/2020/08/MagneranimationA.mp4" length="47581724" type="video/mp4" />

			</item>
	</channel>
</rss>
