Mechanical Bull for Dolls
This mechanical bull was created as a weekend hobby. The creation process was simple and did not last more than two hours. The materials I already had at home. For those who wish to make an equal, will be a good opportunity to recycle materials and learn how to use the joystick shield with Arduino. Hope you enjoy.
Materials:
- A volunteer (doll)
- Pieces of cardboard
- An empty soft drink
- Two servomotors
- A Arduino Uno
- A Joystic Shield
- Arms for the servants
- Three screws
- nuts and a washers
- Hot glue, scissors, knife, etc. ...
- Pieces of cardboard
- An empty soft drink
- Two servomotors
- A Arduino Uno
- A Joystic Shield
- Arms for the servants
- Three screws
- nuts and a washers
- Hot glue, scissors, knife, etc. ...
Creating the Model
I used a can of soda as a model for the doll bull riding. After that, I drew on the cardboard, cut out the template and glued using hot glue.
Joining the Servomotors
The servo motors are fixed on each other as shown, using a piece of cardboard to position them correctly and hot glue.
Attaching the Mount
Joining small pieces of cardboard with a hole in the center, was made a bracket to hold the mount in servants.
Joining the Servants and the Mount
I used a bolt, a nut and washer to secure the mount in servants, according to the figure.
Also used a piece to make the linking of movement between the servo arm and mount. This part should be a little slack for not hang with the movements.
Also used a piece to make the linking of movement between the servo arm and mount. This part should be a little slack for not hang with the movements.
Fixing on a Base
The base was made with a simple cardboard cutout. I made the design of servo arm that controls the base, cut out and pasted it on cardboard with hot glue.
I used a part of the soda can as a handle to hold the puppets up on it.
I used a part of the soda can as a handle to hold the puppets up on it.
Assembling and Programming the Controller
Software:
#include <Servo.h> // incluindo a biblioteca dos servos
Servo SRx;
Servo SRy;
const int VRx = A0;
const int VRy = A1;
int sensorVRx = 0;
int sensorVRy = 0;
int outputVRx = 0;
int outputVRy = 0;
long tempo_anterior= 0;
long intervalo= 100; //milisegundos
unsigned long tempo_atual;
void setup()
{
Serial.begin(9600);
SRx.attach(9);
SRy.attach(10);
}
void loop()
{
tempo_atual = millis();// o tempo atual é igual ao tempo de funcionamento do uC
sensorVRx = analogRead(VRx);
sensorVRy = analogRead(VRy);
outputVRx = map(sensorVRx, 0, 1023, 0, 180);
outputVRy = map(sensorVRy, 0, 1023, 0, 180);
if(tempo_atual - tempo_anterior > intervalo)// se o tempo atual menos o tempo anterior for maior que o intervalo com que eu quero fazer minha acao
{
tempo_anterior = tempo_atual;//tempo anterior recebe o tempo atual
Serial.print(outputVRx);
Serial.print(",");
Serial.print(outputVRy);
Serial.print(",");
Serial.println("");
}
SRx.write(outputVRx);
SRy.write(outputVRy);
delay(2);
}
Running:
#include <Servo.h> // incluindo a biblioteca dos servos
Servo SRx;
Servo SRy;
const int VRx = A0;
const int VRy = A1;
int sensorVRx = 0;
int sensorVRy = 0;
int outputVRx = 0;
int outputVRy = 0;
long tempo_anterior= 0;
long intervalo= 100; //milisegundos
unsigned long tempo_atual;
void setup()
{
Serial.begin(9600);
SRx.attach(9);
SRy.attach(10);
}
void loop()
{
tempo_atual = millis();// o tempo atual é igual ao tempo de funcionamento do uC
sensorVRx = analogRead(VRx);
sensorVRy = analogRead(VRy);
outputVRx = map(sensorVRx, 0, 1023, 0, 180);
outputVRy = map(sensorVRy, 0, 1023, 0, 180);
if(tempo_atual - tempo_anterior > intervalo)// se o tempo atual menos o tempo anterior for maior que o intervalo com que eu quero fazer minha acao
{
tempo_anterior = tempo_atual;//tempo anterior recebe o tempo atual
Serial.print(outputVRx);
Serial.print(",");
Serial.print(outputVRy);
Serial.print(",");
Serial.println("");
}
SRx.write(outputVRx);
SRy.write(outputVRy);
delay(2);
}
Running: