UPDATE: Magzor has just started a Kickstarter campaign. Please check it out to get a good package deal on many of their components. Many of which were used in this tutorial.
This tutorial will show you how to build your own Stroboscopic Animator using Magzor's Mechanotronic Design Portal as a starting point. Magzor Corporation is a business in California that is trying really hard to simplify robotic design. They want to enable users with little to no engineering experience to design and manufacture a custom robot by themselves in a matter of hours.
What is a stroboscope? A stroboscope is an instrument that uses a strobe light to make a moving object look stationary… We will use this feature to create an interesting 4 picture animation on a rotating disk.
Have a look at the video below to see the project in action, and the MDP process walk-through:
Video
Parts Required:
- Arduino MEGA (or compatible board)
- Magzor I2C Arduino Shield
- Magzor MIC: Power and I2C board
- Magzor MIC: 10x GPIO
- Magzor MIC: 2x DC Motor Driver
- Magzor Hall Effect Breakout
- Neodymium Magnet
- Magzor LED board
- 6V 2.5A DC Planetary Geared Motor
- 5V DC 4A Power supply
- RJ45 cable
- Female to Female Jumper wire
- Misc items: scrap paper, wood, brackets, screws, single and double-sided tape, cardboard.
Magzor Schematic Diagram
Click to zoom ...

