Description:
After a lot of trial and error, I finally was able to succesfully demonstrate a kind of brownian motion using the dc motor. At the outset it seemed pretty easy to implement, using strong magnets on the motor and a set of etallic bearings placed in a container at some distance from the rotating magnets to influence motion. But as I started implementing it, it became quite complex. The system was delicate and everything depended on getting that perfect balance.
I have attached a link to the video.
Materials:
Metallic bearings
2 Strong magnets
1 DC motor
1 POT
1 resisitor (10K)
1 diode
1 Transistor
1 power supply
1 Arduino Uno
Code:
/*
* one pot fades one motor
* modified version of AnalogInput
* by DojoDave <http://www.0j0.org>
* http://www.arduino.cc/en/Tutorial/AnalogInput
* Modified again by dave
*/
int potPin = 0; // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the value from the sensor, between 0 - 1024
Serial.println(val);
analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}
- Login to post comments