Introduction: Time Manipulation Effect With Differential Stroboscope( Thoroughly Detailed )

About: Im a student whos been tinkering with electronics for as long as i can remember.The oldest of my memory is that i connected a rc car motor to mains line, Im very alive and the sparks were scary and cool at the…

Today we will learn to make a differential stroboscope which can make periodically moving objects appear still to the eye. Still enough to take note of minor details in the spinning objectwhich is basically invisible otherwise. It can also show beautiful patterns with changing frequency and also give accurate RPM of the spinning object without any physical contact.

But before we begin, there is something you need to understand. This instructable is going to be different than most other Instructables. This instructable assumes that you have NO prior knowledge of electronics, and tries to explain every bit here and there so you can shape this project with whatever you have in hand during these times. How? you may ask... If you understand a subject well enough, Most, if not all of the obstacles in creating something is removed from your way and all that remains is enjoyable challenges.

The main goal is to draw more people into electronics so I can go next door and ask for resistors instead of sugar or make electronics jokes like,

Customer: Do you have any two-watt, 4-volt bulbs?

Sales Rep: For what?

Customer: No, two.

Sales Rep: Two what?

Customer: Yes.

Sales Rep: No.

or, The red wire said to the black wire "Why are you so sad?"

The black wire replied "I've been grounded"

OR, Who do you call when you need to determine the value of a resistor in a circuit?

Sherlock Ohms.

You get the point...

Step 1: But Why?

I see a lot of people, including me, get interested in tinkering with electronics and making cool projects like the ones you see online or on your local science fare. So you look up a project, follow it step by step, and suddenly something decides to stop working, Or you cant find THE EXACT part number mentioned in there for something which can be easily replaced with something more readily available.

But no, not anymore.

In this project, aside from learning how to do, we will learn what to do and why we do..

The basic goal is after you've finished this project, you yourself can decide what things you want to change or how you can get by with things going your way,all the way.

as these are common knowledge you can carry them on to your next project and make it easier!!

Step 2: Theory of Operations

A stroboscope, also known as a strobe, is an instrument used to make a cyclically moving object appear to be slow-moving or stationary. The principle is used for the study of rotating, reciprocating, oscillating, or vibrating objects. Machine parts and vibrating strings are common examples. This effect was first introduced by stroboscopic disks around 1833, which was marked the first time humans saw moving images from still images!! Stroboscopes are vastly used in industries to observe rapidly moving objects, while running to detect faults which don't occur when the machine is stopped.

So basically, we are doing the opposite of the 1833 version. We want a still image from a moving object. Look at the wheel gif, Say every time the red bar reaches the topmost bar, a bright flash illuminates the wheel. Our brains are really efficient, albeit rather lazy. So when we flashlight on a fast enough periodically moving object, our brain decides to not focus on the part between the flashes and focus on the flash and the flashed image itself.

If we want to calculate the RPM of an object, there is a problem with this approach. let's imagine the above wheel spins at 60 Rounds Per Minute Or at 60 RPM. Divided by 60, we get 1 round per second. So we have to flash a light every other second. In another way, this object should appear perfectly still if we flash a light at it every second. This is where the trouble begins. So what happens when this object spins at 120,180,240 or even 6000 RPM? Basically, any integer multiplied or divided RPM is going to appear still with a single flash frequency. If the object spins at 120 RPM, at 60 flashes per minute, the object has already completed 2 spins in 1 second and returned to its Top position ( watch the wheel above for more clear thought picture ). So with every multiplication, we get unsure of how fast the object is spinning.

To solve this, We are going to add a second pulse or a second flash to our strobe. So what happens when we do that?