Further build instructions can be obtained by selecting the components in the Mechanotronics Design Portal within the Magzor website. Generating the build, and then selecting "Setup Instructions" tab at the top of the page. See video above to see this process in action.
Arduino Sketch
Make sure to copy and paste the following code into your Arduino IDE. It doesn't seem to work directly from the browser. You also need to install the Arduino Magzor I2C library ( http://magzor.com/downloads/ )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ================================================================================================================================================== | |
Project: ArduinoBasics: Stroboscopic Animation using Arduino MEGA | |
Author: Scott C | |
Created: 24th Apr 2016 | |
Arduino IDE: 1.6.4 | |
Website: http://arduinobasics.blogspot.com/p/arduino-basics-projects-page.html | |
Description: This sketch will control various Magzor MIC boards using the Magzor I2C Arduino Shield on an Arduino MEGA to | |
create a Stroboscopic animation. The Arduino will listen for a Hall effect sensor to be triggered by a magnet, | |
which will cause an LED to flash rapidly (like a strobe light), allowing some pictures rotating on a disk to | |
appear motionless. We will string 4 of these pictures together to create an animation. | |
Library required: It requires the Arduino MagzorI2C library (http://magzor.com/downloads), and the Wire library | |
NOTE: Some of this source code was AUTOMATICALLY generated by the Magzor MDP process: | |
//Format: Arduino, Build ID: b52016f6-c3a6-4ae0-92f9-892972f1f729 | |
================================================================================================================================================== */ | |
#include <Wire.h> | |
#include <MagzorI2C.h> | |
//Global Declarations | |
//MIC board address constants | |
static const uint8_t GPIO_BOARD_1_ADDRESS = 0x10; | |
static const uint8_t MOTOR_BOARD_1_ADDRESS = 0x30; | |
//MIC objects | |
I2CDevice_IOBoard io_board1(GPIO_BOARD_1_ADDRESS); | |
I2CDevice_MotorBoard motor_board1(MOTOR_BOARD_1_ADDRESS); | |
//device objects | |
// connector 0 on Magzor MIC: 10x GPIO board #1 | |
XPin led1 = io_board1.get_XPin(0); | |
// connector 1 on Magzor MIC: 10x GPIO board #1 | |
XPin hall_effect1 = io_board1.get_XPin(1); | |
// connector 1 on Magzor MIC: 2x DC Motor board #1 | |
XMotor motor1 = motor_board1.get_XMotor(1); | |
const int points =25; | |
uint8_t reset_pin = 0; | |
uint8_t interrupt_pin = 2; | |
unsigned long TimeBetweenEachFrame[points]; | |
int counter=0; | |
unsigned long diff = 0; | |
unsigned long current = 0; | |
unsigned long previous = 0; | |
void setup() { | |
// wait for MICs to initialize | |
delay(1500); | |
Wire.begin(); | |
Serial.begin(9600); | |
//register reset and interrupt pin | |
MagzorI2C::setup(reset_pin, interrupt_pin); | |
//register MIC boards | |
MagzorI2C::register_i2c_device(io_board1); | |
MagzorI2C::register_i2c_device(motor_board1); | |
motor1.set_direction(1); //set the direction of the motor | |
motor1.set_speed(250); //ramp up the motor | |
delay(100); | |
motor1.set_speed(130); //set the speed of the motor to 130 (Note : the maximum is 255) | |
previous=millis(); //initialise the "previous" variable | |
} | |
void loop() { | |
//Hall effect sensor will trigger LOW when it encounters the South side of a magnet | |
if(hall_effect1.digitalRead()==LOW){ | |
//Get the current time | |
current=millis(); | |
/*Calculate the time difference between each frame. | |
The time for one revolution of the disk is calculated by taking the previously triggered timestamp and subtracting it from the currently triggered timestamp. | |
We can then divide that time by 4 to get a rough estimate of the time between each frame. */ | |
diff = (current-previous)/4; | |
//Save the time between each frame in an array, so that we can transmit it to the Serial monitor later on | |
TimeBetweenEachFrame[counter] = diff; | |
//Save the current time for the next round of calculations | |
previous=current; | |
//The first 5 rounds, show frame #2. I have subtracted 2 to allow for processing time | |
if(counter<5){ | |
delay((diff*1)-2); | |
} | |
//The second 5 rounds, show frame #3. | |
if(counter>4&&counter<10){ | |
delay((diff*2)-2); | |
} | |
//The third 5 rounds, show frame #4. | |
if(counter>9&&counter<15){ | |
delay((diff*3)-2); | |
} | |
//The last 5 rounds, show frame #1, | |
if(counter>14&&counter<19){ | |
delay((diff*4)-2); | |
} | |
//When we reach the last round, reset the counter. Otherwise increment the counter. | |
if(counter>18){ | |
delay((diff*4)-2); | |
counter=0; | |
//dataDump(); //Uncomment if you want to know the speed of the disk - print the "Time between each frame" to serial monitor.. | |
} else { | |
counter++; | |
} | |
//Flash the LED for a fraction of a second. | |
led1.digitalWrite(HIGH); | |
led1.digitalWrite(LOW); | |
} | |
} | |
//Check the precision of rotation. | |
//Print the amount of milliseconds between each frame | |
//TimeBetweenEachFrame = Time for one complete rotation divided by 4. | |
void dataDump(){ | |
for(int i=0; i<points; i++){ | |
Serial.println(TimeBetweenEachFrame[i]); | |
} | |
} |
Putting it together

The Arduino MEGA microcontroller listens for the hall effect sensor to be triggered by the south facing side of the magnet on the underside of the rotating disk. As the magnet moves over the hall effect sensor, the sensor is triggered and the Arduino instructs the LED to blink for a fraction of a second. By manipulating the delay after the trigger time, we can get the LED to blink when one of the four images on the rotating disk is towards the front position. And if we get the timing right, we can make a simple animation.
If you watch the video above, you will see that the image bounces around a little bit. The duration of each frame is determined by the speed of the rotating disk (or motor), and the number of LED flashes per frame. Any changes in rotation speed will affect the position of the picture when the LED blinks. My rotating disk is not completely semetrical or centred correctly, and therefore a bit jumpy… but you get the idea. Bold images with high contrast seem to work best… Precision is key for this type of project. And if you can get the disk to rotate at a constant speed, you could probably do away with the hall effect sensors and magnets… however, in my case, these were essential in getting the project to work as intended.
This project is a lot of fun. You can really get creative by making your own pictures or 3 dimensional models (for a stop motion effect). Try different colours. It really is quite cool.
If you watch the video above, you will see that the image bounces around a little bit. The duration of each frame is determined by the speed of the rotating disk (or motor), and the number of LED flashes per frame. Any changes in rotation speed will affect the position of the picture when the LED blinks. My rotating disk is not completely semetrical or centred correctly, and therefore a bit jumpy… but you get the idea. Bold images with high contrast seem to work best… Precision is key for this type of project. And if you can get the disk to rotate at a constant speed, you could probably do away with the hall effect sensors and magnets… however, in my case, these were essential in getting the project to work as intended.
This project is a lot of fun. You can really get creative by making your own pictures or 3 dimensional models (for a stop motion effect). Try different colours. It really is quite cool.

Concluding Comments
I would like to thank Magzor for supplying the components used in this tutorial, and letting me try out their MDP process. I really like the concept, the one stop shop which looks after you from beginning to end. Providing everything I needed to get the project off the ground. The point of this exercise was to go through the entire process of selecting the parts, build the project, and get it up and running. And I have done that in no time at all.
There is only one library to download and install, and the good thing is that you don't have to go hunting for it. The latest "correct" working version of the library is easy to find, right there on the Magzor website… Speaking of the Magzor website, please make sure to take a quick look around. It is quite impressive.
UPDATE: Magzor has just started a Kickstarter campaign. Please check it out to get a good package deal on many of their components. Many of which were used in this tutorial.

If you like this page, please do me a favour and show your appreciation :
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
I can also be found on Pinterest and Instagram.
Have a look at my videos on my YouTube channel.
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
I can also be found on Pinterest and Instagram.
Have a look at my videos on my YouTube channel.
This project would not have been possible without the collaborative effort from Magzor Corporation.
Please visit their site and check out the MDP.
Please visit their site and check out the MDP.

Feel free to share this page with your friends in any way you see fit.
Description: Arduino Stroboscope Animation Rating: 3.5 Reviewer: Unknown ItemReviewed: Arduino Stroboscope Animation
0 comments:
Post a Comment