![]() |
MG90S Metal Gear RC Micro Servo Airplane Racing Car Truck Boat |
x 2 | |
|
PCA9685 16-Channel 12 Bit I2C Servo Driver |
x 1 | |
![]() |
ARDUINO UNO REV3 |
x 1 |
![]() |
arduino IDEArduino
|
Talk to Me
This project is part of an extensive research on the use of animatronics and interactive objects that I have been developing. It is an investigation into the possibility of creating an algorithmic script for a comic object.
The code is quite simple and is based on the notion of dramatic time and rhythm and is enough to make it feel like the Servo Motors are establishing some sort of secret communication. As the PCA9685 module supports up to 16 servos, the system can be used to simulate a crowded environment, such as a fair or trade. With the characters talking to each other.
The two figures in the project's cover photo are designed to be attached to the servo motors and move their mouth when the servos are actuated.
Two versions of the same idea follow. The first eliminates the use of the PCA9685 module, connecting the servos directly to the Arduino. In the second, it is possible to expand the system, connecting up to 16 Servo Motors at the same time.
#include <Wire.h>
#include <Servo.h>
#include <math.h>
Servo ator1;
Servo ator2;
/* SG90 SERVOMIN = 150 e SERVOMAX = 500 */
#define SERVOMIN 165 // Closed Mouth
#define SERVOMAX 310 // Open Mouth
#define NUMMASCARAS 8
bool debug = true ; // Qualquer outro valor vai desabilitar a saída das falas
char pontuacao[] = {" ,,,,,..........!!!!!?????"};
int tamanho = sizeof (pontuacao);
/* Each Character is allocated in a Array, with certain parameters
BOCA_ABERTA (OPEN MOUTH) equal SERVOMIN ou SERVOMAX divided by random number from 1 to 5
BOCA_FECHADA (CLOSED MOUTH) equal SERVOMIN ou SERVOMAX
MINFALA min number of lines of text
MAXFALA max number of lines of text
VELOCIDADE (SPEED of text)
mascara [7] [5] {
{ BOCA_FECHADA, BOCA_ABERTA, MINFALA, MAXFALA, VELOCIDADE}
}
*/
int mascara [NUMMASCARAS] [5] = {
{SERVOMIN, 280, 5, 15, 40}, // Arlecchino
{SERVOMIN, 240, 1, 10, 60}, // Brighella
{SERVOMIN, 310, 1, 8, 70}, // Collombina
{SERVOMIN, 310, 10, 25, 100}, // Dottore
{SERVOMIN, 290, 4, 12, 100}, // Pulcinella
{SERVOMIN, 310, 4, 8, 120}, // Pantallone
{SERVOMIN, 300, 2, 8, 80}, // Scaramouche
{SERVOMIN, 310, 3, 7, 70} // Isabella
};
String personagem [NUMMASCARAS] = {
"Arlecchino",
"Brighella",
"Collombina",
"Dottore",
"Pulcinella",
"Pantallone",
"Scaramouche",
"Isabella"
};
void setup()
{
Serial.begin(115200);
Serial.println ("The conversation");
ator1.begin();
ator1.setPWMFreq(50);
ator1.begin();
ator1.setPWMFreq(50);
randomSeed(analogRead(5));
delay (500);
}
void loop()
{
int endAct = random (0, 100);
int minhavez = random (0, NUMMASCARAS);
int outravez = random (0, NUMMASCARAS);
if (minhavez == outravez) {
outravez = 2;
}
int pausadramatica = random (5, 20);
int tempopausa = pausadramatica * 15;
String mudanca;
/* endAct means Dramatic Pauses */
if (endAct > 95) {
mudanca = "//// Mudanca de Ato ////";
tempopausa = 3000;
}
if (endAct < 95 && endAct > 80) {
mudanca = "//// Respira?ao ////";
tempopausa = 1000;
}
if (endAct < 80 && endAct > 60) {
mudanca = "//// Tensao ////";
tempopausa = 800;
}
conversa (minhavez);
Serial.println (mudanca);
delay (tempopausa);
conversa (outravez);
//delay (tempopausa);
}
void conversa (uint8_t idxmascara) {
if (debug == true) {
Serial.print (personagem [idxmascara]);
Serial.print (": ");
}
int minsilaba = mascara [idxmascara] [2];
int maxsilaba = mascara [idxmascara] [3];
int silaba = random (minsilaba, maxsilaba);
int maxvelocidade = mascara [idxmascara] [4];
int par = tamanho % 2;
if (tamanho % 2 == 1) {
par = par - 1;
}
for (int fala = silaba; fala <= maxsilaba; fala++) {
int semente = random (1, 7);
int minvelocidade = round (maxvelocidade / semente);
int bocaAberta = mascara [idxmascara][1];
int bocaFechada = mascara [idxmascara][0];
if (debug == true) {
Serial.print (" Bla");
int idxponto = random (0, tamanho);
if (fala == maxsilaba) {
int index = par;
idxponto = random (index, tamanho);
}
char ponto = pontuacao [idxponto];
Serial.print (ponto);
}
for (int pulso = bocaFechada; pulso < bocaAberta; pulso++) {
ator.setPWM (idxmascara, 0, pulso);
}
delay (minvelocidade);
for (int pulso = bocaAberta; pulso > bocaFechada; pulso--) {
ator.setPWM (idxmascara, 0, pulso);
}
delay (minvelocidade);
}
delay (maxvelocidade);
if (debug == true) {
Serial.println (" ");
}
}
And the second version:
/*Chit Chat */
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
/* Descobrir a posicao minima e maxima das bocas */
#define SERVOMIN 300 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX 500 // this is the 'maximum' pulse length count (out of 4096)
// Enderecando meus velhos
int silaba = 0;
int velocidade = 0;
int nropersonagem = 9;
char pontuacao[] { " ,,...!!!???" };
int tamanho = sizeof (pontuacao);
void setup() {
Serial.begin(115200);
Serial.println ("The Conversation");
Serial.println ("Infinite Play (Or until the batteries last.) ");
pwm.begin();
pwm.setPWMFreq(60);
randomSeed(analogRead(5));
delay (500);
}
void conversinha (uint8_t velho) { // Chit Chat
int silaba = random (1, 7);
for (uint16_t fala = silaba; fala <= 7; fala++) {
int velocidade = (random (1, 4)) * 50;
int bocaAberta = SERVOMAX / random (1, 4);
int idxponto = random (0,tamanho);
Serial.print (" Bla");
if (fala == 1) {
int idxponto = random (0, 4);
}
if (fala > 6) {
int idxponto = random (5, tamanho);
}
char ponto = pontuacao [idxponto];
Serial.print (ponto);
for (uint16_t pulso = SERVOMIN; pulso < bocaAberta; pulso++) {
pwm.setPWM (velho, 0, pulso);
}
delay (velocidade);
for (uint16_t pulso = bocaAberta; pulso > SERVOMIN; pulso--) {
pwm.setPWM (velho, 0, pulso);
}
delay (velocidade);
}
Serial.println (" ");
}
void loop() {
int cara1 = random (0, nropersonagem);
int cara2 = random (0, nropersonagem);
int nmfala = random (1, 4);
if (cara2 > (cara1 + 4)) {
cara2 = cara1 + nmfala;
}
int pausadramatica = random (0, 5);
int tempopausa = pausadramatica * 150;
int tempo = random (150, 1000);
if (cara1 == cara2) {
cara2 = cara1 + nmfala;
}
for (int dialogo = cara1; dialogo < cara2; dialogo++) {
Serial.print ( "Character ");
Serial.print ( dialogo);
Serial.print (" :");
conversinha (dialogo);
delay (tempo);
}
Serial.println ("/");
delay (tempopausa);
}
Talk to Me
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by nicolaudosbrinquedos
-
Homeassistant in Beaglebone Black With Debian 11 Intro: The primary objective of my project was to give some use to the Beaglebone Black that has bee...
-
The Adventures of Porting Circuitpython to Wio RP2040 I have been developing some electronic props solutions for Escape Rooms. And periodically I usually ...
-
Simple Electronics to Escape Room Owners - Using a bunch of voltmeters with PCA9685 This is a preliminary study for an Escape Room game. My main goal was to add as many analog displays...
-
Simple Electronics to Escape Room Owners - First Chapter I've been developing puzzles and artifacts for Escape Room since 2018 and most of the time, I've bee...
-
Finally! Animated Eyes using Seed Xiao RP2040 This is another advance in my studies to enable a more economically viable version for the Monster M...
-
Circuitpython on Seeed XIAO RP2040 Step 1: Unboxing... I2C Not Working?As soon as the card arrived, I installed the firmware version fo...
-
Raspberry Pi Pico with GC9A01 Round Display using Arduino IDE and TFT-eSPI Library This is a work in progress for another one of the artifacts I used in Leonardo Cortez's "Strange Hou...
-
Recreating an 80s TV with Raspberry Pi Recently I built a series of special effects for the scenography of the play "Strange House" by Leon...
-
Talk to Me This project is part of an extensive research on the use of animatronics and interactive objects tha...
-
Back in time! Make a Zoetrope using Arduino I'm working on a series of animated objects for a children's play and decided to build a Zoetrope, t...
-
Alastor Moody Eye using Raspberry Pi Pico, CircuitPython and Round Display GC9A01 I am developing a series of objects for a children's play about fear and terror. And then I got insp...
-
The Crazy Pots Game At some point on the internet I came across someone who had made a game like that, but unfortunately...
-
Arduino Mastermind Game I created this little game as a hobby for my children during the Covid-19 quarantine. I had already ...
-
Raspberry Pi Pico With I2C Oled Display and CircuitPython This is my first experience using this little board from Raspberry Pi Foundation.I preferred to inst...
-
Raspberry Pi Pico and TFT ILI9341 with Circuit Python I decided to write another tutorial on the Raspberry Pi Pico, mainly because the card is very recent...
-
Arduino Minesweeeper It was then that I found the works of Rachit Belwariar, on the page https://www.geeksforgeeks.org/cp...
-
Commodore 1551 Drive Cartridge Replacement
60 0 2 -
RCMHardwareByte-v2.3
62 0 0 -
Terminal Curiosity PCB Ruler
229 0 0 -
(DIY) COMMODORE 64 DEAD-TEST (781220) DIAGNOSTIC CARTRIDGE
297 0 2 -
Creative Micro Designs Inc. CMD FD-2000 / FD-4000 3D Printable Case
354 0 0 -
Creative Micro Designs Inc. CMD FD-2000 / FD-4000 Metal Case
516 0 0 -