For the correct RPM, We are going to see the flashed image and an inverted flash image together. Let's go back to the wheel. The problem started at 120 RPM, because the light flashed slower than the object spins. So for our previous wheel, which was spinning at 60 RPM, we add another flash at the half-cycle ( the time taken to complete a single spin) or at 1/2 second. So at the correct rotating object speed, we will see the red bar once when it reaches the top and again when it reaches the bottom. Here's the fun part. At 120 RPM, and at 60 flashes per second, We will see the red bar when it reaches the topmost part and we will see only one image. at 120 RPM, the object spins 2 times per second, so it takes .5 second to complete a spin. So at a .5 sec+.5 sec flash, the object is seen only once, in a single state. This phenomenon is easier to observe when you use 2 different colors for 2 pulses. ( see added images)

please note that if the object is symmetrical, meaning you can't say which side is up or which is down, like a circle, You have to mark a point on the object with a tape or a marker.

Step 3: What Do We Want the Arduino to Do?

We want the Arduino to flash twice in a single specified time frame, which we will call the Pulse Cycle. The Arduino nano/uno are readily used, and they have processing speeds of up to 16 Mhz, which means they can calculate, adjust and pulse our light at adequate speed with processing power to spare!!, in this project, The code is limited to objects spinning at a MILLION RPM!! yes, A single spin every Microseconds, that's a thousandth of a millisecond Which again is a thousandth of a second!! I would love to meet you if you can find something that spins nearly as fast...

Step 4: Parts Needed

  1. An Arduino, doesn't matter which one, Most if not all Microcontrollers are capable of doing this project!
  2. An NPN transistor ( MJE3055T, TIP122, etc etc) (See next step)
  3. resistor, 470 Ohm or 1 kilo Ohm (More on the next step)
  4. A Bright enough LED, The brighter the better the images. Preferably 15 to 60 watts, With adequate heatsink.
  5. Some Jumper Wires.
  6. 3 PushButtons, You can use any type of push buttons.( I used these just because they had a nice clicky feel to them, enjoy the little things!!)
  7. Some Heatsink paste for the LED.
  8. Any rotating object, with a point, marked. Don't have marker? Just smear a little bit of heat paste on them!
  9. Any capable Power supply / Or battery

Step 5: Why and Which Part to Use.

First, let's talk about the LED.

