We are using Arduino to control two dc motors with an IR remote. Currently, both motors can only turn in one direction, but they can be controlled separately. Future developments are making motors reversible and adding gear ratios to produce more torque.
#include // IR libarary
#define Button_1 0xFF30CF
#define Button_2 0xFF18E7 // remote buttons in hex
int receiver = 13;// sets reciver to digital pin 13
IRrecv irrecv(receiver); // creates an instance of reciver
decode_results results;
void setup() { pinMode(10, OUTPUT); //motor1
output pinMode(9, OUTPUT); //motor2
output Serial.begin(9600);
irrecv.enableIRIn(); // start the reciver
}
void loop() { if(irrecv.decode(&results)) { // if there is an ir signal
Serial.println(results.value, HEX ); //print value to serial monitor
irrecv.resume();
switch(results.value){
case Button_1: //forward
digitalWrite(10, HIGH);// if button 1 turn on motor1
digitalWrite(9, HIGH); //motor 2
while(true) { delay(100);
if(irrecv.decode(&results)) { // if there is an ir signal
Serial.println(results.value, HEX ); //print value to serial monitor
irrecv.resume();
Serial.println("This sohuld say button2:");
Serial.println(results.value, HEX);
}
if (results.value == Button_2)
break;
}
case Button_2: //stop
digitalWrite(10, LOW); // if button 2 turn off motor
digitalWrite(9, LOW);
}
return;
}
delay(100);
}
7/22/22
We needed to create centripetal motion so that we could measure a constant centripetal acceleration. We explored multiple methods of creating this effect, including a motor and a hand crank before we eventually settled on a device that uses small propellers to push a rotating platform. This contraption utilized 2 dc hobby motors, which are readily available, 1 Arduino Uno r3, 1 L298n stepper driver, and 2 x 3.7 Volt Lithium Ion batteries. Please see the following schematic (I did not make this, it is from https://forum.arduino.cc/.
This setup is easily reproducible so that it can be used for academic purposes. I programmed it to run both motors for 30 seconds. Afterward, the user can re-run the motors by pushing the reset button on the Arduino. Code can be found on GitHub.
Here is how the contraption was assembled:
We made a water proof container with a hook at the bottom, which we could attach a string to. We filled this container with water and put a boyant object in, tied to a string.
The setup looked like this:
A short demonstration of the experiment can be found here: https://youtu.be/IdaRIiYbtYU
For information about how we are tracking the object look here.
For information about the physics at play look here.