• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Speed control of a fidget spinner

Status
Not open for further replies.

Beets

New Member
Hello, anyone good with sensors, robots and control sytems help me with this question. (not neccesarily a robot question)

I am trying to find a way of capturing the speed of a rotating fidget spinner using a micro-controller (the pic18f45k20). The method I am using to make the fidget spinner run is as shown in this link (It also has a video and how it is done including a circuit diagram).

link: http://www.instructables.com/id/Electromagnetic-Fidget-Spinner-Accelerator/

My main aim is to control the speed using the micro-controller (pic18f45k20).

Anyone please advise me on how I can do this and which sensors to use in order to capture high speeds that can vary between 500rpm and 1000rpm .

Thank you.
 

dr pepper

Well-Known Member
Most Helpful Member
If you've seen the 80s gizmo 'power ball', well it has a magnet in the ball and a magnetic reed switch in the rev counter display, simple and measures up to 15k rpm.
 

JonSea

Well-Known Member
Most Helpful Member
An easy way to measure speed would be an IR optical sensor like this one from Elecrow Electronics. This type of sensor will generate a pulse each time a piece of reflective tape passes in front of it. The detection range between tape and sensor is a few cm to half a meter.

These sensors are commonly used to measure the speed of rotation for machinery.
SmartSelectImage_2017-11-02-03-18-16.png
 

Beets

New Member
Dr Pepper, thanks I'll look into that. I'll be back because I still have to learn how I can vary and stabilize the speed.
 

Beets

New Member
Jonsea, Thank you. I also found many other types of this IR sensor on google. I guess what remains is trying to program it together with a micro-controller
 

Beets

New Member
Thanks Dr Pepper. That link will actually help because my design already includes PID tuning, even though am using matlab to design the circuit specifications and some op amps for building the circuit. If the PID circuit works then, I will try to incorporate it with a micro-controller. Am not yet sure how that will work. And for the speed sensor, I suggested a photo-transistor (that will measure how many times the light is blocked by the spinner in a second), which i am not sure will work fine. I intend to replace it with an IR optical sensor as suggested by JonSea.
This is my design so far.
link : https://drive.google.com/open?id=0B8fxRqAjEVYeRC10VTdzVUxid3M
 

jpanhalt

Well-Known Member
Most Helpful Member
Your lower speed is 500 rpm, which equates to 8.3 Hz. Rather than measuring pulses per second (assuming one pulse per revolution), I would measure the time between pulses and "calculate" speed from that to get more timely control. I put calculate in quotes as your control system may be based on time alone and not actually do that calculation.

John
 

jpanhalt

Well-Known Member
Most Helpful Member
You chip has one or more 16-bit timers. The first is Timer 1; the others will have sequential odd numbers. Timer 1 types can be set to trigger on either, both, or alternate edges of a pulse. You probably just want to pick either a rising or falling edge. Since your MCU will be running very fast relative to the pulse, you also need to pre-scale the counter (or its trigger) so you do not overflow more than once during a count. As 16-bits give you more than enough precision for your project, I would set the pre-scale fairly high.
 

dr pepper

Well-Known Member
Most Helpful Member
Good idea from Jp.
I cant open your link however if your using an arduino as the processor there is a pulse library which is meant for such an application.
 

Pommie

Well-Known Member
Most Helpful Member
To add to what John already said, if you use the ccp (PWM) module you can capture timer1 on each rising edge. Subtracting current from previous will give you the period.

Mike.
 

Beets

New Member
Thanks guys, I appreciate. Currently I only have access to a micro-controller. By the way, which of the two is easier to use, a micro-controller or an arduino?
 

Pommie

Well-Known Member
Most Helpful Member
If your Micro is a pic then most newer ones have a PWM/CCP module built in.

Mike.
 

dr pepper

Well-Known Member
Most Helpful Member
An arduino is a micrcontroller, with a board and an Ide and a range of libraries.
The arduino is a good platform to prove your concept or for a one off as the range of libraries is extensive.
The ide is free and dead easy, and the 'duino itself is also cheap.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top