To get a Clear image, we need to keep the led on for a very short amount of time, around 50 microseconds in our case( don't worry, you can edit the time on code ). As we lower the time the LED is kept on, We get a sharper image, Because the object is still rotating while the LED is kept on. So the longer we keep it on, the farther it moves and the hazier the image gets. On the other hand, IF we keep the led on for a very low amount of time, we get little brightness to observe the object, which also makes it hard to use in areas with normal lighting conditions.So, we have to find the perfect trade-off between brightness and sharpness. You can experiment with different values on the code. Please note that it's preferred to use an adequate aluminum heat-sink and thermal paste with the led.

Next, The Transistor.

This is to drive the LED, because the Arduino pins has an absolute maximum current rating of 40mA and a continuous current rating of 20mA. We have to do a bit of simple division calculation for this. Say you get a 60 watt LED which runs at 12 Volts. By the power of ohms law, about power, P=VxI, where P is the wattage, V is the voltage and you guessed it, I is the Ampere required. We want I from this equation, So, I= P/V, 60/12 = 5A. This means our 60 watts LED draws about 5A at 12 Volts, so we need our transistor to be able to carry at least 5 Amps.

For this, Gather some transistors you have in hand, and google "******* transistor datasheet" where the stars are the model number silkscreened on the transistor.

Now on the datasheet pdf, search for The collector current. I added some common transistors datasheet, In them You can see, the mje3055t has a collector current of 10A, where we need 5 A, this means it can easily drive our LED.

Next, The TIP122, It has a continuous current of 5A and a peak current of 8A. This is really close to the border, If we were driving the led continuously, keeping it on without any breaks, this transistor would not be preferred. But we are keeping it on for a very, very small amount of time, So this can work fine. I wanted to test this and used a tip122 in my setup. The transistor never got warm to the touch, even after operating for long period of time.

and maybe the most common of em all, the 2n2222a. It has a measly collector current of .8A, or 800milli amp whereas we need 5A, Its HIGHLY advised against using this.

The Power Supply

You can use any Power supply you want as long as it can keep the led on continuously without this circuit. If you connect a 60 watt LED to a 12V 2A supply, there are 2 things that can happen.

1. The led is going to turn on for a second, and turn off for a second. This is the power supply trying to keep up with the demand.

2. The power Supply Is going to get very hot and maybe explode, which is undesirable...

Usually, a small 12-volt lead-acid battery or multiple 12V adapters connected in parallel can handle this circuit quite fine. Although this doesn't use much power because the led is kept on for a short amount of time, we need the supply to be able to handle the peak current, which is 5A in our 60-watt led's case.

Finally, The resistor

This resistor is a base current limit resistor, this connects our Arduino to the base pin of our transistor. Our Arduino can ideally supply 20mA from its pins, continuously. So to avoid going over this, we need to calculate the required resistance for our transistor. Again, by ohms law, V=IR. The Arduino nano/ uno outputs 5 V at its terminals, so, V=5, I= (20/1000)mA. so we get the value of R to be 250 Ohms. so we need a minimum of 250 ohms between our transistors Base and our output pin. You cant find a 250 ohm resistor easily, So a 220 Ohm resistor is also okay. Do remember, that our arduino is rated at a maximum 40mA, But its usually better to be much below the max current limit, just to be safe. so we can use 470 Ohm Or 1k Ohm, both of which are easily available.

Its also worth noting that usually, MOSFETs are better at controlling higher current loads, even in the region of double to triple-digit Amperes. They dont even require a base current limiting resistor, because they draw very little current from the Arduino. But not all MOSFETs are logic level. Put simply, a logic level is a specific voltage or a state in which a signal can exist. We often refer to the two states in a digital circuit to be ON or OFF. Represented in binary, an ON translates to a binary 1, and an OFF translates to a binary 0. In Arduino, we call these signals HIGH or LOW, respectively. There are several different technologies that have evolved over the past 30 years in electronics to define the various voltage levels. In our arduinos case, the logic "high" is 5V and the logic "low" is 0V or ground ( a disconnected wire is not 0 volt ). Most MOSFETs require more than 5V to turn them on, But there are specialized MOSFETs called Logic level MOSFETs that work fine with 5V from our arduino. Moreover, MOSFETs have a really low "internal resistance" aka Rds ( drain-source resistance ) typically in the 10s of milli-Ohms, which means they can carry more current while wasting less as heat. There's a bit of calculation in there, but we wont go that far here.

Learn more about Transistors and Resistors.

Step 6: The Actual Circuit.

First, We need the led to turn on and off according To our output, So we are going to create a common emitter configuration. With this, we are driving the negative side of the led, which means that the positive terminal of the led is directly connected to the power supply.

1. Get Your Arduino on a breadboard. I had to cut my breadboard sometime ago because I accidentally bought something that half fitted my breadboard, always check what you buy, then you won't have to do this...

2. Insert The Transistor. Note that the power lines of the breadboard are connected vertically and the other pins are connected horizontally. (see image)

3. Connect the resistor From the base of the transistor (Google **** transistor pinout) to a nearby empty rail.

4.apply small amount of Heatsink paste to the heatsink and screw the led in place.

5. Connect LED positive (anode) to the positive rail of the breadboard.

6. Use a jumper to connect The Collector Of the transistor to the negative (cathode) pin of the LED.

7. Connect Emitter of the transistor to the negative rail.

8. Connect The Arduino Output Pin, D5, and D6 to the Resistor. If you want, you can build 2 common emitter configuration to use 2 different color LEDs for a better stroboscope. This one works fine too.

9. Get 3 push switches and connect the common terminal to the negative rail and the others to D7 (Increase), D8 (Decrease), D9 ( Change Accuracy ). You can change these pins in the code, if necessary.

And that's all!! for a mesmerizing project, this is a pretty simple circuit :) .

Step 7: WAAIITTT, You Forgot to Share Grounds.

You forgot something. The most important thing. This is the reason most circuits don't work and possibly the simplest problem which gives the most erratic and non-diagnose-able cause of circuit not working. And it is sharing ground.

You did notice that we didn't connect any power to the Arduino. Because, we want to use the serial monitor to get data on the go so we are powering it from USB. This means there are 2 different power sources here.

1. The Power from USB

2. And the power from the power supply, likely 12 volts.

This site does a nice job of explaining:

"A lot of the time on the Arduino forums we get questions regarding wiring things together. One common format is:

I want to connect my 12V powered LED strip to my Arduino but I can’t get it to communicate. I have checked all the connections and they seem fine. I have a 12V power supply for the LEDs and the Arduino is powered from the computer. And 9 times out of 10 the first question we have to ask in return is: Have you connected the grounds? And guess what the reply to that usually is? Yep: No, do I need to? And isn’t that dangerous, connecting a 12V ground to the 5V Arduino ground? That in itself shows a fundamental lack of knowledge about what “ground” actually is. So let’s start by clearing that up: Ground, technically, is just a name given to a point in your circuit. That point is a point chosen by you against which all other voltages in the circuit are measured. Often it is the point of lowest potential, such as the – side of a battery, or the – connection of a power supply. Or it may have been chosen for you, such as the ground signal from the USB connection to your computer. The 5V pin of the Arduino isn’t 5V – it is 5V with respect to the ground pin. Equally you could rename the 5V pin to Ground, and what was the ground pin then becomes -5V with respect to [the new] ground. So ground has to be a single point in your circuit against which all voltages “make sense”. Let’s take a look at the typical circuit from the original question. An Arduino connected to some 12V device (such as some 12V LEDs):

Here you can see the Arduino connected to, for example, a 5V USB charger. It could be a battery, or it could be the USB port on your computer. It matters not. Connected to that is a 12V device which then has its own 12V power supply. Now. Where is ground in that circuit? The 5V pin of the Arduino is 5V with respect to the ground pin of the Arduino. So seen from the Arduino’s point of view ground is, in the image above, the bottom line of the Arduino’s power circuit (charger -). However, the 12V of the external circuit is 12V with respect to the – side of the 12V PSU. So seen from the point of view of the 12V device the ground is the lower side of the 12V circuit – the “PSU -” connection. That doesn’t sound too bad, does it? Each device’s power is correct with respect to the power supply it is running off. As far as that goes, sure. However take a look at the data signal going from the Arduino to the 12V device. What voltage is that at? Well, seen from the Arduino’s point of view, with respect to its ground, since it is generating the signal, it is a 5V signal. But, what about what the 12V device sees? What voltage is that signal with respect to the 12V circuit ground? Given that voltages aren’t absolute – they are only relative to a reference point within the same circuit, it is impossible to know what the voltage is there. There’s something more fundamental at play here though which can help you to understand it even better. In the image above there are two red arrows in loops. That is the flow of the current around the circuit (shown as conventional current flow). The key phrase there is around the circuit. Current has to flow out of a supply, through a circuit, and back to the supply from where it came. In the circuit above the current can flow out of the 5V, through the Arduino, and back to the 5V again because there is a complete loop there. Likewise there is a loop from the 12V supply, through the 12V device, and back to the 12V supply again. But there is no such loop for the signal from the Arduino to the 12V device. If we think of the Arduino’s output pin as a small power supply there really should be some way for the current to get out of the Arduino, through whatever it is connected to, and then back to the Arduino again. There is no way for that to happen in this circuit. So you connect the grounds. As soon as you do that a lot of things start to happen. Let’s do that now and see how the circuit looks:

The grounds are now linked by the green wire at the bottom. Immediately we can now see a loop has appeared where the current from the IO pin can flow through the 12V device, out of the ground connection of the device, along the green wire, and back up through the ground connection of the Arduino. In actuality the loop is a branch from the 5V power loop. Current goes from 5V into the Arduino where it splits, some to run the Arduino and some out of the IO pin. From there it goes through the 12V device, down to ground, then joins the current flowing out of the ground of the Arduino to go back to the 5V supply. It’s useful to think in terms of discrete loops though so you can get a better idea of how the ground fits into things. Also, now, since the ground of the 5V section and the ground of the 12V section are one and the same (in a schematic all points along a line are the same point) any signals generated from the 5V side are recognizable by the 12V side as 5V since the reference point (ground) is the same for every point in the circuit. But isn’t it dangerous? Absolutely not. Not only is it not dangerous, but it’s also safer than not connecting grounds together. Since now the whole circuit has a single baseline voltage to reference everything from 12V is 12V and 5V is 5V. Without that link the voltage difference between ground on the 5V side and 12V on the 12V side could potentially be many hundreds of volts (especially when the distances between the two points are great). For fully isolated systems, such as battery-powered devices, that is not a problem. For anything using power supplies though it can be quite dangerous. And that leads me on to my next point – a slight variation on the question: I built a circuit with a 12V device powered from a power supply which is controlled by my Arduino. It all works well. But as soon as I run the Arduino from a battery instead of my computer it stops working. This is a classic case where the grounds haven’t been connected together by the user, but there exists another path linking the grounds together. This is most often the earth connection of the computer and the earth connection of the power supply being linked together through the house wiring:

As you can see the current loop still exists, it just takes a longer route. As soon as you remove the Arduino from your computer and power it from batteries – or a power supply that has no connection to earth – the lower part of that loop disappears completely and you are back to the original circuit with only 2 loops. And it stops working. Connect the grounds together manually, though, and you reinstate that portion of the loop, making it all work again. So there you have it. If you have multiple power supplies in your project, whatever they may be (except in special circumstances) you must connect the grounds together for it to work. If it works without connecting the grounds together then you are inadvertently relying on some pre-existing ground connections to do the job for you, and that is likely to fail if your setup ever changes."

Step 8: The Code.

  • This code can seem Fairly complicated. So I created a simple enough flowchart to show how the Arduino decides what to do and when to do. Follow the Flowchart and look at the code. You can see the logic becoming easier.

I am giving short descriptions of all the syntaxes in my code and what they intend to do.

  • Const: Short for Constant, A value that never changes, not unless you tweak the code.
  • byte, Unsigned, Unsigned long: These are data types. They define the range or/and the type of numbers that can be used.
  • pinMode: This tells the Arduino what pin is what, Which pins to look for input and where to output.
  • Void setup(): this is where we Prep for our code, runs once.
  • INPUT_PULLUP: This is a bit tricky... Okay, here it goes

See, The Arduino is a microcontroller right? so it basically senses voltage and current at its pins when you tell it to "listen" for inputs. A good thing with Arduino is that it has Very High input Impedance ( Impedance is the total 'blocking' of the flow of current, including resistance. It is more important in AC current, but not so in DC current, we won't go that deep...). Remember the law from before? Yes, our trusty friend ohm dropped us some laws. And from that, We understand that current decreases as resistance increases. This means the Arduino is built in a way so it can react with very little current. From the datasheet, we get an input impedance of 100MegaOHM!! that makes for a really, really, REALLY, low current draw.

That's all fine and dandy, but what's wrong? This means that the pins can *switch* there states ( are they on or off) with VERY little current. Even the minute amount of current created by clothes against the skin can switch the pins. If that is the case, our switches wouldn't work, They would start changing erratically as soon as someone even comes near. More to that, our environment is electrically noisy. Most everything around you has a bit of charge or current in them, which isn't of much use, but just enough to tip the scales in our Arduino. So we have to find a way around this. So we use something called a pullup or pulldown resistor. These are resistors that "Pull" the pin Up, meaning High, or 5v in our case, or Pull the pin down, meaning Low or to ground. This is basically connecting a high value, usually 10 K ohm resistor from the pin to 5v or ground, so a little current can flow in / flow out of the pin. Mind you, this current is still significantly larger than the current required to turn a pin. But it's still really low to make us worry about heat and efficiency. So say we connect a pullup resistor, then our switch would connect from the pin to ground. The switches have little to no resistance, so it provides a less resistance path for the current to flow and our switches work seamlessly!. So to make our life simpler, the good people at Arduino included Pullup resistors inside there chip, so we can call for it when necessary :). We very rarely need to use external Pullups, But pulldowns are different, cause the Arduino doesn't include them, it only includes Pullups.

  • Serial.begin: This is just to enable the serial output function, so we can observe what our code is doing. The Numbers after that define how many bits are going to be sent per second. Generally, higher values are better but sometimes may cause issues on clone boards.
  • Void Loop(): The part of our code that runs again and again as soon as it ends, this is where the magic happens.
  • Static boolean: This is also a data type, but instead of numbers, it stores only true and false.
  • digitalRead: The state the specified pin is in.
  • If() : its a function. The adjoined code only runs if the statement inside (the brackets) is true. Say,

If( Sara has 10 apples )

{share with adam}. So by this, Sara will only share, if she has 10 apples, any other ways, she won't. ( she seems rude... )

  • Else() : This is used with the if statement, Meaning that if the condition is not true in the if statement, do this.

But this is not absolutely necessary for the if statement to work, no else statement is also fine, but can be useful in many cases.

  • Switch: It's similar to if-else, But lets us Use multiple rules or laws. Let's say Sara has 3, then 5 and then 6 we switch with how many apples Sara has.

Switch( The number of Apples Sara has )

case ( she has 3 ) { give to beth}

case( she has 5 ) { don't give anybody }

case( she has 6) { give adam half }

simple enough, right?

  • Break: This tells the code to move on from the switch function, otherwise, it "falls Through" and does nothing else.
  • digitalWrite LOW/HIGH: we are setting the pins High or low, Connecting it internally to 5 volts or ground with this command.

Bonus: Have you noticed something weird? In the code most words are written together and they are written likeThis, the first letter small and the start of the next word capital. This is called camelCase and is a famous method of writing names in codes. You may ask that what's wrong with using spaces, Spaces are generally more prone to "loops" in the code, where the computer cant understand if this name is a part of the word in left or the word in the right. Still don't like it? Why don't you start making your own language, Who knows how genius Is inspired!!

See! only these simple concepts were looking complicated!!

Step 9: Upload the Code and See the Magic Happen.

Upload the code, and inside the Arduino compiler, go to serial Monitor from tools -> serial monitor. Set the baud rate to the one you have in code, By default 2000000. Press The down button to decrease the pulse rate, Up button to increase. They by default increase/decrease by 100, Press The change accuracy button to increase decrease by 1,10 or 100. Yes, you can change the accuracy down to microseconds!!.

Although the effect seems very compelling, the object is still spinning! So please divert from your plans of sticking fingers inside.

And also, it's better that you don't directly stare into the led, direct bright flashes irritate the eyes.

Remember, You get the accurate RPM of your object when you see 2 markings exactly opposite of each other. Read the Explanation in step 2 and describe what's happening with changing frequency.

If your crafty enough, you can create beautiful artworks with this and a bit of tinkering here and there!!

Step 10: Thanks

This was my first instructable, so im very nervous about how my project is going to do out in the wild. I might have made some rookie mistakes on the way, But nevertheless, I put all my heart into this to make it a worthwhile read. All I hope is that there's more people on the world with a tinkering passion and may this Poke their interest!

Few things, I originally decided to use an amoled display to show the serial output, but with the current situation, I couldn't get my hands on one, As Leonardo da Vinci said, "I have offended God and mankind because my work didn't reach the quality it should have."

Thanks again if you made it this far!!

First Time Author Contest

Participated in the
First Time Author Contest