Magnetic Motion Machine
by TecnoProfesor in Workshop > Science
13856 Views, 78 Favorites, 0 Comments
Magnetic Motion Machine
This time I share with you an easy and low-cost way to make magnetic motion with Arduino or compatible microcontroller.
I think it could be an easy magnetic experiment to build in the classroom or a good inspiration for others makers to develop similar projects.
I hope you like
Supplies
- One piece of plywood
- One A4 PVC film for inkject printer
- Five wooden pieces (this time I have used wooden pieces from a block toys)
- Two micro servomotors
- One Arduino NANO or compatible microcontroller
- One mini breadboard solderless protoboard 400 contacts
- Eight neodymium magnets (8 x 3 mm) (5/16" x 1/8")
- Five neodymium magnets (12 x 3 mm) (15/32" x 1/8")
- One silicone pistole and silicone bars
- Six male/male jumper wires
Build a PVC tube with a diameter a little more greater than 15/32''
Glue three wooden pieces on the plywood as you can see on the PICTURE 1. Glue on the top of the yellow pieces the PVC tube
The object that inside the PVC tube is moving from one side to other is formed by five neodymium magnets (12 x 3 mm). So the object has got a north pole and a south pole.
Taking into account the position of the each pole in the object inside the PVC tube, glue three neodymium magnets with the same pole of the object faced to the servomotor and one neodymium magnet with the opposite pole as you can see on the PICTURE 2
Glue the servomotor to one of the wooden pieces as you can see on the PICTURE 3
Load in the microcontroller the following sketch:
#include Servo.h
#define SERVO1_PIN 2
#define SERVO2_PIN 3
Servo myservo1;
Servo myservo2;
void setup() {
myservo1.attach(SERVO1_PIN);
myservo2.attach(SERVO2_PIN);
}
void loop() {
#define delaymotor 15
#define delaymotion 250
for (int angle = 180; angle >= 5; angle -= 5) {
myservo1.write(angle);
delay(delaymotor);
}
delay(delaymotion);
for (int angle = 180; angle >= 5; angle -= 5) {
myservo2.write(angle);
delay(delaymotor);
}
delay(delaymotion);
}
Connect the data pin of each servomotor (myservo1,myservo2) to pin 2 and 3 and its belonging GND and VCC (5 V). The (delaymotor) value is the delay time to servomotor reaches a position. The (delaymotion) value is the frecuency of the motion
Insert the object in the tube in the right orientation (see STEP 2) and close the side where we are going to install the servomotor to avoid the object exit the tube.
Run the sketch previously loaded and look for the right position of the servomotor. In the right position the three magnets have to push the object to the other side of the tube. When you find this position, glue the wooden piece to the plywood (PICTURE 4)
The other magnet works when the object arrives from the opposite side. This magnet attracts the object and stop it.
Repeat the step 2, 3 and 5 for the other servomotor in the opposite side.