<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Using IR to count a bike wheel rotation, then map to tone for speaker. - Arduino				            </title>
            <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/</link>
            <description>Discussion board for Robotics, Arduino, Raspberry Pi and other DIY electronics and modules. Join us today!</description>
            <language>en-US</language>
            <lastBuildDate>Mon, 08 Jun 2026 20:10:11 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Using IR to count a bike wheel rotation, then map to tone for speaker.</title>
                        <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12465</link>
                        <pubDate>Fri, 14 Aug 2020 22:46:16 +0000</pubDate>
                        <description><![CDATA[The map function worked great, but only to tone/pitch......BUT....I added today the ..
const int ledPin = LED_BUILTIN;int ledState = LOW;unsigned long previousMillis = 0; // will store last...]]></description>
                        <content:encoded><![CDATA[<p>The map function worked great, but only to tone/pitch......BUT....I added today the ..</p>
<p>const int ledPin = LED_BUILTIN;<br />int ledState = LOW;<br />unsigned long previousMillis = 0; // will store last time LED was updated</p>
<p>// constants won't change:<br />const long interval = 50;........</p>
<p>command to blink output pin...which is output for tone same......to pulse/blink  50ms on same output pin...........looking  or should I say sounding good now......like a dirt bike...lol</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>MC2</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12465</guid>
                    </item>
				                    <item>
                        <title>RE: Using IR to count a bike wheel rotation, then map to tone for speaker.</title>
                        <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12459</link>
                        <pubDate>Fri, 14 Aug 2020 18:33:17 +0000</pubDate>
                        <description><![CDATA[@mc2
I hard audio noises...  No video...
It might be better to use a 555 timer Oscillator changing the pitch s the RPM goes Up/Down...]]></description>
                        <content:encoded><![CDATA[<p>@mc2</p>
<p>I hard audio noises...  No video...</p>
<p>It might be better to use a 555 timer Oscillator changing the pitch s the RPM goes Up/Down...</p>
<p> </p>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>JoeLyddon</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12459</guid>
                    </item>
				                    <item>
                        <title>RE: Using IR to count a bike wheel rotation, then map to tone for speaker.</title>
                        <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12454</link>
                        <pubDate>Fri, 14 Aug 2020 13:48:36 +0000</pubDate>
                        <description><![CDATA[Video of Bike wheel mounted to desk....]]></description>
                        <content:encoded><![CDATA[1910
1911
<p>Video of Bike wheel mounted to desk....</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>MC2</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12454</guid>
                    </item>
				                    <item>
                        <title>RE: Using IR to count a bike wheel rotation, then map to tone for speaker.</title>
                        <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12453</link>
                        <pubDate>Fri, 14 Aug 2020 13:42:01 +0000</pubDate>
                        <description><![CDATA[The Code.......
// Useing Nano Tachometer//-------------------------------------#include &lt;Wire.h&gt;//#include &quot;Adafruit_LEDBackpack.h&quot;// External interrpt pin for sensor#define interrup...]]></description>
                        <content:encoded><![CDATA[<p>The Code.......</p>
<p>// Useing Nano Tachometer<br />//-------------------------------------<br />#include &lt;Wire.h&gt;<br />//#include "Adafruit_LEDBackpack.h"<br /><br />// External interrpt pin for sensor<br />#define interruptPin 2<br /><br />//Adafruit_7segment matrix = Adafruit_7segment();<br /><br />long lastUpdate = 0; // for timing display updates<br />volatile long accumulator = 0; // sum of last 8 revolution times<br />volatile unsigned long startTime = 0; // start of revolution in microseconds<br />volatile unsigned int revCount = 0; // number of revolutions since last display update<br /><br />//-------------------------------------<br />// Setup - runs once at startup<br />//-------------------------------------<br />void setup()<br />{<br />// Initialize the serial port and display<br />Serial.begin(115200);<br />//matrix.begin(0x70);<br /><br />// Enable the pullup resistor and attach the interrupt<br />pinMode(interruptPin, INPUT_PULLUP);<br />attachInterrupt(digitalPinToInterrupt(interruptPin), tach_interrupt, FALLING);<br />}<br /><br />//-------------------------------------<br />// Main Loop - runs repeatedly.<br />// Calculate RPM and Update LCD Display<br />//-------------------------------------<br />void loop()<br />{<br /><br /><br />if (millis() - lastUpdate &gt; 1000) // update every second<br />{<br />unsigned int rpm = 0;<br />// divide number of microseconds in a minute, by the average interval.<br />if (revCount &gt; 0)<br />{<br />rpm = 6000000 / (accumulator&gt;&gt;2);<br />}<br /><br />Serial.println(rpm);<br />int sensorReading = (rpm);</p>
<p>int thisPitch = map(sensorReading, 0, 17, 31, 38);</p>
<p>// play the pitch:<br />tone(9, thisPitch, 1150);<br />//tone(10, thisPitch, 1050);<br />delay(1); // delay in between reads for stability<br />//matrix.println(rpm);<br />//matrix.writeDisplay();<br /><br />lastUpdate = millis();<br />revCount = 0;<br />}<br />}<br /><br />//-------------------------------------<br />// Interrupt Handler<br />// Magnetic sensor - target passed<br />// Calculate revolution time<br />//-------------------------------------<br />void tach_interrupt()<br />{<br />// calculate the microseconds since the last interrupt<br />long usNow = micros();<br />long elapsed = usNow - startTime;<br />startTime = usNow; // reset the clock<br /><br />// Accumulate the last 8 interrupt intervals<br />accumulator -= (accumulator &gt;&gt; 2);<br />accumulator += elapsed;<br />revCount++;<br />}</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>MC2</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12453</guid>
                    </item>
				                    <item>
                        <title>RE: Using IR to count a bike wheel rotation, then map to tone for speaker.</title>
                        <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12452</link>
                        <pubDate>Fri, 14 Aug 2020 13:38:52 +0000</pubDate>
                        <description><![CDATA[Thanks for all of your advice...!   I moved to the hall Effect due to the sun reeked havoc on the IR sensors....Got the code to map tone to rpm count like 0  to 20 rpm, mapped to 32hrz to 45...]]></description>
                        <content:encoded><![CDATA[<p>Thanks for all of your advice...!   I moved to the hall Effect due to the sun reeked havoc on the IR sensors....Got the code to map tone to rpm count like 0  to 20 rpm, mapped to 32hrz to 45hrz high.  One last snag though.....need it to increase not just pitch ,but the freq of the timing of it....Like a harley or a card pined to fork speeds up ...looking for bop.bop.bop. I tried "notone" with delay, pulse count linked to map/tone also.....no luck... Would post code and video, but not sure how to do that here.....</p>
<p>Randy (MC2)</p>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>MC2</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12452</guid>
                    </item>
				                    <item>
                        <title>RE: Using IR to count a bike wheel rotation, then map to tone for speaker.</title>
                        <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12439</link>
                        <pubDate>Thu, 13 Aug 2020 02:35:22 +0000</pubDate>
                        <description><![CDATA[If you are just trying to get rpm you can tape a magnet on the wheel and use a hal effect sensor. You can prob. get by with one of those fridge magnets. Once you get the rpms worked out then...]]></description>
                        <content:encoded><![CDATA[<p>If you are just trying to get rpm you can tape a magnet on the wheel and use a hal effect sensor. You can prob. get by with one of those fridge magnets. Once you get the rpms worked out then start on the other parts of the project.</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>noweare</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12439</guid>
                    </item>
				                    <item>
                        <title>RE: Using IR to count a bike wheel rotation, then map to tone for speaker.</title>
                        <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12438</link>
                        <pubDate>Wed, 12 Aug 2020 15:02:48 +0000</pubDate>
                        <description><![CDATA[This idea is a little different and may not be right for what you want, but here goes. You could affix the IR sensor to pick up the teeth on the front sprocket. This could be fun as you coul...]]></description>
                        <content:encoded><![CDATA[<p>This idea is a little different and may not be right for what you want, but here goes. You could affix the IR sensor to pick up the teeth on the front sprocket. This could be fun as you could simulate a idle sound when the peddle is not turning but then use the feedback from the sensor to speed up the sound when peddling. This would actually more closely emulate how an actual engine would work. 😉  </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>Ruplicator</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12438</guid>
                    </item>
				                    <item>
                        <title>RE: Using IR to count a bike wheel rotation, then map to tone for speaker.</title>
                        <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12426</link>
                        <pubDate>Mon, 10 Aug 2020 20:27:40 +0000</pubDate>
                        <description><![CDATA[Sounds like a FUN project...
Looks like it needs more experimentation...  maybe a special workbench setup with a motor hooked up, etc. so you could easily make changes and get quick results...]]></description>
                        <content:encoded><![CDATA[<p>Sounds like a FUN project...</p>
<p>Looks like it needs more experimentation...  maybe a special workbench setup with a motor hooked up, etc. so you could easily make changes and get quick results...  Like maybe have more Markers around the rim and measure Time from one marker to the next... calc. rpm from the time...  All markers would have to be equidistant from each other...  maybe divide the cicumference by 10 for 10 markers and go from there?</p>
<p>How are you going to drive the Speaker for the sound of the Card?</p>
<p>Thanks for keeping us updated.</p>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>JoeLyddon</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12426</guid>
                    </item>
				                    <item>
                        <title>RE: Using IR to count a bike wheel rotation, then map to tone for speaker.</title>
                        <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12423</link>
                        <pubDate>Mon, 10 Aug 2020 17:56:47 +0000</pubDate>
                        <description><![CDATA[Hi @mc2,
How are you controlling the speaker? I would assume through a gpio pin, correct?  If that&#039;s the case then you could use a PWM IO pin and map the RPM input into a PWM out (0-255) vi...]]></description>
                        <content:encoded><![CDATA[<p>Hi <span>@mc2,</span></p>
<p>How are you controlling the speaker? I would assume through a gpio pin, correct?  If that's the case then you could use a PWM IO pin and map the RPM input into a PWM out (0-255) via a map &amp; constrain pair and then that value to an analogWrite to set the PWM.  </p>
<p>Sounds like a fun project :)</p>
<p>Scott</p>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>triform</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12423</guid>
                    </item>
				                    <item>
                        <title>Using IR to count a bike wheel rotation, then map to tone for speaker.</title>
                        <link>https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12422</link>
                        <pubDate>Mon, 10 Aug 2020 17:31:39 +0000</pubDate>
                        <description><![CDATA[Hello, I have been working on a IR transmitter and receiver that puts out 5v and drops to 0v when object passes by. Most code examples are for rpm. I am using the Lafvin Nanos to do so. I ca...]]></description>
                        <content:encoded><![CDATA[<p>Hello, I have been working on a IR transmitter and receiver that puts out 5v and drops to 0v when object passes by. Most code examples are for rpm. I am using the Lafvin Nanos to do so. I cant get the rpm value to be constant at low rpm (like a bike wheel) to be steady, even using two reflectors on wheel. All I really want to do is map the number of the rpm or frequency of reflective hits, to a amp and speaker to speed up clicks or sound as the wheel speeds up and slows down. I am emulating what we all did as kids when we put a card on our bike wheel to sound like a motorcycle.....grin.  Can anyone advise me on a better way to do this ?</p>
<p>Thanks,  Randy</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>MC2</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/using-ir-to-count-a-bike-wheel-rotation-then-map-to-tone-for-speaker/#post-12422</guid>
                    </item>
							        </channel>
        </rss>
		