Author Topic: How to detect rotation and turn on a circuit  (Read 1209 times)

0 Members and 1 Guest are viewing this topic.

Offline SpemoTopic starter

  • Regular Contributor
  • *
  • Posts: 53
  • Country: de
How to detect rotation and turn on a circuit
« on: April 18, 2021, 10:11:47 am »
Hello once again,

I have another question... I hope you don't mind.

Here is what I'm trying to do:

I need to sense the rotation of the pedals on my bicycle, and the output signal of that sensor is supposed to activate a relay once there is rotation.

So if there is rotation -> relay on, no rotation -> relay off.

I have found what is in the attached picture, which looks like it's a hall effect sensor and a disk with magnets which is supposed to spin in front of the sensor.

So I have the first part of the solution, but whatelse do I need to make it work?

what do I need to do here?

Is there an easy solution to this problem?


Thank you for your time

Daniel



 

Offline shaheansar

  • Contributor
  • Posts: 36
  • Country: in
Re: How to detect rotation and turn on a circuit
« Reply #1 on: April 18, 2021, 11:00:30 am »
If you just want something that detects rotation, you can use a tilt switch and an RS latch (A CD4044BE might be good), and reset the latch with an RC discharge circuit followed by a schmitt trigger (Or using a 555 timer in monostable mode).
The latch output will be on if rotation is detected and off if it isn't.
 

Offline SpemoTopic starter

  • Regular Contributor
  • *
  • Posts: 53
  • Country: de
Re: How to detect rotation and turn on a circuit
« Reply #2 on: April 18, 2021, 11:46:18 am »
Thanks for your input, sadly my knowledge isn't good enough to have any clue about what you're talking about  :(

I have done some more research, and basicly I need something that takes a sqare wave signal, let's say 0-12V, which gets pulsed b a reed switch and magnets, and convert it into a solid DC signal.
But it also has to keep the output signal off when there is no rotation, and the input signal is still high

Does that make any sense?
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2522
  • Country: us
Re: How to detect rotation and turn on a circuit
« Reply #3 on: April 18, 2021, 12:10:40 pm »
A 555 Timer configured in the monostable mode is the simplest.
You set the RC time constant for the amount of time you want your relay to stay ON after rotation stops.
The time constant must also be longer than the time between the pulses from the sensor.

Take a look at this article:

   https://www.electronics-tutorials.ws/waveforms/555_timer.html

Monostable configuration:

   

You may need a transistor on the output to drive your relay (i.e. coil instead of lamp, motor, speaker in example).
See the end of the article for NPN and PNP transistor options.
You could also use a MOSFET.

   

 
The following users thanked this post: Spemo

Offline SpemoTopic starter

  • Regular Contributor
  • *
  • Posts: 53
  • Country: de
Re: How to detect rotation and turn on a circuit
« Reply #4 on: April 18, 2021, 12:33:21 pm »
Perfect!

This is exaclty what I was looking for, thank you very much!
 

Offline shaheansar

  • Contributor
  • Posts: 36
  • Country: in
Re: How to detect rotation and turn on a circuit
« Reply #5 on: April 18, 2021, 01:26:33 pm »
Do keep in mind that you'll need a flyback diode if you're driving a relay or motor
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: How to detect rotation and turn on a circuit
« Reply #6 on: April 19, 2021, 02:20:35 am »
That 555 circuit is not going to work.
Even with continuous rotation there are going to be glitches every timeout.
Then there is the problem that it will do that if you left the sensor in the wrong position.

You could disconnect pin 7 (discharge), connect pin 2 to pin 6 and have your input signal discharge the cap.
That would make it a missing pulse detector and not a monomulti.

But then you have to process the input so it's never in a constant trigger position.
You can just AC couple it or XOR it with an RC delayed input.
The XOR could feed a transistor to discharge the cap.
« Last Edit: April 19, 2021, 02:22:14 am by Renate »
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: How to detect rotation and turn on a circuit
« Reply #7 on: April 19, 2021, 02:58:08 am »
Well there's another even simpler solution, use a cheap 8 pin microcontroller such as the attiny12. Lower component count than the 555 circuit and you can write the code to behave any way you want.
 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5170
  • Country: us
Re: How to detect rotation and turn on a circuit
« Reply #8 on: April 19, 2021, 04:00:37 am »
Depending on how much motion you will allow (or how little you need to detect) a really old school approach may work.  Just put an old school generator on the bike.  These had a friction wheel that contacted a bike tire and would run headlights or other accessory when the bike was moving.  While this was (and is) bulky and introduced significant friction to the ride, it also provided real power to run the low efficiency lamps of the day.  A much simpler and smaller version of the same thing could direction operate a low power relay.

You might want to think about this problem in two broad ways.  In one general class you have a battery or other power source operating a sensing circuit, which might be as simple as a friction paddle or reed switch, up through optical interrupters which would detect the periodic blockages caused by spokes and on to complex systems like the optical sensor like that in a computer mouse which would detect motion of the tire.  The other general class would use power collected from motion of the bike to generate the detection signal.  Generators, induction sensors, and piezo devices might fit in this category.  Each class has advantages and disadvantages, and each approach within the class also has similar tradeoffs.  The best choice will depend on your application and goals. 
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: How to detect rotation and turn on a circuit
« Reply #9 on: April 19, 2021, 11:50:42 am »
Use a cheap 8 pin microcontroller...
Well, I was thinking of ATTiny85 (8 pin DIP) since I have a tube of them.

But the point was the general discrete logic of how to implement this.
Optical, hall effect, reluctance pickups, whatever. It's all about the same.
Do you need/want to process both signal edges?

The circuit I described above (using the 555 as a Schmitt trigger inverter) and discharging the cap on activity would work fine.
Still, I kind of dislike the idea of a cap charging slowly and discharging instantly. Nothing discharges "instantly".
Ok, in this case you could add a resistor to mellow the discharge.
That would also be helpful in making it so that a single event wouldn't trigger the output.
Whether this is useful/desirable is another question.
If it's one pulse per revolution, you probably don't want that.

Technically a capacitor is not a good state storage element unless the changes are gradual.
A digital counter is much better.
A rotation event would reset the counter.
The counter stops when it reaches a value (probably a single high bit).
Your output signal is that high bit complimented.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: How to detect rotation and turn on a circuit
« Reply #10 on: April 19, 2021, 04:07:48 pm »
Thanks for your input, sadly my knowledge isn't good enough to have any clue about what you're talking about  :(

I have done some more research, and basicly I need something that takes a sqare wave signal, let's say 0-12V, which gets pulsed b a reed switch and magnets, and convert it into a solid DC signal.
But it also has to keep the output signal off when there is no rotation, and the input signal is still high

Does that make any sense?
A lot depends on how you define 'turning'.  Let's say you had 1 magnet on the sprocket and you had a reed relay or other sensor on the frame.  It could take as long as a full revolution to get a pulse.  That could take a long time (days) between pulses if the pedal motion was slow.  The thing about waiting for the next pulse is that it may never come so you have to decide how long to wait before deciding that the pedals aren't turning.

OK, 'days' isn't the proper time base but the idea is that seconds might not be either.  You have to decide how this will work out.  One solution is to add more magnets.  That will pick up the slower rotations but there is an upper limit to the operating speed of the reed relay.

I like the generator approach given above.  Rather than a massive generator, use a small DC motor like those in robotic toys.  Some will generate 12V at 10,000 RPM and we need 0.7V so somewhere around 500 RPM as a minimum.  That's going to be pretty easy with the front wheel as large as it is and some small rubber tire on the motor shaft.  Some calculation on the maximum wheel RPM and maximum generator RPM will give an optimum size for the generator wheel.

The generator will start generating 'some' voltage with very little rotation.  Detecting that voltage should be fairly easy.  You might just run the generator output, filtered by some capacitor, limited by a zener and resistor (?), into the base of a transistor that is controlling the relay.  No uC required.  I don't know how the lower end of rotation will work out.  You only need to get to 0.7V to turn a transistor completely on.  Or you could run it into an op amp or comparator and measure much smaller voltages.

 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5170
  • Country: us
Re: How to detect rotation and turn on a circuit
« Reply #12 on: April 19, 2021, 05:04:51 pm »
Thanks for your input, sadly my knowledge isn't good enough to have any clue about what you're talking about  :(

I have done some more research, and basicly I need something that takes a sqare wave signal, let's say 0-12V, which gets pulsed b a reed switch and magnets, and convert it into a solid DC signal.
But it also has to keep the output signal off when there is no rotation, and the input signal is still high

Does that make any sense?
A lot depends on how you define 'turning'.  Let's say you had 1 magnet on the sprocket and you had a reed relay or other sensor on the frame.  It could take as long as a full revolution to get a pulse.  That could take a long time (days) between pulses if the pedal motion was slow.  The thing about waiting for the next pulse is that it may never come so you have to decide how long to wait before deciding that the pedals aren't turning.

OK, 'days' isn't the proper time base but the idea is that seconds might not be either.  You have to decide how this will work out.  One solution is to add more magnets.  That will pick up the slower rotations but there is an upper limit to the operating speed of the reed relay.

I like the generator approach given above.  Rather than a massive generator, use a small DC motor like those in robotic toys.  Some will generate 12V at 10,000 RPM and we need 0.7V so somewhere around 500 RPM as a minimum.  That's going to be pretty easy with the front wheel as large as it is and some small rubber tire on the motor shaft.  Some calculation on the maximum wheel RPM and maximum generator RPM will give an optimum size for the generator wheel.

The generator will start generating 'some' voltage with very little rotation.  Detecting that voltage should be fairly easy.  You might just run the generator output, filtered by some capacitor, limited by a zener and resistor (?), into the base of a transistor that is controlling the relay.  No uC required.  I don't know how the lower end of rotation will work out.  You only need to get to 0.7V to turn a transistor completely on.  Or you could run it into an op amp or comparator and measure much smaller voltages.

Your comments and questions lead directly to the real question.  What is the OP trying to do?  Is he trying to monitor how fast the pedals are spinning (cadence)?  Is he looking to implement a speedometer function that is less of a problem when changing wheels?  Is this a theft detection approach?  Is he just looking for a fun way to learn some electronics?  Motivation by a "real" world application.  The best answer and best advice will result from knowing answers to those questions.
 
The following users thanked this post: tpowell1830


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf